Kgapi

person.cpp
1/*
2 * SPDX-FileCopyrightText: 2021 Daniel Vrátil <dvratil@kde.org>
3 * SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@kde.org>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only
6 * SPDX-License-Identifier: LGPL-3.0-only
7 * SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL
8 */
9
10#include "person.h"
11
12#include "debug.h"
13
14#include "address.h"
15#include "agerangetype.h"
16#include "biography.h"
17#include "birthday.h"
18#include "braggingrights.h"
19#include "calendarurl.h"
20#include "clientdata.h"
21#include "coverphoto.h"
22#include "emailaddress.h"
23#include "event.h"
24#include "externalid.h"
25#include "fileas.h"
26#include "gender.h"
27#include "imclient.h"
28#include "interest.h"
29#include "location.h"
30#include "membership.h"
31#include "misckeyword.h"
32#include "name.h"
33#include "nickname.h"
34#include "occupation.h"
35#include "organization.h"
36#include "personlocale.h"
37#include "personmetadata.h"
38#include "phonenumber.h"
39#include "photo.h"
40#include "relation.h"
41#include "relationshipinterest.h"
42#include "relationshipstatus.h"
43#include "residence.h"
44#include "sipaddress.h"
45#include "skill.h"
46#include "tagline.h"
47#include "url.h"
48#include "userdefined.h"
49
50#include <algorithm>
51#include <QJsonObject>
52#include <QJsonArray>
53
54#include <KContacts/Addressee>
55
56namespace KGAPI2::People
57{
58class Person::Private
59{
60public:
61 explicit Private() = default;
62 Private(const Private &) = default;
63 Private(Private &&) noexcept = delete;
64 Private &operator=(const Private &) = delete;
65 Private &operator=(Private &&) noexcept = delete;
66 ~Private() = default;
67
68 bool operator==(const Private &other) const
69 {
70 return nicknames == other.nicknames &&
71 emailAddresses == other.emailAddresses &&
72 clientData == other.clientData &&
73 braggingRights == other.braggingRights &&
74 relationshipStatuses == other.relationshipStatuses &&
75 birthdays == other.birthdays &&
76 relations == other.relations &&
77 locales == other.locales &&
78 locations == other.locations &&
79 externalIds == other.externalIds &&
80 ageRanges == other.ageRanges &&
81 taglines == other.taglines &&
82 userDefined == other.userDefined &&
83 biographies == other.biographies &&
84 sipAddresses == other.sipAddresses &&
85 memberships == other.memberships &&
86 skills == other.skills &&
87 residences == other.residences &&
88 names == other.names &&
89 calendarUrls == other.calendarUrls &&
90 coverPhotos == other.coverPhotos &&
91 addresses == other.addresses &&
92 etag == other.etag &&
93 phoneNumbers == other.phoneNumbers &&
94 imClients == other.imClients &&
95 events == other.events &&
96 photos == other.photos &&
97 occupations == other.occupations &&
98 miscKeywords == other.miscKeywords &&
99 relationshipInterests == other.relationshipInterests &&
100 resourceName == other.resourceName &&
101 interests == other.interests &&
102 organizations == other.organizations &&
103 urls == other.urls &&
104 genders == other.genders &&
105 fileAses == other.fileAses &&
106 ageRange == other.ageRange &&
107 metadata == other.metadata;
108 }
109
110 bool operator!=(const Private &other) const
111 {
112 return !(*this == other);
113 }
114
115 KContacts::Addressee toKContactsAddressee()
116 {
117 KContacts::Addressee addressee;
118
119 setKContactAddresseeNameFields(addressee);
120 setKContactAddresseeNicknameFields(addressee);
121 setKContactAddresseeBirthdayFields(addressee);
122 setKContactAddresseeEmailFields(addressee);
123 setKContactAddresseePhoneFields(addressee);
124 setKContactAddresseeUrlFields(addressee);
125 setKContactAddresseeOrganizationFields(addressee);
126 setKContactAddresseeProfessionFields(addressee);
127 setKContactAddresseePhoto(addressee);
128
129 return addressee;
130 }
131
132 void setFromKContactsAddressee(const KContacts::Addressee &addressee)
133 {
134 if (!addressee.familyName().isEmpty() ||
135 !addressee.givenName().isEmpty() ||
136 !addressee.prefix().isEmpty() ||
137 !addressee.suffix().isEmpty()) {
138
139 names = {Name::fromKContactsAddressee(addressee)};
140 }
141
142 const auto addresseeNickName = addressee.nickName();
143 if (!addresseeNickName.isEmpty()) {
144 Nickname nickname;
145 nickname.setValue(addresseeNickName);
146 nicknames = {nickname};
147 }
148
149 const auto addresseeBirthday = addressee.birthday();
150 if (addresseeBirthday.isValid()) {
151 Birthday birthday;
152 birthday.setDate(addresseeBirthday.date());
153 birthdays = {birthday};
154 }
155
156 const auto addresseeEmailList = addressee.emailList();
157 if (!addresseeEmailList.isEmpty()) {
158 emailAddresses = EmailAddress::fromKContactsEmailList(addresseeEmailList);
159 }
160
161 const auto addresseePhoneNumbers = addressee.phoneNumbers();
162 if (!addresseePhoneNumbers.isEmpty()) {
163 phoneNumbers = PhoneNumber::fromKContactsPhoneNumberList(addressee.phoneNumbers());
164 }
165
166 const auto addresseeProfession = addressee.profession();
167 if (!addresseeProfession.isEmpty()) {
168 Occupation occupation;
169 occupation.setValue(addresseeProfession);
170 occupations = {occupation};
171 }
172
173 const auto addresseeOrganization = addressee.organization();
174 const auto addresseeDepartment = addressee.department();
175 if (!addresseeOrganization.isEmpty() || !addresseeDepartment.isEmpty()) {
176 Organization organization;
177 organization.setName(addresseeOrganization);
178 organization.setDepartment(addresseeDepartment);
179 organizations = {organization};
180 }
181
182 const auto addresseePhoto = addressee.photo();
183 if (!addresseePhoto.isEmpty()) {
184 Photo photo;
185 photo.setUrl(addressee.photo().url());
186 photos = {photo};
187 }
188
189 const auto blogFeed = addressee.blogFeed();
190 if (!blogFeed.isEmpty()) {
191 Url url;
192 url.setValue(blogFeed.toString());
193 url.setType(QStringLiteral("blog"));
194 urls.append(url);
195 }
196
197 const auto addresseeUrls = addressee.extraUrlList();
198 for (const auto &addresseeUrl : addresseeUrls) {
199 Url url;
200 url.setValue(addresseeUrl.toString());
201
202 switch (addresseeUrl.type()) {
204 url.setType(QStringLiteral("home"));
205 break;
207 url.setType(QStringLiteral("profile"));
208 break;
210 url.setType(QStringLiteral("work"));
211 break;
213 url.setType(QStringLiteral("ftp"));
214 break;
216 url.setType(QStringLiteral("appInstallPage"));
217 break;
219 url.setType(QStringLiteral("reservations"));
220 break;
221 default:
222 url.setType(QStringLiteral("other"));
223 }
224
225 urls.append(url);
226 }
227
228 const auto addressessCalendarUrls = addressee.calendarUrlList();
229 for (const auto &calendarUrl : addressessCalendarUrls) {
230 CalendarUrl gCalendarUrl;
231 if (calendarUrl.type() == KContacts::CalendarUrl::FBUrl) {
232 gCalendarUrl.setType(QStringLiteral("freeBusy"));
233 } else if (calendarUrl.type() == KContacts::CalendarUrl::CALUri) {
234 gCalendarUrl.setType(QStringLiteral("CALUri"));
235 } else if (calendarUrl.type() == KContacts::CalendarUrl::CALADRUri) {
236 gCalendarUrl.setType(QStringLiteral("CALADRUri"));
237 } else {
238 gCalendarUrl.setType(QStringLiteral("other"));
239 }
240 gCalendarUrl.setUrl(calendarUrl.url().toString());
241 calendarUrls.append(gCalendarUrl);
242 }
243 }
244
245 QList<Nickname> nicknames{};
246 QList<EmailAddress> emailAddresses{};
247 QList<ClientData> clientData{};
248 QList<BraggingRights> braggingRights{};
249 QList<RelationshipStatus> relationshipStatuses{};
250 QList<Birthday> birthdays{};
251 QList<Relation> relations{};
252 QList<PersonLocale> locales{};
253 QList<Location> locations{};
254 QList<ExternalId> externalIds{};
255 QList<AgeRangeType> ageRanges{};
256 QList<Tagline> taglines{};
257 QList<UserDefined> userDefined{};
258 QList<Biography> biographies{};
259 QList<SipAddress> sipAddresses{};
260 QList<Membership> memberships{};
261 QList<Skill> skills{};
262 QList<Residence> residences{};
263 QList<Name> names{};
264 QList<CalendarUrl> calendarUrls{};
265 QList<CoverPhoto> coverPhotos{};
266 QList<Address> addresses{};
267 QString etag{};
268 QList<PhoneNumber> phoneNumbers{};
269 QList<ImClient> imClients{};
270 QList<Event> events{};
271 QList<Photo> photos{};
272 QList<Occupation> occupations{};
273 QList<MiscKeyword> miscKeywords{};
274 QList<RelationshipInterest> relationshipInterests{};
275 QString resourceName{};
276 QList<Interest> interests{};
277 QList<Organization> organizations{};
278 QList<Url> urls{};
279 QList<Gender> genders{};
280 QList<FileAs> fileAses{};
281 Person::AgeRange ageRange{};
282 PersonMetadata metadata{};
283
284private:
285 void setKContactAddresseeNameFields(KContacts::Addressee &addressee)
286 {
287 if (names.isEmpty()) {
288 return;
289 }
290
291 const auto nameToUse = names.first();
292 nameToUse.applyToKContactsAddressee(addressee);
293 }
294
295 void setKContactAddresseeNicknameFields(KContacts::Addressee &addressee)
296 {
297 if(nicknames.isEmpty()) {
298 addressee.setNickName(QString());
299 return;
300 }
301
302 const auto nicknameToUse = nicknames.first();
303 addressee.setNickName(nicknameToUse.value());
304 }
305
306 void setKContactAddresseeBirthdayFields(KContacts::Addressee &addressee)
307 {
308 if(birthdays.isEmpty()) {
309 addressee.setBirthday(QDate());
310 return;
311 }
312
313 const auto birthdayToUse = birthdays.first();
314 addressee.setBirthday(birthdayToUse.date());
315 }
316
317 void setKContactAddresseeEmailFields(KContacts::Addressee &addressee)
318 {
319 KContacts::Email::List convertedEmails;
320
321 std::transform(emailAddresses.cbegin(),
322 emailAddresses.cend(),
323 std::back_inserter(convertedEmails),
324 [](const EmailAddress &emailAddress) {
325 return emailAddress.toKContactsEmail();
326 });
327
328 addressee.setEmailList(convertedEmails);
329 }
330
331 void setKContactAddresseePhoneFields(KContacts::Addressee &addressee)
332 {
333 KContacts::PhoneNumber::List convertedPhoneNumbers;
334
335 std::transform(phoneNumbers.cbegin(),
336 phoneNumbers.cend(),
337 std::back_inserter(convertedPhoneNumbers),
338 [](const People::PhoneNumber &phoneNumber) {
339 return phoneNumber.toKContactsPhoneNumber();
340 });
341
342 addressee.setPhoneNumbers(convertedPhoneNumbers);
343 }
344
345 void setKContactAddresseeOrganizationFields(KContacts::Addressee &addressee)
346 {
347 if (organizations.isEmpty()) {
348 addressee.setOrganization(QString());
349 addressee.setDepartment(QString());
350 return;
351 }
352
353 const auto organizationToUse = organizations.first();
354 addressee.setOrganization(organizationToUse.name());
355 addressee.setDepartment(organizationToUse.department());
356 }
357
358 void setKContactAddresseeProfessionFields(KContacts::Addressee &addressee)
359 {
360 if (occupations.isEmpty()) {
361 addressee.setProfession(QString());
362 return;
363 }
364
365 const auto occupationToUse = occupations.first();
366 addressee.setProfession(occupationToUse.value());
367 }
368
369 void setKContactAddresseePhoto(KContacts::Addressee &addressee)
370 {
371 if (photos.isEmpty()) {
372 addressee.setPhoto({});
373 return;
374 }
375
376 const auto photoToUse = photos.first();
377 KContacts::Picture picture(photoToUse.url());
378 addressee.setPhoto(picture);
379 }
380
381 void setKContactAddresseeUrlFields(KContacts::Addressee &addressee)
382 {
383 if (urls.isEmpty()) {
384 addressee.setBlogFeed({});
385 addressee.setUrl(QUrl{});
386 addressee.setExtraUrlList({});
387 } else {
388 for (const auto &url : std::as_const(urls)) {
389 if (url.type() == QLatin1StringView("blog")) {
390 addressee.setBlogFeed(QUrl(url.value()));
391 } else {
393
394 if (url.type() == QLatin1StringView("home") || url.type() == QLatin1StringView("homePage")) {
396 } else if (url.type() == QLatin1StringView("profile")) {
398 } else if (url.type() == QLatin1StringView("work")) {
400 } else if (url.type() == QLatin1StringView("ftp")) {
402 } else if (url.type() == QLatin1StringView("appInstallPage")) {
404 } else if (url.type() == QLatin1StringView("reservations")) {
406 } else {
408 }
409
410 KContacts::ResourceLocatorUrl resourceUrl;
411 resourceUrl.setUrl(QUrl(url.value()));
412 resourceUrl.setType(type);
413 addressee.insertExtraUrl(resourceUrl);
414 }
415 }
416 }
417
418
419 for (const auto &calendarUrl : std::as_const(calendarUrls)) {
420 KContacts::CalendarUrl kCalendarUrl;
421 if (calendarUrl.type() == QLatin1StringView("freeBusy")) {
422 kCalendarUrl.setType(KContacts::CalendarUrl::FBUrl);
423 } else if (calendarUrl.type() == QLatin1StringView("CALUri")) {
424 kCalendarUrl.setType(KContacts::CalendarUrl::CALUri);
425 } else if (calendarUrl.type() == QLatin1StringView("CALADRUri")) {
426 kCalendarUrl.setType(KContacts::CalendarUrl::CALADRUri);
427 } else {
428 kCalendarUrl.setType(KContacts::CalendarUrl::Unknown);
429 }
430 kCalendarUrl.setUrl(QUrl(calendarUrl.url()));
431 addressee.insertCalendarUrl(kCalendarUrl);
432 }
433 }
434};
435
437 : KGAPI2::Object()
438 , d(new Private)
439{
440}
441
442Person::~Person() = default;
443
445{
446 return d->nicknames;
447}
448
450{
451 d->nicknames = value;
452}
453
455{
456 d->nicknames.push_back(value);
457}
458
460{
461 d->nicknames.removeOne(value);
462}
463
465{
466 d->nicknames.clear();
467}
468
470{
471 return d->emailAddresses;
472}
473
475{
476 d->emailAddresses = value;
477}
478
480{
481 d->emailAddresses.push_back(value);
482}
483
485{
486 d->emailAddresses.removeOne(value);
487}
488
490{
491 d->emailAddresses.clear();
492}
493
495{
496 return d->clientData;
497}
498
500{
501 d->clientData = value;
502}
503
505{
506 d->clientData.push_back(value);
507}
508
510{
511 d->clientData.removeOne(value);
512}
513
515{
516 d->clientData.clear();
517}
518
520{
521 return d->braggingRights;
522}
523
525{
526 d->braggingRights = value;
527}
528
530{
531 d->braggingRights.push_back(value);
532}
533
535{
536 d->braggingRights.removeOne(value);
537}
538
540{
541 d->braggingRights.clear();
542}
543
545{
546 return d->relationshipStatuses;
547}
549{
550 return d->birthdays;
551}
552
554{
555 d->birthdays = value;
556}
557
559{
560 d->birthdays.push_back(value);
561}
562
564{
565 d->birthdays.removeOne(value);
566}
567
569{
570 d->birthdays.clear();
571}
572
574{
575 return d->relations;
576}
577
579{
580 d->relations = value;
581}
582
584{
585 d->relations.push_back(value);
586}
587
589{
590 d->relations.removeOne(value);
591}
592
594{
595 d->relations.clear();
596}
597
599{
600 return d->locales;
601}
602
604{
605 d->locales = value;
606}
607
609{
610 d->locales.push_back(value);
611}
612
614{
615 d->locales.removeOne(value);
616}
617
619{
620 d->locales.clear();
621}
622
624{
625 return d->locations;
626}
627
629{
630 d->locations = value;
631}
632
634{
635 d->locations.push_back(value);
636}
637
639{
640 d->locations.removeOne(value);
641}
642
644{
645 d->locations.clear();
646}
647
649{
650 return d->externalIds;
651}
652
654{
655 d->externalIds = value;
656}
657
659{
660 d->externalIds.push_back(value);
661}
662
664{
665 d->externalIds.removeOne(value);
666}
667
669{
670 d->externalIds.clear();
671}
672
674{
675 return d->ageRanges;
676}
678{
679 return d->taglines;
680}
682{
683 return d->userDefined;
684}
685
687{
688 d->userDefined = value;
689}
690
692{
693 d->userDefined.push_back(value);
694}
695
697{
698 d->userDefined.removeOne(value);
699}
700
702{
703 d->userDefined.clear();
704}
705
707{
708 return d->biographies;
709}
710
712{
713 d->biographies = value;
714}
715
717{
718 d->biographies.push_back(value);
719}
720
722{
723 d->biographies.removeOne(value);
724}
725
727{
728 d->biographies.clear();
729}
730
732{
733 return d->sipAddresses;
734}
735
737{
738 d->sipAddresses = value;
739}
740
742{
743 d->sipAddresses.push_back(value);
744}
745
747{
748 d->sipAddresses.removeOne(value);
749}
750
752{
753 d->sipAddresses.clear();
754}
755
757{
758 return d->memberships;
759}
760
762{
763 d->memberships = value;
764}
765
767{
768 d->memberships.push_back(value);
769}
770
772{
773 d->memberships.removeOne(value);
774}
775
777{
778 d->memberships.clear();
779}
780
782{
783 return d->skills;
784}
785
787{
788 d->skills = value;
789}
790
791void Person::addSkill(const Skill &value)
792{
793 d->skills.push_back(value);
794}
795
796void Person::removeSkill(const Skill &value)
797{
798 d->skills.removeOne(value);
799}
800
802{
803 d->skills.clear();
804}
805
807{
808 return d->residences;
809}
810
812{
813 d->residences = value;
814}
815
817{
818 d->residences.push_back(value);
819}
820
822{
823 d->residences.removeOne(value);
824}
825
827{
828 d->residences.clear();
829}
830
832{
833 return d->names;
834}
835
837{
838 d->names = value;
839}
840
841void Person::addName(const Name &value)
842{
843 d->names.push_back(value);
844}
845
846void Person::removeName(const Name &value)
847{
848 d->names.removeOne(value);
849}
850
852{
853 d->names.clear();
854}
855
857{
858 return d->calendarUrls;
859}
860
862{
863 d->calendarUrls = value;
864}
865
867{
868 d->calendarUrls.push_back(value);
869}
870
872{
873 d->calendarUrls.removeOne(value);
874}
875
877{
878 d->calendarUrls.clear();
879}
880
882{
883 return d->coverPhotos;
884}
886{
887 return d->addresses;
888}
889
891{
892 d->addresses = value;
893}
894
895void Person::addAddress(const Address &value)
896{
897 d->addresses.push_back(value);
898}
899
901{
902 d->addresses.removeOne(value);
903}
904
906{
907 d->addresses.clear();
908}
909
911{
912 return d->etag;
913}
914
915void Person::setEtag(const QString &value)
916{
917 d->etag = value;
918}
920{
921 return d->phoneNumbers;
922}
923
925{
926 d->phoneNumbers = value;
927}
928
930{
931 d->phoneNumbers.push_back(value);
932}
933
935{
936 d->phoneNumbers.removeOne(value);
937}
938
940{
941 d->phoneNumbers.clear();
942}
943
945{
946 return d->imClients;
947}
948
950{
951 d->imClients = value;
952}
953
955{
956 d->imClients.push_back(value);
957}
958
960{
961 d->imClients.removeOne(value);
962}
963
965{
966 d->imClients.clear();
967}
968
970{
971 return d->events;
972}
973
975{
976 d->events = value;
977}
978
979void Person::addEvent(const Event &value)
980{
981 d->events.push_back(value);
982}
983
984void Person::removeEvent(const Event &value)
985{
986 d->events.removeOne(value);
987}
988
990{
991 d->events.clear();
992}
993
995{
996 return d->photos;
997}
999{
1000 return d->occupations;
1001}
1002
1004{
1005 d->occupations = value;
1006}
1007
1009{
1010 d->occupations.push_back(value);
1011}
1012
1014{
1015 d->occupations.removeOne(value);
1016}
1017
1019{
1020 d->occupations.clear();
1021}
1022
1024{
1025 return d->miscKeywords;
1026}
1027
1029{
1030 d->miscKeywords = value;
1031}
1032
1034{
1035 d->miscKeywords.push_back(value);
1036}
1037
1039{
1040 d->miscKeywords.removeOne(value);
1041}
1042
1044{
1045 d->miscKeywords.clear();
1046}
1047
1049{
1050 return d->relationshipInterests;
1051}
1053{
1054 return d->resourceName;
1055}
1056
1058{
1059 d->resourceName = value;
1060}
1062{
1063 return d->interests;
1064}
1065
1067{
1068 d->interests = value;
1069}
1070
1072{
1073 d->interests.push_back(value);
1074}
1075
1077{
1078 d->interests.removeOne(value);
1079}
1080
1082{
1083 d->interests.clear();
1084}
1085
1087{
1088 return d->organizations;
1089}
1090
1092{
1093 d->organizations = value;
1094}
1095
1097{
1098 d->organizations.push_back(value);
1099}
1100
1102{
1103 d->organizations.removeOne(value);
1104}
1105
1107{
1108 d->organizations.clear();
1109}
1110
1112{
1113 return d->urls;
1114}
1115
1116void Person::setUrls(const QList<Url> &value)
1117{
1118 d->urls = value;
1119}
1120
1121void Person::addUrl(const Url &value)
1122{
1123 d->urls.push_back(value);
1124}
1125
1126void Person::removeUrl(const Url &value)
1127{
1128 d->urls.removeOne(value);
1129}
1130
1132{
1133 d->urls.clear();
1134}
1135
1137{
1138 return d->genders;
1139}
1140
1142{
1143 d->genders = value;
1144}
1145
1146void Person::addGender(const Gender &value)
1147{
1148 d->genders.push_back(value);
1149}
1150
1152{
1153 d->genders.removeOne(value);
1154}
1155
1157{
1158 d->genders.clear();
1159}
1160
1162{
1163 return d->fileAses;
1164}
1165
1167{
1168 d->fileAses = value;
1169}
1170
1171void Person::addFileAs(const FileAs &value)
1172{
1173 d->fileAses.push_back(value);
1174}
1175
1177{
1178 d->fileAses.removeOne(value);
1179}
1180
1182{
1183 d->fileAses.clear();
1184}
1185
1186Person::Person::AgeRange Person::ageRange() const
1187{
1188 return d->ageRange;
1189}
1191{
1192 return d->metadata;
1193}
1194
1195PersonPtr Person::fromJSON(const QJsonObject &obj)
1196{
1197 auto person = new Person;
1198
1199 if (!obj.isEmpty()) {
1200 person->d->resourceName = obj.value(QStringLiteral("resourceName")).toString();
1201 person->d->etag = obj.value(QStringLiteral("etag")).toString();
1202
1203 const auto metadata = obj.value(QStringLiteral("metadata")).toObject();
1204 person->d->metadata = PersonMetadata::fromJSON(metadata);
1205
1206 const auto addresses = obj.value(QStringLiteral("addresses")).toArray();
1207 person->d->addresses = Address::fromJSONArray(addresses);
1208
1209 const auto ageRanges = obj.value(QStringLiteral("ageRanges")).toArray();
1210 person->d->ageRanges = AgeRangeType::fromJSONArray(ageRanges);
1211
1212 const auto biographies = obj.value(QStringLiteral("biographies")).toArray();
1213 person->d->biographies = Biography::fromJSONArray(biographies);
1214
1215 const auto birthdays = obj.value(QStringLiteral("birthdays")).toArray();
1216 person->d->birthdays = Birthday::fromJSONArray(birthdays);
1217
1218 // Bragging rights are deprecated and return nothing. Pass
1219
1220 const auto calendarUrls = obj.value(QStringLiteral("calendarUrls")).toArray();
1221 person->d->calendarUrls = CalendarUrl::fromJSONArray(calendarUrls);
1222
1223 const auto clientData = obj.value(QStringLiteral("clientData")).toArray();
1224 person->d->clientData = ClientData::fromJSONArray(clientData);
1225
1226 const auto coverPhotos = obj.value(QStringLiteral("coverPhotos")).toArray();
1227 person->d->coverPhotos = CoverPhoto::fromJSONArray(coverPhotos);
1228
1229 const auto emailAddresses = obj.value(QStringLiteral("emailAddresses")).toArray();
1230 person->d->emailAddresses = EmailAddress::fromJSONArray(emailAddresses);
1231
1232 const auto events = obj.value(QStringLiteral("events")).toArray();
1233 person->d->events = Event::fromJSONArray(events);
1234
1235 const auto externalIds = obj.value(QStringLiteral("externalIds")).toArray();
1236 person->d->externalIds = ExternalId::fromJSONArray(externalIds);
1237
1238 const auto fileAses = obj.value(QStringLiteral("fileAses")).toArray();
1239 person->d->fileAses = FileAs::fromJSONArray(fileAses);
1240
1241 const auto genders = obj.value(QStringLiteral("genders")).toArray();
1242 person->d->genders = Gender::fromJSONArray(genders);
1243
1244 const auto imClients = obj.value(QStringLiteral("imClients")).toArray();
1245 person->d->imClients = ImClient::fromJSONArray(imClients);
1246
1247 const auto interests = obj.value(QStringLiteral("interests")).toArray();
1248 person->d->interests = Interest::fromJSONArray(interests);
1249
1250 const auto locales = obj.value(QStringLiteral("locales")).toArray();
1251 person->d->locales = PersonLocale::fromJSONArray(locales);
1252
1253 const auto locations = obj.value(QStringLiteral("locations")).toArray();
1254 person->d->locations = Location::fromJSONArray(locations);
1255
1256 const auto memberships = obj.value(QStringLiteral("memberships")).toArray();
1257 person->d->memberships = Membership::fromJSONArray(memberships);
1258
1259 const auto miscKeywords = obj.value(QStringLiteral("miscKeywords")).toArray();
1260 person->d->miscKeywords = MiscKeyword::fromJSONArray(miscKeywords);
1261
1262 const auto names = obj.value(QStringLiteral("names")).toArray();
1263 person->d->names = Name::fromJSONArray(names);
1264
1265 const auto nicknames = obj.value(QStringLiteral("nicknames")).toArray();
1266 person->d->nicknames = Nickname::fromJSONArray(nicknames);
1267
1268 const auto occupations = obj.value(QStringLiteral("occupations")).toArray();
1269 person->d->occupations = Occupation::fromJSONArray(occupations);
1270
1271 const auto organizations = obj.value(QStringLiteral("organizations")).toArray();
1272 person->d->organizations = Organization::fromJSONArray(organizations);
1273
1274 const auto phoneNumbers = obj.value(QStringLiteral("phoneNumbers")).toArray();
1275 person->d->phoneNumbers = PhoneNumber::fromJSONArray(phoneNumbers);
1276
1277 const auto photos = obj.value(QStringLiteral("photos")).toArray();
1278 person->d->photos = Photo::fromJSONArray(photos);
1279
1280 const auto relations = obj.value(QStringLiteral("relations")).toArray();
1281 person->d->relations = Relation::fromJSONArray(relations);
1282
1283 // relationshipInterest is deprecated, provides no data
1284 // relationshipStatus is also deprecated
1285 // residence is also deprecated
1286
1287 const auto sipAddresses = obj.value(QStringLiteral("sipAddresses")).toArray();
1288 person->d->sipAddresses = SipAddress::fromJSONArray(sipAddresses);
1289
1290 const auto skills = obj.value(QStringLiteral("skills")).toArray();
1291 person->d->skills = Skill::fromJSONArray(skills);
1292
1293 // tagline is deprecated, provides no data
1294
1295 const auto urls = obj.value(QStringLiteral("urls")).toArray();
1296 person->d->urls = Url::fromJSONArray(urls);
1297
1298 const auto userDefined = obj.value(QStringLiteral("userDefined")).toArray();
1299 person->d->userDefined = UserDefined::fromJSONArray(userDefined);
1300 }
1301
1302 return People::PersonPtr(person);
1303}
1304
1305QJsonValue Person::toJSON() const
1306{
1307 QJsonObject returnObject;
1308 returnObject.insert(QStringLiteral("resourceName"), d->resourceName);
1309 returnObject.insert(QStringLiteral("etag"), d->etag);
1310
1311 returnObject.insert(QStringLiteral("metadata"), d->metadata.toJSON());
1312
1313 QJsonArray addressesArray;
1314 for (const auto &address : std::as_const(d->addresses)) {
1315 addressesArray.append(address.toJSON());
1316 }
1317 if (!addressesArray.isEmpty()) {
1318 returnObject.insert(QStringLiteral("addresses"), addressesArray);
1319 }
1320
1321 /* Output only field
1322 QJsonArray ageRangesArray;
1323 for (const auto &ageRange : d->ageRanges) {
1324 ageRangesArray.append(ageRange.toJSON());
1325 }
1326 if (!ageRangesArray.isEmpty()) {
1327 returnObject.insert(QStringLiteral("ageRanges"), ageRangesArray);
1328 }
1329 */
1330
1331 QJsonArray biographiesArray;
1332 for (const auto &biography : std::as_const(d->biographies)) {
1333 biographiesArray.append(biography.toJSON());
1334 }
1335 if (!biographiesArray.isEmpty()) {
1336 returnObject.insert(QStringLiteral("biographies"), biographiesArray);
1337 }
1338
1339 QJsonArray birthdaysArray;
1340 for (const auto &birthday : std::as_const(d->birthdays)) {
1341 birthdaysArray.append(birthday.toJSON());
1342 }
1343 if (!birthdaysArray.isEmpty()) {
1344 returnObject.insert(QStringLiteral("birthdays"), birthdaysArray);
1345 }
1346
1347 QJsonArray calendarUrlsArray;
1348 for (const auto &calendarUrl : std::as_const(d->calendarUrls)) {
1349 calendarUrlsArray.append(calendarUrl.toJSON());
1350 }
1351 if (!calendarUrlsArray.isEmpty()) {
1352 returnObject.insert(QStringLiteral("calendarUrls"), calendarUrlsArray);
1353 }
1354
1355 QJsonArray clientDataArray;
1356 for (const auto &clientData : std::as_const(d->clientData)) {
1357 clientDataArray.append(clientData.toJSON());
1358 }
1359 if (!clientDataArray.isEmpty()) {
1360 returnObject.insert(QStringLiteral("clientData"), clientDataArray);
1361 }
1362
1363 /* Output only field
1364 QJsonArray coverPhotosArray;
1365 for (const auto &coverPhoto : d->coverPhotos) {
1366 coverPhotosArray.append(coverPhoto.toJSON());
1367 }
1368 if (!coverPhotosArray.isEmpty()) {
1369 returnObject.insert(QStringLiteral("coverPhotos"), coverPhotosArray);
1370 }
1371 */
1372
1373 QJsonArray emailAddressesArray;
1374 for (const auto &emailAddress : std::as_const(d->emailAddresses)) {
1375 emailAddressesArray.append(emailAddress.toJSON());
1376 }
1377 if (!emailAddressesArray.isEmpty()) {
1378 returnObject.insert(QStringLiteral("emailAddresses"), emailAddressesArray);
1379 }
1380
1381 QJsonArray eventsArray;
1382 for (const auto &event : std::as_const(d->events)) {
1383 eventsArray.append(event.toJSON());
1384 }
1385 if (!eventsArray.isEmpty()) {
1386 returnObject.insert(QStringLiteral("events"), eventsArray);
1387 }
1388
1389 QJsonArray externalIdsArray;
1390 for (const auto &externalId : std::as_const(d->externalIds)) {
1391 externalIdsArray.append(externalId.toJSON());
1392 }
1393 if (!externalIdsArray.isEmpty()) {
1394 returnObject.insert(QStringLiteral("externalIds"), externalIdsArray);
1395 }
1396
1397 QJsonArray fileAsesArray;
1398 for (const auto &fileAs : std::as_const(d->fileAses)) {
1399 fileAsesArray.append(fileAs.toJSON());
1400 }
1401 if (!fileAsesArray.isEmpty()) {
1402 returnObject.insert(QStringLiteral("fileAses"), fileAsesArray);
1403 }
1404
1405 QJsonArray gendersArray;
1406 for (const auto &gender : std::as_const(d->genders)) {
1407 gendersArray.append(gender.toJSON());
1408 }
1409 if (!gendersArray.isEmpty()) {
1410 returnObject.insert(QStringLiteral("genders"), gendersArray);
1411 }
1412
1413 QJsonArray imClientsArray;
1414 for (const auto &imClient : std::as_const(d->imClients)) {
1415 imClientsArray.append(imClient.toJSON());
1416 }
1417 if (!imClientsArray.isEmpty()) {
1418 returnObject.insert(QStringLiteral("imClients"), imClientsArray);
1419 }
1420
1421 QJsonArray interestsArray;
1422 for (const auto &interest : std::as_const(d->interests)) {
1423 interestsArray.append(interest.toJSON());
1424 }
1425 if (!interestsArray.isEmpty()) {
1426 returnObject.insert(QStringLiteral("interests"), interestsArray);
1427 }
1428
1429 QJsonArray localesArray;
1430 for (const auto &locale : std::as_const(d->locales)) {
1431 localesArray.append(locale.toJSON());
1432 }
1433 if (!localesArray.isEmpty()) {
1434 returnObject.insert(QStringLiteral("locales"), localesArray);
1435 }
1436
1437 QJsonArray locationsArray;
1438 for (const auto &location : std::as_const(d->locations)) {
1439 locationsArray.append(location.toJSON());
1440 }
1441 if (!locationsArray.isEmpty()) {
1442 returnObject.insert(QStringLiteral("locations"), locationsArray);
1443 }
1444
1445 QJsonArray membershipsArray;
1446 for (const auto &membership : std::as_const(d->memberships)) {
1447 membershipsArray.append(membership.toJSON());
1448 }
1449 if (!membershipsArray.isEmpty()) {
1450 returnObject.insert(QStringLiteral("memberships"), membershipsArray);
1451 }
1452
1453 QJsonArray miscKeywordsArray;
1454 for (const auto &miscKeyword : std::as_const(d->miscKeywords)) {
1455 miscKeywordsArray.append(miscKeyword.toJSON());
1456 }
1457 if (!miscKeywordsArray.isEmpty()) {
1458 returnObject.insert(QStringLiteral("miscKeywords"), miscKeywordsArray);
1459 }
1460
1461 QJsonArray namesArray;
1462 for (const auto &name : std::as_const(d->names)) {
1463 namesArray.append(name.toJSON());
1464 }
1465 if (!namesArray.isEmpty()) {
1466 returnObject.insert(QStringLiteral("names"), namesArray);
1467 }
1468
1469 QJsonArray nicknamesArray;
1470 for (const auto &nickname : std::as_const(d->nicknames)) {
1471 nicknamesArray.append(nickname.toJSON());
1472 }
1473 if (!nicknamesArray.isEmpty()) {
1474 returnObject.insert(QStringLiteral("nicknames"), nicknamesArray);
1475 }
1476
1477 QJsonArray occupationsArray;
1478 for (const auto &occupation : std::as_const(d->occupations)) {
1479 occupationsArray.append(occupation.toJSON());
1480 }
1481 if (!occupationsArray.isEmpty()) {
1482 returnObject.insert(QStringLiteral("occupations"), occupationsArray);
1483 }
1484
1485 QJsonArray organizationsArray;
1486 for (const auto &organization : std::as_const(d->organizations)) {
1487 organizationsArray.append(organization.toJSON());
1488 }
1489 if (!organizationsArray.isEmpty()) {
1490 returnObject.insert(QStringLiteral("organizations"), organizationsArray);
1491 }
1492
1493 QJsonArray phoneNumbersArray;
1494 for (const auto &phoneNumber : std::as_const(d->phoneNumbers)) {
1495 phoneNumbersArray.append(phoneNumber.toJSON());
1496 }
1497 if (!phoneNumbersArray.isEmpty()) {
1498 returnObject.insert(QStringLiteral("phoneNumbers"), phoneNumbersArray);
1499 }
1500
1501 /* Output only field
1502 QJsonArray photosArray;
1503 for (const auto &photo : d->photos) {
1504 photosArray.append(photo.toJSON());
1505 }
1506 if (!photosArray.isEmpty()) {
1507 returnObject.insert(QStringLiteral("photos"), photosArray);
1508 }
1509 */
1510
1511 QJsonArray relationsArray;
1512 for (const auto &relation : std::as_const(d->relations)) {
1513 relationsArray.append(relation.toJSON());
1514 }
1515 if (!relationsArray.isEmpty()) {
1516 returnObject.insert(QStringLiteral("relations"), relationsArray);
1517 }
1518
1519 // relationshipInterest is deprecated, provides no data
1520 // relationshipStatus is also deprecated
1521 // residence is also deprecated
1522
1523 QJsonArray sipAddressesArray;
1524 for (const auto &sipAddress : std::as_const(d->sipAddresses)) {
1525 sipAddressesArray.append(sipAddress.toJSON());
1526 }
1527 if (!sipAddressesArray.isEmpty()) {
1528 returnObject.insert(QStringLiteral("sipAddresses"), sipAddressesArray);
1529 }
1530
1531 QJsonArray skillsArray;
1532 for (const auto &skill : std::as_const(d->skills)) {
1533 skillsArray.append(skill.toJSON());
1534 }
1535 if (!skillsArray.isEmpty()) {
1536 returnObject.insert(QStringLiteral("skills"), skillsArray);
1537 }
1538
1539 QJsonArray urlsArray;
1540 for (const auto &url : std::as_const(d->urls)) {
1541 urlsArray.append(url.toJSON());
1542 }
1543 if (!urlsArray.isEmpty()) {
1544 returnObject.insert(QStringLiteral("urls"), urlsArray);
1545 }
1546
1547 QJsonArray userDefinedArray;
1548 for (const auto &userDefined : std::as_const(d->userDefined)) {
1549 userDefinedArray.append(userDefined.toJSON());
1550 }
1551 if (!userDefinedArray.isEmpty()) {
1552 returnObject.insert(QStringLiteral("userDefined"), userDefinedArray);
1553 }
1554
1555 return returnObject;
1556}
1557
1558KContacts::Addressee Person::toKContactsAddressee() const
1559{
1560 return d->toKContactsAddressee();
1561}
1562
1563PersonPtr Person::fromKContactsAddressee(const KContacts::Addressee &addressee)
1564{
1565 auto person = new Person;
1566 person->d->setFromKContactsAddressee(addressee);
1567 return PersonPtr(person);
1568}
1569
1570bool Person::operator==(const Person &other) const
1571{
1572 if (!Object::operator==(other)) {
1573 return false;
1574 }
1575
1576 if (d->resourceName != other.d->resourceName) {
1577 qCDebug(KGAPIDebug) << "Resource name does not match"
1578 << d->resourceName
1579 << other.d->resourceName;
1580 return false;
1581 }
1582 if (d->etag != other.d->etag) {
1583 qCDebug(KGAPIDebug) << "Etag does not match"
1584 << d->etag
1585 << other.d->etag;
1586 return false;
1587 }
1588 if (d->metadata != other.d->metadata) {
1589 qCDebug(KGAPIDebug) << "Metadata does not match"
1590 << d->metadata.deleted() << other.d->metadata.deleted()
1591 << d->metadata.linkedPeopleResourceNames() << other.d->metadata.linkedPeopleResourceNames()
1592 << d->metadata.previousResourceNames() << other.d->metadata.previousResourceNames();
1593 return false;
1594 }
1595
1596 return *d.get() == *d.get();
1597}
1598
1599} // namespace KGAPI2::People
QString familyName() const
void setOrganization(const QString &organization)
QString nickName() const
void setBlogFeed(const QUrl &blogFeed)
QString prefix() const
QString organization() const
void setProfession(const QString &profession)
Picture photo() const
QString suffix() const
QDateTime birthday() const
void setNickName(const QString &nickName)
void setDepartment(const QString &department)
QString profession() const
void setPhoto(const Picture &photo)
void setBirthday(const QDate &birthday)
QString givenName() const
QUrl blogFeed() const
QString department() const
PhoneNumber::List phoneNumbers() const
void setUrl(const ResourceLocatorUrl &url)
QList< PhoneNumber > List
QString url() const
Object()
Constructor.
Definition object.cpp:32
A person's physical address.
Definition address.h:35
A person's short biography.
Definition biography.h:34
A person's birthday.
Definition birthday.h:37
DEPRECATED: No data will be returned A person's bragging rights.
A person's calendar URL.
Definition calendarurl.h:34
Arbitrary client data that is populated by clients.
Definition clientdata.h:35
A person's email address.
An event related to the person.
An identifier from an external entity related to the person.
Definition externalid.h:34
The name that should be used to sort the person in a list.
Definition fileas.h:34
A person's gender.
Definition gender.h:34
A person's instant messaging client.
Definition imclient.h:35
One of the person's interests.
Definition interest.h:34
A person's location.
A person's membership in a group.
Definition membership.h:36
A person's miscellaneous keyword.
Definition misckeyword.h:35
A person's name.
Definition name.h:38
A person's nickname.
Definition nickname.h:34
A person's occupation.
Definition occupation.h:34
A person's past or current organization.
A person's locale preference.
The metadata about a person.
Information about a person merged from various data sources such as the authenticated user's contacts...
Definition person.h:82
QList< Relation > relations() const
The person's relations.
Definition person.cpp:573
Person()
Construcuts a new Person.
Definition person.cpp:436
QList< Location > locations() const
The person's locations.
Definition person.cpp:623
void removeBirthday(const Birthday &value)
Removes the given value from the list of birthdays if it exists.
Definition person.cpp:563
void addExternalId(const ExternalId &value)
Appends the given value to the list of externalIds.
Definition person.cpp:658
void addEvent(const Event &value)
Appends the given value to the list of events.
Definition person.cpp:979
QList< Occupation > occupations() const
The person's occupations.
Definition person.cpp:998
void addFileAs(const FileAs &value)
Appends the given value to the list of fileAses.
Definition person.cpp:1171
void clearEvents()
Clears the list of events.
Definition person.cpp:989
void addUrl(const Url &value)
Appends the given value to the list of urls.
Definition person.cpp:1121
void addMembership(const Membership &value)
Appends the given value to the list of memberships.
Definition person.cpp:766
void clearMemberships()
Clears the list of memberships.
Definition person.cpp:776
void addLocation(const Location &value)
Appends the given value to the list of locations.
Definition person.cpp:633
QList< Gender > genders() const
The person's genders.
Definition person.cpp:1136
void addClientData(const ClientData &value)
Appends the given value to the list of clientData.
Definition person.cpp:504
void setEtag(const QString &value)
Sets value of the etag property.
Definition person.cpp:915
QList< SipAddress > sipAddresses() const
The person's SIP addresses.
Definition person.cpp:731
QString etag() const
The HTTP entity tag of the resource.
Definition person.cpp:910
QList< PhoneNumber > phoneNumbers() const
The person's phone numbers.
Definition person.cpp:919
void clearNames()
Clears the list of names.
Definition person.cpp:851
void setBirthdays(const QList< Birthday > &value)
Sets value of the birthdays property.
Definition person.cpp:553
void clearOccupations()
Clears the list of occupations.
Definition person.cpp:1018
void clearResidences()
Clears the list of residences.
Definition person.cpp:826
void removeMembership(const Membership &value)
Removes the given value from the list of memberships if it exists.
Definition person.cpp:771
void setLocales(const QList< PersonLocale > &value)
Sets value of the locales property.
Definition person.cpp:603
void addEmailAddress(const EmailAddress &value)
Appends the given value to the list of emailAddresses.
Definition person.cpp:479
void removeOrganization(const Organization &value)
Removes the given value from the list of organizations if it exists.
Definition person.cpp:1101
Person::AgeRange ageRange() const
Output only.
Definition person.cpp:1186
void clearRelations()
Clears the list of relations.
Definition person.cpp:593
void removeNickname(const Nickname &value)
Removes the given value from the list of nicknames if it exists.
Definition person.cpp:459
void setImClients(const QList< ImClient > &value)
Sets value of the imClients property.
Definition person.cpp:949
void setMemberships(const QList< Membership > &value)
Sets value of the memberships property.
Definition person.cpp:761
void setOrganizations(const QList< Organization > &value)
Sets value of the organizations property.
Definition person.cpp:1091
QList< Name > names() const
The person's names.
Definition person.cpp:831
void setBraggingRights(const QList< BraggingRights > &value)
Sets value of the braggingRights property.
Definition person.cpp:524
QList< CalendarUrl > calendarUrls() const
The person's calendar URLs.
Definition person.cpp:856
void setEvents(const QList< Event > &value)
Sets value of the events property.
Definition person.cpp:974
PersonMetadata metadata() const
Output only.
Definition person.cpp:1190
void setClientData(const QList< ClientData > &value)
Sets value of the clientData property.
Definition person.cpp:499
void removeMiscKeyword(const MiscKeyword &value)
Removes the given value from the list of miscKeywords if it exists.
Definition person.cpp:1038
void setGenders(const QList< Gender > &value)
Sets value of the genders property.
Definition person.cpp:1141
void clearFileAses()
Clears the list of fileAses.
Definition person.cpp:1181
void clearImClients()
Clears the list of imClients.
Definition person.cpp:964
void removeLocation(const Location &value)
Removes the given value from the list of locations if it exists.
Definition person.cpp:638
void addBirthday(const Birthday &value)
Appends the given value to the list of birthdays.
Definition person.cpp:558
void removeEmailAddress(const EmailAddress &value)
Removes the given value from the list of emailAddresses if it exists.
Definition person.cpp:484
QList< Membership > memberships() const
The person's group memberships.
Definition person.cpp:756
void addPersonLocale(const PersonLocale &value)
Appends the given value to the list of locales.
Definition person.cpp:608
void removeResidence(const Residence &value)
Removes the given value from the list of residences if it exists.
Definition person.cpp:821
void removeEvent(const Event &value)
Removes the given value from the list of events if it exists.
Definition person.cpp:984
void setSipAddresses(const QList< SipAddress > &value)
Sets value of the sipAddresses property.
Definition person.cpp:736
QList< Skill > skills() const
The person's skills.
Definition person.cpp:781
QList< Biography > biographies() const
The person's biographies.
Definition person.cpp:706
void clearUserDefined()
Clears the list of userDefined.
Definition person.cpp:701
void setRelations(const QList< Relation > &value)
Sets value of the relations property.
Definition person.cpp:578
void removeBraggingRights(const BraggingRights &value)
Removes the given value from the list of braggingRights if it exists.
Definition person.cpp:534
void removeSkill(const Skill &value)
Removes the given value from the list of skills if it exists.
Definition person.cpp:796
void removeImClient(const ImClient &value)
Removes the given value from the list of imClients if it exists.
Definition person.cpp:959
void setMiscKeywords(const QList< MiscKeyword > &value)
Sets value of the miscKeywords property.
Definition person.cpp:1028
QList< Nickname > nicknames() const
The person's nicknames.
Definition person.cpp:444
void removeInterest(const Interest &value)
Removes the given value from the list of interests if it exists.
Definition person.cpp:1076
void clearNicknames()
Clears the list of nicknames.
Definition person.cpp:464
void setEmailAddresses(const QList< EmailAddress > &value)
Sets value of the emailAddresses property.
Definition person.cpp:474
QList< ImClient > imClients() const
The person's instant messaging clients.
Definition person.cpp:944
void addCalendarUrl(const CalendarUrl &value)
Appends the given value to the list of calendarUrls.
Definition person.cpp:866
void setNames(const QList< Name > &value)
Sets value of the names property.
Definition person.cpp:836
void setExternalIds(const QList< ExternalId > &value)
Sets value of the externalIds property.
Definition person.cpp:653
void setOccupations(const QList< Occupation > &value)
Sets value of the occupations property.
Definition person.cpp:1003
QList< Photo > photos() const
Output only.
Definition person.cpp:994
QList< RelationshipInterest > relationshipInterests() const
Output only.
Definition person.cpp:1048
void setResidences(const QList< Residence > &value)
Sets value of the residences property.
Definition person.cpp:811
void removeOccupation(const Occupation &value)
Removes the given value from the list of occupations if it exists.
Definition person.cpp:1013
void removeName(const Name &value)
Removes the given value from the list of names if it exists.
Definition person.cpp:846
void setResourceName(const QString &value)
Sets value of the resourceName property.
Definition person.cpp:1057
void addGender(const Gender &value)
Appends the given value to the list of genders.
Definition person.cpp:1146
void addBiography(const Biography &value)
Appends the given value to the list of biographies.
Definition person.cpp:716
void clearOrganizations()
Clears the list of organizations.
Definition person.cpp:1106
void clearBiographies()
Clears the list of biographies.
Definition person.cpp:726
void clearSipAddresses()
Clears the list of sipAddresses.
Definition person.cpp:751
void setUrls(const QList< Url > &value)
Sets value of the urls property.
Definition person.cpp:1116
void clearLocations()
Clears the list of locations.
Definition person.cpp:643
void removePhoneNumber(const PhoneNumber &value)
Removes the given value from the list of phoneNumbers if it exists.
Definition person.cpp:934
QList< UserDefined > userDefined() const
The person's user defined data.
Definition person.cpp:681
void setUserDefined(const QList< UserDefined > &value)
Sets value of the userDefined property.
Definition person.cpp:686
void removeUrl(const Url &value)
Removes the given value from the list of urls if it exists.
Definition person.cpp:1126
void addImClient(const ImClient &value)
Appends the given value to the list of imClients.
Definition person.cpp:954
void clearInterests()
Clears the list of interests.
Definition person.cpp:1081
void clearMiscKeywords()
Clears the list of miscKeywords.
Definition person.cpp:1043
void setAddresses(const QList< Address > &value)
Sets value of the addresses property.
Definition person.cpp:890
QList< BraggingRights > braggingRights() const
DEPRECATED: No data will be returned The person's bragging rights.
Definition person.cpp:519
void setFileAses(const QList< FileAs > &value)
Sets value of the fileAses property.
Definition person.cpp:1166
void addRelation(const Relation &value)
Appends the given value to the list of relations.
Definition person.cpp:583
QList< PersonLocale > locales() const
The person's locale preferences.
Definition person.cpp:598
void addMiscKeyword(const MiscKeyword &value)
Appends the given value to the list of miscKeywords.
Definition person.cpp:1033
void clearCalendarUrls()
Clears the list of calendarUrls.
Definition person.cpp:876
void removeGender(const Gender &value)
Removes the given value from the list of genders if it exists.
Definition person.cpp:1151
void setNicknames(const QList< Nickname > &value)
Sets value of the nicknames property.
Definition person.cpp:449
QList< Residence > residences() const
DEPRECATED: (Please use person.locations instead) The person's residences.
Definition person.cpp:806
QList< ExternalId > externalIds() const
The person's external IDs.
Definition person.cpp:648
QList< AgeRangeType > ageRanges() const
Output only.
Definition person.cpp:673
void clearExternalIds()
Clears the list of externalIds.
Definition person.cpp:668
void setLocations(const QList< Location > &value)
Sets value of the locations property.
Definition person.cpp:628
QString resourceName() const
The resource name for the person, assigned by the server.
Definition person.cpp:1052
QList< Url > urls() const
The person's associated URLs.
Definition person.cpp:1111
QList< Organization > organizations() const
The person's past or current organizations.
Definition person.cpp:1086
void clearBirthdays()
Clears the list of birthdays.
Definition person.cpp:568
void setBiographies(const QList< Biography > &value)
Sets value of the biographies property.
Definition person.cpp:711
void removePersonLocale(const PersonLocale &value)
Removes the given value from the list of locales if it exists.
Definition person.cpp:613
void addAddress(const Address &value)
Appends the given value to the list of addresses.
Definition person.cpp:895
void setSkills(const QList< Skill > &value)
Sets value of the skills property.
Definition person.cpp:786
void clearEmailAddresses()
Clears the list of emailAddresses.
Definition person.cpp:489
void clearUrls()
Clears the list of urls.
Definition person.cpp:1131
void addBraggingRights(const BraggingRights &value)
Appends the given value to the list of braggingRights.
Definition person.cpp:529
void setPhoneNumbers(const QList< PhoneNumber > &value)
Sets value of the phoneNumbers property.
Definition person.cpp:924
void addResidence(const Residence &value)
Appends the given value to the list of residences.
Definition person.cpp:816
void setCalendarUrls(const QList< CalendarUrl > &value)
Sets value of the calendarUrls property.
Definition person.cpp:861
void removeClientData(const ClientData &value)
Removes the given value from the list of clientData if it exists.
Definition person.cpp:509
void addSipAddress(const SipAddress &value)
Appends the given value to the list of sipAddresses.
Definition person.cpp:741
void clearLocales()
Clears the list of locales.
Definition person.cpp:618
QList< Address > addresses() const
The person's street addresses.
Definition person.cpp:885
void clearPhoneNumbers()
Clears the list of phoneNumbers.
Definition person.cpp:939
void clearGenders()
Clears the list of genders.
Definition person.cpp:1156
QList< Birthday > birthdays() const
The person's birthdays.
Definition person.cpp:548
void addOrganization(const Organization &value)
Appends the given value to the list of organizations.
Definition person.cpp:1096
void removeCalendarUrl(const CalendarUrl &value)
Removes the given value from the list of calendarUrls if it exists.
Definition person.cpp:871
void clearBraggingRights()
Clears the list of braggingRights.
Definition person.cpp:539
QList< CoverPhoto > coverPhotos() const
Output only.
Definition person.cpp:881
void clearSkills()
Clears the list of skills.
Definition person.cpp:801
void removeAddress(const Address &value)
Removes the given value from the list of addresses if it exists.
Definition person.cpp:900
void clearAddresses()
Clears the list of addresses.
Definition person.cpp:905
QList< Event > events() const
The person's events.
Definition person.cpp:969
QList< FileAs > fileAses() const
The person's file-ases.
Definition person.cpp:1161
QList< EmailAddress > emailAddresses() const
The person's email addresses.
Definition person.cpp:469
void removeRelation(const Relation &value)
Removes the given value from the list of relations if it exists.
Definition person.cpp:588
void addUserDefined(const UserDefined &value)
Appends the given value to the list of userDefined.
Definition person.cpp:691
void clearClientData()
Clears the list of clientData.
Definition person.cpp:514
void removeExternalId(const ExternalId &value)
Removes the given value from the list of externalIds if it exists.
Definition person.cpp:663
QList< ClientData > clientData() const
The person's client data.
Definition person.cpp:494
QList< RelationshipStatus > relationshipStatuses() const
Output only.
Definition person.cpp:544
void removeBiography(const Biography &value)
Removes the given value from the list of biographies if it exists.
Definition person.cpp:721
void setInterests(const QList< Interest > &value)
Sets value of the interests property.
Definition person.cpp:1066
void addOccupation(const Occupation &value)
Appends the given value to the list of occupations.
Definition person.cpp:1008
void removeFileAs(const FileAs &value)
Removes the given value from the list of fileAses if it exists.
Definition person.cpp:1176
QList< Tagline > taglines() const
Output only.
Definition person.cpp:677
QList< Interest > interests() const
The person's interests.
Definition person.cpp:1061
QList< MiscKeyword > miscKeywords() const
The person's miscellaneous keywords.
Definition person.cpp:1023
void removeSipAddress(const SipAddress &value)
Removes the given value from the list of sipAddresses if it exists.
Definition person.cpp:746
void addNickname(const Nickname &value)
Appends the given value to the list of nicknames.
Definition person.cpp:454
void addInterest(const Interest &value)
Appends the given value to the list of interests.
Definition person.cpp:1071
void removeUserDefined(const UserDefined &value)
Removes the given value from the list of userDefined if it exists.
Definition person.cpp:696
void addName(const Name &value)
Appends the given value to the list of names.
Definition person.cpp:841
void addPhoneNumber(const PhoneNumber &value)
Appends the given value to the list of phoneNumbers.
Definition person.cpp:929
void addSkill(const Skill &value)
Appends the given value to the list of skills.
Definition person.cpp:791
A person's phone number.
Definition phonenumber.h:38
A person's relation to another person.
Definition relation.h:34
DEPRECATED: Please use person.locations instead.
Definition residence.h:33
A person's SIP address.
Definition sipaddress.h:35
A skill that the person has.
Definition skill.h:34
A person's associated URLs.
Definition url.h:34
Arbitrary user data that is populated by the end users.
Definition userdefined.h:34
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
Type type(const QSqlDatabase &db)
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
QVariant location(const QVariant &res)
QString name(StandardAction id)
Organization
void append(const QJsonValue &value)
bool isEmpty() const const
iterator insert(QLatin1StringView key, const QJsonValue &value)
bool isEmpty() const const
QJsonValue value(QLatin1StringView key) const const
QJsonArray toArray() const const
QJsonObject toObject() const const
QString toString() const const
void push_back(parameter_type value)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 12:07:24 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.