diff -Nru address-book-service-0.1.1+14.04.20140327/CMakeLists.txt address-book-service-0.1.1+14.04.20140408.3/CMakeLists.txt --- address-book-service-0.1.1+14.04.20140327/CMakeLists.txt 2014-03-27 18:16:30.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/CMakeLists.txt 2014-04-08 20:41:00.000000000 +0000 @@ -16,12 +16,6 @@ pkg_check_modules(FOLKS REQUIRED folks>=0.9.0) pkg_check_modules(FOLKS_EDS REQUIRED folks-eds) -if(FOLKS_VERSION VERSION_LESS "0.9.5") - set(FOLKS_VERSION_LESS_THAN_0_9_5 "1") -else() - set(FOLKS_VERSION_LESS_THAN_0_9_5 "0") -endif() - set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) add_definitions(-std=c++11) diff -Nru address-book-service-0.1.1+14.04.20140327/config.h.in address-book-service-0.1.1+14.04.20140408.3/config.h.in --- address-book-service-0.1.1+14.04.20140327/config.h.in 2014-03-27 18:16:30.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/config.h.in 2014-04-08 20:41:00.000000000 +0000 @@ -1,15 +1,6 @@ #ifndef __GALERA_CONFIG_H__ #define __GALERA_CONFIG_H__ -#define FOLKS_VERSION "@FOLKS_VERSION@" -#define FOLKS_VERSION_LESS_THAN_0_9_5 @FOLKS_VERSION_LESS_THAN_0_9_5@ - -#if FOLKS_VERSION_LESS_THAN_0_9_5 - #define FOLKS_INDIVIDUAL_AGGREGATOR_DUP folks_individual_aggregator_new -#else - #define FOLKS_INDIVIDUAL_AGGREGATOR_DUP folks_individual_aggregator_dup -#endif - -#define QT_PLUGINS_BINARY_DIR "@CMAKE_BINARY_DIR@" +#define QT_PLUGINS_BINARY_DIR "@CMAKE_BINARY_DIR@" #endif diff -Nru address-book-service-0.1.1+14.04.20140327/contacts/contacts-service.cpp address-book-service-0.1.1+14.04.20140408.3/contacts/contacts-service.cpp --- address-book-service-0.1.1+14.04.20140327/contacts/contacts-service.cpp 2014-03-27 18:16:30.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/contacts/contacts-service.cpp 2014-04-08 20:41:00.000000000 +0000 @@ -172,6 +172,8 @@ connect(m_iface.data(), SIGNAL(contactsAdded(QStringList)), this, SLOT(onContactsAdded(QStringList))); connect(m_iface.data(), SIGNAL(contactsRemoved(QStringList)), this, SLOT(onContactsRemoved(QStringList))); connect(m_iface.data(), SIGNAL(contactsUpdated(QStringList)), this, SLOT(onContactsUpdated(QStringList))); + + Q_EMIT serviceChanged(); } else { qWarning() << "Fail to connect with service:" << m_iface->lastError(); m_iface.clear(); @@ -193,9 +195,10 @@ } // this will make the service re-initialize - QDBusMessage result = m_iface->call("ping"); - if (result.type() == QDBusMessage::ErrorMessage) { - qWarning() << result.errorName() << result.errorMessage(); + m_iface->call("ping"); + if (m_iface->lastError().isValid()) { + qWarning() << m_iface->lastError(); + m_iface.clear(); m_serviceIsReady = false; } else { m_serviceIsReady = m_iface.data()->property("isReady").toBool(); @@ -698,17 +701,17 @@ void GaleraContactsService::addRequest(QtContacts::QContactAbstractRequest *request) { - if (!m_serviceIsReady) { - m_pendingRequests << QPointer(request); - return; - } - if (!isOnline()) { qWarning() << "Server is not online"; QContactManagerEngine::updateRequestState(request, QContactAbstractRequest::FinishedState); return; } + if (!m_serviceIsReady) { + m_pendingRequests << QPointer(request); + return; + } + Q_ASSERT(request->state() == QContactAbstractRequest::ActiveState); switch (request->type()) { case QContactAbstractRequest::ContactFetchRequest: diff -Nru address-book-service-0.1.1+14.04.20140327/debian/changelog address-book-service-0.1.1+14.04.20140408.3/debian/changelog --- address-book-service-0.1.1+14.04.20140327/debian/changelog 2014-04-09 07:36:14.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/debian/changelog 2014-04-09 07:36:14.000000000 +0000 @@ -1,3 +1,10 @@ +address-book-service (0.1.1+14.04.20140408.3-0ubuntu1) trusty; urgency=low + + [ Renato Araujo Oliveira Filho ] + * Disabled folks linking. (LP: #1302152) + + -- Ubuntu daily release Tue, 08 Apr 2014 20:41:10 +0000 + address-book-service (0.1.1+14.04.20140327-0ubuntu1) trusty; urgency=low [ Renato Araujo Oliveira Filho ] diff -Nru address-book-service-0.1.1+14.04.20140327/lib/addressbook.cpp address-book-service-0.1.1+14.04.20140408.3/lib/addressbook.cpp --- address-book-service-0.1.1+14.04.20140327/lib/addressbook.cpp 2014-03-27 18:16:30.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/lib/addressbook.cpp 2014-04-08 20:41:00.000000000 +0000 @@ -194,7 +194,7 @@ void AddressBook::prepareFolks() { - m_individualAggregator = FOLKS_INDIVIDUAL_AGGREGATOR_DUP(); + m_individualAggregator = folks_individual_aggregator_dup(); g_object_get(G_OBJECT(m_individualAggregator), "is-quiescent", &m_ready, NULL); if (m_ready) { AddressBook::isQuiescentChanged(G_OBJECT(m_individualAggregator), NULL, this); @@ -209,6 +209,7 @@ (GCallback) AddressBook::individualsChangedCb, this); + folks_individual_aggregator_prepare(m_individualAggregator, (GAsyncReadyCallback) AddressBook::prepareFolksDone, this); @@ -284,38 +285,6 @@ delete cData; } -void AddressBook::addGlobalAntilink(FolksPersona *persona, GAsyncReadyCallback antilinkReady, void *data) -{ - if (FOLKS_IS_ANTI_LINKABLE(persona)) { - GeeSet *oldAntiLinks = folks_anti_linkable_get_anti_links(FOLKS_ANTI_LINKABLE(persona)); - if (!gee_collection_contains(GEE_COLLECTION(oldAntiLinks), "*")) { - GeeHashSet *antiLinks = gee_hash_set_new(G_TYPE_STRING, - (GBoxedCopyFunc) g_strdup, - g_free, - NULL, NULL, NULL, NULL, NULL, NULL); - gee_collection_add(GEE_COLLECTION(antiLinks), "*"); - folks_anti_linkable_change_anti_links(FOLKS_ANTI_LINKABLE(persona), - GEE_SET(antiLinks), - antilinkReady, - data); - g_object_unref(antiLinks); - } - } else { - g_object_unref(persona); - } -} - -void AddressBook::addGlobalAntilinkDone(FolksAntiLinkable *antilinkable, GAsyncResult *result, void *data) -{ - GError *error = 0; - folks_anti_linkable_change_anti_links_finish(antilinkable, result, &error); - if (error) { - qWarning() << "Fail to anti link pesona" << folks_persona_get_display_id(FOLKS_PERSONA(antilinkable)) << error->message; - g_error_free(error); - } - g_object_unref(antilinkable); -} - void AddressBook::getSource(const QDBusMessage &message, bool onlyTheDefault) { FolksBackendStore *backendStore = folks_backend_store_dup(); @@ -568,28 +537,6 @@ } } -void AddressBook::addAntiLinksDone(FolksAntiLinkable *antilinkable, - GAsyncResult *result, - void *data) -{ - CreateContactData *createData = static_cast(data); - QDBusMessage reply; - - GError *error = 0; - folks_anti_linkable_change_anti_links_finish(antilinkable, result, &error); - if (error) { - qWarning() << "Fail to anti link pesona" << folks_persona_get_display_id(FOLKS_PERSONA(antilinkable)) << error->message; - reply = createData->m_message.createErrorReply("Fail to anti link pesona:", error->message); - g_error_free(error); - } else { - FolksIndividual *individual = folks_persona_get_individual(FOLKS_PERSONA(antilinkable)); - // return the result/contactId to the client - reply = createData->m_message.createReply(QString::fromUtf8(folks_individual_get_id(individual))); - } - QDBusConnection::sessionBus().send(reply); - delete createData; -} - QStringList AddressBook::sortFields() { return SortClause::supportedFields(); @@ -690,18 +637,6 @@ //TODO: Notify view } - // add anti lik for any new contact, if the contact is already linked ignore it - // because this could be manually linked before - GeeSet *personas = folks_individual_get_personas(individual); - int size = 0; - FolksPersona **personasArray = (FolksPersona **) gee_collection_to_array(GEE_COLLECTION(personas), &size); - if (gee_collection_get_size(GEE_COLLECTION(personas)) == 1) { - FolksPersona **personasArray = (FolksPersona **) gee_collection_to_array(GEE_COLLECTION(personas), &size); - addGlobalAntilink(personasArray[0], - (GAsyncReadyCallback) AddressBook::addGlobalAntilinkDone, - 0); - } - g_free(personasArray); return id; } diff -Nru address-book-service-0.1.1+14.04.20140327/lib/addressbook.h address-book-service-0.1.1+14.04.20140408.3/lib/addressbook.h --- address-book-service-0.1.1+14.04.20140327/lib/addressbook.h 2014-03-27 18:16:30.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/lib/addressbook.h 2014-04-08 20:41:00.000000000 +0000 @@ -49,7 +49,7 @@ AddressBook(QObject *parent=0); virtual ~AddressBook(); - static QString objectPath(); + static QString objectPath(); bool start(QDBusConnection connection); // Adaptor @@ -64,7 +64,7 @@ Q_SIGNALS: void stopped(); -public Q_SLOTS: +public Q_SLOTS: bool start(); void shutdown(); SourceList availableSources(const QDBusMessage &message); @@ -145,20 +145,9 @@ static void removeContactDone(FolksIndividualAggregator *individualAggregator, GAsyncResult *result, void *data); - static void addAntiLinksDone(FolksAntiLinkable *antilinkable, - GAsyncResult *result, - void *data); static void createSourceDone(GObject *source, GAsyncResult *res, void *data); - - static void addGlobalAntilink(FolksPersona *persona, - GAsyncReadyCallback antilinkReady, - void *data); - static void addGlobalAntilinkDone(FolksAntiLinkable *antilinkable, - GAsyncResult *result, - void *data); - friend class DirtyContactsNotify; }; diff -Nru address-book-service-0.1.1+14.04.20140327/lib/qindividual.cpp address-book-service-0.1.1+14.04.20140408.3/lib/qindividual.cpp --- address-book-service-0.1.1+14.04.20140327/lib/qindividual.cpp 2014-03-27 18:16:30.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/lib/qindividual.cpp 2014-04-08 20:41:00.000000000 +0000 @@ -23,6 +23,8 @@ #include "common/vcard-parser.h" +#include + #include #include #include @@ -312,21 +314,20 @@ return detail; } -void QIndividual::folksPersonaChanged(FolksPersona *persona, - GParamSpec *pspec, - QIndividual *self) -{ - const gchar* paramName = g_param_spec_get_name(pspec); - if (QString::fromUtf8(paramName) == QStringLiteral("avatar")) { - QContactDetail newAvatar = self->getPersonaPhoto(persona, 1); - - QContactAvatar avatar = self->m_contact->detail(QContactAvatar::Type); - avatar.setImageUrl(newAvatar.value(QContactAvatar::FieldImageUrl).toUrl()); - - self->m_contact->saveDetail(&avatar); +void QIndividual::folksIndividualChanged(FolksIndividual *individual, + GParamSpec *pspec, + QIndividual *self) +{ + Q_UNUSED(individual); + Q_UNUSED(pspec); + + // skip update contact during a contact update, the update will be done after + if (self->m_contactLock.tryLock()) { + // invalidate contact + self->markAsDirty(); self->notifyUpdate(); + self->m_contactLock.unlock(); } - //TODO: implement for all details } QtContacts::QContactDetail QIndividual::getPersonaPhoto(FolksPersona *persona, int index) const @@ -383,7 +384,9 @@ g_error_free(error); } - Q_ASSERT(g_str_equal(data, uri)); + if (g_str_equal(data, uri) != 0) { + qWarning() << "Avatar name changed from" << (gchar*)data << "to" << uri; + } g_free(data); } @@ -759,8 +762,12 @@ QtContacts::QContact &QIndividual::contact() { if (!m_contact && m_individual) { + QMutexLocker locker(&m_contactLock); updatePersonas(); - updateContact(); + // avoid change on m_contact pointer until the contact is fully loaded + QContact contact; + updateContact(&contact); + m_contact = new QContact(contact); } return *m_contact; } @@ -780,39 +787,21 @@ GeeIterator *iter = gee_iterable_iterator(GEE_ITERABLE(personas)); while(gee_iterator_next(iter)) { FolksPersona *persona = FOLKS_PERSONA(gee_iterator_get(iter)); - g_signal_connect(G_OBJECT(persona), "notify::avatar", - (GCallback) QIndividual::folksPersonaChanged, - const_cast(this)); - m_personas.insert(QString::fromUtf8(folks_persona_get_iid(persona)), persona); } g_object_unref(iter); } -void QIndividual::updateContact() +void QIndividual::updateContact(QContact *contact) const { - // disconnect any previous handler - Q_FOREACH(FolksPersona *p, m_notifyConnections.keys()) { - Q_FOREACH(int handlerId, m_notifyConnections.value(p)) { - g_signal_handler_disconnect(p, handlerId); - } - m_notifyConnections.remove(p); - } - - if (m_contact) { - delete m_contact; - m_contact = 0; - } - - m_contact = new QContact(); if (!m_individual) { return; } - m_contact->appendDetail(getUid()); + contact->appendDetail(getUid()); Q_FOREACH(QContactDetail detail, getSyncTargets()) { - m_contact->appendDetail(detail); + contact->appendDetail(detail); } int personaIndex = 1; @@ -831,22 +820,22 @@ // vcard only support one of these details by contact if (personaIndex == 1) { - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, getPersonaName(persona, personaIndex), !wPropList.contains("structured-name")); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, getPersonaFullName(persona, personaIndex), !wPropList.contains("full-name")); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, getPersonaNickName(persona, personaIndex), !wPropList.contains("structured-name")); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, getPersonaBirthday(persona, personaIndex), !wPropList.contains("birthday")); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, getPersonaPhoto(persona, personaIndex), !wPropList.contains("avatar")); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, getPersonaFavorite(persona, personaIndex), !wPropList.contains("is-favourite")); } @@ -854,55 +843,47 @@ QList details; QContactDetail prefDetail; details = getPersonaRoles(persona, &prefDetail, personaIndex); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, details, VCardParser::PreferredActionNames[QContactOrganization::Type], prefDetail, !wPropList.contains("roles")); details = getPersonaEmails(persona, &prefDetail, personaIndex); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, details, VCardParser::PreferredActionNames[QContactEmailAddress::Type], prefDetail, !wPropList.contains("email-addresses")); details = getPersonaPhones(persona, &prefDetail, personaIndex); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, details, VCardParser::PreferredActionNames[QContactPhoneNumber::Type], prefDetail, !wPropList.contains("phone-numbers")); details = getPersonaAddresses(persona, &prefDetail, personaIndex); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, details, VCardParser::PreferredActionNames[QContactAddress::Type], prefDetail, !wPropList.contains("postal-addresses")); details = getPersonaIms(persona, &prefDetail, personaIndex); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, details, VCardParser::PreferredActionNames[QContactOnlineAccount::Type], prefDetail, !wPropList.contains("im-addresses")); details = getPersonaUrls(persona, &prefDetail, personaIndex); - appendDetailsForPersona(m_contact, + appendDetailsForPersona(contact, details, VCardParser::PreferredActionNames[QContactUrl::Type], prefDetail, !wPropList.contains("urls")); personaIndex++; - - QList ids = m_notifyConnections.value(persona); - - // for now we are getting updated only about avatar changes - ids << g_signal_connect(G_OBJECT(persona), "notify::avatar", - (GCallback) QIndividual::folksPersonaChanged, - const_cast(this)); - m_notifyConnections[persona] = ids; } } @@ -910,18 +891,25 @@ { QContact &originalContact = contact(); if (newContact != originalContact) { - // only suppport one update by time - Q_ASSERT(m_currentUpdate == 0); m_currentUpdate = new UpdateContactRequest(newContact, this, object, slot); + if (!m_contactLock.tryLock(5000)) { + qWarning() << "Fail to lock contact to update"; + m_currentUpdate->notifyError("Fail to update contact"); + m_currentUpdate->deleteLater(); + m_currentUpdate = 0; + return false; + } + m_updateConnection = QObject::connect(m_currentUpdate, &UpdateContactRequest::done, [this] (const QString &errorMessage) { if (errorMessage.isEmpty()) { - this->updateContact(); + markAsDirty(); } m_currentUpdate->deleteLater(); m_currentUpdate = 0; + m_contactLock.unlock(); }); m_currentUpdate->start(); return true; @@ -950,10 +938,6 @@ void QIndividual::clearPersonas() { Q_FOREACH(FolksPersona *p, m_personas.values()) { - Q_FOREACH(int handlerId, m_notifyConnections.value(p)) { - g_signal_handler_disconnect(p, handlerId); - } - m_notifyConnections.remove(p); g_object_unref(p); } m_personas.clear(); @@ -963,6 +947,11 @@ { clearPersonas(); if (m_individual) { + // disconnect any previous handler + Q_FOREACH(int handlerId, m_notifyConnections) { + g_signal_handler_disconnect(m_individual, handlerId); + } + m_notifyConnections.clear(); g_object_unref(m_individual); m_individual = 0; } @@ -994,15 +983,13 @@ folks_persona_store_flush(folks_individual_aggregator_get_primary_store(m_aggregator), 0, 0); // cause the contact info to be reload - clearPersonas(); - if (m_contact) { - delete m_contact; - m_contact = 0; - } + markAsDirty(); } void QIndividual::setIndividual(FolksIndividual *individual) { + static QList individualProperties; + if (m_individual != individual) { clear(); @@ -1019,6 +1006,48 @@ m_individual = individual; if (m_individual) { g_object_ref(m_individual); + + if (individualProperties.isEmpty()) { + individualProperties << "alias" + << "avatar" + << "birthday" + << "calendar-event-id" + << "call-interaction-count" + << "client-types" + << "email-addresses" + << "full-name" + << "gender" + << "groups" + << "id" + << "im-addresses" + << "im-interaction-count" + << "is-favourite" + << "is-user" + << "last-call-interaction-datetime" + << "last-im-interaction-datetime" + << "local-ids" + << "location" + << "nickname" + << "notes" + << "personas" + << "phone-numbers" + << "postal-addresses" + << "presence-message" + << "presence-status" + << "presence-type" + << "roles" + << "structured-name" + << "trust-level" + << "urls" + << "web-service-addresses"; + } + + Q_FOREACH(const QByteArray &property, individualProperties) { + uint signalHandler = g_signal_connect(G_OBJECT(m_individual), QByteArray("notify::") + property, + (GCallback) QIndividual::folksIndividualChanged, + const_cast(this)); + m_notifyConnections << signalHandler; + } } } } @@ -1405,6 +1434,12 @@ return details; } +void QIndividual::markAsDirty() +{ + delete m_contact; + m_contact = 0; +} + void QIndividual::enableAutoLink(bool flag) { m_autoLink = flag; diff -Nru address-book-service-0.1.1+14.04.20140327/lib/qindividual.h address-book-service-0.1.1+14.04.20140408.3/lib/qindividual.h --- address-book-service-0.1.1+14.04.20140327/lib/qindividual.h 2014-03-27 18:16:30.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/lib/qindividual.h 2014-04-08 20:41:00.000000000 +0000 @@ -22,6 +22,8 @@ #include #include #include +#include + #include #include @@ -66,9 +68,10 @@ UpdateContactRequest *m_currentUpdate; QList > m_listeners; QMap m_personas; - QMap > m_notifyConnections; + QList m_notifyConnections; QString m_id; QMetaObject::Connection m_updateConnection; + QMutex m_contactLock; static bool m_autoLink; QIndividual(); @@ -77,7 +80,8 @@ void notifyUpdate(); QMultiHash parseDetails(FolksAbstractFieldDetails *details) const; - void updateContact(); + void markAsDirty(); + void updateContact(QtContacts::QContact *contact) const; void updatePersonas(); void clearPersonas(); void clear(); @@ -102,7 +106,7 @@ QtContacts::QContactDetail getPersonaNickName (FolksPersona *persona, int index) const; QtContacts::QContactDetail getPersonaBirthday (FolksPersona *persona, int index) const; QtContacts::QContactDetail getPersonaPhoto (FolksPersona *persona, int index) const; - QtContacts::QContactDetail getPersonaFavorite (FolksPersona *persona, int index) const; + QtContacts::QContactDetail getPersonaFavorite (FolksPersona *persona, int index) const; QList getPersonaRoles (FolksPersona *persona, QtContacts::QContactDetail *preferredRole, int index) const; @@ -158,7 +162,7 @@ const QList &cDetails, const QtContacts::QContactDetail &prefDetail); // property changed - static void folksPersonaChanged (FolksPersona *persona, + static void folksIndividualChanged (FolksIndividual *individual, GParamSpec *pspec, QIndividual *self); }; diff -Nru address-book-service-0.1.1+14.04.20140327/lib/update-contact-request.cpp address-book-service-0.1.1+14.04.20140408.3/lib/update-contact-request.cpp --- address-book-service-0.1.1+14.04.20140327/lib/update-contact-request.cpp 2014-03-27 18:16:17.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/lib/update-contact-request.cpp 2014-04-08 20:41:00.000000000 +0000 @@ -56,6 +56,8 @@ void UpdateContactRequest::invokeSlot(const QString &errorMessage) { + Q_EMIT done(errorMessage); + if (m_slot.isValid() && m_parent) { m_slot.invoke(m_object, Q_ARG(QString, m_parent->id()), Q_ARG(QString, errorMessage)); @@ -67,8 +69,6 @@ if (m_eventLoop) { m_eventLoop->quit(); } - - Q_EMIT done(errorMessage); } void UpdateContactRequest::start() @@ -94,6 +94,11 @@ m_parent = 0; } +void UpdateContactRequest::notifyError(const QString &errorMessage) +{ + invokeSlot(errorMessage); +} + bool UpdateContactRequest::isEqual(const QtContacts::QContactDetail &detailA, const QtContacts::QContactDetail &detailB) { @@ -258,29 +263,38 @@ << "\n\t" << newDetails.size() << (newDetails.size() > 0 ? newDetails[0] : QContactDetail()); //Only supports one avatar QUrl avatarUri; + QUrl oldAvatarUri; + + if (originalDetails.count()) { + QContactAvatar avatar = static_cast(originalDetails[0]); + oldAvatarUri = avatar.imageUrl(); + } + if (newDetails.count()) { QContactAvatar avatar = static_cast(newDetails[0]); avatarUri = avatar.imageUrl(); } - GFileIcon *avatarFileIcon = NULL; - if(!avatarUri.isEmpty()) { - QString formattedUri = avatarUri.toString(QUrl::RemoveUserInfo); - - if(!formattedUri.isEmpty()) { - QByteArray uriUtf8 = formattedUri.toUtf8(); - GFile *avatarFile = g_file_new_for_uri(uriUtf8.constData()); - avatarFileIcon = G_FILE_ICON(g_file_icon_new(avatarFile)); - g_object_unref(avatarFile); + if (avatarUri != oldAvatarUri) { + GFileIcon *avatarFileIcon = NULL; + if(!avatarUri.isEmpty()) { + QString formattedUri = avatarUri.toString(QUrl::RemoveUserInfo); + + if(!formattedUri.isEmpty()) { + QByteArray uriUtf8 = formattedUri.toUtf8(); + GFile *avatarFile = g_file_new_for_uri(uriUtf8.constData()); + avatarFileIcon = G_FILE_ICON(g_file_icon_new(avatarFile)); + g_object_unref(avatarFile); + } } - } - folks_avatar_details_change_avatar(FOLKS_AVATAR_DETAILS(m_currentPersona), - G_LOADABLE_ICON(avatarFileIcon), - (GAsyncReadyCallback) updateDetailsDone, - this); - if (avatarFileIcon) { - g_object_unref(avatarFileIcon); + folks_avatar_details_change_avatar(FOLKS_AVATAR_DETAILS(m_currentPersona), + G_LOADABLE_ICON(avatarFileIcon), + (GAsyncReadyCallback) updateDetailsDone, + this); + if (avatarFileIcon) { + g_object_unref(avatarFileIcon); + } } } else { updateDetailsDone(0, 0, this); @@ -698,31 +712,7 @@ g_object_ref(m_currentPersona); m_currentDetailType = QContactDetail::TypeUndefined; m_currentPersonaIndex++; - - if (QIndividual::autoLinkEnabled()) { - updateDetailsDone(0, 0, this); - } else { - // all personas edited by the user will have the auto link disabled - GeeSet *antiLinks; - antiLinks = GEE_SET(gee_hash_set_new(G_TYPE_STRING, - (GBoxedCopyFunc) g_strdup, - g_free, - NULL, NULL, NULL, NULL, NULL, NULL)); - - GeeSet *oldLinks = folks_anti_linkable_get_anti_links(FOLKS_ANTI_LINKABLE(m_currentPersona)); - if (oldLinks && - gee_collection_contains(GEE_COLLECTION(antiLinks), "*")) { - updateDetailsDone(0, 0, this); - return; - } else if (oldLinks) { - gee_collection_add_all(GEE_COLLECTION(antiLinks), GEE_COLLECTION(oldLinks)); - } - gee_collection_add(GEE_COLLECTION(antiLinks), "*"); - folks_anti_linkable_change_anti_links(FOLKS_ANTI_LINKABLE(m_currentPersona), - antiLinks, - (GAsyncReadyCallback) folksAddAntiLinksDone, - this); - } + updateDetailsDone(0, 0, this); } } @@ -878,17 +868,4 @@ } } -void UpdateContactRequest::folksAddAntiLinksDone(FolksAntiLinkable *antilinkable, - GAsyncResult *result, - UpdateContactRequest *self) -{ - GError *error = 0; - folks_anti_linkable_change_anti_links_finish(antilinkable, result, &error); - if (error) { - qWarning() << "Error during the anti link operation:" << error->message; - g_error_free(error); - } - updateDetailsDone(0, 0, self); -} - } // namespace diff -Nru address-book-service-0.1.1+14.04.20140327/lib/update-contact-request.h address-book-service-0.1.1+14.04.20140408.3/lib/update-contact-request.h --- address-book-service-0.1.1+14.04.20140327/lib/update-contact-request.h 2014-03-27 18:16:17.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/lib/update-contact-request.h 2014-04-08 20:41:00.000000000 +0000 @@ -43,6 +43,7 @@ void start(); void wait(); void deatach(); + void notifyError(const QString &errorMessage); Q_SIGNALS: void done(const QString &errorMessage); @@ -104,7 +105,6 @@ GAsyncResult *result); static void updateDetailsDone(GObject *detail, GAsyncResult *result, gpointer userdata); - static void folksAddAntiLinksDone(FolksAntiLinkable *antilinkable, GAsyncResult *result, UpdateContactRequest *self); }; } diff -Nru address-book-service-0.1.1+14.04.20140327/src/main.cpp address-book-service-0.1.1+14.04.20140408.3/src/main.cpp --- address-book-service-0.1.1+14.04.20140327/src/main.cpp 2014-03-27 18:16:17.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/src/main.cpp 2014-04-08 20:41:00.000000000 +0000 @@ -39,6 +39,11 @@ qInstallMessageHandler(contactServiceMessageOutput); } + // disable folks linking for now + if (!qEnvironmentVariableIsSet("FOLKS_DISABLE_LINKING")) { + qputenv("FOLKS_DISABLE_LINKING", "on"); + } + galera::AddressBook book; book.start(); app.connect(&book, SIGNAL(stopped()), SLOT(quit())); diff -Nru address-book-service-0.1.1+14.04.20140327/tests/unittest/dummy-backend.cpp address-book-service-0.1.1+14.04.20140408.3/tests/unittest/dummy-backend.cpp --- address-book-service-0.1.1+14.04.20140327/tests/unittest/dummy-backend.cpp 2014-03-27 18:16:30.000000000 +0000 +++ address-book-service-0.1.1+14.04.20140408.3/tests/unittest/dummy-backend.cpp 2014-04-08 20:41:00.000000000 +0000 @@ -153,7 +153,7 @@ } void DummyBackendProxy::initFolks() -{ +{ m_backendStore = folks_backend_store_dup(); folks_backend_store_load_backends(m_backendStore, (GAsyncReadyCallback) DummyBackendProxy::backendStoreLoaded, @@ -167,7 +167,7 @@ void DummyBackendProxy::prepareAggregator() { - m_aggregator = FOLKS_INDIVIDUAL_AGGREGATOR_DUP(); + m_aggregator = folks_individual_aggregator_dup(); m_individualsChangedDetailedId = g_signal_connect(m_aggregator, "individuals-changed-detailed", (GCallback) DummyBackendProxy::individualsChangedCb, @@ -298,7 +298,7 @@ // home qputenv("HOME", tmpFullPath.toUtf8().data()); - // cache + // cache QString cacheDir = QString("%1/.cache/").arg(tmpFullPath); mkpath(cacheDir); qputenv("XDG_CACHE_HOME", cacheDir.toUtf8().data());