[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=9939bde
The following commit has been merged in the master branch:
commit 9939bde3e39076e0e285e8e4b036b12fab6d827f
Author: Vishesh Handa <handa.vish at gmail.com>
Date: Thu Feb 16 18:20:26 2012 +0530
Create all the accounts asynchronously
---
kpeople/nepomuk-feeder/nepomuk-storage.cpp | 43 ++++++++++++++++++------------
kpeople/nepomuk-feeder/nepomuk-storage.h | 2 ++
2 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.cpp b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
index 83c4499..7a64bf1 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.cpp
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
@@ -617,23 +617,12 @@ void NepomukStorage::createAccount(const QString &path, const QString &id, const
Nepomuk::SimpleResource mePersonContact(m_mePersonContact);
mePersonContact.addProperty(Nepomuk::Vocabulary::NCO::hasIMAccount(), imAccount);
- // Add all changed resources to a graph and save it.
- Nepomuk::SimpleResourceGraph graph;
- graph << imAccount << mePersonContact;
+ m_graph << imAccount << mePersonContact;
+ m_accounts.insert(path, AccountResources(imAccount.uri(), protocol));
- Nepomuk::StoreResourcesJob *job = Nepomuk::storeResources(graph);
- job->exec();
- if( job->error() ) {
- kWarning() << job->errorString();
- return;
- }
-
- QUrl accountUri = job->mappings().value( imAccount.uri() );
- Q_ASSERT(!accountUri.isEmpty());
+ m_unresolvedAccounts << path;
- kDebug() << ">>>>>***** The Account URI is:" << accountUri;
- // Add the account to the list.
- m_accounts.insert(path, AccountResources(accountUri, protocol));
+ fireGraphTimer();
}
void NepomukStorage::destroyAccount(const QString &path)
@@ -1131,22 +1120,42 @@ void NepomukStorage::onContactGraphJob(KJob* job)
Nepomuk::StoreResourcesJob* sjob = dynamic_cast<Nepomuk::StoreResourcesJob*>(job);
QHash<QUrl, QUrl> mappings = sjob->mappings();
+ //
+ // Resolve all the contacts
+ //
QList<ContactIdentifier> unresolvedContacts;
foreach( const ContactIdentifier& identifier, m_unresolvedContacts ) {
- ContactResources& res = m_contacts[identifier];
+ const 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;
+ continue;
}
m_contacts[identifier] = ContactResources(personUri, contactUri, accountUri);
}
m_unresolvedContacts = unresolvedContacts;
+
+ //
+ // Resolve all the accounts
+ //
+ QList<QString> unresolvedAccounts;
+ foreach( const QString& path, m_unresolvedAccounts ) {
+ const AccountResources& res = m_accounts[path];
+ const QUrl accountUri = mappings.value( res.account() );
+
+ if( accountUri.isEmpty() ) {
+ unresolvedAccounts << path;
+ continue;
+ }
+
+ m_accounts[path] = AccountResources(accountUri, res.protocol());
+ }
+ m_unresolvedAccounts = unresolvedAccounts;
}
void NepomukStorage::onRemovePropertiesJob(KJob* job)
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.h b/kpeople/nepomuk-feeder/nepomuk-storage.h
index a58cbe4..4583b5a 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.h
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.h
@@ -170,6 +170,8 @@ private:
QHash<ContactIdentifier, ContactResources> m_contacts;
QList<ContactIdentifier> m_unresolvedContacts;
+ QList<QString> m_unresolvedAccounts;
+
Nepomuk::SimpleResourceGraph m_graph;
QTimer m_graphTimer;
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list