diff --git a/src/xmpp/xmpp-im/xmpp_vcard4.cpp b/src/xmpp/xmpp-im/xmpp_vcard4.cpp index 8774a516..c813cb1d 100644 --- a/src/xmpp/xmpp-im/xmpp_vcard4.cpp +++ b/src/xmpp/xmpp-im/xmpp_vcard4.cpp @@ -812,22 +812,20 @@ void VCard::fromVCardTemp(const XMPP::VCard &tempVCard) setNames(names); // Nickname - setNickName({ { { PStringList { Parameters(), { tempVCard.nickName() } } } } }); + setNickName({ tempVCard.nickName() }); // Photo if (!tempVCard.photo().isEmpty()) { - setPhoto({ { PAdvUri { - Parameters(), - UriValue(QString::fromLatin1("data:image/jpeg;base64,") + tempVCard.photo().toBase64()) } } }); + setPhoto(UriValue(QString::fromLatin1("data:image/jpeg;base64,") + tempVCard.photo().toBase64())); } else { - setPhoto({ { PAdvUri { Parameters(), UriValue(tempVCard.photoURI()) } } }); + setPhoto(UriValue(tempVCard.photoURI())); } // Birthday if (!tempVCard.bday().isNull()) { - setBday({ { Parameters(), tempVCard.bday() } }); + setBday(tempVCard.bday()); } else { - setBday({ { Parameters(), tempVCard.bdayStr() } }); + setBday(tempVCard.bdayStr()); } // Addresses @@ -890,20 +888,19 @@ void VCard::fromVCardTemp(const XMPP::VCard &tempVCard) setEmails(emails); // JID - setImpp({ { PUri { Parameters(), tempVCard.jid() } } }); + setImpp(tempVCard.jid()); // Title - setTitle({ { PString { Parameters(), tempVCard.title() } } }); + setTitle(tempVCard.title()); // Role - setRole({ { PString { Parameters(), tempVCard.role() } } }); + setRole(tempVCard.role()); // Logo if (!tempVCard.logo().isEmpty()) { - setLogo({ { PAdvUri { - Parameters(), UriValue(QString::fromLatin1("data:image/jpeg;base64,") + tempVCard.logo().toBase64()) } } }); + setLogo(UriValue(QString::fromLatin1("data:image/jpeg;base64,") + tempVCard.logo().toBase64())); } else { - setLogo({ { PAdvUri { Parameters(), UriValue(tempVCard.logoURI()) } } }); + setLogo(UriValue(tempVCard.logoURI())); } // Org @@ -915,7 +912,7 @@ void VCard::fromVCardTemp(const XMPP::VCard &tempVCard) setOrg(org); // Categories - setCategories({ { { PStringList { Parameters(), tempVCard.categories() } } } }); + setCategories(tempVCard.categories()); // Note setNote({ { PString { Parameters(), tempVCard.note() } } }); @@ -930,11 +927,11 @@ void VCard::fromVCardTemp(const XMPP::VCard &tempVCard) setUid(tempVCard.uid()); // URL - setUrls({ { PUri { Parameters(), QUrl(tempVCard.url()) } } }); + setUrls(QUrl(tempVCard.url())); // Geo if (!tempVCard.geo().lat.isEmpty() && !tempVCard.geo().lon.isEmpty()) { - setGeo({ { PUri { Parameters(), QUrl("geo:" + tempVCard.geo().lat + "," + tempVCard.geo().lon) } } }); + setGeo(QUrl("geo:" + tempVCard.geo().lat + "," + tempVCard.geo().lon)); } // Timezone @@ -945,10 +942,9 @@ void VCard::fromVCardTemp(const XMPP::VCard &tempVCard) // Sound if (!tempVCard.sound().isEmpty()) { - setSound({ { PAdvUri { - Parameters(), UriValue(QString::fromLatin1("data:audio/wav;base64,") + tempVCard.sound().toBase64()) } } }); + setSound(UriValue(QString::fromLatin1("data:audio/wav;base64,") + tempVCard.sound().toBase64())); } else { - setSound({ { PAdvUri { Parameters(), UriValue(tempVCard.soundURI()) } } }); + setSound(UriValue(tempVCard.soundURI())); } } @@ -1074,6 +1070,13 @@ void VCard::setFullName(const PStrings &fullName) d->fullName = fullName; } +Item &VCard::setFullName(const QString &fullName) +{ + INIT_D(); + d->fullName.append({ Parameters(), fullName }); + return d->fullName.last(); +} + PNames VCard::names() const { return d ? d->names : PNames {}; } void VCard::setNames(const PNames &names) @@ -1082,6 +1085,13 @@ void VCard::setNames(const PNames &names) d->names = names; } +Item &VCard::setNames(const Names &names) +{ + INIT_D(); + d->names = { Parameters(), names }; + return d->names; +} + PStringLists VCard::nickName() const { return d ? d->nickname : PStringLists(); } void VCard::setNickName(const PStringLists &nickname) @@ -1090,6 +1100,13 @@ void VCard::setNickName(const PStringLists &nickname) d->nickname = nickname; } +Item &VCard::setNickName(const QStringList &nickname) +{ + INIT_D(); + d->nickname.append({ Parameters(), nickname }); + return d->nickname.last(); +} + PStrings VCard::emails() const { return d ? d->emails : PStrings(); } void VCard::setEmails(const PStrings &emails) @@ -1098,6 +1115,13 @@ void VCard::setEmails(const PStrings &emails) d->emails = emails; } +Item &VCard::setEmails(const QString &email) +{ + INIT_D(); + d->emails.append({ Parameters(), email }); + return d->emails.last(); +} + PUrisOrTexts VCard::phones() const { return d ? d->tels : PUrisOrTexts(); } void VCard::setPhones(const PUrisOrTexts &tels) @@ -1106,6 +1130,13 @@ void VCard::setPhones(const PUrisOrTexts &tels) d->tels = tels; } +Item &VCard::setPhones(const UriOrText &phone) +{ + INIT_D(); + d->tels.append({ Parameters(), phone }); + return d->tels.last(); +} + PStringLists VCard::org() const { return d ? d->org : PStringLists(); } void VCard::setOrg(const PStringLists &org) @@ -1114,6 +1145,13 @@ void VCard::setOrg(const PStringLists &org) d->org = org; } +Item &VCard::setOrg(const QStringList &org) +{ + INIT_D(); + d->org.append({ Parameters(), org }); + return d->org.last(); +} + PStrings VCard::title() const { return d ? d->title : PStrings(); } void VCard::setTitle(const PStrings &title) @@ -1122,6 +1160,13 @@ void VCard::setTitle(const PStrings &title) d->title = title; } +Item &VCard::setTitle(const QString &title) +{ + INIT_D(); + d->title.append({ Parameters(), title }); + return d->title.last(); +} + PStrings VCard::role() const { return d ? d->role : PStrings(); } void VCard::setRole(const PStrings &role) @@ -1130,6 +1175,13 @@ void VCard::setRole(const PStrings &role) d->role = role; } +Item &VCard::setRole(const QString &role) +{ + INIT_D(); + d->role.append({ Parameters(), role }); + return d->role.last(); +} + PStrings VCard::note() const { return d ? d->note : PStrings(); } void VCard::setNote(const PStrings ¬e) @@ -1138,6 +1190,13 @@ void VCard::setNote(const PStrings ¬e) d->note = note; } +Item &VCard::setNote(const QString ¬e) +{ + INIT_D(); + d->note.append({ Parameters(), note }); + return d->note.last(); +} + PUris VCard::urls() const { return d ? d->urls : PUris(); } void VCard::setUrls(const PUris &urls) @@ -1146,6 +1205,13 @@ void VCard::setUrls(const PUris &urls) d->urls = urls; } +Item &VCard::setUrls(const QUrl &url) +{ + INIT_D(); + d->urls.append({ Parameters(), url }); + return d->urls.last(); +} + PHistorical VCard::bday() const { return d ? d->bday : PHistorical(); } void VCard::setBday(const PHistorical &bday) @@ -1154,6 +1220,13 @@ void VCard::setBday(const PHistorical &bday) d->bday = bday; } +Item &VCard::setBday(const Historical &bday) +{ + INIT_D(); + d->bday = { Parameters(), bday }; + return d->bday; +} + PHistorical VCard::anniversary() const { return d ? d->anniversary : PHistorical(); } void VCard::setAnniversary(const PHistorical &anniversary) @@ -1162,6 +1235,13 @@ void VCard::setAnniversary(const PHistorical &anniversary) d->anniversary = anniversary; } +Item &VCard::setAnniversary(const Historical &anniversary) +{ + INIT_D(); + d->anniversary = { Parameters(), anniversary }; + return d->anniversary; +} + VCard4::Gender VCard::gender() const { return d ? d->gender : VCard4::Gender::Undefined; } void VCard::setGender(Gender gender) @@ -1202,6 +1282,13 @@ void VCard::setCategories(const PStringLists &categories) d->categories = categories; } +Item &VCard::setCategories(const QStringList &categories) +{ + INIT_D(); + d->categories.append({ Parameters(), categories }); + return d->categories.last(); +} + PUris VCard::busyTimeUrl() const { return d ? d->busyTimeUrl : PUris(); } void VCard::setBusyTimeUrl(const PUris &busyTimeUrl) @@ -1210,6 +1297,13 @@ void VCard::setBusyTimeUrl(const PUris &busyTimeUrl) d->busyTimeUrl = busyTimeUrl; } +Item &VCard::setBusyTimeUrl(const QUrl &url) +{ + INIT_D(); + d->busyTimeUrl.append({ Parameters(), url }); + return d->busyTimeUrl.last(); +} + PUris VCard::calendarRequestUri() const { return d ? d->calendarRequestUri : PUris(); } void VCard::setCalendarRequestUri(const PUris &calendarRequestUri) @@ -1218,6 +1312,13 @@ void VCard::setCalendarRequestUri(const PUris &calendarRequestUri) d->calendarRequestUri = calendarRequestUri; } +Item &VCard::setCalendarRequestUri(const QUrl &url) +{ + INIT_D(); + d->calendarRequestUri.append({ Parameters(), url }); + return d->calendarRequestUri.last(); +} + PUris VCard::calendarUri() const { return d ? d->calendarUri : PUris(); } void VCard::setCalendarUri(const PUris &calendarUri) @@ -1226,6 +1327,13 @@ void VCard::setCalendarUri(const PUris &calendarUri) d->calendarUri = calendarUri; } +Item &VCard::setCalendarUri(const QUrl &url) +{ + INIT_D(); + d->calendarUri.append({ Parameters(), url }); + return d->calendarUri.last(); +} + QHash VCard::clientPidMap() const { return d ? d->clientPidMap : QHash(); } void VCard::setClientPidMap(const QHash &clientPidMap) @@ -1242,6 +1350,13 @@ void VCard::setGeo(const PUris &geo) d->geo = geo; } +Item &VCard::setGeo(const QUrl &url) +{ + INIT_D(); + d->geo.append({ Parameters(), url }); + return d->geo.last(); +} + PUris VCard::impp() const { return d ? d->impp : PUris(); } void VCard::setImpp(const PUris &impp) @@ -1250,6 +1365,13 @@ void VCard::setImpp(const PUris &impp) d->impp = impp; } +Item &VCard::setImpp(const QUrl &url) +{ + INIT_D(); + d->impp.append({ Parameters(), url }); + return d->impp.last(); +} + PUrisOrTexts VCard::key() const { return d ? d->key : PUrisOrTexts(); } void VCard::setKey(const PUrisOrTexts &key) @@ -1258,6 +1380,13 @@ void VCard::setKey(const PUrisOrTexts &key) d->key = key; } +Item &VCard::setKey(const UriOrText &key) +{ + INIT_D(); + d->key.append({ Parameters(), key }); + return d->key.last(); +} + PStrings VCard::languages() const { return d ? d->lang : PStrings(); } void VCard::setLanguages(const PStrings &lang) @@ -1266,6 +1395,13 @@ void VCard::setLanguages(const PStrings &lang) d->lang = lang; } +Item &VCard::setLanguages(const QString &lang) +{ + INIT_D(); + d->lang.append({ Parameters(), lang }); + return d->lang.last(); +} + PAdvUris VCard::logo() const { return d ? d->logo : PAdvUris(); } void VCard::setLogo(const PAdvUris &logo) @@ -1274,6 +1410,13 @@ void VCard::setLogo(const PAdvUris &logo) d->logo = logo; } +Item &VCard::setLogo(const UriValue &logo) +{ + INIT_D(); + d->logo.append({ Parameters(), logo }); + return d->logo.last(); +} + PUris VCard::member() const { return d ? d->member : PUris(); } void VCard::setMember(const PUris &member) @@ -1282,6 +1425,13 @@ void VCard::setMember(const PUris &member) d->member = member; } +Item &VCard::setMember(const QUrl &member) +{ + INIT_D(); + d->member.append({ Parameters(), member }); + return d->member.last(); +} + PAdvUris VCard::photo() const { return d ? d->photo : PAdvUris(); } void VCard::setPhoto(const PAdvUris &photo) @@ -1290,6 +1440,13 @@ void VCard::setPhoto(const PAdvUris &photo) d->photo = photo; } +Item &VCard::setPhoto(const UriValue &photo) +{ + INIT_D(); + d->photo.append({ Parameters(), photo }); + return d->photo.last(); +} + QString VCard::prodid() const { return d ? d->prodid : QString(); } void VCard::setProdid(const QString &prodid) @@ -1306,6 +1463,13 @@ void VCard::setRelated(const PUrisOrTexts &related) d->related = related; } +Item &VCard::setRelated(const UriOrText &related) +{ + INIT_D(); + d->related.append({ Parameters(), related }); + return d->related.last(); +} + QDateTime VCard::rev() const { return d ? d->rev : QDateTime(); } void VCard::setRev(const QDateTime &rev) @@ -1322,6 +1486,13 @@ void VCard::setSound(const PAdvUris &sound) d->sound = sound; } +Item &VCard::setSound(const UriValue &sound) +{ + INIT_D(); + d->sound.append({ Parameters(), sound }); + return d->sound.last(); +} + PUris VCard::source() const { return d ? d->source : PUris(); } void VCard::setSource(const PUris &source) @@ -1330,6 +1501,13 @@ void VCard::setSource(const PUris &source) d->source = source; } +Item &VCard::setSource(const QUrl &source) +{ + INIT_D(); + d->source.append({ Parameters(), source }); + return d->source.last(); +} + PTimeZones VCard::timeZone() const { return d ? d->timeZone : PTimeZones(); } void VCard::setTimeZone(const PTimeZones &timeZone) @@ -1338,6 +1516,13 @@ void VCard::setTimeZone(const PTimeZones &timeZone) d->timeZone = timeZone; } +Item &VCard::setTimeZone(const TimeZone &timeZone) +{ + INIT_D(); + d->timeZone.append({ Parameters(), timeZone }); + return d->timeZone.last(); +} + PAddresses VCard::addresses() const { return d ? d->addresses : PAddresses(); } void VCard::setAddresses(const PAddresses &addresses) @@ -1346,4 +1531,11 @@ void VCard::setAddresses(const PAddresses &addresses) d->addresses = addresses; } +Item
&VCard::setAddresses(const Address &addresses) +{ + INIT_D(); + d->addresses.append({ Parameters(), addresses }); + return d->addresses.last(); +} + } // namespace VCard4 diff --git a/src/xmpp/xmpp-im/xmpp_vcard4.h b/src/xmpp/xmpp-im/xmpp_vcard4.h index 8c7f461b..ff234294 100644 --- a/src/xmpp/xmpp-im/xmpp_vcard4.h +++ b/src/xmpp/xmpp-im/xmpp_vcard4.h @@ -268,41 +268,53 @@ class VCard { XMPP::VCard toVCardTemp() const; // Getters and setters - PStrings fullName() const; - void setFullName(const PStrings &fullName); + PStrings fullName() const; + void setFullName(const PStrings &fullName); + Item &setFullName(const QString &fullName); - PNames names() const; - void setNames(const PNames &names); + PNames names() const; + void setNames(const PNames &names); + Item &setNames(const Names &names); - PStringLists nickName() const; - void setNickName(const PStringLists &nickname); + PStringLists nickName() const; + void setNickName(const PStringLists &nickname); + Item &setNickName(const QStringList &nickname); - PStrings emails() const; - void setEmails(const PStrings &emails); + PStrings emails() const; + void setEmails(const PStrings &emails); + Item &setEmails(const QString &email); - PUrisOrTexts phones() const; - void setPhones(const PUrisOrTexts &tels); + PUrisOrTexts phones() const; + void setPhones(const PUrisOrTexts &tels); + Item &setPhones(const UriOrText &phone); - PStringLists org() const; - void setOrg(const PStringLists &org); + PStringLists org() const; + void setOrg(const PStringLists &org); + Item &setOrg(const QStringList &org); - PStrings title() const; - void setTitle(const PStrings &title); + PStrings title() const; + void setTitle(const PStrings &title); + Item &setTitle(const QString &title); - PStrings role() const; - void setRole(const PStrings &role); + PStrings role() const; + void setRole(const PStrings &role); + Item &setRole(const QString &role); - PStrings note() const; - void setNote(const PStrings ¬e); + PStrings note() const; + void setNote(const PStrings ¬e); + Item &setNote(const QString ¬e); - PUris urls() const; - void setUrls(const PUris &urls); + PUris urls() const; + void setUrls(const PUris &urls); + Item &setUrls(const QUrl &url); - PHistorical bday() const; - void setBday(const PHistorical &bday); + PHistorical bday() const; + void setBday(const PHistorical &bday); + Item &setBday(const Historical &bday); - PHistorical anniversary() const; - void setAnniversary(const PHistorical &anniversary); + PHistorical anniversary() const; + void setAnniversary(const PHistorical &anniversary); + Item &setAnniversary(const Historical &anniversary); Gender gender() const; void setGender(Gender gender); @@ -316,62 +328,78 @@ class VCard { QString kind() const; void setKind(const QString &kind); - PStringLists categories() const; - void setCategories(const PStringLists &categories); + PStringLists categories() const; + void setCategories(const PStringLists &categories); + Item &setCategories(const QStringList &categories); - PUris busyTimeUrl() const; - void setBusyTimeUrl(const PUris &busyTimeUrl); + PUris busyTimeUrl() const; + void setBusyTimeUrl(const PUris &busyTimeUrl); + Item &setBusyTimeUrl(const QUrl &url); - PUris calendarRequestUri() const; - void setCalendarRequestUri(const PUris &calendarRequestUri); + PUris calendarRequestUri() const; + void setCalendarRequestUri(const PUris &calendarRequestUri); + Item &setCalendarRequestUri(const QUrl &url); - PUris calendarUri() const; - void setCalendarUri(const PUris &calendarUri); + PUris calendarUri() const; + void setCalendarUri(const PUris &calendarUri); + Item &setCalendarUri(const QUrl &url); QHash clientPidMap() const; void setClientPidMap(const QHash &clientPidMap); - PUris geo() const; - void setGeo(const PUris &geo); + PUris geo() const; + void setGeo(const PUris &geo); + Item &setGeo(const QUrl &url); - PUris impp() const; - void setImpp(const PUris &impp); + PUris impp() const; + void setImpp(const PUris &impp); + Item &setImpp(const QUrl &url); - PUrisOrTexts key() const; - void setKey(const PUrisOrTexts &key); + PUrisOrTexts key() const; + void setKey(const PUrisOrTexts &key); + Item &setKey(const UriOrText &key); - PStrings languages() const; - void setLanguages(const PStrings &lang); + PStrings languages() const; + void setLanguages(const PStrings &lang); + Item &setLanguages(const QString &lang); - PAdvUris logo() const; - void setLogo(const PAdvUris &logo); + PAdvUris logo() const; + void setLogo(const PAdvUris &logo); + Item &setLogo(const UriValue &logo); - PUris member() const; - void setMember(const PUris &member); + PUris member() const; + void setMember(const PUris &member); + Item &setMember(const QUrl &member); - PAdvUris photo() const; - void setPhoto(const PAdvUris &photo); + PAdvUris photo() const; + void setPhoto(const PAdvUris &photo); + Item &setPhoto(const UriValue &photo); QString prodid() const; void setProdid(const QString &prodid); - PUrisOrTexts related() const; - void setRelated(const PUrisOrTexts &related); + PUrisOrTexts related() const; + void setRelated(const PUrisOrTexts &related); + Item &setRelated(const UriOrText &related); QDateTime rev() const; void setRev(const QDateTime &rev); - PAdvUris sound() const; - void setSound(const PAdvUris &sound); + PAdvUris sound() const; + void setSound(const PAdvUris &sound); + Item &setSound(const UriValue &sound); - PUris source() const; - void setSource(const PUris &source); + PUris source() const; + void setSource(const PUris &source); + Item &setSource(const QUrl &source); - PTimeZones timeZone() const; - void setTimeZone(const PTimeZones &timeZone); + PTimeZones timeZone() const; + void setTimeZone(const PTimeZones &timeZone); + Item &setTimeZone(const TimeZone &timeZone); - PAddresses addresses() const; - void setAddresses(const PAddresses &addresses); + PAddresses addresses() const; + void setAddresses(const PAddresses &addresses); + Item
&setAddresses(const Address &addresses); private: class VCardData;