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


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

The following commit has been merged in the master branch:
commit 117d739f5c66bb572f9733053a75263c23a9e628
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Fri Feb 1 11:31:06 2013 +0000

    Port more to new enum
---
 CMakeLists.txt                |  4 ++++
 abstract-contact-delegate.cpp | 15 +++++++--------
 contact-delegate-compact.cpp  | 11 ++++-------
 main-widget.cpp               | 16 ++++++++++------
 tooltips/contacttooltip.cpp   | 26 +++++++++-----------------
 5 files changed, 34 insertions(+), 38 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a1c0fe..bda1078 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,6 +74,10 @@ target_link_libraries (ktp-contactlist
                        ${TELEPATHY_LOGGER_QT4_LIBRARIES}
 )
 
+install(FILES ktp-contact-list.rc
+        DESTINATION  ${DATA_INSTALL_DIR}/ktp-contact-list/)
+
+
 # Install:
 install (TARGETS ktp-contactlist
          DESTINATION ${BIN_INSTALL_DIR}
diff --git a/abstract-contact-delegate.cpp b/abstract-contact-delegate.cpp
index 5890e95..e49eba3 100644
--- a/abstract-contact-delegate.cpp
+++ b/abstract-contact-delegate.cpp
@@ -32,7 +32,7 @@
 #include <KDE/KIconLoader>
 #include <KDE/KIcon>
 
-#include <KTp/Models/contacts-model.h>
+#include <KTp/type.h>
 #include <KDebug>
 
 const int SPACING = 2;
@@ -49,7 +49,7 @@ AbstractContactDelegate::~AbstractContactDelegate()
 
 void AbstractContactDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
 {
-    if (index.data(ContactsModel::TypeRole).toInt() == ContactsModel::ContactRowType) {
+    if (index.data(KTp::RowTypeRole).toInt() == KTp::ContactRowType) {
         paintContact(painter, option, index);
     } else {
         paintHeader(painter, option, index);
@@ -60,7 +60,7 @@ QSize AbstractContactDelegate::sizeHint(const QStyleOptionViewItem& option, cons
 {
     Q_UNUSED(option);
 
-    if (index.data(ContactsModel::TypeRole).toInt() == ContactsModel::ContactRowType) {
+    if (index.data(KTp::RowTypeRole).toInt() == KTp::ContactRowType) {
         return sizeHintContact(option, index);
     } else {
         return sizeHintHeader(option, index);
@@ -96,12 +96,11 @@ void AbstractContactDelegate::paintHeader(QPainter *painter, const QStyleOptionV
 
     QFont groupFont = KGlobalSettings::smallestReadableFont();
 
-    QString counts = QString(" (%1/%2)").arg(index.data(ContactsModel::OnlineUsersCountRole).toString(),
-                     index.data(ContactsModel::TotalUsersCountRole).toString());
+    QString counts = QString(" (%1/%2)").arg(index.data(KTp::HeaderOnlineUsersRole).toString(),
+                     index.data(KTp::HeaderTotalUsersRole).toString());
 
-    if (index.data(ContactsModel::TypeRole).toInt() == ContactsModel::AccountRowType) {
-        painter->drawPixmap(accountGroupRect, KIcon(index.data(ContactsModel::IconRole).toString())
-                            .pixmap(32));
+    if (index.data(KTp::RowTypeRole).toInt() == KTp::AccountRowType) {
+        painter->drawPixmap(accountGroupRect, KIcon(index.data(Qt::DecorationRole).value<QIcon>().pixmap(32));
     } else {
         painter->drawPixmap(accountGroupRect, KIconLoader::global()->loadIcon(QString("system-users"),
                             KIconLoader::Desktop));
diff --git a/contact-delegate-compact.cpp b/contact-delegate-compact.cpp
index aa05c5a..c6da9af 100644
--- a/contact-delegate-compact.cpp
+++ b/contact-delegate-compact.cpp
@@ -34,8 +34,7 @@
 #include <KGlobalSettings>
 #include <KDE/KLocale>
 
-#include <KTp/Models/contacts-model.h>
-#include <KTp/presence.h>
+#include <KTp/types.h>
 
 ContactDelegateCompact::ContactDelegateCompact(ContactDelegateCompact::ListSize size, QObject * parent)
     : AbstractContactDelegate(parent)
@@ -66,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(ContactsModel::AvatarRole).toString());
+    avatar.load(index.data(KTp::AvatarRole).toString());
 
     bool noContactAvatar = avatar.isNull();
 
@@ -76,12 +75,10 @@ void ContactDelegateCompact::paintContact(QPainter * painter, const QStyleOption
 
     style->drawItemPixmap(painter, iconRect, Qt::AlignCenter, avatar.scaled(iconRect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
 
-    KTp::Presence presence = index.data(ContactsModel::PresenceRole).value<KTp::Presence>();
-
     // This value is used to set the correct width for the username and the presence message.
     int rightIconsWidth = m_presenceIconSize + m_spacing;
 
-    QPixmap icon = presence.icon().pixmap(KIconLoader::SizeSmallMedium);
+    QPixmap icon = KIcon(index.data(KTp::PresenceIconRole).toString()).pixmap(KIconLoader::SizeSmallMedium);
 
     QRect statusIconRect = optV4.rect;
 
@@ -92,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(ContactsModel::ClientTypesRole).toStringList().contains(QLatin1String("phone"))) {
+    if (index.data(KTp::ClientTypesRole).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);
 
diff --git a/main-widget.cpp b/main-widget.cpp
index 31bb688..6cef884 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -1,10 +1,11 @@
 /*
- * This file is part of telepathy-contactslist-prototype
+ * This file is part of ktp-contact-list
  *
  * Copyright (C) 2009-2010 Collabora Ltd. <info at collabora.co.uk>
  *   @Author George Goldberg <george.goldberg at collabora.co.uk>
- * Copyright (C) 2011 Martin Klapetek <martin.klapetek at gmail.com>
  * Copyright (C) 2011 Keith Rusler <xzekecomax at gmail.com>
+ * Copyright (C) 2011-2013 Martin Klapetek <martin.klapetek at gmail.com>
+ * Copyright (C) 2012-2012 David Edmundson <kde at davidedmundson.co.uk>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -37,7 +38,7 @@
 #include <TelepathyQt/PendingReady>
 
 #include <KTp/contact-factory.h>
-#include <KTp/Models/contacts-model.h>
+#include <KTp/types.h>
 #include <KTp/Widgets/add-contact-dialog.h>
 #include <KTp/Widgets/join-chat-room-dialog.h>
 
@@ -73,6 +74,8 @@ MainWidget::MainWidget(QWidget *parent)
     Tp::registerTypes();
 
     setupUi(this);
+
+    menuBar()->hide();
     m_filterBar->hide();
     setWindowIcon(KIcon("telepathy-kde"));
     setAutoSaveSettings();
@@ -113,6 +116,7 @@ MainWidget::MainWidget(QWidget *parent)
     m_toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
 
     m_addContactAction = new KAction(KIcon("list-add-user"), i18n("Add New Contacts..."), this);
+    actionCollection()->addAction("add_contact", m_addContactAction);
 
     m_toolBar->addAction(m_addContactAction);
 
@@ -367,13 +371,13 @@ void MainWidget::onCustomContextMenuRequested(const QPoint &pos)
         return;
     }
 
-    ContactsModel::RowType type = (ContactsModel::RowType)index.data(ContactsModel::TypeRole).toInt();
+    KTp::RowType type = (KTp::RowType)index.data(KTp::RowTypeRole).toInt();
 
     KMenu *menu = 0;
 
-    if (type == ContactsModel::ContactRowType) {
+    if (type == KTp::ContactRowType) {
         menu = m_contextMenu->contactContextMenu(index);
-    } else if (type == ContactsModel::GroupRowType) {
+    } else if (type == KTp::GroupRowType) {
         menu = m_contextMenu->groupContextMenu(index);
     }
 
diff --git a/tooltips/contacttooltip.cpp b/tooltips/contacttooltip.cpp
index 502c8fb..d541920 100644
--- a/tooltips/contacttooltip.cpp
+++ b/tooltips/contacttooltip.cpp
@@ -24,7 +24,7 @@
 #include "ui_contacttooltip.h"
 #include "ktooltip.h"
 
-#include <KTp/Models/contacts-model.h>
+#include <KTp/types.h>
 #include <KTp/text-parser.h>
 #include <KTp/presence.h>
 
@@ -40,11 +40,11 @@ ContactToolTip::ContactToolTip(const QModelIndex &index) :
 {
     ui->setupUi(this);
     ui->nameLabel->setText(index.data(Qt::DisplayRole).toString());
-    ui->idLabel->setText(index.data(ContactsModel::IdRole).toString());
+    ui->idLabel->setText(index.data(KTp::IdRole).toString());
     ui->avatarLabel->setScaledContents(false);
     ui->avatarLabel->setAlignment(Qt::AlignCenter);
 
-    QString avatar = index.data(ContactsModel::AvatarRole).toString();
+    QString avatar = index.data(KTp::AvatarRole).toString();
     if (avatar.isEmpty()) {
         ui->avatarLabel->setPixmap(KIconLoader::global()->loadIcon("im-user", KIconLoader::NoGroup, 96));
     } else {
@@ -52,19 +52,11 @@ ContactToolTip::ContactToolTip(const QModelIndex &index) :
         ui->avatarLabel->setPixmap(avatarPixmap.scaled(ui->avatarLabel->size(), Qt::KeepAspectRatio));
     }
 
-    KTp::Presence presence = index.data(ContactsModel::PresenceRole).value<KTp::Presence>();
+    QString presenceMessage = index.data(KTp::ContactPresenceMessageRole);
+    QString presenceIconPath = index.data(KTp::ContactPresenceIconRole);
+    QString presenceText = index.data(KTp::ContactPresenceNameRole);
 
-    QString presenceMessage;
-    QString presenceIconPath = KIconLoader::global()->iconPath("task-attention", 1);
-    QString presenceText = i18nc("This is an IM user status", "Unknown");
-
-    if (presence.isValid()) {
-        presenceMessage = getTextWithHyperlinks(presence.statusMessage());
-        presenceIconPath = KIconLoader::global()->iconPath(presence.icon().name(), 1);
-        presenceText = presence.displayString();
-    }
-
-    if (presence.type() == Tp::ConnectionPresenceTypeError) {
+    if (index.data(KTp::ContactPresenceTypeRole).toInt() == Tp::ConnectionPresenceTypeError) {
         presenceIconPath = KIconLoader::global()->iconPath("task-attention", 1);
         presenceText = i18nc("This is an IM user status", "Error Getting Presence");
 
@@ -78,9 +70,9 @@ ContactToolTip::ContactToolTip(const QModelIndex &index) :
     ui->presenceIcon->setPixmap(QPixmap(presenceIconPath));
     ui->presenceLabel->setText(presenceText);
     ui->presenceMessageLabel->setText(presenceMessage);
-    ui->blockedLabel->setShown(index.data(ContactsModel::BlockedRole).toBool());
+    ui->blockedLabel->setShown(index.data(KTp::BlockedRole).toBool());
 
-    const Tp::AccountPtr account = index.data(ContactsModel::AccountRole).value<Tp::AccountPtr>();
+    const Tp::AccountPtr account = index.data(KTp::AccountRole).value<Tp::AccountPtr>();
     ui->accountLabel->setText(i18n("Account: %1").arg(account->displayName()));
 
     connect(ui->presenceMessageLabel, SIGNAL(linkActivated(QString)), this, SLOT(openLink(QString)));

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list