[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:12:14 UTC 2016


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

The following commit has been merged in the master branch:
commit 552f5a05354a3ff1d0889288d41e2ca133466ba6
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Fri Feb 1 17:44:39 2013 +0100

    First bunch of refactors
---
 contact-delegate-compact.cpp |  8 ++++----
 context-menu.cpp             | 19 ++++++++++---------
 tooltips/contacttooltip.cpp  | 10 +++++-----
 tooltips/tooltipmanager.cpp  |  8 +++-----
 4 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/contact-delegate-compact.cpp b/contact-delegate-compact.cpp
index c6da9af..7fedb1f 100644
--- a/contact-delegate-compact.cpp
+++ b/contact-delegate-compact.cpp
@@ -65,7 +65,7 @@ void ContactDelegateCompact::paintContact(QPainter * painter, const QStyleOption
     iconRect.moveTo(QPoint(iconRect.x() + m_spacing, iconRect.y() + m_spacing));
 
     QPixmap avatar;
-    avatar.load(index.data(KTp::AvatarRole).toString());
+    avatar.load(index.data(KTp::ContactAvatarPathRole).toString());
 
     bool noContactAvatar = avatar.isNull();
 
@@ -78,7 +78,7 @@ void ContactDelegateCompact::paintContact(QPainter * painter, const QStyleOption
     // This value is used to set the correct width for the username and the presence message.
     int rightIconsWidth = m_presenceIconSize + m_spacing;
 
-    QPixmap icon = KIcon(index.data(KTp::PresenceIconRole).toString()).pixmap(KIconLoader::SizeSmallMedium);
+    QPixmap icon = KIcon(index.data(KTp::ContactPresenceIconRole).toString()).pixmap(KIconLoader::SizeSmallMedium);
 
     QRect statusIconRect = optV4.rect;
 
@@ -89,7 +89,7 @@ void ContactDelegateCompact::paintContact(QPainter * painter, const QStyleOption
     painter->drawPixmap(statusIconRect, icon);
 
     // Right now we only check for 'phone', as that's the most interesting type.
-    if (index.data(KTp::ClientTypesRole).toStringList().contains(QLatin1String("phone"))) {
+    if (index.data(KTp::ContactClientTypesRole).toStringList().contains(QLatin1String("phone"))) {
         // Additional space is needed for the icons, don't add too much spacing between the two icons
         rightIconsWidth += m_clientTypeIconSize + (m_spacing / 2);
 
@@ -139,7 +139,7 @@ void ContactDelegateCompact::paintContact(QPainter * painter, const QStyleOption
     }
 
     painter->drawText(presenceMessageRect,
-                      nameFontMetrics.elidedText(presence.statusMessage().simplified(),
+                      nameFontMetrics.elidedText(index.data(KTp::ContactPresenceMessageRole).toString().trimmed(),
                                                  Qt::ElideRight, presenceMessageRect.width()));
 
     painter->restore();
diff --git a/context-menu.cpp b/context-menu.cpp
index a339bfc..52605a3 100644
--- a/context-menu.cpp
+++ b/context-menu.cpp
@@ -29,13 +29,14 @@
 #include <KMessageBox>
 #include <KAction>
 
-#include <KTp/Models/contacts-model.h>
 #include <KTp/text-parser.h>
 #include <KTp/Widgets/notificationconfigdialog.h>
 #include <KTp/contact-info-dialog.h>
+#include <KTp/types.h>
 
 #include <TelepathyQt/ContactManager>
 #include <TelepathyQt/Account>
+#include <TelepathyQt/PendingOperation>
 
 #include <TelepathyLoggerQt4/Entity>
 #include <TelepathyLoggerQt4/LogManager>
@@ -103,7 +104,7 @@ KMenu* ContextMenu::contactContextMenu(const QModelIndex &index)
     connect(action, SIGNAL(triggered(bool)),
             SLOT(onStartTextChatTriggered()));
 
-    if (index.data(ContactsModel::TextChatCapabilityRole).toBool()) {
+    if (index.data(KTp::ContactCanTextChatRole).toBool()) {
         action->setEnabled(true);
     }
 
@@ -119,7 +120,7 @@ KMenu* ContextMenu::contactContextMenu(const QModelIndex &index)
     connect(action, SIGNAL(triggered(bool)),
             SLOT(onStartAudioChatTriggered()));
 
-    if (index.data(ContactsModel::AudioCallCapabilityRole).toBool()) {
+    if (index.data(KTp::ContactCanAudioCallRole).toBool()) {
         action->setEnabled(true);
     }
 
@@ -129,7 +130,7 @@ KMenu* ContextMenu::contactContextMenu(const QModelIndex &index)
     connect(action, SIGNAL(triggered(bool)),
             SLOT(onStartVideoChatTriggered()));
 
-    if (index.data(ContactsModel::VideoCallCapabilityRole).toBool()) {
+    if (index.data(KTp::ContactCanVideoCallRole).toBool()) {
         action->setEnabled(true);
     }
 
@@ -139,7 +140,7 @@ KMenu* ContextMenu::contactContextMenu(const QModelIndex &index)
     connect(action, SIGNAL(triggered(bool)),
             SLOT(onStartFileTransferTriggered()));
 
-    if (index.data(ContactsModel::FileTransferCapabilityRole).toBool()) {
+    if (index.data(KTp::ContactCanFileTransferRole).toBool()) {
         action->setEnabled(true);
     }
 
@@ -149,7 +150,7 @@ KMenu* ContextMenu::contactContextMenu(const QModelIndex &index)
     connect(action, SIGNAL(triggered(bool)),
             SLOT(onStartDesktopSharingTriggered()));
 
-    if (index.data(ContactsModel::DesktopSharingCapabilityRole).toBool()) {
+    if (index.data(KTp::ContactTubesRole).toStringList().contains(QLatin1String("rfb"))) {
         action->setEnabled(true);
     }
 
@@ -173,7 +174,7 @@ KMenu* ContextMenu::contactContextMenu(const QModelIndex &index)
     // add "goto" submenu for navigating to links the contact has in presence message
     // first check to see if there are any links in the contact's presence message
     QStringList contactLinks;
-    QString presenceMsg = index.data(ContactsModel::PresenceMessageRole).toString();
+    QString presenceMsg = index.data(KTp::ContactPresenceMessageRole).toString();
     if (presenceMsg.isEmpty()) {
         contactLinks = QStringList();
     } else {
@@ -306,14 +307,14 @@ KMenu* ContextMenu::groupContextMenu(const QModelIndex &index)
 
 void ContextMenu::onRemoveContactFromGroupTriggered()
 {
-    if (m_currentIndex.parent().data(ContactsModel::TypeRole).toUInt() != ContactsModel::GroupRowType) {
+    if (m_currentIndex.parent().data(KTp::RowTypeRole).toUInt() != KTp::GroupRowType) {
         return;
     }
 
     const QString groupName = m_currentIndex.parent().data(Qt::DisplayRole).toString();
     Tp::ContactPtr contact =  m_currentIndex.data(KTp::ContactRole).value<Tp::ContactPtr>();
 
-    Tp::PendingOperation* operation = contact->removeFromGroup(groupName);
+    Tp::PendingOperation *operation = contact->removeFromGroup(groupName);
 
     if (operation) {
         connect(operation, SIGNAL(finished(Tp::PendingOperation*)),
diff --git a/tooltips/contacttooltip.cpp b/tooltips/contacttooltip.cpp
index d541920..5bdab3e 100644
--- a/tooltips/contacttooltip.cpp
+++ b/tooltips/contacttooltip.cpp
@@ -44,7 +44,7 @@ ContactToolTip::ContactToolTip(const QModelIndex &index) :
     ui->avatarLabel->setScaledContents(false);
     ui->avatarLabel->setAlignment(Qt::AlignCenter);
 
-    QString avatar = index.data(KTp::AvatarRole).toString();
+    QString avatar = index.data(KTp::ContactAvatarPathRole).toString();
     if (avatar.isEmpty()) {
         ui->avatarLabel->setPixmap(KIconLoader::global()->loadIcon("im-user", KIconLoader::NoGroup, 96));
     } else {
@@ -52,9 +52,9 @@ ContactToolTip::ContactToolTip(const QModelIndex &index) :
         ui->avatarLabel->setPixmap(avatarPixmap.scaled(ui->avatarLabel->size(), Qt::KeepAspectRatio));
     }
 
-    QString presenceMessage = index.data(KTp::ContactPresenceMessageRole);
-    QString presenceIconPath = index.data(KTp::ContactPresenceIconRole);
-    QString presenceText = index.data(KTp::ContactPresenceNameRole);
+    QString presenceMessage = index.data(KTp::ContactPresenceMessageRole).toString();
+    QString presenceIconPath = index.data(KTp::ContactPresenceIconRole).toString();
+    QString presenceText = index.data(KTp::ContactPresenceNameRole).toString();
 
     if (index.data(KTp::ContactPresenceTypeRole).toInt() == Tp::ConnectionPresenceTypeError) {
         presenceIconPath = KIconLoader::global()->iconPath("task-attention", 1);
@@ -70,7 +70,7 @@ ContactToolTip::ContactToolTip(const QModelIndex &index) :
     ui->presenceIcon->setPixmap(QPixmap(presenceIconPath));
     ui->presenceLabel->setText(presenceText);
     ui->presenceMessageLabel->setText(presenceMessage);
-    ui->blockedLabel->setShown(index.data(KTp::BlockedRole).toBool());
+    ui->blockedLabel->setShown(index.data(KTp::ContactIsBlockedRole).toBool());
 
     const Tp::AccountPtr account = index.data(KTp::AccountRole).value<Tp::AccountPtr>();
     ui->accountLabel->setText(i18n("Account: %1").arg(account->displayName()));
diff --git a/tooltips/tooltipmanager.cpp b/tooltips/tooltipmanager.cpp
index a4aa740..648933b 100644
--- a/tooltips/tooltipmanager.cpp
+++ b/tooltips/tooltipmanager.cpp
@@ -37,9 +37,7 @@
 #include <KIcon>
 #include <KColorScheme>
 
-#include <KTp/Models/contacts-model.h>
-#include <KTp/Models/contact-model-item.h>
-
+#include <KTp/types.h>
 
 class ToolTipManager::Private
 {
@@ -138,13 +136,13 @@ void ToolTipManager::prepareToolTip()
     }
 }
 
-void ToolTipManager::showToolTip(const  QModelIndex &menuItem)
+void ToolTipManager::showToolTip(const QModelIndex &menuItem)
 {
     if (QApplication::mouseButtons() & Qt::LeftButton || !menuItem.isValid()) {
         return;
     }
 
-    if (!menuItem.data(ContactsModel::ContactRole).canConvert<Tp::ContactPtr>()) {
+    if (!menuItem.data(KTp::RowTypeRole).toUInt() == KTp::ContactRowType) {
         return;
     }
 

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list