void QFacebookGraphUser::requestDone(bool ok) { if(ok) { QVariantMap map = result(); QVariantMap::const_iterator i; for (i = map.constBegin(); i != map.constEnd(); ++i) { if(i.key() == "name" ) setName(i.value().toString()); if(i.key() == "hometown") setHometown(i.value().toMap()); if(i.key() == "last_name") setLastName(i.value().toString()); if(i.key() == "birthday") setBirthday(i.value().toString()); if(i.key() == "education") { QFacebookGraphCommonEducationModel *edu = new QFacebookGraphCommonEducationModel(); for (int j = 0; j < i.value().toList().size(); ++j) { edu->populate(i.value().toList().at(j).toMap()); m_education.append(edu); edu = new QFacebookGraphCommonEducationModel(); } } if(i.key() == "work") { QFacebookGraphCommonWorkModel *work = new QFacebookGraphCommonWorkModel(); for (int j = 0; j < i.value().toList().size(); ++j) { work->populate(i.value().toList().at(j).toMap()); m_work.append(work); work = new QFacebookGraphCommonWorkModel(); } } if(i.key() == "first_name") setFirstName(i.value().toString()); if(i.key() == "gender") setGender(i.value().toString()); if(i.key() == "id") setFbid(i.value().toString()); if(i.key() == "link") setLink(i.value().toString()); if(i.key() == "locale") setLocale(i.value().toString()); if(i.key() == "location") setLocation(i.value().toMap()); if(i.key() == "middle_name") setMiddleName(i.value().toString()); if(i.key() == "timezone") setTimezone(i.value().toLongLong()); if(i.key() == "updated_time") setUpdatedtime(i.value().toString()); if(i.key() == "verified") setVerified(i.value().toBool()); } emit modelPopulated(); } }
void JabberPersonalInfoService::updatePersonalInfo(const QString &id, Buddy buddy) { Q_UNUSED(id); if (!VCardService) { emit personalInfoUpdated(false); return; } CurrentBuddy = buddy; auto vcard = QXmppVCardIq{}; vcard.setFullName(CurrentBuddy.firstName()); vcard.setNickName(CurrentBuddy.nickName()); vcard.setMiddleName(CurrentBuddy.familyName()); QDate birthday; birthday.setDate(CurrentBuddy.birthYear(), 1, 1); vcard.setBirthday(birthday); auto addr = QXmppVCardAddress{}; addr.setLocality(CurrentBuddy.city()); vcard.setAddresses({addr}); auto email = QXmppVCardEmail{}; email.setAddress(CurrentBuddy.email()); vcard.setEmails({email}); vcard.setUrl(CurrentBuddy.website()); auto vCardUploader = VCardService->createVCardUploader(); if (!vCardUploader) { emit personalInfoUpdated(false); return; } vCardUploader->uploadVCard(vcard); emit personalInfoUpdated(true); }