[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:04:35 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=1291257

The following commit has been merged in the master branch:
commit 1291257c540cdcc8da34936e1c9551cfa624e49c
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Sun Mar 7 14:25:12 2010 +0000

    Add custom roles to the contactlist model for Groups and PresenceType.
    
    svn path=/trunk/playground/network/telepathy-contactlist/; revision=1100414
---
 CMakeLists.txt          |  7 -------
 contact-item.cpp        | 26 ++++++++++++++++++++++++++
 contact-item.h          |  2 ++
 contacts-list-model.cpp |  6 ++++++
 contacts-list-model.h   |  5 +++++
 5 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index de4baf1..4e76ee8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -81,13 +81,6 @@ kde4_add_ui_files (contactlist_SRCS
                    main-widget.ui
 )
 
-nepomuk_add_ontology_classes (contactlist_NEPOMUK_SRCS 
-                              ONTOLOGIES
-                              ${NCO_TRIG_SOURCE}
-                              CLASSES
-                              "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#PersonContact"
-)
-
 soprano_add_ontology(nco_SRCS ${NCO_TRIG_SOURCE} "NCO" "Nepomuk::Vocabulary" "trig")
 soprano_add_ontology(pimo_SRCS ${PIMO_TRIG_SOURCE} "PIMO" "Nepomuk::Vocabulary" "trig")
 soprano_add_ontology(telepathy_SRCS ${TELEPATHY_TRIG_SOURCE} "Telepathy" "Nepomuk::Vocabulary" "trig")
diff --git a/contact-item.cpp b/contact-item.cpp
index 6470fef..c8a3b15 100644
--- a/contact-item.cpp
+++ b/contact-item.cpp
@@ -21,6 +21,8 @@
 
 #include "contact-item.h"
 
+#include "contactgroup.h"
+
 #include <KDebug>
 
 ContactItem::ContactItem(Nepomuk::PersonContact personContact,
@@ -100,6 +102,30 @@ const KIcon& ContactItem::presenceIcon() const
     return *m_presenceIcon;
 }
 
+qint64 ContactItem::presenceType() const
+{
+    QList<qint64> statusTypes = m_imAccount.statusTypes();
+
+    if (statusTypes.size() == 0) {
+        return 1;
+    }
+
+    return statusTypes.first();
+}
+
+QStringList ContactItem::groups() const
+{
+    QList<Nepomuk::ContactGroup> groups = m_personContact.belongsToGroups();
+
+    QStringList groupNames;
+
+    foreach (const Nepomuk::ContactGroup &group, groups) {
+        groupNames << group.contactGroupName();
+    }
+
+    return groupNames;
+}
+
 void ContactItem::onStatementAdded(const Soprano::Statement &statement)
 {
     kDebug() << "Statement added called.";
diff --git a/contact-item.h b/contact-item.h
index 7bdf85c..a80490a 100644
--- a/contact-item.h
+++ b/contact-item.h
@@ -43,6 +43,8 @@ public:
 
     QString displayName() const;
     const KIcon& presenceIcon() const;
+    qint64 presenceType() const;
+    QStringList groups() const;
 
     virtual void onStatementAdded(const Soprano::Statement &statement);
 
diff --git a/contacts-list-model.cpp b/contacts-list-model.cpp
index 1f251f8..a556f20 100644
--- a/contacts-list-model.cpp
+++ b/contacts-list-model.cpp
@@ -114,6 +114,12 @@ QVariant ContactsListModel::data(const QModelIndex &index, int role) const
     case Qt::DecorationRole:
         data.setValue<QIcon>(m_contactItems.at(index.row())->presenceIcon());
         break;
+    case ContactsListModel::PresenceTypeRole:
+        data.setValue<qint64>(m_contactItems.at(index.row())->presenceType());
+        break;
+    case ContactsListModel::GroupsRole:
+        data.setValue<QStringList>(m_contactItems.at(index.row())->groups());
+        break;
     default:
         break;
     }
diff --git a/contacts-list-model.h b/contacts-list-model.h
index 3d3857f..31bc134 100644
--- a/contacts-list-model.h
+++ b/contacts-list-model.h
@@ -31,6 +31,11 @@ class ContactsListModel : public QAbstractListModel
     Q_OBJECT
 
 public:
+    enum {
+        PresenceTypeRole = Qt::UserRole,
+        GroupsRole
+    };
+
     explicit ContactsListModel(QObject *parent = 0);
     virtual ~ContactsListModel();
 

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list