addressee.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KABC_ADDRESSEE_H
00023 #define KABC_ADDRESSEE_H
00024
00025 #include <qdatetime.h>
00026 #include <qstring.h>
00027 #include <qstringlist.h>
00028 #include <qvaluelist.h>
00029
00030 #include <ksharedptr.h>
00031 #include <kurl.h>
00032
00033 #include "address.h"
00034 #include "agent.h"
00035 #include "geo.h"
00036 #include "key.h"
00037 #include "phonenumber.h"
00038 #include "picture.h"
00039 #include "secrecy.h"
00040 #include "sound.h"
00041 #include "timezone.h"
00042
00043 namespace KABC {
00044
00045 class Resource;
00046 class Field;
00047 class SortMode;
00048
00075 class KABC_EXPORT Addressee
00076 {
00077 friend KABC_EXPORT QDataStream &operator<<( QDataStream &, const Addressee & );
00078 friend KABC_EXPORT QDataStream &operator>>( QDataStream &, Addressee & );
00079
00080 public:
00081 typedef QValueList<Addressee> List;
00082 typedef QMap<QString, Addressee> Map;
00083
00087 Addressee();
00088 ~Addressee();
00089
00090 Addressee( const Addressee & );
00091 Addressee &operator=( const Addressee & );
00092
00093 bool operator==( const Addressee & ) const;
00094 bool operator!=( const Addressee & ) const;
00095
00099 bool isEmpty() const;
00100
00104 void setUid( const QString &uid );
00108 QString uid() const;
00112 static QString uidLabel();
00113
00117 void setName( const QString &name );
00121 QString name() const;
00125 static QString nameLabel();
00126
00130 void setFormattedName( const QString &formattedName );
00134 QString formattedName() const;
00138 static QString formattedNameLabel();
00139
00143 void setFamilyName( const QString &familyName );
00147 QString familyName() const;
00151 static QString familyNameLabel();
00152
00156 void setGivenName( const QString &givenName );
00160 QString givenName() const;
00164 static QString givenNameLabel();
00165
00169 void setAdditionalName( const QString &additionalName );
00173 QString additionalName() const;
00177 static QString additionalNameLabel();
00178
00182 void setPrefix( const QString &prefix );
00186 QString prefix() const;
00190 static QString prefixLabel();
00191
00195 void setSuffix( const QString &suffix );
00199 QString suffix() const;
00203 static QString suffixLabel();
00204
00208 void setNickName( const QString &nickName );
00212 QString nickName() const;
00216 static QString nickNameLabel();
00217
00221 void setBirthday( const QDateTime &birthday );
00225 QDateTime birthday() const;
00229 static QString birthdayLabel();
00230
00234 static QString homeAddressStreetLabel();
00235
00239 static QString homeAddressLocalityLabel();
00240
00244 static QString homeAddressRegionLabel();
00245
00249 static QString homeAddressPostalCodeLabel();
00250
00254 static QString homeAddressCountryLabel();
00255
00259 static QString homeAddressLabelLabel();
00260
00264 static QString businessAddressStreetLabel();
00265
00269 static QString businessAddressLocalityLabel();
00270
00274 static QString businessAddressRegionLabel();
00275
00279 static QString businessAddressPostalCodeLabel();
00280
00284 static QString businessAddressCountryLabel();
00285
00289 static QString businessAddressLabelLabel();
00290
00294 static QString homePhoneLabel();
00295
00299 static QString businessPhoneLabel();
00300
00304 static QString mobilePhoneLabel();
00305
00309 static QString homeFaxLabel();
00310
00314 static QString businessFaxLabel();
00315
00319 static QString carPhoneLabel();
00320
00324 static QString isdnLabel();
00325
00329 static QString pagerLabel();
00330
00334 static QString emailLabel();
00335
00339 void setMailer( const QString &mailer );
00343 QString mailer() const;
00347 static QString mailerLabel();
00348
00352 void setTimeZone( const TimeZone &timeZone );
00356 TimeZone timeZone() const;
00360 static QString timeZoneLabel();
00361
00365 void setGeo( const Geo &geo );
00369 Geo geo() const;
00373 static QString geoLabel();
00374
00378 void setTitle( const QString &title );
00382 QString title() const;
00386 static QString titleLabel();
00387
00391 void setRole( const QString &role );
00395 QString role() const;
00399 static QString roleLabel();
00400
00404 void setOrganization( const QString &organization );
00408 QString organization() const;
00412 static QString organizationLabel();
00413
00417 void setDepartment( const QString &department );
00421 QString department() const;
00425 static QString departmentLabel();
00426
00430 void setNote( const QString ¬e );
00434 QString note() const;
00438 static QString noteLabel();
00439
00443 void setProductId( const QString &productId );
00447 QString productId() const;
00451 static QString productIdLabel();
00452
00456 void setRevision( const QDateTime &revision );
00460 QDateTime revision() const;
00464 static QString revisionLabel();
00465
00469 void setSortString( const QString &sortString );
00473 QString sortString() const;
00477 static QString sortStringLabel();
00478
00482 void setUrl( const KURL &url );
00486 KURL url() const;
00490 static QString urlLabel();
00491
00495 void setSecrecy( const Secrecy &secrecy );
00499 Secrecy secrecy() const;
00503 static QString secrecyLabel();
00504
00508 void setLogo( const Picture &logo );
00512 Picture logo() const;
00516 static QString logoLabel();
00517
00521 void setPhoto( const Picture &photo );
00525 Picture photo() const;
00529 static QString photoLabel();
00530
00534 void setSound( const Sound &sound );
00538 Sound sound() const;
00542 static QString soundLabel();
00543
00547 void setAgent( const Agent &agent );
00551 Agent agent() const;
00555 static QString agentLabel();
00556
00562 void setNameFromString( const QString & );
00563
00568 QString realName() const;
00569
00573 QString assembledName() const;
00574
00581 QString fullEmail( const QString &email=QString::null ) const;
00582
00591 void insertEmail( const QString &email, bool preferred=false );
00592
00596 void removeEmail( const QString &email );
00597
00602 QString preferredEmail() const;
00603
00607 QStringList emails() const;
00608
00614 void setEmails( const QStringList& list);
00615
00620 void insertPhoneNumber( const PhoneNumber &phoneNumber );
00621
00626 void removePhoneNumber( const PhoneNumber &phoneNumber );
00627
00631 PhoneNumber phoneNumber( int type ) const;
00632
00636 PhoneNumber::List phoneNumbers() const;
00637
00641 PhoneNumber::List phoneNumbers( int type ) const;
00642
00646 PhoneNumber findPhoneNumber( const QString &id ) const;
00647
00652 void insertKey( const Key &key );
00653
00658 void removeKey( const Key &key );
00659
00666 Key key( int type, QString customTypeString = QString::null ) const;
00667
00671 Key::List keys() const;
00672
00677 void setKeys( const Key::List& keys);
00678
00685 Key::List keys( int type, QString customTypeString = QString::null ) const;
00686
00690 Key findKey( const QString &id ) const;
00691
00696 void insertAddress( const Address &address );
00697
00702 void removeAddress( const Address &address );
00703
00707 Address address( int type ) const;
00708
00712 Address::List addresses() const;
00713
00717 Address::List addresses( int type ) const;
00718
00722 Address findAddress( const QString &id ) const;
00723
00727 void insertCategory( const QString & );
00728
00732 void removeCategory( const QString & );
00733
00737 bool hasCategory( const QString & ) const;
00738
00742 void setCategories( const QStringList & );
00743
00747 QStringList categories() const;
00748
00757 void insertCustom( const QString &app, const QString &name,
00758 const QString &value );
00759
00763 void removeCustom( const QString &app, const QString &name );
00764
00768 QString custom( const QString &app, const QString &name ) const;
00769
00773 void setCustoms( const QStringList & );
00774
00778 QStringList customs() const;
00779
00783 static void parseEmailAddress( const QString &rawEmail, QString &fullName,
00784 QString &email );
00785
00789 void dump() const;
00790
00794 QString asString() const;
00795
00799 void setResource( Resource *resource );
00800
00804 Resource *resource() const;
00805
00809 void setChanged( bool value );
00810
00814 bool changed() const;
00815
00816 static void setSortMode( KABC::SortMode *mode );
00817
00818 bool operator< ( const Addressee &addr );
00819
00820 private:
00821 void detach();
00822
00823 struct AddresseeData;
00824 mutable KSharedPtr<AddresseeData> mData;
00825
00826 private:
00827 static AddresseeData* shared_null;
00828 static AddresseeData* makeSharedNull();
00829 static KABC::SortMode *mSortMode;
00830 };
00831
00832 KABC_EXPORT QDataStream &operator<<( QDataStream &, const Addressee & );
00833 KABC_EXPORT QDataStream &operator>>( QDataStream &, Addressee & );
00834
00835 }
00836
00837 #endif
|