KContacts

addressee.h
1 /*
2  This file is part of the KContacts framework.
3  SPDX-FileCopyrightText: 2001 Cornelius Schumacher <[email protected]>
4  SPDX-FileCopyrightText: 2013 Tobias Koenig <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KCONTACTS_ADDRESSEE_H
10 #define KCONTACTS_ADDRESSEE_H
11 
12 #include <QDateTime>
13 #include <QStringList>
14 #include <QSharedDataPointer>
15 #include <QUrl>
16 #include <QMap>
17 
18 #include "address.h"
19 #include "geo.h"
20 #include "key.h"
21 #include "email.h"
22 #include "lang.h"
23 #include "gender.h"
24 #include "phonenumber.h"
25 #include "picture.h"
26 #include "secrecy.h"
27 #include "sound.h"
28 #include "impp.h"
29 #include "timezone.h"
30 #include "calendarurl.h"
31 #include "related.h"
32 #include "addresseelist.h"
33 #include "resourcelocatorurl.h"
34 #include "fieldgroup.h"
35 #include "title.h"
36 #include "nickname.h"
37 #include "role.h"
38 #include "org.h"
39 #include "clientpidmap.h"
40 
41 namespace KContacts {
68 class KCONTACTS_EXPORT Addressee
69 {
70  friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Addressee &);
71  friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Addressee &);
72 
73  Q_GADGET
74  Q_PROPERTY(bool isEmpty READ isEmpty)
75  Q_PROPERTY(QString uid READ uid WRITE setUid)
76  Q_PROPERTY(QString name READ name WRITE setName)
77  Q_PROPERTY(QString formattedName READ formattedName WRITE setFormattedName)
78  Q_PROPERTY(QString familyName READ familyName WRITE setFamilyName)
79  Q_PROPERTY(QString givenName READ givenName WRITE setGivenName)
80  Q_PROPERTY(QString additionalName READ additionalName WRITE setAdditionalName)
81  Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
82  Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
83  Q_PROPERTY(QString nickName READ nickName)
84  Q_PROPERTY(QDateTime birthday READ birthday) // ### can't set this due to withTime argument
85  Q_PROPERTY(bool birthdayHasTime READ birthdayHasTime)
86  Q_PROPERTY(QString mailer READ mailer WRITE setMailer)
87  Q_PROPERTY(KContacts::Geo geo READ geo WRITE setGeo)
88  Q_PROPERTY(QString title READ title)
89  Q_PROPERTY(QString role READ role)
90  Q_PROPERTY(QString organization READ organization)
91  Q_PROPERTY(QString department READ department WRITE setDepartment)
92  Q_PROPERTY(QString note READ note WRITE setNote)
93  Q_PROPERTY(QString productId READ productId WRITE setProductId)
94  Q_PROPERTY(QDateTime revision READ revision)
95  Q_PROPERTY(QString sortString READ sortString WRITE setSortString)
96  Q_PROPERTY(KContacts::ResourceLocatorUrl url READ url WRITE setUrl)
97  Q_PROPERTY(QString realName READ realName)
98  Q_PROPERTY(QString assembledName READ assembledName)
99  Q_PROPERTY(QString preferredEmail READ preferredEmail)
100  Q_PROPERTY(QStringList categories READ categories WRITE setCategories)
101  Q_PROPERTY(QStringList customs READ customs)
102  Q_PROPERTY(bool changed READ changed WRITE setChanged)
103  Q_PROPERTY(QDate anniversary READ anniversary WRITE setAnniversary)
104  Q_PROPERTY(QString assistantsName READ assistantsName WRITE setAssistantsName)
105  Q_PROPERTY(QUrl blogFeed READ blogFeed WRITE setBlogFeed)
106  Q_PROPERTY(QString managersName READ managersName WRITE setManagersName)
107  Q_PROPERTY(QString office READ office WRITE setOffice)
108  Q_PROPERTY(QString profession READ profession WRITE setProfession)
109  Q_PROPERTY(QString spousesName READ spousesName WRITE setSpousesName)
110 
111  // using variants for QML compatibility, can be changed to proper types once QML supports that
112  Q_PROPERTY(QVariantList emails READ emailsVariant)
113  Q_PROPERTY(QVariantList phoneNumbers READ phoneNumbersVariant)
114  Q_PROPERTY(QVariantList addresses READ addressesVariant)
115  Q_PROPERTY(QVariantList urls READ urlsVariant)
116  Q_PROPERTY(QVariantList impps READ imppsVariant)
117 
118  // ### the following properties are still missing:
119  // - logos, photos, sounds
120  // - keys
121  // - the list variants for nicks, titles, roles, orgs
122  // - timezone, secrecy, gender, kind, members, relationships, language
123  // - field groups, sourceUrls, calendarUrls
124 
125 public:
136 
140  Addressee();
141 
145  ~Addressee();
146 
150  Addressee(const Addressee &other);
151 
157  Addressee &operator=(const Addressee &other);
158 
165  bool operator==(const Addressee &other) const;
166 
173  bool operator!=(const Addressee &other) const;
174 
178  bool isEmpty() const;
179 
185  void setUid(const QString &uid);
186 
190  QString uid() const;
191 
195  static QString uidLabel();
196 
200  void setName(const QString &name);
201 
205  QString name() const;
206 
210  static QString nameLabel();
211 
215  void setFormattedName(const QString &formattedName);
216 
220  QString formattedName() const;
221 
225  static QString formattedNameLabel();
226 
230  void setFamilyName(const QString &familyName);
231 
235  QString familyName() const;
236 
240  static QString familyNameLabel();
241 
245  void setGivenName(const QString &givenName);
246 
250  QString givenName() const;
251 
255  static QString givenNameLabel();
256 
260  void setAdditionalName(const QString &additionalName);
261 
265  QString additionalName() const;
266 
270  static QString additionalNameLabel();
271 
275  void setPrefix(const QString &prefix);
276 
280  QString prefix() const;
281 
285  static QString prefixLabel();
286 
290  void setSuffix(const QString &suffix);
291 
295  QString suffix() const;
296 
300  static QString suffixLabel();
301 
305  void setNickName(const QString &nickName);
306  void setNickName(const NickName &nickName);
307  void insertExtraNickName(const NickName &nickName);
308  void setExtraNickNameList(const NickName::List &nickNameList);
309  NickName::List extraNickNameList() const;
310 
314  QString nickName() const;
315 
319  static QString nickNameLabel();
320 
326  void setBirthday(const QDateTime &birthday, bool withTime = true);
327 
331  void setBirthday(const QDate &birthday);
332 
337  QDateTime birthday() const;
338 
342  bool birthdayHasTime() const;
343 
347  static QString birthdayLabel();
348 
352  static QString homeAddressStreetLabel();
353 
357  static QString homeAddressPostOfficeBoxLabel();
358 
362  static QString homeAddressLocalityLabel();
363 
367  static QString homeAddressRegionLabel();
368 
372  static QString homeAddressPostalCodeLabel();
373 
377  static QString homeAddressCountryLabel();
378 
382  static QString homeAddressLabelLabel();
383 
387  static QString businessAddressStreetLabel();
388 
392  static QString businessAddressPostOfficeBoxLabel();
393 
397  static QString businessAddressLocalityLabel();
398 
402  static QString businessAddressRegionLabel();
403 
407  static QString businessAddressPostalCodeLabel();
408 
412  static QString businessAddressCountryLabel();
413 
417  static QString businessAddressLabelLabel();
418 
422  static QString homePhoneLabel();
423 
427  static QString businessPhoneLabel();
428 
432  static QString mobilePhoneLabel();
433 
437  static QString homeFaxLabel();
438 
442  static QString businessFaxLabel();
443 
447  static QString carPhoneLabel();
448 
452  static QString isdnLabel();
453 
457  static QString pagerLabel();
458 
462  static QString emailLabel();
463 
467  void setMailer(const QString &mailer);
468 
472  QString mailer() const;
473 
477  static QString mailerLabel();
478 
482  void setTimeZone(const TimeZone &timeZone);
483 
487  TimeZone timeZone() const;
488 
492  static QString timeZoneLabel();
493 
497  void setGeo(const Geo &geo);
498 
502  Geo geo() const;
503 
507  static QString geoLabel();
508 
512  //Remove in kf6
513  void setTitle(const QString &title);
514  void setTitle(const Title &title);
515  void insertExtraTitle(const Title &title);
516  void setExtraTitleList(const Title::List &urltitle);
517  Title::List extraTitleList() const;
521  QString title() const;
522 
526  static QString titleLabel();
527 
531  void setRole(const QString &role);
532  void setRole(const Role &role);
533  void insertExtraRole(const Role &role);
534  void setExtraRoleList(const Role::List &roleList);
535  Role::List extraRoleList() const;
536 
540  QString role() const;
541 
545  static QString roleLabel();
546 
550  //Remove in kf6
551  void setOrganization(const QString &organization);
552  void setOrganization(const Org &organization);
553  void insertExtraOrganization(const Org &organization);
554  void setExtraOrganizationList(const Org::List &orgList);
555  Org::List extraOrganizationList() const;
556 
560  QString organization() const;
561 
565  static QString organizationLabel();
566 
570  void setDepartment(const QString &department);
571 
575  QString department() const;
576 
580  static QString departmentLabel();
581 
585  void setNote(const QString &note);
586 
590  QString note() const;
591 
595  static QString noteLabel();
596 
600  void setProductId(const QString &productId);
601 
605  QString productId() const;
606 
610  static QString productIdLabel();
611 
615  void setRevision(const QDateTime &revision);
616 
620  QDateTime revision() const;
621 
625  static QString revisionLabel();
626 
630  void setSortString(const QString &sortString);
631 
635  QString sortString() const;
636 
640  static QString sortStringLabel();
641 
645  void setUrl(const ResourceLocatorUrl &url);
646  //kf6: remove it
647  void setUrl(const QUrl &url);
648 
652  ResourceLocatorUrl url() const;
653 
657  static QString urlLabel();
658 
662  void setSecrecy(const Secrecy &secrecy);
663 
667  Secrecy secrecy() const;
668 
672  static QString secrecyLabel();
673 
677  void setLogo(const Picture &logo);
678 
682  Picture logo() const;
683 
687  static QString logoLabel();
688 
692  void setPhoto(const Picture &photo);
693 
697  Picture photo() const;
698 
702  static QString photoLabel();
703 
707  void setSound(const Sound &sound);
708 
712  Sound sound() const;
713 
717  static QString soundLabel();
718 
724  void setNameFromString(const QString &s);
725 
730  QString realName() const;
731 
735  QString assembledName() const;
736 
743  QString fullEmail(const QString &email = QString()) const;
744 
753  void insertEmail(const QString &email, bool preferred = false, const QMap<QString, QStringList> &param = QMap<QString, QStringList>());
754 
760  void removeEmail(const QString &email);
761 
766  QString preferredEmail() const;
767 
771  QStringList emails() const;
772 
778  void setEmails(const QStringList &list);
779 
786  void insertPhoneNumber(const PhoneNumber &phoneNumber);
787 
794  void removePhoneNumber(const PhoneNumber &phoneNumber);
795 
801  PhoneNumber phoneNumber(PhoneNumber::Type type) const;
802 
806  PhoneNumber::List phoneNumbers() const;
807 
808  void setPhoneNumbers(const PhoneNumber::List &phoneNumbers);
809 
815  PhoneNumber::List phoneNumbers(PhoneNumber::Type type) const;
816 
823  PhoneNumber findPhoneNumber(const QString &id) const;
824 
831  void insertKey(const Key &key);
832 
839  void removeKey(const Key &key);
840 
851  Key key(Key::Type type, const QString &customTypeString = QString()) const;
852 
856  Key::List keys() const;
857 
862  void setKeys(const Key::List &keys);
863 
874  Key::List keys(Key::Type type, const QString &customTypeString = QString()) const;
875 
881  Key findKey(const QString &id) const;
882 
889  void insertAddress(const Address &address);
890 
897  void removeAddress(const Address &address);
898 
904  Address address(Address::Type type) const;
905 
909  Address::List addresses() const;
910 
916  Address::List addresses(Address::Type type) const;
917 
923  Address findAddress(const QString &id) const;
924 
928  void insertCategory(const QString &category);
929 
933  void removeCategory(const QString &category);
934 
938  bool hasCategory(const QString &category) const;
939 
943  void setCategories(const QStringList &category);
944 
948  QStringList categories() const;
949 
962  void insertCustom(const QString &app, const QString &name, const QString &value);
963 
970  void removeCustom(const QString &app, const QString &name);
971 
978  QString custom(const QString &app, const QString &name) const;
979 
983  void setCustoms(const QStringList &customs);
984 
991  QStringList customs() const;
992 
1000  static void parseEmailAddress(const QString &rawEmail, QString &fullName, QString &email);
1001 
1005  QString toString() const;
1006 
1012  void setChanged(bool value);
1013 
1017  bool changed() const;
1018 
1022  static QString mimeType();
1023 
1024  KContacts::Email::List emailList() const;
1025  void setEmailList(const Email::List &list);
1026 
1032  void removeLang(const QString &language);
1038  void insertLang(const Lang &language);
1043  Lang::List langs() const;
1044  void setLangs(const Lang::List &langs);
1045 
1046  void setGender(const Gender &gender);
1047  Gender gender() const;
1048 
1049  QString kind() const;
1050  void setKind(const QString &kind);
1051 
1052  void insertCalendarUrl(const CalendarUrl &calendarUrl);
1053  CalendarUrl::List calendarUrlList() const;
1054 
1055  void insertExtraSound(const Sound &sound);
1056  void setExtraSoundList(const Sound::List &soundList);
1057  Sound::List extraSoundList() const;
1058 
1059  void insertExtraPhoto(const Picture &picture);
1060  void setExtraPhotoList(const Picture::List &pictureList);
1061  Picture::List extraPhotoList() const;
1062 
1063  void insertExtraLogo(const Picture &logo);
1064  void setExtraLogoList(const Picture::List &logoList);
1065  Picture::List extraLogoList() const;
1066 
1067  ResourceLocatorUrl::List extraUrlList() const;
1068  void setExtraUrlList(const ResourceLocatorUrl::List &urlList);
1069  void insertExtraUrl(const ResourceLocatorUrl &url);
1070 
1071  //Member
1072  void insertMember(const QString &member);
1073  void setMembers(const QStringList &c);
1074  QStringList members() const;
1075 
1076  //Relation
1077  void insertRelationship(const Related &related);
1078  void setRelationships(const Related::List &c);
1079  Related::List relationships() const;
1080 
1081  //Source
1082  void insertSourceUrl(const QUrl &url);
1083  void setSourcesUrlList(const QVector<QUrl> &urlList);
1084  QVector<QUrl> sourcesUrlList() const;
1085 
1086  //Impp
1087  Impp::List imppList() const;
1088  void setImppList(const Impp::List &imppList);
1089  void insertImpp(const Impp &impp);
1090 
1091  //FieldGroup
1092  FieldGroup::List fieldGroupList() const;
1093  void setFieldGroupList(const FieldGroup::List &fieldGroupList);
1094  void insertFieldGroup(const FieldGroup &fieldGroup);
1095 
1096  //ClientPidMap
1097  ClientPidMap::List clientPidMapList() const;
1098  void setClientPidMapList(const ClientPidMap::List &clientpidmaplist);
1099  void insertClientPidMap(const ClientPidMap &clientpidmap);
1100 
1106  QDate anniversary() const;
1112  void setAnniversary(const QDate &anniversary);
1113 
1119  QString assistantsName() const;
1125  void setAssistantsName(const QString &assistantsName);
1126 
1132  QUrl blogFeed() const;
1138  void setBlogFeed(const QUrl &blogFeed);
1139 
1145  QString managersName() const;
1151  void setManagersName(const QString &managersName);
1152 
1158  QString office() const;
1164  void setOffice(const QString &office);
1165 
1171  QString profession() const;
1177  void setProfession(const QString &profession);
1178 
1184  QString spousesName() const;
1190  void setSpousesName(const QString &spousesName);
1191 
1192 private:
1193  QVariantList emailsVariant() const;
1194  QVariantList phoneNumbersVariant() const;
1195  QVariantList addressesVariant() const;
1196  QVariantList urlsVariant() const;
1197  QVariantList imppsVariant() const;
1198 
1199  class Private;
1201 };
1202 
1203 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Addressee &);
1204 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Addressee &);
1205 }
1206 
1207 #define KCONTACTS_ADDRESSEE_METATYPE_DEFINED 1
1208 Q_DECLARE_METATYPE(KContacts::Addressee)
1209 
1210 #endif
Class that holds a FieldGroup for a contact.
Definition: fieldgroup.h:21
Descripes a relationship of an Addressee.
Definition: related.h:18
Class that holds a Role for a contact.
Definition: role.h:20
Class that holds a Resource Locator.
QDataStream & operator>>(QDataStream &in, KDateTime::Spec &spec)
Geographic position.
Definition: geo.h:23
Class that holds a Calendar Url (FBURL/CALADRURI/CALURI)
Definition: calendarurl.h:21
Class that holds a ClientPidMap for a contact.
Definition: clientpidmap.h:20
A class to store an encryption key.
Definition: key.h:20
Class that holds a IMPP for a contact.
Definition: impp.h:26
A class to store a picture of an addressee.
Definition: picture.h:26
Type
Key types.
Definition: key.h:34
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Class that holds a Sound clip for a contact.
Definition: sound.h:44
QHash< QString, Addressee > Map
A map from unique identifier to addressee.
Definition: addressee.h:135
AddresseeList List
A list of addressee objects.
Definition: addressee.h:129
Postal address information.
Definition: address.h:27
Class that holds a NickName for a contact.
Definition: nickname.h:20
Class that holds a Language for a contact.
Definition: lang.h:20
Descripes the confidentiality of an addressee.
Definition: secrecy.h:17
Class that holds a Gender for a contact.
Definition: gender.h:19
Class that holds a Title for a contact.
Definition: title.h:20
address book entry
Definition: addressee.h:68
Class that holds a Organization for a contact.
Definition: org.h:20
Time zone information.
Definition: timezone.h:21
Phonenumber information.
Definition: phonenumber.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Oct 27 2020 23:00:04 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.