Skip to content

Commit

Permalink
[buteo-sync-plugins-social] Don't use custom qtcontacts-sqlite extens…
Browse files Browse the repository at this point in the history
…ion values that already exist in latest QtPim. JB#50552
  • Loading branch information
Bea Lam committed Sep 25, 2020
1 parent 910123a commit 6dd0ed5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/facebook/facebook-contacts/facebookcontactsyncadaptor.cpp
Expand Up @@ -496,7 +496,7 @@ QContact FacebookContactSyncAdaptor::parseContactDetails(const QJsonObject &blob
bool foundCover = false;
bool foundPicture = false;
foreach (const QContactAvatar &avatar, contactAvatars) {
if (avatar.value(QContactAvatar__FieldAvatarMetadata) == QLatin1String("cover")) {
if (avatar.value(QContactAvatar::FieldMetaData) == QLatin1String("cover")) {
foundCover = true;
if (cover.isEmpty()) {
// needs to be removed.
Expand All @@ -516,7 +516,7 @@ QContact FacebookContactSyncAdaptor::parseContactDetails(const QJsonObject &blob
contactAvatar.setImageUrl(avatarFileName);
SAVE_DETAIL(contactAvatar);
}
} else if (avatar.value(QContactAvatar__FieldAvatarMetadata) == QLatin1String("picture")) {
} else if (avatar.value(QContactAvatar::FieldMetaData) == QLatin1String("picture")) {
foundPicture = true;
if (picture.isEmpty()) {
// needs to be removed.
Expand Down Expand Up @@ -551,7 +551,7 @@ QContact FacebookContactSyncAdaptor::parseContactDetails(const QJsonObject &blob
// needs to be updated. we set the value to be the (future) image filename.
QContactAvatar contactAvatar;
contactAvatar.setImageUrl(avatarFileName);
contactAvatar.setValue(QContactAvatar__FieldAvatarMetadata, QLatin1String("cover"));
contactAvatar.setValue(QContactAvatar::FieldMetaData, QLatin1String("cover"));
SAVE_DETAIL(contactAvatar);
}
if (!foundPicture && !picture.isEmpty()) {
Expand All @@ -567,7 +567,7 @@ QContact FacebookContactSyncAdaptor::parseContactDetails(const QJsonObject &blob
// needs to be updated. we set the value to be the (future) image filename.
QContactAvatar contactAvatar;
contactAvatar.setImageUrl(avatarFileName);
contactAvatar.setValue(QContactAvatar__FieldAvatarMetadata, QLatin1String("picture"));
contactAvatar.setValue(QContactAvatar::FieldMetaData, QLatin1String("picture"));
SAVE_DETAIL(contactAvatar);
}

Expand Down
4 changes: 2 additions & 2 deletions src/google/google-contacts/googlecontactstream.cpp
Expand Up @@ -346,7 +346,7 @@ void GoogleContactStream::handleAtomEntry()
// If it's an avatar, we grab it as a QContactAvatar detail
QContactAvatar avatar;
Q_FOREACH (const QContactAvatar &av, entryContact.details<QContactAvatar>()) {
if (av.value(QContactAvatar__FieldAvatarMetadata).toString() == QStringLiteral("picture")) {
if (av.value(QContactAvatar::FieldMetaData).toString() == QStringLiteral("picture")) {
avatar = av;
break;
}
Expand Down Expand Up @@ -422,7 +422,7 @@ QString GoogleContactStream::handleEntryLink(QContactAvatar *avatar, bool *isAva
&& (mXmlReader->attributes().value("rel") == "http://schemas.google.com/contacts/2008/rel#photo")) {
// this is an avatar photo for the contact entry
avatar->setImageUrl(mXmlReader->attributes().value("href").toString());
avatar->setValue(QContactAvatar__FieldAvatarMetadata, QVariant::fromValue<QString>(QStringLiteral("picture")));
avatar->setValue(QContactAvatar::FieldMetaData, QVariant::fromValue<QString>(QStringLiteral("picture")));
*isAvatar = true;
}

Expand Down
6 changes: 3 additions & 3 deletions src/google/google-contacts/googletwowaycontactsyncadaptor.cpp
Expand Up @@ -824,7 +824,7 @@ void GoogleTwoWayContactSyncAdaptor::transformContactAvatars(QList<QContact> &re
// we have a remote avatar which we need to transform.
QContactAvatar avatar = curr.detail<QContactAvatar>();
Q_FOREACH (const QContactAvatar &av, curr.details<QContactAvatar>()) {
if (av.value(QContactAvatar__FieldAvatarMetadata).toString() == QStringLiteral("picture")) {
if (av.value(QContactAvatar::FieldMetaData).toString() == QStringLiteral("picture")) {
avatar = av;
break;
}
Expand Down Expand Up @@ -958,12 +958,12 @@ void GoogleTwoWayContactSyncAdaptor::finalize(int accountId)
// we have downloaded the avatar for this contact, and need to update it.
QContactAvatar a;
Q_FOREACH (const QContactAvatar &av, c.details<QContactAvatar>()) {
if (av.value(QContactAvatar__FieldAvatarMetadata).toString() == QStringLiteral("picture")) {
if (av.value(QContactAvatar::FieldMetaData).toString() == QStringLiteral("picture")) {
a = av;
break;
}
}
a.setValue(QContactAvatar__FieldAvatarMetadata, QVariant::fromValue<QString>(QStringLiteral("picture")));
a.setValue(QContactAvatar::FieldMetaData, QVariant::fromValue<QString>(QStringLiteral("picture")));
a.setImageUrl(it.value());
if (c.saveDetail(&a)) {
contactsToSave[c.detail<QContactGuid>().guid()] = c;
Expand Down
12 changes: 6 additions & 6 deletions src/vk/vk-contacts/vkcontactsyncadaptor.cpp
Expand Up @@ -254,9 +254,9 @@ void VKContactSyncAdaptor::purgeDataForOldAccount(int oldId, SocialNetworkSyncAd
QtContactsSqliteExtensions::ContactManagerEngine::PreserveLocalChanges,
true,
&error)) {
SOCIALD_LOG_INFO("purged account" << pid << "and successfully removed collection" << friendCollectionId);
SOCIALD_LOG_INFO("purged account" << oldId << "and successfully removed collection" << friendCollectionId);
} else {
SOCIALD_LOG_ERROR("Failed to remove collection during purge of account" << pid
SOCIALD_LOG_ERROR("Failed to remove collection during purge of account" << oldId
<< "error:" << error);
}
}
Expand Down Expand Up @@ -480,7 +480,7 @@ QList<QContact> VKContactSyncAdaptor::parseContacts(const QJsonArray &json, int
if (!obj.value("photo_max").toString().isEmpty()) {
QContactAvatar avatar;
avatar.setImageUrl(QUrl(obj.value("photo_max").toString()));
avatar.setValue(QContactAvatar__FieldAvatarMetadata, QStringLiteral("picture"));
avatar.setValue(QContactAvatar::FieldMetaData, QStringLiteral("picture"));
saveNonexportableDetail(c, avatar);
}

Expand Down Expand Up @@ -544,7 +544,7 @@ void VKContactSyncAdaptor::transformContactAvatars(QList<QContact> &remoteContac
// we have a remote avatar which we need to transform.
QContactAvatar avatar = curr.detail<QContactAvatar>();
Q_FOREACH (const QContactAvatar &av, curr.details<QContactAvatar>()) {
if (av.value(QContactAvatar__FieldAvatarMetadata).toString() == QStringLiteral("picture")) {
if (av.value(QContactAvatar::FieldMetaData).toString() == QStringLiteral("picture")) {
avatar = av;
break;
}
Expand Down Expand Up @@ -646,12 +646,12 @@ void VKContactSyncAdaptor::finalize(int accountId)
// we have downloaded the avatar for this contact, and need to update it.
QContactAvatar a;
Q_FOREACH (const QContactAvatar &av, c.details<QContactAvatar>()) {
if (av.value(QContactAvatar__FieldAvatarMetadata).toString() == QStringLiteral("picture")) {
if (av.value(QContactAvatar::FieldMetaData).toString() == QStringLiteral("picture")) {
a = av;
break;
}
}
a.setValue(QContactAvatar__FieldAvatarMetadata, QVariant::fromValue<QString>(QStringLiteral("picture")));
a.setValue(QContactAvatar::FieldMetaData, QVariant::fromValue<QString>(QStringLiteral("picture")));
a.setImageUrl(it.value());
saveNonexportableDetail(c, a);
contactsToSave[c.detail<QContactGuid>().guid()] = c;
Expand Down
4 changes: 2 additions & 2 deletions tests/tst_facebook/tst_facebook.cpp
Expand Up @@ -193,10 +193,10 @@ void tst_facebook::contacts()
: testfriendOne.details<QContactUrl>().at(0);
QCOMPARE(linkUrl.url(), QString::fromLatin1("https://www.facebook.com/testfriendone"));
QCOMPARE(websiteUrl.url(), QString::fromLatin1("http://friendone.test.com/"));
QContactAvatar coverAvatar = testfriendOne.details<QContactAvatar>().at(0).value(QContactAvatar__FieldAvatarMetadata) == QString::fromLatin1("cover")
QContactAvatar coverAvatar = testfriendOne.details<QContactAvatar>().at(0).value(QContactAvatar::FieldMetaData) == QString::fromLatin1("cover")
? testfriendOne.details<QContactAvatar>().at(0)
: testfriendOne.details<QContactAvatar>().at(1);
QContactAvatar pictureAvatar = testfriendOne.details<QContactAvatar>().at(0).value(QContactAvatar__FieldAvatarMetadata) == QString::fromLatin1("cover")
QContactAvatar pictureAvatar = testfriendOne.details<QContactAvatar>().at(0).value(QContactAvatar::FieldMetaData) == QString::fromLatin1("cover")
? testfriendOne.details<QContactAvatar>().at(1)
: testfriendOne.details<QContactAvatar>().at(0);
QVERIFY(!coverAvatar.imageUrl().isEmpty()); // it'll be something generated.
Expand Down

0 comments on commit 6dd0ed5

Please sign in to comment.