kabc
addressee.h
00001
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 homeAddressPostOfficeBoxLabel();
00240
00244 static QString homeAddressLocalityLabel();
00245
00249 static QString homeAddressRegionLabel();
00250
00254 static QString homeAddressPostalCodeLabel();
00255
00259 static QString homeAddressCountryLabel();
00260
00264 static QString homeAddressLabelLabel();
00265
00269 static QString businessAddressStreetLabel();
00270
00274 static QString businessAddressPostOfficeBoxLabel();
00275
00279 static QString businessAddressLocalityLabel();
00280
00284 static QString businessAddressRegionLabel();
00285
00289 static QString businessAddressPostalCodeLabel();
00290
00294 static QString businessAddressCountryLabel();
00295
00299 static QString businessAddressLabelLabel();
00300
00304 static QString homePhoneLabel();
00305
00309 static QString businessPhoneLabel();
00310
00314 static QString mobilePhoneLabel();
00315
00319 static QString homeFaxLabel();
00320
00324 static QString businessFaxLabel();
00325
00329 static QString carPhoneLabel();
00330
00334 static QString isdnLabel();
00335
00339 static QString pagerLabel();
00340
00344 static QString emailLabel();
00345
00349 void setMailer( const QString &mailer );
00353 QString mailer() const;
00357 static QString mailerLabel();
00358
00362 void setTimeZone( const TimeZone &timeZone );
00366 TimeZone timeZone() const;
00370 static QString timeZoneLabel();
00371
00375 void setGeo( const Geo &geo );
00379 Geo geo() const;
00383 static QString geoLabel();
00384
00388 void setTitle( const QString &title );
00392 QString title() const;
00396 static QString titleLabel();
00397
00401 void setRole( const QString &role );
00405 QString role() const;
00409 static QString roleLabel();
00410
00414 void setOrganization( const QString &organization );
00418 QString organization() const;
00422 static QString organizationLabel();
00423
00427 void setDepartment( const QString &department );
00431 QString department() const;
00435 static QString departmentLabel();
00436
00440 void setNote( const QString ¬e );
00444 QString note() const;
00448 static QString noteLabel();
00449
00453 void setProductId( const QString &productId );
00457 QString productId() const;
00461 static QString productIdLabel();
00462
00466 void setRevision( const QDateTime &revision );
00470 QDateTime revision() const;
00474 static QString revisionLabel();
00475
00479 void setSortString( const QString &sortString );
00483 QString sortString() const;
00487 static QString sortStringLabel();
00488
00492 void setUrl( const KURL &url );
00496 KURL url() const;
00500 static QString urlLabel();
00501
00505 void setSecrecy( const Secrecy &secrecy );
00509 Secrecy secrecy() const;
00513 static QString secrecyLabel();
00514
00518 void setLogo( const Picture &logo );
00522 Picture logo() const;
00526 static QString logoLabel();
00527
00531 void setPhoto( const Picture &photo );
00535 Picture photo() const;
00539 static QString photoLabel();
00540
00544 void setSound( const Sound &sound );
00548 Sound sound() const;
00552 static QString soundLabel();
00553
00557 void setAgent( const Agent &agent );
00561 Agent agent() const;
00565 static QString agentLabel();
00566
00572 void setNameFromString( const QString & );
00573
00578 QString realName() const;
00579
00583 QString assembledName() const;
00584
00591 QString fullEmail( const QString &email=QString::null ) const;
00592
00601 void insertEmail( const QString &email, bool preferred=false );
00602
00606 void removeEmail( const QString &email );
00607
00612 QString preferredEmail() const;
00613
00617 QStringList emails() const;
00618
00624 void setEmails( const QStringList& list);
00625
00630 void insertPhoneNumber( const PhoneNumber &phoneNumber );
00631
00636 void removePhoneNumber( const PhoneNumber &phoneNumber );
00637
00641 PhoneNumber phoneNumber( int type ) const;
00642
00646 PhoneNumber::List phoneNumbers() const;
00647
00651 PhoneNumber::List phoneNumbers( int type ) const;
00652
00656 PhoneNumber findPhoneNumber( const QString &id ) const;
00657
00662 void insertKey( const Key &key );
00663
00668 void removeKey( const Key &key );
00669
00676 Key key( int type, QString customTypeString = QString::null ) const;
00677
00681 Key::List keys() const;
00682
00687 void setKeys( const Key::List& keys);
00688
00695 Key::List keys( int type, QString customTypeString = QString::null ) const;
00696
00700 Key findKey( const QString &id ) const;
00701
00706 void insertAddress( const Address &address );
00707
00712 void removeAddress( const Address &address );
00713
00717 Address address( int type ) const;
00718
00722 Address::List addresses() const;
00723
00727 Address::List addresses( int type ) const;
00728
00732 Address findAddress( const QString &id ) const;
00733
00737 void insertCategory( const QString & );
00738
00742 void removeCategory( const QString & );
00743
00747 bool hasCategory( const QString & ) const;
00748
00752 void setCategories( const QStringList & );
00753
00757 QStringList categories() const;
00758
00767 void insertCustom( const QString &app, const QString &name,
00768 const QString &value );
00769
00773 void removeCustom( const QString &app, const QString &name );
00774
00778 QString custom( const QString &app, const QString &name ) const;
00779
00783 void setCustoms( const QStringList & );
00784
00788 QStringList customs() const;
00789
00793 static void parseEmailAddress( const QString &rawEmail, QString &fullName,
00794 QString &email );
00795
00799 void dump() const;
00800
00804 QString asString() const;
00805
00809 void setResource( Resource *resource );
00810
00814 Resource *resource() const;
00815
00819 void setChanged( bool value );
00820
00824 bool changed() const;
00825
00826 static void setSortMode( KABC::SortMode *mode );
00827
00828 bool operator< ( const Addressee &addr );
00829
00830 private:
00831 void detach();
00832
00833 struct AddresseeData;
00834 mutable KSharedPtr<AddresseeData> mData;
00835
00836 private:
00837 static AddresseeData* shared_null;
00838 static AddresseeData* makeSharedNull();
00839 static KABC::SortMode *mSortMode;
00840 };
00841
00842 KABC_EXPORT QDataStream &operator<<( QDataStream &, const Addressee & );
00843 KABC_EXPORT QDataStream &operator>>( QDataStream &, Addressee & );
00844
00845 }
00846
00847 #endif