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