[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:07:31 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=d5aa0da

The following commit has been merged in the master branch:
commit d5aa0dab3ea08c588e49eaa97bd55a6071570b15
Author: Vishesh Handa <me at vhanda.in>
Date:   Wed Aug 29 02:47:08 2012 +0530

    Create the contacts synchronously
---
 kpeople/nepomuk-feeder/nepomuk-storage.cpp | 41 ++++++++++--------------------
 kpeople/nepomuk-feeder/nepomuk-storage.h   |  2 --
 2 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.cpp b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
index 358633d..2dc3962 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.cpp
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
@@ -635,15 +635,23 @@ void NepomukStorage::createContact(const QString &path, const QString &id)
 
     newPersonContact.addProperty(Nepomuk2::Vocabulary::NCO::hasIMAccount(), newImAccount);
 
-    m_graph << newPersonContact << newImAccount;
-    m_contacts.insert( identifier, ContactResources(newPersonContact.uri(),
-                                                    newImAccount.uri()) );
+    Nepomuk2::SimpleResourceGraph graph;
+    graph << newPersonContact << newImAccount;
 
-    // Insert into a list so that their real uri can be set later on
-    m_unresolvedContacts.append( identifier );
-    fireGraphTimer();
+    Nepomuk2::StoreResourcesJob* job = graph.save();
+    job->exec();
+    if( job->error() ) {
+        kError() << job->errorString();
+        Q_ASSERT( job->error() );
+        return;
+    }
+
+    const QUrl personContactUri = job->mappings().value( newPersonContact.uri() );
+    const QUrl imAccountUri = job->mappings().value( newImAccount.uri() );
+    m_contacts.insert( identifier, ContactResources(personContactUri, imAccountUri) );
 }
 
+
 void NepomukStorage::destroyContact(const QString &path, const QString &id)
 {
     Tp::SimplePresence presence;
@@ -958,27 +966,6 @@ void NepomukStorage::onContactGraphJob(KJob* job)
         kWarning() << job->errorString();
         return;
     }
-    Nepomuk2::StoreResourcesJob* sjob = dynamic_cast<Nepomuk2::StoreResourcesJob*>(job);
-    QHash<QUrl, QUrl> mappings = sjob->mappings();
-
-    //
-    // Resolve all the contacts
-    //
-    QList<ContactIdentifier> unresolvedContacts;
-    foreach( const ContactIdentifier& identifier, m_unresolvedContacts ) {
-        const ContactResources& res = m_contacts[identifier];
-        QUrl contactUri = mappings.value( res.personContact() );
-        QUrl accountUri = mappings.value( res.imAccount() );
-
-        if( contactUri.isEmpty() || accountUri.isEmpty() ) {
-            unresolvedContacts << identifier;
-            continue;
-        }
-
-        m_contacts[identifier] = ContactResources(contactUri, accountUri);
-    }
-
-    m_unresolvedContacts = unresolvedContacts;
 
     emit graphSaved();
 }
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.h b/kpeople/nepomuk-feeder/nepomuk-storage.h
index b14d116..68f1cc4 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.h
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.h
@@ -160,8 +160,6 @@ private:
     QHash<QString, AccountResources> m_accounts;
     QHash<ContactIdentifier, ContactResources> m_contacts;
 
-    QList<ContactIdentifier> m_unresolvedContacts;
-
     Nepomuk2::SimpleResourceGraph m_graph;
     QTimer m_graphTimer;
 

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list