File indexing completed on 2024-10-06 06:39:43

0001 /*
0002     This file is part of the KContacts framework.
0003     SPDX-FileCopyrightText: 2001 Cornelius Schumacher <schumacher@kde.org>
0004     SPDX-FileCopyrightText: 2013 Tobias Koenig <tokoe@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KCONTACTS_ADDRESSEE_H
0010 #define KCONTACTS_ADDRESSEE_H
0011 
0012 #include <QDateTime>
0013 #include <QMap>
0014 #include <QSharedDataPointer>
0015 #include <QStringList>
0016 #include <QUrl>
0017 
0018 #include "address.h"
0019 #include "addresseelist.h"
0020 #include "calendarurl.h"
0021 #include "clientpidmap.h"
0022 #include "email.h"
0023 #include "fieldgroup.h"
0024 #include "gender.h"
0025 #include "geo.h"
0026 #include "impp.h"
0027 #include "key.h"
0028 #include "lang.h"
0029 #include "nickname.h"
0030 #include "org.h"
0031 #include "phonenumber.h"
0032 #include "picture.h"
0033 #include "related.h"
0034 #include "resourcelocatorurl.h"
0035 #include "role.h"
0036 #include "secrecy.h"
0037 #include "sound.h"
0038 #include "timezone.h"
0039 #include "title.h"
0040 
0041 namespace KContacts
0042 {
0043 /**
0044   @short address book entry
0045 
0046   This class represents an entry in the address book.
0047 
0048   The data of this class is implicitly shared. You can pass this class by value.
0049 
0050   If you need the name of a field for presenting it to the user you should use
0051   the functions ending in Label(). They return a translated string which can be
0052   used as label for the corresponding field.
0053 
0054   About the name fields:
0055 
0056   givenName() is the first name and familyName() the last name. In some
0057   countries the family name comes first, that's the reason for the
0058   naming. formattedName() is the full name with the correct formatting.
0059   It is used as an override, when the correct formatting can't be generated
0060   from the other name fields automatically.
0061 
0062   realName() returns a fully formatted name(). It uses formattedName, if set,
0063   otherwise it constructs the name from the name fields. As fallback, if
0064   nothing else is set it uses name().
0065 
0066   name() is the NAME type of RFC2426. It can be used as internal name for the
0067   data entry, but shouldn't be used for displaying the data to the user.
0068  */
0069 class KCONTACTS_EXPORT Addressee
0070 {
0071     friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Addressee &);
0072     friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Addressee &);
0073 
0074     Q_GADGET
0075     Q_PROPERTY(bool isEmpty READ isEmpty)
0076     Q_PROPERTY(QString uid READ uid WRITE setUid)
0077     Q_PROPERTY(QString name READ name WRITE setName)
0078     Q_PROPERTY(QString formattedName READ formattedName WRITE setFormattedName)
0079     Q_PROPERTY(QString familyName READ familyName WRITE setFamilyName)
0080     Q_PROPERTY(QString givenName READ givenName WRITE setGivenName)
0081     Q_PROPERTY(QString additionalName READ additionalName WRITE setAdditionalName)
0082     Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
0083     Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
0084     Q_PROPERTY(QString nickName READ nickName)
0085     Q_PROPERTY(QDateTime birthday READ birthday WRITE setBirthdayProperty) // special write method due to withTime argument
0086     Q_PROPERTY(bool birthdayHasTime READ birthdayHasTime)
0087     Q_PROPERTY(QString mailer READ mailer WRITE setMailer)
0088     Q_PROPERTY(KContacts::Geo geo READ geo WRITE setGeo)
0089     Q_PROPERTY(QString title READ title)
0090     Q_PROPERTY(QString role READ role)
0091     Q_PROPERTY(QString organization READ organization)
0092     Q_PROPERTY(QString department READ department WRITE setDepartment)
0093     Q_PROPERTY(QString note READ note WRITE setNote)
0094     Q_PROPERTY(QString productId READ productId WRITE setProductId)
0095     Q_PROPERTY(QDateTime revision READ revision)
0096     Q_PROPERTY(QString sortString READ sortString WRITE setSortString)
0097     Q_PROPERTY(KContacts::ResourceLocatorUrl url READ url WRITE setUrl)
0098     Q_PROPERTY(QList<KContacts::ResourceLocatorUrl> extraUrls READ extraUrlList WRITE setExtraUrlList)
0099     Q_PROPERTY(QString realName READ realName)
0100     Q_PROPERTY(QString assembledName READ assembledName)
0101     Q_PROPERTY(QString preferredEmail READ preferredEmail)
0102     Q_PROPERTY(QList<KContacts::Email> emails READ emailList WRITE setEmailList)
0103     Q_PROPERTY(QList<KContacts::PhoneNumber> phoneNumbers READ phoneNumbers WRITE setPhoneNumbers)
0104     Q_PROPERTY(QList<KContacts::Address> addresses READ addresses)
0105     Q_PROPERTY(QStringList categories READ categories WRITE setCategories)
0106     Q_PROPERTY(QStringList customs READ customs)
0107     Q_PROPERTY(bool changed READ changed WRITE setChanged)
0108     Q_PROPERTY(QList<KContacts::Impp> impps READ imppList WRITE setImppList)
0109     Q_PROPERTY(QDate anniversary READ anniversary WRITE setAnniversary)
0110     Q_PROPERTY(QString assistantsName READ assistantsName WRITE setAssistantsName)
0111     Q_PROPERTY(QUrl blogFeed READ blogFeed WRITE setBlogFeed)
0112     Q_PROPERTY(QString managersName READ managersName WRITE setManagersName)
0113     Q_PROPERTY(QString office READ office WRITE setOffice)
0114     Q_PROPERTY(QString profession READ profession WRITE setProfession)
0115     Q_PROPERTY(QString spousesName READ spousesName WRITE setSpousesName)
0116     Q_PROPERTY(KContacts::Picture photo READ photo WRITE setPhoto)
0117 
0118     // ### the following properties are still missing:
0119     // - logos, photos, sounds
0120     // - keys
0121     // - the list variants for nicks, titles, roles, orgs
0122     // - timezone, secrecy, gender, kind, members, relationships, language
0123     // - field groups, sourceUrls, calendarUrls
0124 
0125 public:
0126     /**
0127       A list of addressee objects
0128      */
0129     typedef AddresseeList List;
0130 
0131     /**
0132       Construct an empty address book entry.
0133      */
0134     Addressee();
0135 
0136     /**
0137       Destroys the address book entry.
0138      */
0139     ~Addressee();
0140 
0141     /**
0142       Copy constructor.
0143      */
0144     Addressee(const Addressee &other);
0145 
0146     /**
0147       Assignment operator.
0148 
0149       @return a reference to @c this
0150     */
0151     Addressee &operator=(const Addressee &other);
0152 
0153     /**
0154       Equality operator.
0155 
0156       @return @c true if @c this and the given addressee are equal,
0157               otherwise @c false
0158     */
0159     bool operator==(const Addressee &other) const;
0160 
0161     /**
0162       Not-equal operator.
0163 
0164       @return @c true if @c this and the given addressee are not equal,
0165               otherwise @c false
0166     */
0167     bool operator!=(const Addressee &other) const;
0168 
0169     /**
0170       Return if the address book entry is empty.
0171      */
0172     bool isEmpty() const;
0173 
0174     /**
0175       Set unique identifier.
0176 
0177       @param uid the KABC unique identifier
0178      */
0179     void setUid(const QString &uid);
0180 
0181     /**
0182       Return unique identifier.
0183      */
0184     QString uid() const;
0185 
0186     /**
0187       Return translated label for uid field.
0188      */
0189     static QString uidLabel();
0190 
0191     /**
0192       Set name.
0193      */
0194     void setName(const QString &name);
0195 
0196     /**
0197       Return name.
0198      */
0199     QString name() const;
0200 
0201     /**
0202       Return translated label for name field.
0203      */
0204     static QString nameLabel();
0205 
0206     /**
0207       Set formatted name.
0208      */
0209     void setFormattedName(const QString &formattedName);
0210 
0211     /**
0212       Return formatted name.
0213      */
0214     QString formattedName() const;
0215 
0216     /**
0217       Return translated label for formattedName field.
0218      */
0219     static QString formattedNameLabel();
0220 
0221     /**
0222       Set family name.
0223      */
0224     void setFamilyName(const QString &familyName);
0225 
0226     /**
0227       Return family name.
0228      */
0229     QString familyName() const;
0230 
0231     /**
0232       Return translated label for familyName field.
0233      */
0234     static QString familyNameLabel();
0235 
0236     /**
0237       Set given name.
0238      */
0239     void setGivenName(const QString &givenName);
0240 
0241     /**
0242       Return given name.
0243      */
0244     QString givenName() const;
0245 
0246     /**
0247       Return translated label for givenName field.
0248      */
0249     static QString givenNameLabel();
0250 
0251     /**
0252       Set additional names.
0253      */
0254     void setAdditionalName(const QString &additionalName);
0255 
0256     /**
0257       Return additional names.
0258      */
0259     QString additionalName() const;
0260 
0261     /**
0262       Return translated label for additionalName field.
0263      */
0264     static QString additionalNameLabel();
0265 
0266     /**
0267       Set honorific prefixes.
0268      */
0269     void setPrefix(const QString &prefix);
0270 
0271     /**
0272       Return honorific prefixes.
0273      */
0274     QString prefix() const;
0275 
0276     /**
0277       Return translated label for prefix field.
0278      */
0279     static QString prefixLabel();
0280 
0281     /**
0282       Set honorific suffixes.
0283      */
0284     void setSuffix(const QString &suffix);
0285 
0286     /**
0287       Return honorific suffixes.
0288      */
0289     QString suffix() const;
0290 
0291     /**
0292       Return translated label for suffix field.
0293      */
0294     static QString suffixLabel();
0295 
0296     /**
0297       Set nick name.
0298      */
0299     void setNickName(const QString &nickName);
0300     void setNickName(const NickName &nickName);
0301     void insertExtraNickName(const NickName &nickName);
0302     void setExtraNickNameList(const NickName::List &nickNameList);
0303     NickName::List extraNickNameList() const;
0304 
0305     /**
0306       Return nick name.
0307      */
0308     QString nickName() const;
0309 
0310     /**
0311       Return translated label for nickName field.
0312      */
0313     static QString nickNameLabel();
0314 
0315     /**
0316       Set birthday (date and time). If withTime is false the time will be set
0317       to midnight and birthdayHasTime() will return false afterwards.
0318       @since 5.4
0319      */
0320     void setBirthday(const QDateTime &birthday, bool withTime = true);
0321 
0322     /**
0323       Set birthday (date only). birthdayHasTime() will return false afterwards.
0324      */
0325     void setBirthday(const QDate &birthday);
0326 
0327     /**
0328       Return birthday. (If a valid date has been set, birthday().time() will
0329       always return a valid QTime!)
0330      */
0331     QDateTime birthday() const;
0332 
0333     /**
0334       Returns true if birthday has been set with a time. Returns false otherwise.
0335      */
0336     bool birthdayHasTime() const;
0337 
0338     /**
0339       Return translated label for birthday field.
0340      */
0341     static QString birthdayLabel();
0342 
0343     /**
0344       Return translated label for homeAddressStreet field.
0345      */
0346     static QString homeAddressStreetLabel();
0347 
0348     /**
0349       Return translated label for homeAddressPostOfficeBox field.
0350      */
0351     static QString homeAddressPostOfficeBoxLabel();
0352 
0353     /**
0354       Return translated label for homeAddressLocality field.
0355      */
0356     static QString homeAddressLocalityLabel();
0357 
0358     /**
0359       Return translated label for homeAddressRegion field.
0360      */
0361     static QString homeAddressRegionLabel();
0362 
0363     /**
0364       Return translated label for homeAddressPostalCode field.
0365      */
0366     static QString homeAddressPostalCodeLabel();
0367 
0368     /**
0369       Return translated label for homeAddressCountry field.
0370      */
0371     static QString homeAddressCountryLabel();
0372 
0373     /**
0374       Return translated label for homeAddressLabel field.
0375      */
0376     static QString homeAddressLabelLabel();
0377 
0378     /**
0379       Return translated label for businessAddressStreet field.
0380      */
0381     static QString businessAddressStreetLabel();
0382 
0383     /**
0384       Return translated label for businessAddressPostOfficeBox field.
0385      */
0386     static QString businessAddressPostOfficeBoxLabel();
0387 
0388     /**
0389       Return translated label for businessAddressLocality field.
0390      */
0391     static QString businessAddressLocalityLabel();
0392 
0393     /**
0394       Return translated label for businessAddressRegion field.
0395      */
0396     static QString businessAddressRegionLabel();
0397 
0398     /**
0399       Return translated label for businessAddressPostalCode field.
0400      */
0401     static QString businessAddressPostalCodeLabel();
0402 
0403     /**
0404       Return translated label for businessAddressCountry field.
0405      */
0406     static QString businessAddressCountryLabel();
0407 
0408     /**
0409       Return translated label for businessAddressLabel field.
0410      */
0411     static QString businessAddressLabelLabel();
0412 
0413     /**
0414       Return translated label for homePhone field.
0415      */
0416     static QString homePhoneLabel();
0417 
0418     /**
0419       Return translated label for businessPhone field.
0420      */
0421     static QString businessPhoneLabel();
0422 
0423     /**
0424       Return translated label for mobilePhone field.
0425      */
0426     static QString mobilePhoneLabel();
0427 
0428     /**
0429       Return translated label for homeFax field.
0430      */
0431     static QString homeFaxLabel();
0432 
0433     /**
0434       Return translated label for businessFax field.
0435      */
0436     static QString businessFaxLabel();
0437 
0438     /**
0439       Return translated label for carPhone field.
0440      */
0441     static QString carPhoneLabel();
0442 
0443     /**
0444       Return translated label for isdn field.
0445      */
0446     static QString isdnLabel();
0447 
0448     /**
0449       Return translated label for pager field.
0450      */
0451     static QString pagerLabel();
0452 
0453     /**
0454       Return translated label for email field.
0455      */
0456     static QString emailLabel();
0457 
0458     /**
0459       Set mail client.
0460      */
0461     void setMailer(const QString &mailer);
0462 
0463     /**
0464       Return mail client.
0465      */
0466     QString mailer() const;
0467 
0468     /**
0469       Return translated label for mailer field.
0470      */
0471     static QString mailerLabel();
0472 
0473     /**
0474       Set time zone.
0475      */
0476     void setTimeZone(const TimeZone &timeZone);
0477 
0478     /**
0479       Return time zone.
0480      */
0481     TimeZone timeZone() const;
0482 
0483     /**
0484       Return translated label for timeZone field.
0485      */
0486     static QString timeZoneLabel();
0487 
0488     /**
0489       Set geographic position.
0490      */
0491     void setGeo(const Geo &geo);
0492 
0493     /**
0494       Return geographic position.
0495      */
0496     Geo geo() const;
0497 
0498     /**
0499       Return translated label for geo field.
0500      */
0501     static QString geoLabel();
0502 
0503     /**
0504       Set title.
0505      */
0506     // Remove in kf6
0507     void setTitle(const QString &title);
0508     void setTitle(const Title &title);
0509     void insertExtraTitle(const Title &title);
0510     void setExtraTitleList(const Title::List &urltitle);
0511     Title::List extraTitleList() const;
0512     /**
0513       Return title.
0514      */
0515     QString title() const;
0516 
0517     /**
0518       Return translated label for title field.
0519      */
0520     static QString titleLabel();
0521 
0522     /**
0523       Set role.
0524      */
0525     void setRole(const QString &role);
0526     void setRole(const Role &role);
0527     void insertExtraRole(const Role &role);
0528     void setExtraRoleList(const Role::List &roleList);
0529     Role::List extraRoleList() const;
0530 
0531     /**
0532       Return role.
0533      */
0534     QString role() const;
0535 
0536     /**
0537       Return translated label for role field.
0538      */
0539     static QString roleLabel();
0540 
0541     /**
0542       Set organization.
0543      */
0544     // Remove in kf6
0545     void setOrganization(const QString &organization);
0546     void setOrganization(const Org &organization);
0547     void insertExtraOrganization(const Org &organization);
0548     void setExtraOrganizationList(const Org::List &orgList);
0549     Org::List extraOrganizationList() const;
0550 
0551     /**
0552       Return organization.
0553      */
0554     QString organization() const;
0555 
0556     /**
0557       Return translated label for organization field.
0558      */
0559     static QString organizationLabel();
0560 
0561     /**
0562       Set department.
0563      */
0564     void setDepartment(const QString &department);
0565 
0566     /**
0567       Return department.
0568      */
0569     QString department() const;
0570 
0571     /**
0572       Return translated label for department field.
0573      */
0574     static QString departmentLabel();
0575 
0576     /**
0577       Set note.
0578      */
0579     void setNote(const QString &note);
0580 
0581     /**
0582       Return note.
0583      */
0584     QString note() const;
0585 
0586     /**
0587       Return translated label for note field.
0588      */
0589     static QString noteLabel();
0590 
0591     /**
0592       Set product identifier.
0593      */
0594     void setProductId(const QString &productId);
0595 
0596     /**
0597       Return product identifier.
0598      */
0599     QString productId() const;
0600 
0601     /**
0602       Return translated label for productId field.
0603      */
0604     static QString productIdLabel();
0605 
0606     /**
0607       Set revision date.
0608      */
0609     void setRevision(const QDateTime &revision);
0610 
0611     /**
0612       Return revision date.
0613      */
0614     QDateTime revision() const;
0615 
0616     /**
0617       Return translated label for revision field.
0618      */
0619     static QString revisionLabel();
0620 
0621     /**
0622       Set sort string.
0623      */
0624     void setSortString(const QString &sortString);
0625 
0626     /**
0627       Return sort string.
0628      */
0629     QString sortString() const;
0630 
0631     /**
0632       Return translated label for sortString field.
0633      */
0634     static QString sortStringLabel();
0635 
0636     /**
0637       Set homepage.
0638      */
0639     void setUrl(const ResourceLocatorUrl &url);
0640     // kf6: remove it
0641     void setUrl(const QUrl &url);
0642 
0643     /**
0644       Return homepage.
0645      */
0646     ResourceLocatorUrl url() const;
0647 
0648     /**
0649       Return translated label for url field.
0650      */
0651     static QString urlLabel();
0652 
0653     /**
0654       Set security class.
0655      */
0656     void setSecrecy(const Secrecy &secrecy);
0657 
0658     /**
0659       Return security class.
0660      */
0661     Secrecy secrecy() const;
0662 
0663     /**
0664       Return translated label for secrecy field.
0665      */
0666     static QString secrecyLabel();
0667 
0668     /**
0669       Set logo.
0670      */
0671     void setLogo(const Picture &logo);
0672 
0673     /**
0674       Return logo.
0675      */
0676     Picture logo() const;
0677 
0678     /**
0679       Return translated label for logo field.
0680      */
0681     static QString logoLabel();
0682 
0683     /**
0684       Set photo.
0685      */
0686     void setPhoto(const Picture &photo);
0687 
0688     /**
0689       Return photo.
0690      */
0691     Picture photo() const;
0692 
0693     /**
0694       Return translated label for photo field.
0695      */
0696     static QString photoLabel();
0697 
0698     /**
0699       Set sound.
0700      */
0701     void setSound(const Sound &sound);
0702 
0703     /**
0704       Return sound.
0705      */
0706     Sound sound() const;
0707 
0708     /**
0709       Return translated label for sound field.
0710      */
0711     static QString soundLabel();
0712 
0713     /**
0714       Set name fields by parsing the given string and trying to associate the
0715       parts of the string with according fields. This function should probably
0716       be a bit more clever.
0717      */
0718     void setNameFromString(const QString &s);
0719 
0720     /**
0721       Return the name of the addressee. This is calculated from all the name
0722       fields.
0723      */
0724     QString realName() const;
0725 
0726     /**
0727       Return the name that consists of all name parts.
0728      */
0729     QString assembledName() const;
0730 
0731     /**
0732       Return email address including real name.
0733 
0734       @param email Email address to be used to construct the full email string.
0735                    If this is QString() the preferred email address is used.
0736      */
0737     QString fullEmail(const QString &email = QString()) const;
0738 
0739     /**
0740       Adds an email address. If the email address (i.e. @p email.mail()) already
0741       exists in this addressee it won't be duplicated, instead @p email is assigned
0742       to it.
0743 
0744       @since 5.88
0745      */
0746     void addEmail(const Email &email);
0747 
0748     /**
0749       Remove email address. If the email address doesn't exist, nothing happens.
0750 
0751       @param email Email address to remove
0752      */
0753     void removeEmail(const QString &email);
0754 
0755     /**
0756       Return preferred email address. This is the first email address or the last
0757       one added with insertEmail() or addEmail() with a set preferred parameter.
0758      */
0759     QString preferredEmail() const;
0760 
0761     /**
0762       Return list of all email addresses.
0763      */
0764     QStringList emails() const;
0765 
0766     /**
0767        Set the emails to @p list.
0768        The first email address gets the preferred one!
0769        @param list The list of email addresses.
0770      */
0771     void setEmails(const QStringList &list);
0772 
0773     /**
0774       Insert a phone number. If a phone number with the same id already exists
0775       in this addressee it is not duplicated.
0776 
0777       @param phoneNumber The telephone number to insert to the addressee
0778      */
0779     void insertPhoneNumber(const PhoneNumber &phoneNumber);
0780 
0781     /**
0782       Remove phone number. If no phone number with the given id exists for this
0783       addressee, nothing happens.
0784 
0785       @param phoneNumber The telephone number to remove from the addressee
0786      */
0787     void removePhoneNumber(const PhoneNumber &phoneNumber);
0788 
0789     /**
0790       Return phone number, which matches the given type.
0791 
0792       @param type The type of phone number to get
0793      */
0794     PhoneNumber phoneNumber(PhoneNumber::Type type) const;
0795 
0796     /**
0797       Return list of all phone numbers.
0798      */
0799     PhoneNumber::List phoneNumbers() const;
0800 
0801     void setPhoneNumbers(const PhoneNumber::List &phoneNumbers);
0802 
0803     /**
0804       Return list of phone numbers with a special type.
0805 
0806       @param type The type of phone number to get
0807      */
0808     PhoneNumber::List phoneNumbers(PhoneNumber::Type type) const;
0809 
0810     /**
0811       Return phone number with the given id.
0812 
0813       @param id The identifier of the phone number to look for.
0814                 See PhoneNumber::id()
0815      */
0816     PhoneNumber findPhoneNumber(const QString &id) const;
0817 
0818     /**
0819       Insert a key. If a key with the same id already exists
0820       in this addressee it is not duplicated.
0821 
0822       @param key The key to insert
0823      */
0824     void insertKey(const Key &key);
0825 
0826     /**
0827       Remove a key. If no key with the given id exists for this
0828       addressee, nothing happens.
0829 
0830       @param key The key to remove
0831      */
0832     void removeKey(const Key &key);
0833 
0834     /**
0835       Return key, which matches the given type.
0836       If @p type == Key::Custom you can specify a string
0837       that should match. If you leave the string empty, the first
0838       key with a custom value is returned.
0839 
0840       @param type The type of key to look for
0841       @param customTypeString A string to match custom keys against when
0842              @p type is @c Key::Custom
0843      */
0844     Key key(Key::Type type, const QString &customTypeString = QString()) const;
0845 
0846     /**
0847       Return list of all keys.
0848      */
0849     Key::List keys() const;
0850 
0851     /**
0852        Set the list of keys
0853        @param keys The keys to be set.
0854      */
0855     void setKeys(const Key::List &keys);
0856 
0857     /**
0858       Return list of keys with a special type.
0859       If @p type == Key::Custom you can specify a string
0860       that should match. If you leave the string empty, all custom
0861       keys will be returned.
0862 
0863       @param type The type of key to look for
0864       @param customTypeString A string to match custom keys against when
0865              @p type is @c Key::Custom
0866      */
0867     Key::List keys(Key::Type type, const QString &customTypeString = QString()) const;
0868 
0869     /**
0870       Return key with the given id.
0871 
0872       @param id The identifier of the key to look for. See Key::id()
0873      */
0874     Key findKey(const QString &id) const;
0875 
0876     /**
0877       Insert an address. If an address with the same id already exists
0878       in this addressee it is not duplicated.
0879 
0880       @param address The address to insert
0881      */
0882     void insertAddress(const Address &address);
0883 
0884     /**
0885       Remove address. If no address with the given id exists for this
0886       addressee, nothing happens.
0887 
0888       @param address The address to remove
0889      */
0890     void removeAddress(const Address &address);
0891 
0892     /**
0893       Set the addressee
0894 
0895       @param addresses The new addresses
0896       @since 5.100
0897      */
0898     void setAddresses(const Address::List &addresses);
0899 
0900     /**
0901       Return address, which matches the given type.
0902 
0903       @param type The type of address to look for
0904      */
0905     Address address(Address::Type type) const;
0906 
0907     /**
0908       Return list of all addresses.
0909      */
0910     Address::List addresses() const;
0911 
0912     /**
0913       Return list of addresses with a special type.
0914 
0915       @param type The type of addresses to look for
0916      */
0917     Address::List addresses(Address::Type type) const;
0918 
0919     /**
0920       Return address with the given id.
0921 
0922       @param id The identifier of the address to look for. See Address::id()
0923      */
0924     Address findAddress(const QString &id) const;
0925 
0926     /**
0927       Insert category. If the category already exists it is not duplicated.
0928      */
0929     void insertCategory(const QString &category);
0930 
0931     /**
0932       Remove category.
0933      */
0934     void removeCategory(const QString &category);
0935 
0936     /**
0937       Return, if addressee has the given category.
0938      */
0939     bool hasCategory(const QString &category) const;
0940 
0941     /**
0942       Set categories to given value.
0943      */
0944     void setCategories(const QStringList &category);
0945 
0946     /**
0947       Return list of all set categories.
0948      */
0949     QStringList categories() const;
0950 
0951     /**
0952       Insert custom entry. The entry is identified by the name of the inserting
0953       application and a unique name. If an entry with the given app and name
0954       already exists its value is replaced with the new given value.
0955 
0956       An empty value isn't allowed (nothing happens if this is called with
0957       any of the three arguments being empty)
0958 
0959       @param app Name of the application inserting this custom entry
0960       @param name Name of this application specific custom entry
0961       @param value Value of this application specific custom entry
0962      */
0963     void insertCustom(const QString &app, const QString &name, const QString &value);
0964 
0965     /**
0966       Remove custom entry.
0967 
0968       @param app Name of the application which has inserted this custom entry
0969       @param name Name of this application specific custom entry
0970      */
0971     void removeCustom(const QString &app, const QString &name);
0972 
0973     /**
0974       Return value of custom entry, identified by app and entry name.
0975 
0976       @param app Name of the application which has inserted this custom entry
0977       @param name Name of this application specific custom entry
0978      */
0979     QString custom(const QString &app, const QString &name) const;
0980 
0981     /**
0982       Set all custom entries.
0983      */
0984     void setCustoms(const QStringList &customs);
0985 
0986     /**
0987       Return list of all custom entries.
0988 
0989       The format of the custom entries is 'app-key:value' and the list is sorted
0990       alphabetically by 'app-key'.
0991      */
0992     QStringList customs() const;
0993 
0994     /**
0995       Parse full email address. The result is given back in fullName and email.
0996 
0997       @param rawEmail The input string to parse for name and email
0998       @param fullName The name part of the @p rawEmail input, if it contained one
0999       @param email The email part of the @p rawEmail input, if it contained one
1000      */
1001     static void parseEmailAddress(const QString &rawEmail, QString &fullName, QString &email);
1002 
1003     /**
1004       Returns string representation of the addressee.
1005      */
1006     QString toString() const;
1007 
1008     /**
1009       Mark addressee as changed.
1010 
1011       @param value Sets the status indicating changed data
1012      */
1013     void setChanged(bool value);
1014 
1015     /**
1016       Return whether the addressee is changed.
1017      */
1018     bool changed() const;
1019 
1020     /**
1021       Returns the MIME type used for Addressees
1022      */
1023     static QString mimeType();
1024 
1025     KContacts::Email::List emailList() const;
1026     void setEmailList(const Email::List &list);
1027 
1028     /**
1029      * Remove Language
1030      * @brief removeLang
1031      * @param language
1032      */
1033     void removeLang(const QString &language);
1034     /**
1035      * Insert Language
1036      * @brief insertLang
1037      * @param language
1038      */
1039     void insertLang(const Lang &language);
1040     /**
1041      * @brief langs
1042      * @return List of lang
1043      */
1044     Lang::List langs() const;
1045     void setLangs(const Lang::List &langs);
1046 
1047     void setGender(const Gender &gender);
1048     Gender gender() const;
1049 
1050     QString kind() const;
1051     void setKind(const QString &kind);
1052 
1053     void insertCalendarUrl(const CalendarUrl &calendarUrl);
1054     CalendarUrl::List calendarUrlList() const;
1055 
1056     void insertExtraSound(const Sound &sound);
1057     void setExtraSoundList(const Sound::List &soundList);
1058     Sound::List extraSoundList() const;
1059 
1060     void insertExtraPhoto(const Picture &picture);
1061     void setExtraPhotoList(const Picture::List &pictureList);
1062     Picture::List extraPhotoList() const;
1063 
1064     void insertExtraLogo(const Picture &logo);
1065     void setExtraLogoList(const Picture::List &logoList);
1066     Picture::List extraLogoList() const;
1067 
1068     ResourceLocatorUrl::List extraUrlList() const;
1069     void setExtraUrlList(const ResourceLocatorUrl::List &urlList);
1070     void insertExtraUrl(const ResourceLocatorUrl &url);
1071 
1072     // Member
1073     void insertMember(const QString &member);
1074     void setMembers(const QStringList &c);
1075     QStringList members() const;
1076 
1077     // Relation
1078     void insertRelationship(const Related &related);
1079     void setRelationships(const Related::List &c);
1080     Related::List relationships() const;
1081 
1082     // Source
1083     void insertSourceUrl(const QUrl &url);
1084     void setSourcesUrlList(const QList<QUrl> &urlList);
1085     QList<QUrl> sourcesUrlList() const;
1086 
1087     // Impp
1088     Impp::List imppList() const;
1089     void setImppList(const Impp::List &imppList);
1090     void insertImpp(const Impp &impp);
1091 
1092     // FieldGroup
1093     FieldGroup::List fieldGroupList() const;
1094     void setFieldGroupList(const FieldGroup::List &fieldGroupList);
1095     void insertFieldGroup(const FieldGroup &fieldGroup);
1096 
1097     // ClientPidMap
1098     ClientPidMap::List clientPidMapList() const;
1099     void setClientPidMapList(const ClientPidMap::List &clientpidmaplist);
1100     void insertClientPidMap(const ClientPidMap &clientpidmap);
1101 
1102     /**
1103      * Returns the contact's anniversary date.
1104      * @note This is a non-standard extension using the @c X-Anniversary field.
1105      * @since 5.12
1106      */
1107     QDate anniversary() const;
1108     /**
1109      * Sets the contact's anniversary date.
1110      * @note This is a non-standard extension using the @c X-Anniversary field.
1111      * @since 5.12
1112      */
1113     void setAnniversary(const QDate &anniversary);
1114 
1115     /**
1116      * Returns the contact's assistant's name.
1117      * @note This is a non-standard extension using the @c X-AssistantsName field.
1118      * @since 5.12
1119      */
1120     QString assistantsName() const;
1121     /**
1122      * Set the contact's assistant's name.
1123      * @note This is a non-standard extension using the @c X-AssistantsName field.
1124      * @since 5.12
1125      */
1126     void setAssistantsName(const QString &assistantsName);
1127 
1128     /**
1129      * Returns the contact's blog feed.
1130      * @note This is a non-standard extension using the @c BlogFeed field.
1131      * @since 5.12
1132      */
1133     QUrl blogFeed() const;
1134     /**
1135      * Set the contact's blog feed.
1136      * @note This is a non-standard extension using the @c BlogFeed field.
1137      * @since 5.12
1138      */
1139     void setBlogFeed(const QUrl &blogFeed);
1140 
1141     /**
1142      * Returns the contact's manager's name.
1143      * @note This is a non-standard extension using the @c X-ManagersName field.
1144      * @since 5.12
1145      */
1146     QString managersName() const;
1147     /**
1148      * Set the contact's manager's name.
1149      * @note This is a non-standard extension using the @c X-ManagersName field.
1150      * @since 5.12
1151      */
1152     void setManagersName(const QString &managersName);
1153 
1154     /**
1155      * Returns the contact's office.
1156      * @note This is a non-standard extension using the @c X-Office field.
1157      * @since 5.12
1158      */
1159     QString office() const;
1160     /**
1161      * Set the contact's office.
1162      * @note This is a non-standard extension using the @c X-Office field.
1163      * @since 5.12
1164      */
1165     void setOffice(const QString &office);
1166 
1167     /**
1168      * Returns the contact's profession.
1169      * @note This is a non-standard extension using the @c X-Profession field.
1170      * @since 5.12
1171      */
1172     QString profession() const;
1173     /**
1174      * Set the contact's profession.
1175      * @note This is a non-standard extension using the @c X-Profession field.
1176      * @since 5.12
1177      */
1178     void setProfession(const QString &profession);
1179 
1180     /**
1181      * Returns the contact's spouse's name.
1182      * @note This is a non-standard extension using the @c X-SpousesName field.
1183      * @since 5.12
1184      */
1185     QString spousesName() const;
1186     /**
1187      * Set the contact's spouse's name.
1188      * @note This is a non-standard extension using the @c X-SpousesName field.
1189      * @since 5.12
1190      */
1191     void setSpousesName(const QString &spousesName);
1192 
1193 private:
1194     KCONTACTS_NO_EXPORT void setBirthdayProperty(const QDateTime &birthday);
1195 
1196     class Private;
1197     QSharedDataPointer<Private> d;
1198 };
1199 
1200 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Addressee &);
1201 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Addressee &);
1202 }
1203 
1204 #endif