[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:15:42 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=7ca7cde

The following commit has been merged in the master branch:
commit 7ca7cdee6a6d2cb277ffda3792e1297fb6a05ce7
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Tue Nov 13 01:03:12 2012 +0100

    Port to the new ContactsModel
---
 contact-applet/src/abstract-contact-delegate.cpp | 28 ++++++++++++------------
 contact-applet/src/applet_config.cpp             |  8 +++----
 contact-applet/src/applet_config.h               |  4 ++--
 contact-applet/src/contact-delegate.cpp          | 12 +++++-----
 declarative-plugin/contact-list.cpp              |  8 +++----
 declarative-plugin/contact-list.h                |  4 ++--
 6 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/contact-applet/src/abstract-contact-delegate.cpp b/contact-applet/src/abstract-contact-delegate.cpp
index 4410329..fed5bcd 100644
--- a/contact-applet/src/abstract-contact-delegate.cpp
+++ b/contact-applet/src/abstract-contact-delegate.cpp
@@ -32,7 +32,7 @@
 #include <KDE/KIconLoader>
 #include <KDE/KIcon>
 
-#include <KTp/Models/accounts-model.h>
+#include <KTp/Models/contacts-model.h>
 #include <KTp/Models/accounts-model-item.h>
 #include <KTp/Models/groups-model.h>
 #include <KTp/Models/contact-model-item.h>
@@ -79,11 +79,11 @@ void AbstractContactDelegate::paint(QPainter* painter, const QStyleOptionViewIte
 
     QFont groupFont = KGlobalSettings::smallestReadableFont();
 
-    QString counts = QString(" (%1/%2)").arg(index.data(AccountsModel::OnlineUsersCountRole).toString(),
-                   index.data(AccountsModel::TotalUsersCountRole).toString());
+    QString counts = QString(" (%1/%2)").arg(index.data(ContactsModel::OnlineUsersCountRole).toString(),
+                   index.data(ContactsModel::TotalUsersCountRole).toString());
 
-    if (index.data(AccountsModel::ItemRole).userType() == qMetaTypeId<AccountsModelItem*>()) {
-        painter->drawPixmap(accountGroupRect, KIcon(index.data(AccountsModel::IconRole).toString())
+    if (index.data(ContactsModel::ItemRole).userType() == qMetaTypeId<AccountsModelItem*>()) {
+        painter->drawPixmap(accountGroupRect, KIcon(index.data(ContactsModel::IconRole).toString())
         .pixmap(ACCOUNT_ICON_SIZE, ACCOUNT_ICON_SIZE));
     } else {
         painter->drawPixmap(accountGroupRect, KIconLoader::global()->loadIcon(QString("system-users"),
@@ -137,7 +137,7 @@ bool AbstractContactDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *vi
     Q_UNUSED(option);
 
     // Check and make sure that we only want it to work on contacts and nothing else.
-    if (index.data(AccountsModel::ItemRole).userType() != qMetaTypeId<ContactModelItem*>()) {
+    if (index.data(ContactsModel::ItemRole).userType() != qMetaTypeId<ContactModelItem*>()) {
         return false;
     }
 
@@ -145,16 +145,16 @@ bool AbstractContactDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *vi
         return false;
     }
 
-    const QString contactAvatar = index.data(AccountsModel::AvatarRole).toString();
-    const QString displayName = index.parent().data(AccountsModel::DisplayNameRole).toString();
-    const QString cmIconPath = KIconLoader::global()->iconPath(index.parent().data(AccountsModel::IconRole).toString(), 1);
-    const QString alias = index.data(AccountsModel::AliasRole).toString();
-    const QString id = index.data(AccountsModel::IdRole).toString();
-    const QString presenceStatus = index.data(AccountsModel::PresenceMessageRole).toString();
+    const QString contactAvatar = index.data(ContactsModel::AvatarRole).toString();
+    const QString displayName = index.parent().data(ContactsModel::DisplayNameRole).toString();
+    const QString cmIconPath = KIconLoader::global()->iconPath(index.parent().data(ContactsModel::IconRole).toString(), 1);
+    const QString alias = index.data(ContactsModel::AliasRole).toString();
+    const QString id = index.data(ContactsModel::IdRole).toString();
+    const QString presenceStatus = index.data(ContactsModel::PresenceMessageRole).toString();
     QString presenceIconPath;
     QString presenceText;
 
-    switch (index.data(AccountsModel::PresenceTypeRole).toUInt()) {
+    switch (index.data(ContactsModel::PresenceTypeRole).toUInt()) {
         case Tp::ConnectionPresenceTypeAvailable:
             presenceIconPath = KIconLoader::global()->iconPath("user-online", 1);
             presenceText = i18nc("This is an IM user status", "Online");
@@ -212,7 +212,7 @@ bool AbstractContactDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *vi
     table += QString("<tr><td>");
     table += QString("%2").arg(presenceStatus.isEmpty() ? presenceText : presenceStatus);
     table += QString("</td></tr>");
-    if (index.data(AccountsModel::BlockedRole).toBool()) {
+    if (index.data(ContactsModel::BlockedRole).toBool()) {
         table += QString("<tr><td colspan='2'>%1</td></tr>").arg(i18n("User is blocked"));
     }
     table += QString("</table>");
diff --git a/contact-applet/src/applet_config.cpp b/contact-applet/src/applet_config.cpp
index 5a60e69..7653a49 100644
--- a/contact-applet/src/applet_config.cpp
+++ b/contact-applet/src/applet_config.cpp
@@ -20,7 +20,7 @@
 #include "applet_config.h"
 #include "contact-delegate.h"
 
-#include <KTp/Models/accounts-model.h>
+#include <KTp/Models/contacts-model.h>
 #include <KTp/Models/contact-model-item.h>
 #include <KTp/Models/groups-model.h>
 #include <KTp/Models/accounts-filter-model.h>
@@ -74,7 +74,7 @@ void AppletConfig::enableOfflineContacts(bool enable)
 void AppletConfig::setupContactsList()
 {
     // prepare models
-    m_model = new AccountsModel(this);
+    m_model = new ContactsModel(this);
     m_model->setAccountManager(m_accountManager);
     m_groupsModel = new GroupsModel(m_model, this);
     m_modelFilter = new AccountsFilterModel(this);
@@ -114,8 +114,8 @@ void AppletConfig::slotButtonClicked(int button)
     QModelIndex selectedItem = ui.contactsList->currentIndex();
 
     if (button == KDialog::Ok && selectedItem.isValid()) {
-        if (selectedItem.data(AccountsModel::ItemRole).userType() == qMetaTypeId<ContactModelItem*>()) {
-            ContactModelItem *item = selectedItem.data(AccountsModel::ItemRole).value<ContactModelItem*>();
+        if (selectedItem.data(ContactsModel::ItemRole).userType() == qMetaTypeId<ContactModelItem*>()) {
+            ContactModelItem *item = selectedItem.data(ContactsModel::ItemRole).value<ContactModelItem*>();
 
             // retrieve account related to the contact
             Tp::AccountPtr account = m_model->accountForContactItem(item);
diff --git a/contact-applet/src/applet_config.h b/contact-applet/src/applet_config.h
index 98bfd41..c236587 100644
--- a/contact-applet/src/applet_config.h
+++ b/contact-applet/src/applet_config.h
@@ -29,7 +29,7 @@ namespace Ui {
     class Config;
 }
 
-class AccountsModel;
+class ContactsModel;
 class AccountsFilterModel;
 class GroupsModel;
 
@@ -55,7 +55,7 @@ private slots:
 private:
     void setupContactsList();                               /** prepare the contacts to be show in the list */
 
-    AccountsModel *m_model;
+    ContactsModel *m_model;
     AccountsFilterModel *m_modelFilter;
     GroupsModel *m_groupsModel;
     Tp::AccountManagerPtr m_accountManager;
diff --git a/contact-applet/src/contact-delegate.cpp b/contact-applet/src/contact-delegate.cpp
index 53cd497..bfc7e16 100644
--- a/contact-applet/src/contact-delegate.cpp
+++ b/contact-applet/src/contact-delegate.cpp
@@ -33,7 +33,7 @@
 #include <KGlobalSettings>
 #include <KDE/KLocale>
 
-#include <KTp/Models/accounts-model.h>
+#include <KTp/Models/contacts-model.h>
 #include <KTp/Models/contact-model-item.h>
 #include <KTp/Models/proxy-tree-node.h>
 #include <KTp/Models/groups-model-item.h>
@@ -67,7 +67,7 @@ void ContactDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opt
     QStyle *style = QApplication::style();
     style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter);
 
-    bool isContact = index.data(AccountsModel::ItemRole).userType() == qMetaTypeId<ContactModelItem*>();
+    bool isContact = index.data(ContactsModel::ItemRole).userType() == qMetaTypeId<ContactModelItem*>();
 
     if (isContact) {
         QRect iconRect = optV4.rect;
@@ -75,7 +75,7 @@ void ContactDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opt
         iconRect.moveTo(QPoint(iconRect.x() + SPACING, iconRect.y() + SPACING));
 
         QPixmap avatar;
-        avatar.load(index.data(AccountsModel::AvatarRole).toString());
+        avatar.load(index.data(ContactsModel::AvatarRole).toString());
 
         bool noContactAvatar = avatar.isNull();
 
@@ -87,7 +87,7 @@ void ContactDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opt
 
         QPixmap icon;
 
-        switch (index.data(AccountsModel::PresenceTypeRole).toInt()) {
+        switch (index.data(ContactsModel::PresenceTypeRole).toInt()) {
         case Tp::ConnectionPresenceTypeAvailable:
             icon = SmallIcon("user-online", KIconLoader::SizeSmallMedium);
             break;
@@ -144,7 +144,7 @@ void ContactDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opt
         painter->setPen(presenceMessagePen);
 
         painter->drawText(presenceMessageRect,
-                          nameFontMetrics.elidedText(index.data(AccountsModel::PresenceMessageRole).toString(),
+                          nameFontMetrics.elidedText(index.data(ContactsModel::PresenceMessageRole).toString(),
                                                      Qt::ElideRight, presenceMessageRect.width()));
     } else {
         AbstractContactDelegate::paint(painter, option, index);
@@ -156,7 +156,7 @@ void ContactDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opt
 QSize ContactDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
 {
     Q_UNUSED(option);
-    bool isContact = index.data(AccountsModel::ItemRole).userType() == qMetaTypeId<ContactModelItem*>();
+    bool isContact = index.data(ContactsModel::ItemRole).userType() == qMetaTypeId<ContactModelItem*>();
 
     if (isContact) {
         return QSize(0, 28);
diff --git a/declarative-plugin/contact-list.cpp b/declarative-plugin/contact-list.cpp
index 834b9b3..c81ebe9 100644
--- a/declarative-plugin/contact-list.cpp
+++ b/declarative-plugin/contact-list.cpp
@@ -33,11 +33,11 @@
 
 ContactList::ContactList(QObject *parent)
     : QObject(parent),
-      m_accountsModel(new AccountsModel(this)),
+      m_contactsModel(new ContactsModel(this)),
       m_filterModel(new AccountsFilterModel(this)),
       m_flatModel(0)
 {
-    m_filterModel->setSourceModel(m_accountsModel);
+    m_filterModel->setSourceModel(m_contactsModel);
     //flat model takes the source as a constructor parameter, the other's don't.
     //due to a bug somewhere creating the flat model proxy with the filter model as a source before the filter model has a source means the rolenames do not get propgated up
     m_flatModel = new FlatModelProxy(m_filterModel);
@@ -84,7 +84,7 @@ ContactList::ContactList(QObject *parent)
 void ContactList::onAccountManagerReady(Tp::PendingOperation *op)
 {
     Q_UNUSED(op);
-    m_accountsModel->setAccountManager(m_accountManager);
+    m_contactsModel->setAccountManager(m_accountManager);
 }
 
 FlatModelProxy * ContactList::flatModel() const
@@ -103,7 +103,7 @@ void ContactList::startChat(ContactModelItem *contactItem)
     Tp::ContactPtr contact = contactItem->contact();
 
     kDebug() << "Requesting chat for contact" << contact->alias();
-    Tp::AccountPtr account = m_accountsModel->accountForContactItem(contactItem);
+    Tp::AccountPtr account = m_contactsModel->accountForContactItem(contactItem);
 
     Tp::ChannelRequestHints hints;
     hints.setHint("org.freedesktop.Telepathy.ChannelRequest","DelegateToPreferredHandler", QVariant(true));
diff --git a/declarative-plugin/contact-list.h b/declarative-plugin/contact-list.h
index fdf4c88..40b4243 100644
--- a/declarative-plugin/contact-list.h
+++ b/declarative-plugin/contact-list.h
@@ -19,7 +19,7 @@
 #ifndef CONTACT_LIST_H
 #define CONTACT_LIST_H
 
-#include <KTp/Models/accounts-model.h>
+#include <KTp/Models/contacts-model.h>
 #include <KTp/Models/flat-model-proxy.h>
 #include <KTp/Models/accounts-filter-model.h>
 
@@ -47,7 +47,7 @@ private slots:
     void onAccountManagerReady(Tp::PendingOperation *op);
     
 private:
-    AccountsModel* m_accountsModel;
+    ContactsModel* m_contactsModel;
     AccountsFilterModel* m_filterModel;
     FlatModelProxy* m_flatModel; 
     Tp::AccountManagerPtr m_accountManager;

-- 
ktp-contact-applet packaging



More information about the pkg-kde-commits mailing list