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 <QMap>
14 #include <QSharedDataPointer>
15 #include <QStringList>
16 #include <QUrl>
17 
18 #include "address.h"
19 #include "addresseelist.h"
20 #include "calendarurl.h"
21 #include "clientpidmap.h"
22 #include "email.h"
23 #include "fieldgroup.h"
24 #include "gender.h"
25 #include "geo.h"
26 #include "impp.h"
27 #include "key.h"
28 #include "lang.h"
29 #include "nickname.h"
30 #include "org.h"
31 #include "phonenumber.h"
32 #include "picture.h"
33 #include "related.h"
34 #include "resourcelocatorurl.h"
35 #include "role.h"
36 #include "secrecy.h"
37 #include "sound.h"
38 #include "timezone.h"
39 #include "title.h"
40 
41 namespace KContacts
42 {
43 /**
44  @short address book entry
45 
46  This class represents an entry in the address book.
47 
48  The data of this class is implicitly shared. You can pass this class by value.
49 
50  If you need the name of a field for presenting it to the user you should use
51  the functions ending in Label(). They return a translated string which can be
52  used as label for the corresponding field.
53 
54  About the name fields:
55 
56  givenName() is the first name and familyName() the last name. In some
57  countries the family name comes first, that's the reason for the
58  naming. formattedName() is the full name with the correct formatting.
59  It is used as an override, when the correct formatting can't be generated
60  from the other name fields automatically.
61 
62  realName() returns a fully formatted name(). It uses formattedName, if set,
63  otherwise it constructs the name from the name fields. As fallback, if
64  nothing else is set it uses name().
65 
66  name() is the NAME type of RFC2426. It can be used as internal name for the
67  data entry, but shouldn't be used for displaying the data to the user.
68  */
69 class KCONTACTS_EXPORT Addressee
70 {
71  friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Addressee &);
72  friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Addressee &);
73 
74  Q_GADGET
75  Q_PROPERTY(bool isEmpty READ isEmpty)
76  Q_PROPERTY(QString uid READ uid WRITE setUid)
77  Q_PROPERTY(QString name READ name WRITE setName)
78  Q_PROPERTY(QString formattedName READ formattedName WRITE setFormattedName)
79  Q_PROPERTY(QString familyName READ familyName WRITE setFamilyName)
80  Q_PROPERTY(QString givenName READ givenName WRITE setGivenName)
81  Q_PROPERTY(QString additionalName READ additionalName WRITE setAdditionalName)
82  Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
83  Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
84  Q_PROPERTY(QString nickName READ nickName)
85  Q_PROPERTY(QDateTime birthday READ birthday) // ### can't set this due to withTime argument
86  Q_PROPERTY(bool birthdayHasTime READ birthdayHasTime)
87  Q_PROPERTY(QString mailer READ mailer WRITE setMailer)
88  Q_PROPERTY(KContacts::Geo geo READ geo WRITE setGeo)
89  Q_PROPERTY(QString title READ title)
90  Q_PROPERTY(QString role READ role)
91  Q_PROPERTY(QString organization READ organization)
92  Q_PROPERTY(QString department READ department WRITE setDepartment)
93  Q_PROPERTY(QString note READ note WRITE setNote)
94  Q_PROPERTY(QString productId READ productId WRITE setProductId)
95  Q_PROPERTY(QDateTime revision READ revision)
96  Q_PROPERTY(QString sortString READ sortString WRITE setSortString)
97  Q_PROPERTY(KContacts::ResourceLocatorUrl url READ url WRITE setUrl)
98  Q_PROPERTY(QString realName READ realName)
99  Q_PROPERTY(QString assembledName READ assembledName)
100  Q_PROPERTY(QString preferredEmail READ preferredEmail)
101  Q_PROPERTY(QStringList categories READ categories WRITE setCategories)
102  Q_PROPERTY(QStringList customs READ customs)
103  Q_PROPERTY(bool changed READ changed WRITE setChanged)
104  Q_PROPERTY(QDate anniversary READ anniversary WRITE setAnniversary)
105  Q_PROPERTY(QString assistantsName READ assistantsName WRITE setAssistantsName)
106  Q_PROPERTY(QUrl blogFeed READ blogFeed WRITE setBlogFeed)
107  Q_PROPERTY(QString managersName READ managersName WRITE setManagersName)
108  Q_PROPERTY(QString office READ office WRITE setOffice)
109  Q_PROPERTY(QString profession READ profession WRITE setProfession)
110  Q_PROPERTY(QString spousesName READ spousesName WRITE setSpousesName)
111  Q_PROPERTY(KContacts::Picture photo READ photo WRITE setPhoto)
112 
113  // using variants for QML compatibility, can be changed to proper types once QML supports that
114  Q_PROPERTY(QVariantList emails READ emailsVariant WRITE setEmailsVariant)
115  Q_PROPERTY(QVariantList phoneNumbers READ phoneNumbersVariant WRITE setPhoneNumbersVariant)
116  Q_PROPERTY(QVariantList addresses READ addressesVariant)
117  Q_PROPERTY(QVariantList urls READ urlsVariant)
118  Q_PROPERTY(QVariantList impps READ imppsVariant WRITE setImppsVariant)
119 
120  // ### the following properties are still missing:
121  // - logos, photos, sounds
122  // - keys
123  // - the list variants for nicks, titles, roles, orgs
124  // - timezone, secrecy, gender, kind, members, relationships, language
125  // - field groups, sourceUrls, calendarUrls
126 
127 public:
128  /**
129  A list of addressee objects
130  */
132  /**
133  A map from unique identifier to addressee.
134 
135  @see uid()
136  */
138 
139  /**
140  Construct an empty address book entry.
141  */
142  Addressee();
143 
144  /**
145  Destroys the address book entry.
146  */
147  ~Addressee();
148 
149  /**
150  Copy constructor.
151  */
152  Addressee(const Addressee &other);
153 
154  /**
155  Assignment operator.
156 
157  @return a reference to @c this
158  */
159  Addressee &operator=(const Addressee &other);
160 
161  /**
162  Equality operator.
163 
164  @return @c true if @c this and the given addressee are equal,
165  otherwise @c false
166  */
167  bool operator==(const Addressee &other) const;
168 
169  /**
170  Not-equal operator.
171 
172  @return @c true if @c this and the given addressee are not equal,
173  otherwise @c false
174  */
175  bool operator!=(const Addressee &other) const;
176 
177  /**
178  Return if the address book entry is empty.
179  */
180  bool isEmpty() const;
181 
182  /**
183  Set unique identifier.
184 
185  @param uid the KABC unique identifier
186  */
187  void setUid(const QString &uid);
188 
189  /**
190  Return unique identifier.
191  */
192  QString uid() const;
193 
194  /**
195  Return translated label for uid field.
196  */
197  static QString uidLabel();
198 
199  /**
200  Set name.
201  */
202  void setName(const QString &name);
203 
204  /**
205  Return name.
206  */
207  QString name() const;
208 
209  /**
210  Return translated label for name field.
211  */
212  static QString nameLabel();
213 
214  /**
215  Set formatted name.
216  */
217  void setFormattedName(const QString &formattedName);
218 
219  /**
220  Return formatted name.
221  */
222  QString formattedName() const;
223 
224  /**
225  Return translated label for formattedName field.
226  */
227  static QString formattedNameLabel();
228 
229  /**
230  Set family name.
231  */
232  void setFamilyName(const QString &familyName);
233 
234  /**
235  Return family name.
236  */
237  QString familyName() const;
238 
239  /**
240  Return translated label for familyName field.
241  */
242  static QString familyNameLabel();
243 
244  /**
245  Set given name.
246  */
247  void setGivenName(const QString &givenName);
248 
249  /**
250  Return given name.
251  */
252  QString givenName() const;
253 
254  /**
255  Return translated label for givenName field.
256  */
257  static QString givenNameLabel();
258 
259  /**
260  Set additional names.
261  */
262  void setAdditionalName(const QString &additionalName);
263 
264  /**
265  Return additional names.
266  */
267  QString additionalName() const;
268 
269  /**
270  Return translated label for additionalName field.
271  */
272  static QString additionalNameLabel();
273 
274  /**
275  Set honorific prefixes.
276  */
277  void setPrefix(const QString &prefix);
278 
279  /**
280  Return honorific prefixes.
281  */
282  QString prefix() const;
283 
284  /**
285  Return translated label for prefix field.
286  */
287  static QString prefixLabel();
288 
289  /**
290  Set honorific suffixes.
291  */
292  void setSuffix(const QString &suffix);
293 
294  /**
295  Return honorific suffixes.
296  */
297  QString suffix() const;
298 
299  /**
300  Return translated label for suffix field.
301  */
302  static QString suffixLabel();
303 
304  /**
305  Set nick name.
306  */
307  void setNickName(const QString &nickName);
308  void setNickName(const NickName &nickName);
309  void insertExtraNickName(const NickName &nickName);
310  void setExtraNickNameList(const NickName::List &nickNameList);
311  NickName::List extraNickNameList() const;
312 
313  /**
314  Return nick name.
315  */
316  QString nickName() const;
317 
318  /**
319  Return translated label for nickName field.
320  */
321  static QString nickNameLabel();
322 
323  /**
324  Set birthday (date and time). If withTime is false the time will be set
325  to midnight and birthdayHasTime() will return false afterwards.
326  @since 5.4
327  */
328  void setBirthday(const QDateTime &birthday, bool withTime = true);
329 
330  /**
331  Set birthday (date only). birthdayHasTime() will return false afterwards.
332  */
333  void setBirthday(const QDate &birthday);
334 
335  /**
336  Return birthday. (If a valid date has been set, birthday().time() will
337  always return a valid QTime!)
338  */
339  QDateTime birthday() const;
340 
341  /**
342  Returns true if birthday has been set with a time. Returns false otherwise.
343  */
344  bool birthdayHasTime() const;
345 
346  /**
347  Return translated label for birthday field.
348  */
349  static QString birthdayLabel();
350 
351  /**
352  Return translated label for homeAddressStreet field.
353  */
354  static QString homeAddressStreetLabel();
355 
356  /**
357  Return translated label for homeAddressPostOfficeBox field.
358  */
359  static QString homeAddressPostOfficeBoxLabel();
360 
361  /**
362  Return translated label for homeAddressLocality field.
363  */
364  static QString homeAddressLocalityLabel();
365 
366  /**
367  Return translated label for homeAddressRegion field.
368  */
369  static QString homeAddressRegionLabel();
370 
371  /**
372  Return translated label for homeAddressPostalCode field.
373  */
374  static QString homeAddressPostalCodeLabel();
375 
376  /**
377  Return translated label for homeAddressCountry field.
378  */
379  static QString homeAddressCountryLabel();
380 
381  /**
382  Return translated label for homeAddressLabel field.
383  */
384  static QString homeAddressLabelLabel();
385 
386  /**
387  Return translated label for businessAddressStreet field.
388  */
389  static QString businessAddressStreetLabel();
390 
391  /**
392  Return translated label for businessAddressPostOfficeBox field.
393  */
394  static QString businessAddressPostOfficeBoxLabel();
395 
396  /**
397  Return translated label for businessAddressLocality field.
398  */
399  static QString businessAddressLocalityLabel();
400 
401  /**
402  Return translated label for businessAddressRegion field.
403  */
404  static QString businessAddressRegionLabel();
405 
406  /**
407  Return translated label for businessAddressPostalCode field.
408  */
409  static QString businessAddressPostalCodeLabel();
410 
411  /**
412  Return translated label for businessAddressCountry field.
413  */
414  static QString businessAddressCountryLabel();
415 
416  /**
417  Return translated label for businessAddressLabel field.
418  */
419  static QString businessAddressLabelLabel();
420 
421  /**
422  Return translated label for homePhone field.
423  */
424  static QString homePhoneLabel();
425 
426  /**
427  Return translated label for businessPhone field.
428  */
429  static QString businessPhoneLabel();
430 
431  /**
432  Return translated label for mobilePhone field.
433  */
434  static QString mobilePhoneLabel();
435 
436  /**
437  Return translated label for homeFax field.
438  */
439  static QString homeFaxLabel();
440 
441  /**
442  Return translated label for businessFax field.
443  */
444  static QString businessFaxLabel();
445 
446  /**
447  Return translated label for carPhone field.
448  */
449  static QString carPhoneLabel();
450 
451  /**
452  Return translated label for isdn field.
453  */
454  static QString isdnLabel();
455 
456  /**
457  Return translated label for pager field.
458  */
459  static QString pagerLabel();
460 
461  /**
462  Return translated label for email field.
463  */
464  static QString emailLabel();
465 
466  /**
467  Set mail client.
468  */
469  void setMailer(const QString &mailer);
470 
471  /**
472  Return mail client.
473  */
474  QString mailer() const;
475 
476  /**
477  Return translated label for mailer field.
478  */
479  static QString mailerLabel();
480 
481  /**
482  Set time zone.
483  */
484  void setTimeZone(const TimeZone &timeZone);
485 
486  /**
487  Return time zone.
488  */
489  TimeZone timeZone() const;
490 
491  /**
492  Return translated label for timeZone field.
493  */
494  static QString timeZoneLabel();
495 
496  /**
497  Set geographic position.
498  */
499  void setGeo(const Geo &geo);
500 
501  /**
502  Return geographic position.
503  */
504  Geo geo() const;
505 
506  /**
507  Return translated label for geo field.
508  */
509  static QString geoLabel();
510 
511  /**
512  Set title.
513  */
514  // Remove in kf6
515  void setTitle(const QString &title);
516  void setTitle(const Title &title);
517  void insertExtraTitle(const Title &title);
518  void setExtraTitleList(const Title::List &urltitle);
519  Title::List extraTitleList() const;
520  /**
521  Return title.
522  */
523  QString title() const;
524 
525  /**
526  Return translated label for title field.
527  */
528  static QString titleLabel();
529 
530  /**
531  Set role.
532  */
533  void setRole(const QString &role);
534  void setRole(const Role &role);
535  void insertExtraRole(const Role &role);
536  void setExtraRoleList(const Role::List &roleList);
537  Role::List extraRoleList() const;
538 
539  /**
540  Return role.
541  */
542  QString role() const;
543 
544  /**
545  Return translated label for role field.
546  */
547  static QString roleLabel();
548 
549  /**
550  Set organization.
551  */
552  // Remove in kf6
553  void setOrganization(const QString &organization);
554  void setOrganization(const Org &organization);
555  void insertExtraOrganization(const Org &organization);
556  void setExtraOrganizationList(const Org::List &orgList);
557  Org::List extraOrganizationList() const;
558 
559  /**
560  Return organization.
561  */
562  QString organization() const;
563 
564  /**
565  Return translated label for organization field.
566  */
567  static QString organizationLabel();
568 
569  /**
570  Set department.
571  */
572  void setDepartment(const QString &department);
573 
574  /**
575  Return department.
576  */
577  QString department() const;
578 
579  /**
580  Return translated label for department field.
581  */
582  static QString departmentLabel();
583 
584  /**
585  Set note.
586  */
587  void setNote(const QString &note);
588 
589  /**
590  Return note.
591  */
592  QString note() const;
593 
594  /**
595  Return translated label for note field.
596  */
597  static QString noteLabel();
598 
599  /**
600  Set product identifier.
601  */
602  void setProductId(const QString &productId);
603 
604  /**
605  Return product identifier.
606  */
607  QString productId() const;
608 
609  /**
610  Return translated label for productId field.
611  */
612  static QString productIdLabel();
613 
614  /**
615  Set revision date.
616  */
617  void setRevision(const QDateTime &revision);
618 
619  /**
620  Return revision date.
621  */
622  QDateTime revision() const;
623 
624  /**
625  Return translated label for revision field.
626  */
627  static QString revisionLabel();
628 
629  /**
630  Set sort string.
631  */
632  void setSortString(const QString &sortString);
633 
634  /**
635  Return sort string.
636  */
637  QString sortString() const;
638 
639  /**
640  Return translated label for sortString field.
641  */
642  static QString sortStringLabel();
643 
644  /**
645  Set homepage.
646  */
647  void setUrl(const ResourceLocatorUrl &url);
648  // kf6: remove it
649  void setUrl(const QUrl &url);
650 
651  /**
652  Return homepage.
653  */
654  ResourceLocatorUrl url() const;
655 
656  /**
657  Return translated label for url field.
658  */
659  static QString urlLabel();
660 
661  /**
662  Set security class.
663  */
664  void setSecrecy(const Secrecy &secrecy);
665 
666  /**
667  Return security class.
668  */
669  Secrecy secrecy() const;
670 
671  /**
672  Return translated label for secrecy field.
673  */
674  static QString secrecyLabel();
675 
676  /**
677  Set logo.
678  */
679  void setLogo(const Picture &logo);
680 
681  /**
682  Return logo.
683  */
684  Picture logo() const;
685 
686  /**
687  Return translated label for logo field.
688  */
689  static QString logoLabel();
690 
691  /**
692  Set photo.
693  */
694  void setPhoto(const Picture &photo);
695 
696  /**
697  Return photo.
698  */
699  Picture photo() const;
700 
701  /**
702  Return translated label for photo field.
703  */
704  static QString photoLabel();
705 
706  /**
707  Set sound.
708  */
709  void setSound(const Sound &sound);
710 
711  /**
712  Return sound.
713  */
714  Sound sound() const;
715 
716  /**
717  Return translated label for sound field.
718  */
719  static QString soundLabel();
720 
721  /**
722  Set name fields by parsing the given string and trying to associate the
723  parts of the string with according fields. This function should probably
724  be a bit more clever.
725  */
726  void setNameFromString(const QString &s);
727 
728  /**
729  Return the name of the addressee. This is calculated from all the name
730  fields.
731  */
732  QString realName() const;
733 
734  /**
735  Return the name that consists of all name parts.
736  */
737  QString assembledName() const;
738 
739  /**
740  Return email address including real name.
741 
742  @param email Email address to be used to construct the full email string.
743  If this is QString() the preferred email address is used.
744  */
745  QString fullEmail(const QString &email = QString()) const;
746 
747  /**
748  Insert an email address. If the email address already exists in this
749  addressee it is not duplicated.
750 
751  @param email Email address
752  @param preferred Set to true, if this is the preferred email address of
753  the addressee.
754  */
755  void insertEmail(const QString &email, bool preferred = false, const QMap<QString, QStringList> &param = QMap<QString, QStringList>());
756 
757  /**
758  Remove email address. If the email address doesn't exist, nothing happens.
759 
760  @param email Email address to remove
761  */
762  void removeEmail(const QString &email);
763 
764  /**
765  Return preferred email address. This is the first email address or the
766  last one added with insertEmail() with a set preferred parameter.
767  */
768  QString preferredEmail() const;
769 
770  /**
771  Return list of all email addresses.
772  */
773  QStringList emails() const;
774 
775  /**
776  Set the emails to @p list.
777  The first email address gets the preferred one!
778  @param list The list of email addresses.
779  */
780  void setEmails(const QStringList &list);
781 
782  /**
783  Insert a phone number. If a phone number with the same id already exists
784  in this addressee it is not duplicated.
785 
786  @param phoneNumber The telephone number to insert to the addressee
787  */
788  void insertPhoneNumber(const PhoneNumber &phoneNumber);
789 
790  /**
791  Remove phone number. If no phone number with the given id exists for this
792  addressee, nothing happens.
793 
794  @param phoneNumber The telephone number to remove from the addressee
795  */
796  void removePhoneNumber(const PhoneNumber &phoneNumber);
797 
798  /**
799  Return phone number, which matches the given type.
800 
801  @param type The type of phone number to get
802  */
803  PhoneNumber phoneNumber(PhoneNumber::Type type) const;
804 
805  /**
806  Return list of all phone numbers.
807  */
808  PhoneNumber::List phoneNumbers() const;
809 
810  void setPhoneNumbers(const PhoneNumber::List &phoneNumbers);
811 
812  /**
813  Return list of phone numbers with a special type.
814 
815  @param type The type of phone number to get
816  */
817  PhoneNumber::List phoneNumbers(PhoneNumber::Type type) const;
818 
819  /**
820  Return phone number with the given id.
821 
822  @param id The identifier of the phone number to look for.
823  See PhoneNumber::id()
824  */
825  PhoneNumber findPhoneNumber(const QString &id) const;
826 
827  /**
828  Insert a key. If a key with the same id already exists
829  in this addressee it is not duplicated.
830 
831  @param key The key to insert
832  */
833  void insertKey(const Key &key);
834 
835  /**
836  Remove a key. If no key with the given id exists for this
837  addressee, nothing happens.
838 
839  @param key The key to remove
840  */
841  void removeKey(const Key &key);
842 
843  /**
844  Return key, which matches the given type.
845  If @p type == Key::Custom you can specify a string
846  that should match. If you leave the string empty, the first
847  key with a custom value is returned.
848 
849  @param type The type of key to look for
850  @param customTypeString A string to match custom keys against when
851  @p type is @c Key::Custom
852  */
853  Key key(Key::Type type, const QString &customTypeString = QString()) const;
854 
855  /**
856  Return list of all keys.
857  */
858  Key::List keys() const;
859 
860  /**
861  Set the list of keys
862  @param keys The keys to be set.
863  */
864  void setKeys(const Key::List &keys);
865 
866  /**
867  Return list of keys with a special type.
868  If @p type == Key::Custom you can specify a string
869  that should match. If you leave the string empty, all custom
870  keys will be returned.
871 
872  @param type The type of key to look for
873  @param customTypeString A string to match custom keys against when
874  @p type is @c Key::Custom
875  */
876  Key::List keys(Key::Type type, const QString &customTypeString = QString()) const;
877 
878  /**
879  Return key with the given id.
880 
881  @param id The identifier of the key to look for. See Key::id()
882  */
883  Key findKey(const QString &id) const;
884 
885  /**
886  Insert an address. If an address with the same id already exists
887  in this addressee it is not duplicated.
888 
889  @param address The address to insert
890  */
891  void insertAddress(const Address &address);
892 
893  /**
894  Remove address. If no address with the given id exists for this
895  addressee, nothing happens.
896 
897  @param address The address to remove
898  */
899  void removeAddress(const Address &address);
900 
901  /**
902  Return address, which matches the given type.
903 
904  @param type The type of address to look for
905  */
906  Address address(Address::Type type) const;
907 
908  /**
909  Return list of all addresses.
910  */
911  Address::List addresses() const;
912 
913  /**
914  Return list of addresses with a special type.
915 
916  @param type The type of addresses to look for
917  */
918  Address::List addresses(Address::Type type) const;
919 
920  /**
921  Return address with the given id.
922 
923  @param id The identifier of the address to look for. See Address::id()
924  */
925  Address findAddress(const QString &id) const;
926 
927  /**
928  Insert category. If the category already exists it is not duplicated.
929  */
930  void insertCategory(const QString &category);
931 
932  /**
933  Remove category.
934  */
935  void removeCategory(const QString &category);
936 
937  /**
938  Return, if addressee has the given category.
939  */
940  bool hasCategory(const QString &category) const;
941 
942  /**
943  Set categories to given value.
944  */
945  void setCategories(const QStringList &category);
946 
947  /**
948  Return list of all set categories.
949  */
950  QStringList categories() const;
951 
952  /**
953  Insert custom entry. The entry is identified by the name of the inserting
954  application and a unique name. If an entry with the given app and name
955  already exists its value is replaced with the new given value.
956 
957  An empty value isn't allowed (nothing happens if this is called with
958  any of the three arguments being empty)
959 
960  @param app Name of the application inserting this custom entry
961  @param name Name of this application specific custom entry
962  @param value Value of this application specific custom entry
963  */
964  void insertCustom(const QString &app, const QString &name, const QString &value);
965 
966  /**
967  Remove custom entry.
968 
969  @param app Name of the application which has inserted this custom entry
970  @param name Name of this application specific custom entry
971  */
972  void removeCustom(const QString &app, const QString &name);
973 
974  /**
975  Return value of custom entry, identified by app and entry name.
976 
977  @param app Name of the application which has inserted this custom entry
978  @param name Name of this application specific custom entry
979  */
980  QString custom(const QString &app, const QString &name) const;
981 
982  /**
983  Set all custom entries.
984  */
985  void setCustoms(const QStringList &customs);
986 
987  /**
988  Return list of all custom entries.
989 
990  The format of the custom entries is 'app-key:value' and the list is sorted
991  alphabetically by 'app-key'.
992  */
993  QStringList customs() const;
994 
995  /**
996  Parse full email address. The result is given back in fullName and email.
997 
998  @param rawEmail The input string to parse for name and email
999  @param fullName The name part of the @p rawEmail input, if it contained one
1000  @param email The email part of the @p rawEmail input, if it contained one
1001  */
1002  static void parseEmailAddress(const QString &rawEmail, QString &fullName, QString &email);
1003 
1004  /**
1005  Returns string representation of the addressee.
1006  */
1007  QString toString() const;
1008 
1009  /**
1010  Mark addressee as changed.
1011 
1012  @param value Sets the status indicating changed data
1013  */
1014  void setChanged(bool value);
1015 
1016  /**
1017  Return whether the addressee is changed.
1018  */
1019  bool changed() const;
1020 
1021  /**
1022  Returns the MIME type used for Addressees
1023  */
1024  static QString mimeType();
1025 
1026  KContacts::Email::List emailList() const;
1027  void setEmailList(const Email::List &list);
1028 
1029  /**
1030  * Remove Language
1031  * @brief removeLang
1032  * @param language
1033  */
1034  void removeLang(const QString &language);
1035  /**
1036  * Insert Language
1037  * @brief insertLang
1038  * @param language
1039  */
1040  void insertLang(const Lang &language);
1041  /**
1042  * @brief langs
1043  * @return List of lang
1044  */
1045  Lang::List langs() const;
1046  void setLangs(const Lang::List &langs);
1047 
1048  void setGender(const Gender &gender);
1049  Gender gender() const;
1050 
1051  QString kind() const;
1052  void setKind(const QString &kind);
1053 
1054  void insertCalendarUrl(const CalendarUrl &calendarUrl);
1055  CalendarUrl::List calendarUrlList() const;
1056 
1057  void insertExtraSound(const Sound &sound);
1058  void setExtraSoundList(const Sound::List &soundList);
1059  Sound::List extraSoundList() const;
1060 
1061  void insertExtraPhoto(const Picture &picture);
1062  void setExtraPhotoList(const Picture::List &pictureList);
1063  Picture::List extraPhotoList() const;
1064 
1065  void insertExtraLogo(const Picture &logo);
1066  void setExtraLogoList(const Picture::List &logoList);
1067  Picture::List extraLogoList() const;
1068 
1069  ResourceLocatorUrl::List extraUrlList() const;
1070  void setExtraUrlList(const ResourceLocatorUrl::List &urlList);
1071  void insertExtraUrl(const ResourceLocatorUrl &url);
1072 
1073  // Member
1074  void insertMember(const QString &member);
1075  void setMembers(const QStringList &c);
1076  QStringList members() const;
1077 
1078  // Relation
1079  void insertRelationship(const Related &related);
1080  void setRelationships(const Related::List &c);
1081  Related::List relationships() const;
1082 
1083  // Source
1084  void insertSourceUrl(const QUrl &url);
1085  void setSourcesUrlList(const QVector<QUrl> &urlList);
1086  QVector<QUrl> sourcesUrlList() const;
1087 
1088  // Impp
1089  Impp::List imppList() const;
1090  void setImppList(const Impp::List &imppList);
1091  void insertImpp(const Impp &impp);
1092 
1093  // FieldGroup
1094  FieldGroup::List fieldGroupList() const;
1095  void setFieldGroupList(const FieldGroup::List &fieldGroupList);
1096  void insertFieldGroup(const FieldGroup &fieldGroup);
1097 
1098  // ClientPidMap
1099  ClientPidMap::List clientPidMapList() const;
1100  void setClientPidMapList(const ClientPidMap::List &clientpidmaplist);
1101  void insertClientPidMap(const ClientPidMap &clientpidmap);
1102 
1103  /**
1104  * Returns the contact's anniversary date.
1105  * @note This is a non-standard extension using the @c X-Anniversary field.
1106  * @since 5.12
1107  */
1108  QDate anniversary() const;
1109  /**
1110  * Sets the contact's anniversary date.
1111  * @note This is a non-standard extension using the @c X-Anniversary field.
1112  * @since 5.12
1113  */
1114  void setAnniversary(const QDate &anniversary);
1115 
1116  /**
1117  * Returns the contact's assistant's name.
1118  * @note This is a non-standard extension using the @c X-AssistantsName field.
1119  * @since 5.12
1120  */
1121  QString assistantsName() const;
1122  /**
1123  * Set the contact's assistant's name.
1124  * @note This is a non-standard extension using the @c X-AssistantsName field.
1125  * @since 5.12
1126  */
1127  void setAssistantsName(const QString &assistantsName);
1128 
1129  /**
1130  * Returns the contact's blog feed.
1131  * @note This is a non-standard extension using the @c BlogFeed field.
1132  * @since 5.12
1133  */
1134  QUrl blogFeed() const;
1135  /**
1136  * Set the contact's blog feed.
1137  * @note This is a non-standard extension using the @c BlogFeed field.
1138  * @since 5.12
1139  */
1140  void setBlogFeed(const QUrl &blogFeed);
1141 
1142  /**
1143  * Returns the contact's manager's name.
1144  * @note This is a non-standard extension using the @c X-ManagersName field.
1145  * @since 5.12
1146  */
1147  QString managersName() const;
1148  /**
1149  * Set the contact's manager's name.
1150  * @note This is a non-standard extension using the @c X-ManagersName field.
1151  * @since 5.12
1152  */
1153  void setManagersName(const QString &managersName);
1154 
1155  /**
1156  * Returns the contact's office.
1157  * @note This is a non-standard extension using the @c X-Office field.
1158  * @since 5.12
1159  */
1160  QString office() const;
1161  /**
1162  * Set the contact's office.
1163  * @note This is a non-standard extension using the @c X-Office field.
1164  * @since 5.12
1165  */
1166  void setOffice(const QString &office);
1167 
1168  /**
1169  * Returns the contact's profession.
1170  * @note This is a non-standard extension using the @c X-Profession field.
1171  * @since 5.12
1172  */
1173  QString profession() const;
1174  /**
1175  * Set the contact's profession.
1176  * @note This is a non-standard extension using the @c X-Profession field.
1177  * @since 5.12
1178  */
1179  void setProfession(const QString &profession);
1180 
1181  /**
1182  * Returns the contact's spouse's name.
1183  * @note This is a non-standard extension using the @c X-SpousesName field.
1184  * @since 5.12
1185  */
1186  QString spousesName() const;
1187  /**
1188  * Set the contact's spouse's name.
1189  * @note This is a non-standard extension using the @c X-SpousesName field.
1190  * @since 5.12
1191  */
1192  void setSpousesName(const QString &spousesName);
1193 
1194 private:
1195  QVariantList emailsVariant() const;
1196  void setEmailsVariant(const QVariantList &emails);
1197  QVariantList phoneNumbersVariant() const;
1198  void setPhoneNumbersVariant(const QVariantList &emails);
1199  QVariantList addressesVariant() const;
1200  QVariantList urlsVariant() const;
1201  QVariantList imppsVariant() const;
1202  void setImppsVariant(const QVariantList &impps);
1203 
1204  class Private;
1206 };
1207 
1208 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Addressee &);
1209 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Addressee &);
1210 }
1211 
1212 #define KCONTACTS_ADDRESSEE_METATYPE_DEFINED 1
1213 Q_DECLARE_METATYPE(KContacts::Addressee)
1214 
1215 #endif
Class that holds a FieldGroup for a contact.
Definition: fieldgroup.h:21
Describes a relationship of an Addressee.
Definition: related.h:19
Class that holds a Role for a contact.
Definition: role.h:21
Class that holds a Resource Locator.
QDataStream & operator>>(QDataStream &in, KDateTime::Spec &spec)
Geographic position.
Definition: geo.h:24
Class that holds a Calendar Url (FBURL/CALADRURI/CALURI)
Definition: calendarurl.h:22
Class that holds a ClientPidMap for a contact.
Definition: clientpidmap.h:21
A class to store an encryption key.
Definition: key.h:21
Class that holds a IMPP for a contact.
Definition: impp.h:27
A class to store a picture of an addressee.
Definition: picture.h:26
Type
Key types.
Definition: key.h:35
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Class that holds a Sound clip for a contact.
Definition: sound.h:45
QHash< QString, Addressee > Map
A map from unique identifier to addressee.
Definition: addressee.h:137
AddresseeList List
A list of addressee objects.
Definition: addressee.h:131
Postal address information.
Definition: address.h:28
Class that holds a NickName for a contact.
Definition: nickname.h:21
Class that holds a Language for a contact.
Definition: lang.h:21
Describes the confidentiality of an addressee.
Definition: secrecy.h:18
Class that holds a Gender for a contact.
Definition: gender.h:19
Class that holds a Title for a contact.
Definition: title.h:21
address book entry
Definition: addressee.h:69
Class that holds a Organization for a contact.
Definition: org.h:21
Time zone information.
Definition: timezone.h:22
Phonenumber information.
Definition: phonenumber.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Sep 26 2021 22:55:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.