[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:08:07 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=39c6468
The following commit has been merged in the master branch:
commit 39c646849fb4b4b119d22b849710e2fd34c6e8c7
Author: Alexandr Akulich <akulichalexander at gmail.com>
Date: Thu Apr 10 20:15:30 2014 +0200
KPeople plugin: Implemented groups cache support.
REVIEW: 116706
BUG: 331272
---
.../datasourceplugin/im-persons-data-source.cpp | 32 +++++++++++++++++++---
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/kpeople/datasourceplugin/im-persons-data-source.cpp b/kpeople/datasourceplugin/im-persons-data-source.cpp
index 94d8de1..c2dc682 100644
--- a/kpeople/datasourceplugin/im-persons-data-source.cpp
+++ b/kpeople/datasourceplugin/im-persons-data-source.cpp
@@ -86,9 +86,19 @@ void KTpAllContacts::loadCache()
db.setDatabaseName(KGlobal::dirs()->locateLocal("data", QLatin1String("ktp/cache.db")));
db.open();
- QSqlQuery query(QLatin1String("SELECT accountId, contactId, alias, avatarFileName FROM contacts"), db);
+ QSqlQuery query(db);
+ query.exec(QLatin1String("SELECT groupName FROM groups ORDER BY groupId;"));
- query.exec();
+ QStringList groupsList;
+ while (query.next()) {
+ groupsList.append(query.value(0).toString());
+ }
+
+ if (!groupsList.isEmpty()) {
+ query.exec(QLatin1String("SELECT accountId, contactId, alias, avatarFileName, groupsIds FROM contacts;"));
+ } else {
+ query.exec(QLatin1String("SELECT accountId, contactId, alias, avatarFileName FROM contacts;"));
+ }
while (query.next()) {
KABC::Addressee addressee;
@@ -98,6 +108,21 @@ void KTpAllContacts::loadCache()
addressee.setFormattedName(query.value(2).toString());
addressee.setPhoto(KABC::Picture(query.value(3).toString()));
+ if (!groupsList.isEmpty()) {
+ QStringList contactGroups;
+
+ Q_FOREACH (const QString &groupIdStr, query.value(4).toString().split(QLatin1String(","))) {
+ bool convSuccess;
+ int groupId = groupIdStr.toInt(&convSuccess);
+ if ((!convSuccess) || (groupId >= groupsList.count()))
+ continue;
+
+ contactGroups.append(groupsList.at(groupId));
+ }
+
+ addressee.setCategories(contactGroups);
+ }
+
addressee.insertCustom(QLatin1String("telepathy"), QLatin1String("contactId"), contactId);
addressee.insertCustom(QLatin1String("telepathy"), QLatin1String("accountPath"), accountId);
addressee.insertCustom(QLatin1String("telepathy"), QLatin1String("presence"), QLatin1String("offline"));
@@ -115,7 +140,6 @@ void KTpAllContacts::loadCache()
emitInitialFetchComplete();
}
-
QString KTpAllContacts::createUri(const KTp::ContactPtr &contact) const
{
// so real ID will look like
@@ -257,4 +281,4 @@ K_PLUGIN_FACTORY( IMPersonsDataSourceFactory, registerPlugin<IMPersonsDataSource
K_EXPORT_PLUGIN( IMPersonsDataSourceFactory("im_persons_data_source_plugin") )
-#include "im-persons-data-source.moc"
\ No newline at end of file
+#include "im-persons-data-source.moc"
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list