[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:34 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=5f23387
The following commit has been merged in the master branch:
commit 5f233877c46ea6bfbb6806c861962de6c2c5bcc1
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Mon Feb 11 10:32:16 2013 +0100
Pass around Tp::ContactPtr instead of contact id
Reviewed-by: David Edmundson
REVIEW: 108881
---
kpeople/nepomuk-feeder/abstract-storage.h | 4 ++--
kpeople/nepomuk-feeder/account.cpp | 6 ++----
kpeople/nepomuk-feeder/account.h | 4 ++--
kpeople/nepomuk-feeder/controller.cpp | 8 ++++----
kpeople/nepomuk-feeder/nepomuk-storage.cpp | 28 ++++++++++++++++++----------
kpeople/nepomuk-feeder/nepomuk-storage.h | 4 ++--
6 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/kpeople/nepomuk-feeder/abstract-storage.h b/kpeople/nepomuk-feeder/abstract-storage.h
index 0614336..5b93df2 100644
--- a/kpeople/nepomuk-feeder/abstract-storage.h
+++ b/kpeople/nepomuk-feeder/abstract-storage.h
@@ -86,7 +86,7 @@ public Q_SLOTS:
* \param path the object path (unique identifier) of the account
* \param ids the ids (e.g. me at example.com) of the complete server-side contact list of the account.
*/
- virtual void cleanupAccountContacts(const QString &path, const QList<QString> &ids) = 0;
+ virtual void cleanupAccountContacts(const QString &path, const Tp::Contacts &contacts) = 0;
/**
* Invoked when the Tp account is removed from AccountManager
@@ -102,7 +102,7 @@ public Q_SLOTS:
* \param path the object path (unique identifier) of the account
* \param id the id (e.g. me at example.com) that in conjunction with the \p path uniquely identifies the contact.
*/
- virtual void createContact(const QString &path, const QString &id) = 0;
+ virtual void createContact(const QString &path, const Tp::ContactPtr &contact) = 0;
/**
* Invoked to update the alias of the Telepathy Contact.
diff --git a/kpeople/nepomuk-feeder/account.cpp b/kpeople/nepomuk-feeder/account.cpp
index d11caef..bdb616d 100644
--- a/kpeople/nepomuk-feeder/account.cpp
+++ b/kpeople/nepomuk-feeder/account.cpp
@@ -126,7 +126,7 @@ void Account::onContactManagerStateChanged(Tp::ContactListState state)
foreach (const Tp::ContactPtr &contact, contacts) {
initialContacts.append(contact->id());
}
- emit initialContactsLoaded(m_account->objectPath(), initialContacts);
+ emit initialContactsLoaded(m_account->objectPath(), contacts);
// Create wrapper objects for all the Contacts.
foreach (const Tp::ContactPtr &contact, contacts) {
@@ -193,10 +193,8 @@ void Account::onNewContact(const Tp::ContactPtr &contact)
SIGNAL(avatarDataChanged(Tp::AvatarData)),
SLOT(onContactAvatarChanged(Tp::AvatarData)));
- emit contactCreated(m_account->objectPath(), contact->id());
+ emit contactCreated(m_account->objectPath(), contact);
- onContactAddedToGroup(contact);
- onContactAliasChanged(contact);
}
}
diff --git a/kpeople/nepomuk-feeder/account.h b/kpeople/nepomuk-feeder/account.h
index c09d946..8389d0f 100644
--- a/kpeople/nepomuk-feeder/account.h
+++ b/kpeople/nepomuk-feeder/account.h
@@ -51,10 +51,10 @@ Q_SIGNALS:
void created(const QString &path, const QString &id, const QString &protocol);
void accountDestroyed(const QString &path);
void nicknameChanged(const QString &path, const QString &nickname);
- void initialContactsLoaded(const QString &path, const QList<QString> &ids);
+ void initialContactsLoaded(const QString &path, const Tp::Contacts &contacts);
void accountRemoved(const QString &path);
- void contactCreated(const QString &path, const QString &id);
+ void contactCreated(const QString &path, const Tp::ContactPtr &contact);
void contactAliasChanged(const QString &path, const QString &id, const QString &alias);
void contactGroupsChanged(const QString &path, const QString &id, const QStringList &groups);
void contactAvatarChanged(const QString &path, const QString &id, const Tp::AvatarData &avatar);
diff --git a/kpeople/nepomuk-feeder/controller.cpp b/kpeople/nepomuk-feeder/controller.cpp
index c1cec56..725fc9b 100644
--- a/kpeople/nepomuk-feeder/controller.cpp
+++ b/kpeople/nepomuk-feeder/controller.cpp
@@ -136,14 +136,14 @@ void Controller::onNewAccount(const Tp::AccountPtr &account)
m_storage, SLOT(createAccount(QString,QString,QString)));
connect(acc, SIGNAL(nicknameChanged(QString,QString)),
m_storage, SLOT(setAccountNickname(QString,QString)));
- connect(acc, SIGNAL(initialContactsLoaded(QString,QList<QString>)),
- m_storage, SLOT(cleanupAccountContacts(QString,QList<QString>)));
+ connect(acc, SIGNAL(initialContactsLoaded(QString,Tp::Contacts)),
+ m_storage, SLOT(cleanupAccountContacts(QString,Tp::Contacts)));
connect(acc, SIGNAL(accountRemoved(QString)),
m_storage, SLOT(onAccountRemoved(QString)));
// Connect to all the signals/slots that signify the contacts are changing in some way.
- connect(acc, SIGNAL(contactCreated(QString,QString)),
- m_storage, SLOT(createContact(QString,QString)));
+ connect(acc, SIGNAL(contactCreated(QString,Tp::ContactPtr)),
+ m_storage, SLOT(createContact(QString,Tp::ContactPtr)));
connect(acc, SIGNAL(contactAliasChanged(QString,QString,QString)),
m_storage, SLOT(setContactAlias(QString,QString,QString)));
connect(acc, SIGNAL(contactGroupsChanged(QString,QString,QStringList)),
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.cpp b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
index be80e23..bc34010 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.cpp
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
@@ -518,9 +518,13 @@ void NepomukStorage::fireGraphTimer()
-void NepomukStorage::cleanupAccountContacts(const QString &path, const QList<QString> &ids)
+void NepomukStorage::cleanupAccountContacts(const QString &path, const Tp::Contacts &contacts)
{
- QSet<QString> idSet = ids.toSet();
+ QHash<QString, Tp::ContactPtr> contactHash;
+
+ Q_FOREACH (const Tp::ContactPtr &contact, contacts) {
+ contactHash.insert(contact->id(), contact);
+ }
// Go through all the contacts that we have received from the account and create any
// new ones in Nepomuk.
@@ -529,9 +533,11 @@ void NepomukStorage::cleanupAccountContacts(const QString &path, const QList<QSt
nepomukIds.insert(ci.contactId());
}
- QSet<QString> newIds = idSet.subtract(nepomukIds);
+ QSet<QString> oldIds = contactHash.keys().toSet();
+
+ QSet<QString> newIds = oldIds.subtract(nepomukIds);
foreach (const QString &id, newIds) {
- createContact(path, id);
+ createContact(path, contactHash[id]);
}
}
@@ -559,17 +565,20 @@ void NepomukStorage::onAccountRemoved(const QString &path)
this, SLOT(onContactGraphJob(KJob*)));
}
-void NepomukStorage::createContact(const QString &path, const QString &id)
+void NepomukStorage::createContact(const QString &path, const Tp::ContactPtr &contact)
{
+ if (contact.isNull()) {
+ return;
+ }
// First, check that we don't already have a record for this contact.
- ContactIdentifier identifier(path, id);
+ ContactIdentifier identifier(path, contact->id());
if (m_contacts.contains(identifier)) {
// kDebug() << "Contact record already exists. Return.";
return;
}
// Contact not found. Need to create it.
- kDebug() << path << id;
+ kDebug() << path << contact->id();
kDebug() << "Contact not found in Nepomuk. Creating it.";
Q_ASSERT(m_accounts.contains(path));
@@ -587,11 +596,10 @@ void NepomukStorage::createContact(const QString &path, const QString &id)
Nepomuk2::SimpleResource newImAccount;
//TODO: Somehow add this imAccount as a sub resource the account, maybe.
newImAccount.addType(NCO::IMAccount());
- newImAccount.setProperty(NCO::imStatus(), QString::fromLatin1("unknown"));
- newImAccount.setProperty(NCO::imID(), id);
- newImAccount.setProperty(Telepathy::statusType(), Tp::ConnectionPresenceTypeUnknown);
+ newImAccount.setProperty(NCO::imID(), contact->id());
newImAccount.setProperty(NCO::imAccountType(), accountRes.protocol());
newImAccount.addProperty(NCO::isAccessedBy(), accountUri);
+ newImAccount.addProperty(NCO::imNickname(), contact->alias());
newPersonContact.addProperty(NCO::hasIMAccount(), newImAccount);
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.h b/kpeople/nepomuk-feeder/nepomuk-storage.h
index 8190a5b..ad5b6bc 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.h
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.h
@@ -123,10 +123,10 @@ public Q_SLOTS:
virtual void cleanupAccounts(const QList<QString> &paths);
virtual void createAccount(const QString &path, const QString &id, const QString &protocol);
virtual void setAccountNickname(const QString &path, const QString &nickname);
- virtual void cleanupAccountContacts(const QString &path, const QList<QString> &ids);
+ virtual void cleanupAccountContacts(const QString &path, const Tp::Contacts &contacts);
virtual void onAccountRemoved(const QString &path);
- virtual void createContact(const QString &path, const QString &id);
+ virtual void createContact(const QString &path, const Tp::ContactPtr &contact);
virtual void setContactAlias(const QString &path, const QString &id, const QString &alias);
virtual void setContactGroups(const QString &path, const QString &id, const QStringList &groups);
virtual void setContactAvatar(const QString &path, const QString &id, const Tp::AvatarData &avatar);
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list