[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:21 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=6059c86
The following commit has been merged in the master branch:
commit 6059c8665dde9baa3b51abfcb2a601c1409d3e0b
Author: George Goldberg <george.goldberg at collabora.co.uk>
Date: Thu Aug 11 16:41:44 2011 +0100
Make the Controller send a list of all accounts to the storage on startup to enable removal of accounts that have been deleted from Nepomuk once we figure out how to do that.
---
kpeople/nepomuk-feeder/abstract-storage.h | 11 ++++++++++-
kpeople/nepomuk-feeder/controller.cpp | 8 ++++++++
kpeople/nepomuk-feeder/nepomuk-storage.cpp | 23 +++++++++++++++++++++++
kpeople/nepomuk-feeder/nepomuk-storage.h | 1 +
kpeople/nepomuk-feeder/tests/controller-test.h | 2 ++
5 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/kpeople/nepomuk-feeder/abstract-storage.h b/kpeople/nepomuk-feeder/abstract-storage.h
index ad9c67d..8850965 100644
--- a/kpeople/nepomuk-feeder/abstract-storage.h
+++ b/kpeople/nepomuk-feeder/abstract-storage.h
@@ -52,6 +52,15 @@ public:
public Q_SLOTS:
/**
+ * Invoked when the account manager is readied, this method allows the storage class to alter
+ * accounts that are no longer in the account manager as well as batch-adding any new accounts
+ * that are not yet in the store.
+ *
+ * \param paths the object paths (unique identifiers) of the complete list of Telepathy Accounts.
+ */
+ virtual void cleanupAccounts(const QList<QString> &paths) = 0;
+
+ /**
* Invoked when a Telepathy Account is constructed.
*
* \param path the object path (unique identifier) of the account
@@ -88,7 +97,7 @@ public Q_SLOTS:
/**
* Invoked when the contact list of a Telepathy Account becomes available, this method allows
- * the storage class to alter accounts that are no longer part of the server-side contact list
+ * the storage class to alter contacts that are no longer part of the server-side contact list
* as well as batch-adding any contacts to the store that have been added to the server-side
* contact list since the last run.
*
diff --git a/kpeople/nepomuk-feeder/controller.cpp b/kpeople/nepomuk-feeder/controller.cpp
index e512b21..f70d94c 100644
--- a/kpeople/nepomuk-feeder/controller.cpp
+++ b/kpeople/nepomuk-feeder/controller.cpp
@@ -114,6 +114,14 @@ void Controller::onAccountManagerReady(Tp::PendingOperation *op)
SIGNAL(newAccount(Tp::AccountPtr)),
SLOT(onNewAccount(Tp::AccountPtr)));
+ // Signal the full list of accounts to the storage so it can check that the list in Nepomuk
+ // corresponds to the list on the AM.
+ QList<QString> accounts;
+ foreach (const Tp::AccountPtr &account, m_accountManager->allAccounts()) {
+ accounts.append(account->objectPath());
+ }
+ m_storage->cleanupAccounts(accounts);
+
// Take into account (ha ha) the accounts that already existed when the AM object became ready.
foreach (const Tp::AccountPtr &account, m_accountManager->allAccounts()) {
onNewAccount(account);
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.cpp b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
index 3cb7517..b5edfb5 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.cpp
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
@@ -425,6 +425,29 @@ void NepomukStorage::onContactsQueryFinishedListing()
emit initialised(true);
}
+void NepomukStorage::cleanupAccounts(const QList<QString> &paths)
+{
+ kDebug();
+
+ // Go through all the accounts in the cache and make any that are not in the list we
+ // received from the controller are removed??? Do as a batch job for better performance.
+ foreach (const QString &aid, m_accounts.keys()) {
+ if (!paths.contains(aid)) {
+ // TODO: Do this properly once the ontology supports this
+ // TODO: Do this as a batch job to reduce the number of nepomuk queries that result.
+ // TODO: What do we do with an account in nepomuk which the use has removed?
+ }
+ }
+
+ // Go through all the accounts that we have received from the controller and create any
+ // new ones in neponmuk. Do this as a batch job to improve performance.
+ foreach (const QString &path, paths) {
+ if (!m_accounts.keys().contains(path)) {
+ // TODO: Implement me to do this as a batch job???
+ // For now, we just let the constructed signal do this one at a time.
+ }
+ }
+}
void NepomukStorage::createAccount(const QString &path, const QString &id, const QString &protocol)
{
kDebug() << "Creating a new Account";
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.h b/kpeople/nepomuk-feeder/nepomuk-storage.h
index 8242c9e..23a3a64 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.h
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.h
@@ -92,6 +92,7 @@ public:
virtual ~NepomukStorage();
public Q_SLOTS:
+ virtual void cleanupAccounts(const QList<QString> &paths);
virtual void createAccount(const QString &path, const QString &id, const QString &protocol);
virtual void destroyAccount(const QString &path);
virtual void setAccountNickname(const QString &path, const QString &nickname);
diff --git a/kpeople/nepomuk-feeder/tests/controller-test.h b/kpeople/nepomuk-feeder/tests/controller-test.h
index 908b6d5..fdff9e2 100644
--- a/kpeople/nepomuk-feeder/tests/controller-test.h
+++ b/kpeople/nepomuk-feeder/tests/controller-test.h
@@ -91,6 +91,7 @@ public Q_SLOTS:
virtual void emitInitialisedSignal();
// Not used
+ virtual void cleanupAccounts(const QList<QString> &) { }
virtual void setAccountNickname(const QString &, const QString &) { }
virtual void setAccountCurrentPresence(const QString &, const Tp::SimplePresence &) { }
virtual void cleanupAccountContacts(const QString &, const QList<QString> &) { }
@@ -123,6 +124,7 @@ public Q_SLOTS:
virtual void emitInitialisedSignal();
// Not used
+ virtual void cleanupAccounts(const QList<QString> &) { }
virtual void destroyAccount(const QString &) { }
virtual void setAccountNickname(const QString &, const QString &) { }
virtual void setAccountCurrentPresence(const QString &, const Tp::SimplePresence &) { }
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list