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

KDE's Doxygen guidelines are available online.