[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:00 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=a600861
The following commit has been merged in the master branch:
commit a600861fac694549173682163db36d611e166da6
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Wed Jul 17 23:30:21 2013 +0000
Fetch Tp accountPath from nepomuk in the initial query
This avoids doing a synchronous queries in the case where the contact is
offline
---
KTp/Models/contacts-model.cpp | 8 ++++++++
KTp/Models/kpeopletranslationproxy.cpp | 15 +++++----------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/KTp/Models/contacts-model.cpp b/KTp/Models/contacts-model.cpp
index 697c241..dfa2c41 100644
--- a/KTp/Models/contacts-model.cpp
+++ b/KTp/Models/contacts-model.cpp
@@ -68,7 +68,15 @@ KTp::ContactsModel::ContactsModel(QObject *parent)
kDebug() << "Nepomuk is enabled, using kpeople model";
KPeople::PersonsModel *personsModel = new KPeople::PersonsModel(this);
+ KPeople::PersonsModelFeature accountFeature;
+ QHash<QString, int> bindingMap;
+ bindingMap[QLatin1String("account")] = KPeople::PersonsModel::UserRole;
+ accountFeature.setBindingsMap(bindingMap);
+ accountFeature.setOptional(false);
+ accountFeature.setQueryPart(QLatin1String("?uri nco:hasIMAccount ?imAccount . ?imAccount nco:isAccessedBy ?accessedBy . ?accessedBy telepathy:accountIdentifier ?account . "));
+
personsModel->startQuery(QList<KPeople::PersonsModelFeature>() << KPeople::PersonsModelFeature::imModelFeature()
+ << accountFeature
<< KPeople::PersonsModelFeature::avatarModelFeature(KPeople::PersonsModelFeature::Mandatory)
<< KPeople::PersonsModelFeature::groupsModelFeature(KPeople::PersonsModelFeature::Mandatory));
d->source = new KPeopleTranslationProxy(this);
diff --git a/KTp/Models/kpeopletranslationproxy.cpp b/KTp/Models/kpeopletranslationproxy.cpp
index 54f181d..8a1c2d9 100644
--- a/KTp/Models/kpeopletranslationproxy.cpp
+++ b/KTp/Models/kpeopletranslationproxy.cpp
@@ -56,6 +56,11 @@ QVariant KPeopleTranslationProxy::data(const QModelIndex &proxyIndex, int role)
return QVariant();
}
+ if (role == KTp::AccountRole) {
+ QString accountPath = mapToSource(proxyIndex).data(PersonsModel::UserRole).toString();
+ imPlugin->accountManager()->accountForObjectPath(accountPath);
+ }
+
switch (role) {
case KTp::ContactPresenceTypeRole:
return translatePresence(mapToSource(proxyIndex).data(PersonsModel::PresenceTypeRole));
@@ -116,9 +121,6 @@ QVariant KPeopleTranslationProxy::data(const QModelIndex &proxyIndex, int role)
case KTp::ContactRole:
return QVariant::fromValue<KTp::ContactPtr>(contact);
break;
- case KTp::AccountRole:
- return QVariant::fromValue<Tp::AccountPtr>(imPlugin->accountForContact(contact));
- break;
case KTp::ContactPresenceMessageRole:
return contact->presence().statusMessage();
break;
@@ -141,13 +143,6 @@ QVariant KPeopleTranslationProxy::data(const QModelIndex &proxyIndex, int role)
return contact->clientTypes();
break;
}
- } else if (contact.isNull() && role == KTp::AccountRole) {
- //if the KTp contact is null, we still need the Tp account for that contact
- //so we can either group it properly or bring that account online if user
- //starts a chat with a contact that belongs to offline account
- QString contactId = j > 0 ? mapToSource(proxyIndex).data(PersonsModel::IMsRole).toList().first().toString()
- : mapToSource(proxyIndex).data(PersonsModel::IMsRole).toString();
- return QVariant::fromValue<Tp::AccountPtr>(imPlugin->accountForContactId(contactId));
}
// }
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list