home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kabc / agent.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.1 KB  |  129 lines

  1. /*
  2.     This file is part of libkabc.
  3.     Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.     Boston, MA 02110-1301, USA.
  19. */
  20.  
  21. #ifndef KABC_AGENT_H
  22. #define KABC_AGENT_H
  23.  
  24. class QDataStream;
  25.  
  26. #include <qstring.h>
  27.  
  28. #include <kdelibs_export.h>
  29.  
  30. namespace KABC {
  31.  
  32. class Addressee;
  33.  
  34. /**
  35.  * Important!!!
  36.  *
  37.  * At the moment the vcard format does not support saving and loading
  38.  * this entity.
  39.  */
  40. class KABC_EXPORT Agent
  41. {
  42.   friend KABC_EXPORT QDataStream &operator<<( QDataStream &, const Agent & );
  43.   friend KABC_EXPORT QDataStream &operator>>( QDataStream &, Agent & );
  44.  
  45. public:
  46.  
  47.   /**
  48.    * Consturctor. Creates an empty object.
  49.    */
  50.   Agent();
  51.  
  52.   /**
  53.    * Consturctor.
  54.    *
  55.    * @param url  A URL that describes the position of the agent file.
  56.    */
  57.   Agent( const QString &url );
  58.  
  59.   /**
  60.    * Consturctor.
  61.    *
  62.    * @param addressee  The addressee object of the agent.
  63.    */
  64.   Agent( Addressee *addressee );
  65.  
  66.   /**
  67.    * Destructor.
  68.    */
  69.   ~Agent();
  70.  
  71.  
  72.   bool operator==( const Agent & ) const;
  73.   bool operator!=( const Agent & ) const;
  74.   Agent &operator=(  const Agent & );
  75.   
  76.   /**
  77.    * Sets a URL for the location of the agent file. When using this
  78.    * function, isIntern() will return 'false' until you use
  79.    * setAddressee().
  80.    *
  81.    * @param url  The location URL of the agent file.
  82.    */
  83.   void setUrl( const QString &url );
  84.  
  85.   /**
  86.    * Sets the addressee of the agent. When using this function,
  87.    * isIntern() will return 'true' until you use setUrl().
  88.    *
  89.    * @param addressee  The addressee object of the agent.
  90.    */
  91.   void setAddressee( Addressee *addressee );
  92.  
  93.   /**
  94.    * Returns whether the agent is described by a URL (extern) or
  95.    * by a addressee (intern).
  96.    * When this method returns 'true' you can use addressee() to
  97.    * get a Addressee object. Otherwise you can request the URL
  98.    * of this agent by url() and load the data from that location.
  99.    */
  100.   bool isIntern() const;
  101.  
  102.   /**
  103.    * Returns the location URL of this agent.
  104.    */
  105.   QString url() const;
  106.  
  107.   /**
  108.    * Returns the addressee object of this agent.
  109.    */
  110.   Addressee* addressee() const;
  111.  
  112.   /**
  113.    * Returns string representation of the agent.
  114.    */
  115.   QString asString() const;
  116.  
  117. private:
  118.   Addressee *mAddressee;
  119.   QString mUrl;
  120.  
  121.   int mIntern;
  122. };
  123.  
  124. KABC_EXPORT QDataStream &operator<<( QDataStream &, const Agent & );
  125. KABC_EXPORT QDataStream &operator>>( QDataStream &, Agent & );
  126.  
  127. }
  128. #endif
  129.