addressee.src.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KABC_ADDRESSEE_H
00022 #define KABC_ADDRESSEE_H
00023
00024 #include <qdatetime.h>
00025 #include <qstring.h>
00026 #include <qstringlist.h>
00027 #include <qvaluelist.h>
00028
00029 #include <ksharedptr.h>
00030 #include <kurl.h>
00031
00032 #include "address.h"
00033 #include "agent.h"
00034 #include "geo.h"
00035 #include "key.h"
00036 #include "phonenumber.h"
00037 #include "picture.h"
00038 #include "secrecy.h"
00039 #include "sound.h"
00040 #include "timezone.h"
00041
00042 namespace KABC {
00043
00044 class Resource;
00045 class Field;
00046 class SortMode;
00047
00074 class KABC_EXPORT Addressee
00075 {
00076 friend KABC_EXPORT QDataStream &operator<<( QDataStream &, const Addressee & );
00077 friend KABC_EXPORT QDataStream &operator>>( QDataStream &, Addressee & );
00078
00079 public:
00080 typedef QValueList<Addressee> List;
00081 typedef QMap<QString, Addressee> Map;
00082
00086 Addressee();
00087 ~Addressee();
00088
00089 Addressee( const Addressee & );
00090 Addressee &operator=( const Addressee & );
00091
00092 bool operator==( const Addressee & ) const;
00093 bool operator!=( const Addressee & ) const;
00094
00098 bool isEmpty() const;
00099
00103 void setUid( const QString &uid );
00107 QString uid() const;
00111 static QString uidLabel();
00112
00113 --DECLARATIONS--
00119 void setNameFromString( const QString & );
00120
00125 QString realName() const;
00126
00130 QString assembledName() const;
00131
00138 QString fullEmail( const QString &email=QString::null ) const;
00139
00148 void insertEmail( const QString &email, bool preferred=false );
00149
00153 void removeEmail( const QString &email );
00154
00159 QString preferredEmail() const;
00160
00164 QStringList emails() const;
00165
00171 void setEmails( const QStringList& list);
00172
00177 void insertPhoneNumber( const PhoneNumber &phoneNumber );
00178
00183 void removePhoneNumber( const PhoneNumber &phoneNumber );
00184
00188 PhoneNumber phoneNumber( int type ) const;
00189
00193 PhoneNumber::List phoneNumbers() const;
00194
00198 PhoneNumber::List phoneNumbers( int type ) const;
00199
00203 PhoneNumber findPhoneNumber( const QString &id ) const;
00204
00209 void insertKey( const Key &key );
00210
00215 void removeKey( const Key &key );
00216
00223 Key key( int type, QString customTypeString = QString::null ) const;
00224
00228 Key::List keys() const;
00229
00234 void setKeys( const Key::List& keys);
00235
00242 Key::List keys( int type, QString customTypeString = QString::null ) const;
00243
00247 Key findKey( const QString &id ) const;
00248
00253 void insertAddress( const Address &address );
00254
00259 void removeAddress( const Address &address );
00260
00264 Address address( int type ) const;
00265
00269 Address::List addresses() const;
00270
00274 Address::List addresses( int type ) const;
00275
00279 Address findAddress( const QString &id ) const;
00280
00284 void insertCategory( const QString & );
00285
00289 void removeCategory( const QString & );
00290
00294 bool hasCategory( const QString & ) const;
00295
00299 void setCategories( const QStringList & );
00300
00304 QStringList categories() const;
00305
00314 void insertCustom( const QString &app, const QString &name,
00315 const QString &value );
00316
00320 void removeCustom( const QString &app, const QString &name );
00321
00325 QString custom( const QString &app, const QString &name ) const;
00326
00330 void setCustoms( const QStringList & );
00331
00335 QStringList customs() const;
00336
00340 static void parseEmailAddress( const QString &rawEmail, QString &fullName,
00341 QString &email );
00342
00346 void dump() const;
00347
00351 QString asString() const;
00352
00356 void setResource( Resource *resource );
00357
00361 Resource *resource() const;
00362
00366 void setChanged( bool value );
00367
00371 bool changed() const;
00372
00373 static void setSortMode( KABC::SortMode *mode );
00374
00375 bool operator< ( const Addressee &addr );
00376
00377 private:
00378 void detach();
00379
00380 struct AddresseeData;
00381 mutable KSharedPtr<AddresseeData> mData;
00382
00383 private:
00384 static AddresseeData* shared_null;
00385 static AddresseeData* makeSharedNull();
00386 static KABC::SortMode *mSortMode;
00387 };
00388
00389 KABC_EXPORT QDataStream &operator<<( QDataStream &, const Addressee & );
00390 KABC_EXPORT QDataStream &operator>>( QDataStream &, Addressee & );
00391
00392 }
00393
00394 #endif
|