[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:26 UTC 2016


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

The following commit has been merged in the master branch:
commit a6e6b8054e3801da9ba38ebcd604d1f55360cd49
Author: Vishesh Handa <handa.vish at gmail.com>
Date:   Thu Feb 16 14:45:01 2012 +0530

    Creates the Contacts asynchronously
    
    All Contact operations are peformed every 200 mseconds, so during
    startup when all the contacts are being created, only one asynchronous
    call is made to the storage service.
    
    This speeds up the startup exponentially.
---
 kpeople/nepomuk-feeder/nepomuk-storage.cpp | 44 ++++++++++++++++++------------
 kpeople/nepomuk-feeder/nepomuk-storage.h   |  1 +
 2 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.cpp b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
index b3a9b6d..4919020 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.cpp
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
@@ -4,7 +4,7 @@
  * Copyright (C) 2009-2011 Collabora Ltd. <info at collabora.co.uk>
  *   @author George Goldberg <george.goldberg at collabora.co.uk>
  *
- * Copyright (C) 2011 Vishesh Handa <handa.vish at gmail.com>
+ * Copyright (C) 2011-2012 Vishesh Handa <handa.vish at gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -790,23 +790,14 @@ void NepomukStorage::createContact(const QString &path, const QString &id)
     newPersonContact.addProperty(Nepomuk::Vocabulary::NCO::hasIMAccount(), newImAccount);
     newPimoPerson.addProperty(Nepomuk::Vocabulary::PIMO::groundingOccurrence(), newPersonContact);
 
-    Nepomuk::SimpleResourceGraph graph;
-    graph << newPersonContact << newImAccount << newPimoPerson;
-
-    Nepomuk::StoreResourcesJob *job = Nepomuk::storeResources( graph );
-    job->exec();
-    if( job->error() ) {
-        kWarning() << job->errorString();
-        return;
-    }
+    m_contactGraph << newPersonContact << newImAccount << newPimoPerson;
+    m_contacts.insert( identifier, ContactResources(newPimoPerson.uri(),
+                                                    newPersonContact.uri(),
+                                                    newImAccount.uri()) );
 
-    QHash< QUrl, QUrl > mappings = job->mappings();
-
-    // Add it to the Contacts list.
-    m_contacts.insert( identifier,
-                       ContactResources(mappings.value(newPimoPerson.uri()),
-                                        mappings.value(newPersonContact.uri()),
-                                        mappings.value(newImAccount.uri())) );
+    // Insert into a list so that their real uri can be set later on
+    m_unresolvedContacts.append( identifier );
+    fireContactTimer();
 }
 
 void NepomukStorage::destroyContact(const QString &path, const QString &id)
@@ -1124,6 +1115,25 @@ void NepomukStorage::onContactGraphJob(KJob* job)
         kWarning() << job->errorString();
         return;
     }
+    Nepomuk::StoreResourcesJob* sjob = dynamic_cast<Nepomuk::StoreResourcesJob*>(job);
+    QHash<QUrl, QUrl> mappings = sjob->mappings();
+
+    QList<ContactIdentifier> unresolvedContacts;
+    foreach( const ContactIdentifier& identifier, m_unresolvedContacts ) {
+        ContactResources& res = m_contacts[identifier];
+        QUrl personUri = mappings.value( res.person() );
+        QUrl contactUri = mappings.value( res.personContact() );
+        QUrl accountUri = mappings.value( res.imAccount() );
+
+        if( personUri.isEmpty() || contactUri.isEmpty() || accountUri.isEmpty() ) {
+            unresolvedContacts << identifier;
+            return;
+        }
+
+        m_contacts[identifier] = ContactResources(personUri, contactUri, accountUri);
+    }
+
+    m_unresolvedContacts = unresolvedContacts;
 }
 
 int qHash(ContactIdentifier c)
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.h b/kpeople/nepomuk-feeder/nepomuk-storage.h
index e6f8f64..62c02df 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.h
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.h
@@ -165,6 +165,7 @@ private:
     QHash<QString, AccountResources> m_accounts;
     QHash<ContactIdentifier, ContactResources> m_contacts;
 
+    QList<ContactIdentifier> m_unresolvedContacts;
     Nepomuk::SimpleResourceGraph m_contactGraph;
     QTimer m_contactsTimer;
 

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list