KContacts

addressee.h
1 /*
2  This file is part of the KContacts framework.
3  Copyright (c) 2001 Cornelius Schumacher <[email protected]>
4  2013 Tobias Koenig <[email protected]>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KCONTACTS_ADDRESSEE_H
23 #define KCONTACTS_ADDRESSEE_H
24 
25 #include <QDateTime>
26 #include <QStringList>
27 #include <QSharedDataPointer>
28 #include <QUrl>
29 #include <QMap>
30 
31 #include "address.h"
32 #include "geo.h"
33 #include "key.h"
34 #include "email.h"
35 #include "lang.h"
36 #include "gender.h"
37 #include "phonenumber.h"
38 #include "picture.h"
39 #include "secrecy.h"
40 #include "sound.h"
41 #include "impp.h"
42 #include "timezone.h"
43 #include "calendarurl.h"
44 #include "related.h"
45 #include "addresseelist.h"
46 #include "resourcelocatorurl.h"
47 #include "fieldgroup.h"
48 #include "title.h"
49 #include "nickname.h"
50 #include "role.h"
51 #include "org.h"
52 #include "clientpidmap.h"
53 
54 namespace KContacts {
81 class KCONTACTS_EXPORT Addressee
82 {
83  friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Addressee &);
84  friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Addressee &);
85 
86  Q_GADGET
87  Q_PROPERTY(bool isEmpty READ isEmpty)
88  Q_PROPERTY(QString uid READ uid WRITE setUid)
89  Q_PROPERTY(QString name READ name WRITE setName)
90  Q_PROPERTY(QString formattedName READ formattedName WRITE setFormattedName)
91  Q_PROPERTY(QString familyName READ familyName WRITE setFamilyName)
92  Q_PROPERTY(QString givenName READ givenName WRITE setGivenName)
93  Q_PROPERTY(QString additionalName READ additionalName WRITE setAdditionalName)
94  Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
95  Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
96  Q_PROPERTY(QString nickName READ nickName)
97  Q_PROPERTY(QDateTime birthday READ birthday) // ### can't set this due to withTime argument
98  Q_PROPERTY(bool birthdayHasTime READ birthdayHasTime)
99  Q_PROPERTY(QString mailer READ mailer WRITE setMailer)
100  Q_PROPERTY(KContacts::Geo geo READ geo WRITE setGeo)
101  Q_PROPERTY(QString title READ title)
102  Q_PROPERTY(QString role READ role)
103  Q_PROPERTY(QString organization READ organization)
104  Q_PROPERTY(QString department READ department WRITE setDepartment)
105  Q_PROPERTY(QString note READ note WRITE setNote)
106  Q_PROPERTY(QString productId READ productId WRITE setProductId)
107  Q_PROPERTY(QDateTime revision READ revision)
108  Q_PROPERTY(QString sortString READ sortString WRITE setSortString)
109  Q_PROPERTY(KContacts::ResourceLocatorUrl url READ url WRITE setUrl)
110  Q_PROPERTY(QString realName READ realName)
111  Q_PROPERTY(QString assembledName READ assembledName)
112  Q_PROPERTY(QString preferredEmail READ preferredEmail)
113  Q_PROPERTY(QStringList categories READ categories WRITE setCategories)
114  Q_PROPERTY(QStringList customs READ customs)
115  Q_PROPERTY(bool changed READ changed WRITE setChanged)
116  Q_PROPERTY(QDate anniversary READ anniversary WRITE setAnniversary)
117  Q_PROPERTY(QString assistantsName READ assistantsName WRITE setAssistantsName)
118  Q_PROPERTY(QUrl blogFeed READ blogFeed WRITE setBlogFeed)
119  Q_PROPERTY(QString managersName READ managersName WRITE setManagersName)
120  Q_PROPERTY(QString office READ office WRITE setOffice)
121  Q_PROPERTY(QString profession READ profession WRITE setProfession)
122  Q_PROPERTY(QString spousesName READ spousesName WRITE setSpousesName)
123 
124  // using variants for QML compatibility, can be changed to proper types once QML supports that
125  Q_PROPERTY(QVariantList emails READ emailsVariant)
126  Q_PROPERTY(QVariantList phoneNumbers READ phoneNumbersVariant)
127  Q_PROPERTY(QVariantList addresses READ addressesVariant)
128  Q_PROPERTY(QVariantList urls READ urlsVariant)
129  Q_PROPERTY(QVariantList impps READ imppsVariant)
130 
131  // ### the following properties are still missing:
132  // - logos, photos, sounds
133  // - keys
134  // - the list variants for nicks, titles, roles, orgs
135  // - timezone, secrecy, gender, kind, members, relationships, language
136  // - field groups, sourceUrls, calendarUrls
137 
138 public:
149 
153  Addressee();
154 
158  ~Addressee();
159 
163  Addressee(const Addressee &other);
164 
170  Addressee &operator=(const Addressee &other);
171 
178  bool operator==(const Addressee &other) const;
179 
186  bool operator!=(const Addressee &other) const;
187 
191  bool isEmpty() const;
192 
198  void setUid(const QString &uid);
199 
203  QString uid() const;
204 
208  static QString uidLabel();
209 
213  void setName(const QString &name);
214 
218  QString name() const;
219 
223  static QString nameLabel();
224 
228  void setFormattedName(const QString &formattedName);
229 
233  QString formattedName() const;
234 
238  static QString formattedNameLabel();
239 
243  void setFamilyName(const QString &familyName);
244 
248  QString familyName() const;
249 
253  static QString familyNameLabel();
254 
258  void setGivenName(const QString &givenName);
259 
263  QString givenName() const;
264 
268  static QString givenNameLabel();
269 
273  void setAdditionalName(const QString &additionalName);
274 
278  QString additionalName() const;
279 
283  static QString additionalNameLabel();
284 
288  void setPrefix(const QString &prefix);
289 
293  QString prefix() const;
294 
298  static QString prefixLabel();
299 
303  void setSuffix(const QString &suffix);
304 
308  QString suffix() const;
309 
313  static QString suffixLabel();
314 
318  void setNickName(const QString &nickName);
319  void setNickName(const NickName &nickName);
320  void insertExtraNickName(const NickName &nickName);
321  void setExtraNickNameList(const NickName::List &nickNameList);
322  NickName::List extraNickNameList() const;
323 
327  QString nickName() const;
328 
332  static QString nickNameLabel();
333 
339  void setBirthday(const QDateTime &birthday, bool withTime = true);
340 
344  void setBirthday(const QDate &birthday);
345 
350  QDateTime birthday() const;
351 
355  bool birthdayHasTime() const;
356 
360  static QString birthdayLabel();
361 
365  static QString homeAddressStreetLabel();
366 
370  static QString homeAddressPostOfficeBoxLabel();
371 
375  static QString homeAddressLocalityLabel();
376 
380  static QString homeAddressRegionLabel();
381 
385  static QString homeAddressPostalCodeLabel();
386 
390  static QString homeAddressCountryLabel();
391 
395  static QString homeAddressLabelLabel();
396 
400  static QString businessAddressStreetLabel();
401 
405  static QString businessAddressPostOfficeBoxLabel();
406 
410  static QString businessAddressLocalityLabel();
411 
415  static QString businessAddressRegionLabel();
416 
420  static QString businessAddressPostalCodeLabel();
421 
425  static QString businessAddressCountryLabel();
426 
430  static QString businessAddressLabelLabel();
431 
435  static QString homePhoneLabel();
436 
440  static QString businessPhoneLabel();
441 
445  static QString mobilePhoneLabel();
446 
450  static QString homeFaxLabel();
451 
455  static QString businessFaxLabel();
456 
460  static QString carPhoneLabel();
461 
465  static QString isdnLabel();
466 
470  static QString pagerLabel();
471 
475  static QString emailLabel();
476 
480  void setMailer(const QString &mailer);
481 
485  QString mailer() const;
486 
490  static QString mailerLabel();
491 
495  void setTimeZone(const TimeZone &timeZone);
496 
500  TimeZone timeZone() const;
501 
505  static QString timeZoneLabel();
506 
510  void setGeo(const Geo &geo);
511 
515  Geo geo() const;
516 
520  static QString geoLabel();
521 
525  //Remove in kf6
526  void setTitle(const QString &title);
527  void setTitle(const Title &title);
528  void insertExtraTitle(const Title &title);
529  void setExtraTitleList(const Title::List &urltitle);
530  Title::List extraTitleList() const;
534  QString title() const;
535 
539  static QString titleLabel();
540 
544  void setRole(const QString &role);
545  void setRole(const Role &role);
546  void insertExtraRole(const Role &role);
547  void setExtraRoleList(const Role::List &roleList);
548  Role::List extraRoleList() const;
549 
553  QString role() const;
554 
558  static QString roleLabel();
559 
563  //Remove in kf6
564  void setOrganization(const QString &organization);
565  void setOrganization(const Org &organization);
566  void insertExtraOrganization(const Org &organization);
567  void setExtraOrganizationList(const Org::List &orgList);
568  Org::List extraOrganizationList() const;
569 
573  QString organization() const;
574 
578  static QString organizationLabel();
579 
583  void setDepartment(const QString &department);
584 
588  QString department() const;
589 
593  static QString departmentLabel();
594 
598  void setNote(const QString &note);
599 
603  QString note() const;
604 
608  static QString noteLabel();
609 
613  void setProductId(const QString &productId);
614 
618  QString productId() const;
619 
623  static QString productIdLabel();
624 
628  void setRevision(const QDateTime &revision);
629 
633  QDateTime revision() const;
634 
638  static QString revisionLabel();
639 
643  void setSortString(const QString &sortString);
644 
648  QString sortString() const;
649 
653  static QString sortStringLabel();
654 
658  void setUrl(const ResourceLocatorUrl &url);
659  //kf6: remove it
660  void setUrl(const QUrl &url);
661 
665  ResourceLocatorUrl url() const;
666 
670  static QString urlLabel();
671 
675  void setSecrecy(const Secrecy &secrecy);
676 
680  Secrecy secrecy() const;
681 
685  static QString secrecyLabel();
686 
690  void setLogo(const Picture &logo);
691 
695  Picture logo() const;
696 
700  static QString logoLabel();
701 
705  void setPhoto(const Picture &photo);
706 
710  Picture photo() const;
711 
715  static QString photoLabel();
716 
720  void setSound(const Sound &sound);
721 
725  Sound sound() const;
726 
730  static QString soundLabel();
731 
737  void setNameFromString(const QString &s);
738 
743  QString realName() const;
744 
748  QString assembledName() const;
749 
756  QString fullEmail(const QString &email = QString()) const;
757 
766  void insertEmail(const QString &email, bool preferred = false, const QMap<QString, QStringList> &param = QMap<QString, QStringList>());
767 
773  void removeEmail(const QString &email);
774 
779  QString preferredEmail() const;
780 
784  QStringList emails() const;
785 
791  void setEmails(const QStringList &list);
792 
799  void insertPhoneNumber(const PhoneNumber &phoneNumber);
800 
807  void removePhoneNumber(const PhoneNumber &phoneNumber);
808 
814  PhoneNumber phoneNumber(PhoneNumber::Type type) const;
815 
819  PhoneNumber::List phoneNumbers() const;
820 
821  void setPhoneNumbers(const PhoneNumber::List &phoneNumbers);
822 
828  PhoneNumber::List phoneNumbers(PhoneNumber::Type type) const;
829 
836  PhoneNumber findPhoneNumber(const QString &id) const;
837 
844  void insertKey(const Key &key);
845 
852  void removeKey(const Key &key);
853 
864  Key key(Key::Type type, const QString &customTypeString = QString()) const;
865 
869  Key::List keys() const;
870 
875  void setKeys(const Key::List &keys);
876 
887  Key::List keys(Key::Type type, const QString &customTypeString = QString()) const;
888 
894  Key findKey(const QString &id) const;
895 
902  void insertAddress(const Address &address);
903 
910  void removeAddress(const Address &address);
911 
917  Address address(Address::Type type) const;
918 
922  Address::List addresses() const;
923 
929  Address::List addresses(Address::Type type) const;
930 
936  Address findAddress(const QString &id) const;
937 
941  void insertCategory(const QString &category);
942 
946  void removeCategory(const QString &category);
947 
951  bool hasCategory(const QString &category) const;
952 
956  void setCategories(const QStringList &category);
957 
961  QStringList categories() const;
962 
975  void insertCustom(const QString &app, const QString &name, const QString &value);
976 
983  void removeCustom(const QString &app, const QString &name);
984 
991  QString custom(const QString &app, const QString &name) const;
992 
996  void setCustoms(const QStringList &customs);
997 
1004  QStringList customs() const;
1005 
1013  static void parseEmailAddress(const QString &rawEmail, QString &fullName, QString &email);
1014 
1018  QString toString() const;
1019 
1025  void setChanged(bool value);
1026 
1030  bool changed() const;
1031 
1035  static QString mimeType();
1036 
1037  KContacts::Email::List emailList() const;
1038  void setEmailList(const Email::List &list);
1039 
1045  void removeLang(const QString &language);
1051  void insertLang(const Lang &language);
1056  Lang::List langs() const;
1057  void setLangs(const Lang::List &langs);
1058 
1059  void setGender(const Gender &gender);
1060  Gender gender() const;
1061 
1062  QString kind() const;
1063  void setKind(const QString &kind);
1064 
1065  void insertCalendarUrl(const CalendarUrl &calendarUrl);
1066  CalendarUrl::List calendarUrlList() const;
1067 
1068  void insertExtraSound(const Sound &sound);
1069  void setExtraSoundList(const Sound::List &soundList);
1070  Sound::List extraSoundList() const;
1071 
1072  void insertExtraPhoto(const Picture &picture);
1073  void setExtraPhotoList(const Picture::List &pictureList);
1074  Picture::List extraPhotoList() const;
1075 
1076  void insertExtraLogo(const Picture &logo);
1077  void setExtraLogoList(const Picture::List &logoList);
1078  Picture::List extraLogoList() const;
1079 
1080  ResourceLocatorUrl::List extraUrlList() const;
1081  void setExtraUrlList(const ResourceLocatorUrl::List &urlList);
1082  void insertExtraUrl(const ResourceLocatorUrl &url);
1083 
1084  //Member
1085  void insertMember(const QString &member);
1086  void setMembers(const QStringList &c);
1087  QStringList members() const;
1088 
1089  //Relation
1090  void insertRelationship(const Related &related);
1091  void setRelationships(const Related::List &c);
1092  Related::List relationships() const;
1093 
1094  //Source
1095  void insertSourceUrl(const QUrl &url);
1096  void setSourcesUrlList(const QVector<QUrl> &urlList);
1097  QVector<QUrl> sourcesUrlList() const;
1098 
1099  //Impp
1100  Impp::List imppList() const;
1101  void setImppList(const Impp::List &imppList);
1102  void insertImpp(const Impp &impp);
1103 
1104  //FieldGroup
1105  FieldGroup::List fieldGroupList() const;
1106  void setFieldGroupList(const FieldGroup::List &fieldGroupList);
1107  void insertFieldGroup(const FieldGroup &fieldGroup);
1108 
1109  //ClientPidMap
1110  ClientPidMap::List clientPidMapList() const;
1111  void setClientPidMapList(const ClientPidMap::List &clientpidmaplist);
1112  void insertClientPidMap(const ClientPidMap &clientpidmap);
1113 
1119  QDate anniversary() const;
1125  void setAnniversary(const QDate &anniversary);
1126 
1132  QString assistantsName() const;
1138  void setAssistantsName(const QString &assistantsName);
1139 
1145  QUrl blogFeed() const;
1151  void setBlogFeed(const QUrl &blogFeed);
1152 
1158  QString managersName() const;
1164  void setManagersName(const QString &managersName);
1165 
1171  QString office() const;
1177  void setOffice(const QString &office);
1178 
1184  QString profession() const;
1190  void setProfession(const QString &profession);
1191 
1197  QString spousesName() const;
1203  void setSpousesName(const QString &spousesName);
1204 
1205 private:
1206  QVariantList emailsVariant() const;
1207  QVariantList phoneNumbersVariant() const;
1208  QVariantList addressesVariant() const;
1209  QVariantList urlsVariant() const;
1210  QVariantList imppsVariant() const;
1211 
1212  class Private;
1214 };
1215 
1216 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Addressee &);
1217 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Addressee &);
1218 }
1219 
1220 #define KCONTACTS_ADDRESSEE_METATYPE_DEFINED 1
1221 Q_DECLARE_METATYPE(KContacts::Addressee)
1222 
1223 #endif
Class that holds a FieldGroup for a contact.
Definition: fieldgroup.h:34
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Descripes a relationship of an Addressee.
Definition: related.h:31
Class that holds a Role for a contact.
Definition: role.h:33
Class that holds a Resource Locator.
Geographic position.
Definition: geo.h:36
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
Class that holds a Calendar Url (FBURL/CALADRURI/CALURI)
Definition: calendarurl.h:34
Class that holds a ClientPidMap for a contact.
Definition: clientpidmap.h:33
A class to store an encryption key.
Definition: key.h:33
Class that holds a IMPP for a contact.
Definition: impp.h:39
A class to store a picture of an addressee.
Definition: picture.h:39
Type
Key types.
Definition: key.h:47
Class that holds a Sound clip for a contact.
Definition: sound.h:57
QHash< QString, Addressee > Map
A map from unique identifier to addressee.
Definition: addressee.h:148
AddresseeList List
A list of addressee objects.
Definition: addressee.h:142
Postal address information.
Definition: address.h:40
Class that holds a NickName for a contact.
Definition: nickname.h:33
Class that holds a Language for a contact.
Definition: lang.h:33
Descripes the confidentiality of an addressee.
Definition: secrecy.h:30
Class that holds a Gender for a contact.
Definition: gender.h:32
Class that holds a Title for a contact.
Definition: title.h:33
address book entry
Definition: addressee.h:81
Class that holds a Organization for a contact.
Definition: org.h:33
Time zone information.
Definition: timezone.h:34
Phonenumber information.
Definition: phonenumber.h:40
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 22:44:12 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.