[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:11:51 UTC 2016


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

The following commit has been merged in the master branch:
commit 2bb395846aade7c04d9a8b7c400b7ff230c75f8f
Author: Dan Vrátil <dvratil at redhat.com>
Date:   Sun Dec 30 14:56:48 2012 +0100

    Port ContextMenu away from GroupsModel
    
    ...and remove some unused #includes
---
 abstract-contact-delegate.cpp |  2 --
 contact-delegate-compact.cpp  |  3 ---
 contact-delegate.cpp          |  3 ---
 context-menu.cpp              | 23 ++++++++++++++---------
 4 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/abstract-contact-delegate.cpp b/abstract-contact-delegate.cpp
index 29f076c..5890e95 100644
--- a/abstract-contact-delegate.cpp
+++ b/abstract-contact-delegate.cpp
@@ -33,8 +33,6 @@
 #include <KDE/KIcon>
 
 #include <KTp/Models/contacts-model.h>
-#include <KTp/Models/accounts-model-item.h>
-#include <KTp/Models/groups-model.h>
 #include <KDebug>
 
 const int SPACING = 2;
diff --git a/contact-delegate-compact.cpp b/contact-delegate-compact.cpp
index 886d10d..aa05c5a 100644
--- a/contact-delegate-compact.cpp
+++ b/contact-delegate-compact.cpp
@@ -35,9 +35,6 @@
 #include <KDE/KLocale>
 
 #include <KTp/Models/contacts-model.h>
-#include <KTp/Models/proxy-tree-node.h>
-#include <KTp/Models/groups-model-item.h>
-#include <KTp/Models/groups-model.h>
 #include <KTp/presence.h>
 
 ContactDelegateCompact::ContactDelegateCompact(ContactDelegateCompact::ListSize size, QObject * parent)
diff --git a/contact-delegate.cpp b/contact-delegate.cpp
index 65e00ba..8f7290a 100644
--- a/contact-delegate.cpp
+++ b/contact-delegate.cpp
@@ -35,9 +35,6 @@
 #include <KDE/KLocale>
 
 #include <KTp/Models/contacts-model.h>
-#include <KTp/Models/proxy-tree-node.h>
-#include <KTp/Models/groups-model-item.h>
-#include <KTp/Models/groups-model.h>
 #include <KTp/presence.h>
 
 ContactDelegate::ContactDelegate(QObject * parent)
diff --git a/context-menu.cpp b/context-menu.cpp
index db670f7..b5d26cf 100644
--- a/context-menu.cpp
+++ b/context-menu.cpp
@@ -30,14 +30,11 @@
 #include <KAction>
 
 #include <KTp/Models/contacts-model.h>
-#include <KTp/Models/proxy-tree-node.h>
-#include <KTp/Models/groups-model-item.h>
-#include <KTp/Models/groups-model.h>
-#include <KTp/Models/accounts-filter-model.h>
 #include <KTp/text-parser.h>
 #include <KTp/Widgets/notificationconfigdialog.h>
 
 #include <TelepathyQt/ContactManager>
+#include <TelepathyQt/Account>
 
 #include <TelepathyLoggerQt4/Entity>
 #include <TelepathyLoggerQt4/LogManager>
@@ -286,7 +283,7 @@ KMenu* ContextMenu::groupContextMenu(const QModelIndex &index)
 
     m_currentIndex = index;
 
-    const QString groupName = index.data(GroupsModel::GroupNameRole).toString();
+    const QString groupName = index.data(Qt::DisplayRole).toString();
 
     KMenu *menu = new KMenu();
     menu->addTitle(groupName);
@@ -309,8 +306,11 @@ KMenu* ContextMenu::groupContextMenu(const QModelIndex &index)
 
 void ContextMenu::onRemoveContactFromGroupTriggered()
 {
-    const QString groupName = m_currentIndex.parent().data(GroupsModel::GroupNameRole).toString();
+    if (m_currentIndex.parent().data().toUInt() != ContactsModel::GroupRowType) {
+        return;
+    }
 
+    const QString groupName = m_currentIndex.parent().data(Qt::DisplayRole).toString();
     Tp::ContactPtr contact =  m_currentIndex.data(ContactsModel::ContactRole).value<Tp::ContactPtr>();
 
     Tp::PendingOperation* operation = contact->removeFromGroup(groupName);
@@ -481,7 +481,11 @@ void ContextMenu::onCreateNewGroupTriggered()
 
 void ContextMenu::onRenameGroupTriggered()
 {
-    const QString groupName = m_currentIndex.data(GroupsModel::GroupNameRole).toString();
+    if (m_currentIndex.data(ContactsModel::TypeRole).toUInt() != ContactsModel::GroupRowType) {
+        return;
+    }
+
+    const QString groupName = m_currentIndex.data(Qt::DisplayRole).toString();
     const QAbstractItemModel *model = m_currentIndex.model();
 
     bool ok = false;
@@ -510,11 +514,12 @@ void ContextMenu::onRenameGroupTriggered()
 
 void ContextMenu::onDeleteGroupTriggered()
 {
-    if (m_accountManager.isNull()) {
+    if (m_accountManager.isNull() ||
+        (m_currentIndex.data(ContactsModel::TypeRole).toUInt() != ContactsModel::GroupRowType)) {
         return;
     }
 
-    const QString groupName = m_currentIndex.data(GroupsModel::GroupNameRole).toString();
+    const QString groupName = m_currentIndex.data(Qt::DisplayRole).toString();
     const QAbstractItemModel *model = m_currentIndex.model();
 
 

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list