[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:24:38 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=aec2fa2

The following commit has been merged in the master branch:
commit aec2fa2db6c09efcbccd99340e6aa2c297bcaca4
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Tue May 13 16:17:24 2014 +0200

    Restore showing who is typing in the group chat participants
    
    REVIEWED-BY: Martin Klapetek
    BUG: 333702
---
 lib/channel-contact-model.cpp |  3 +++
 lib/channel-contact-model.h   |  6 ++++++
 lib/contact-delegate.cpp      | 10 +++++++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/lib/channel-contact-model.cpp b/lib/channel-contact-model.cpp
index 68b79c0..40607ca 100644
--- a/lib/channel-contact-model.cpp
+++ b/lib/channel-contact-model.cpp
@@ -115,6 +115,9 @@ QVariant ChannelContactModel::data(const QModelIndex &index, int role) const
     case KTp::ContactRole:
         return QVariant::fromValue(m_contacts[row]);
 
+    case ChannelContactModel::IsTypingRole:
+        return TextChatConfig::instance()->showOthersTyping() && (m_channel->chatState(contact) == Tp::ChannelChatStateComposing);
+
     default:
         return QVariant();
     }
diff --git a/lib/channel-contact-model.h b/lib/channel-contact-model.h
index 94419f9..3dabf71 100644
--- a/lib/channel-contact-model.h
+++ b/lib/channel-contact-model.h
@@ -29,6 +29,7 @@
 #include <TelepathyQt/Presence>
 
 #include <KTp/presence.h>
+#include <KTp/types.h>
 
 /** A model of all users in the channel.
   Also acts as a proxy for emiting presence and alias changes of any contacts in the channel
@@ -39,7 +40,12 @@
 class ChannelContactModel : public QAbstractListModel
 {
     Q_OBJECT
+
 public:
+    enum contactRoles {
+        IsTypingRole = KTp::CustomRole
+    };
+
     explicit ChannelContactModel(const Tp::TextChannelPtr &channel, QObject *parent = 0);
 
     void setTextChannel(const Tp::TextChannelPtr &channel);
diff --git a/lib/contact-delegate.cpp b/lib/contact-delegate.cpp
index a66ff32..50cd4fd 100644
--- a/lib/contact-delegate.cpp
+++ b/lib/contact-delegate.cpp
@@ -38,6 +38,8 @@
 
 #include <KTp/types.h>
 
+#include "channel-contact-model.h"
+
 ContactDelegate::ContactDelegate(QObject *parent)
     : QStyledItemDelegate(parent)
 {
@@ -69,7 +71,13 @@ void ContactDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
     iconRect.setSize(QSize(m_avatarSize, m_avatarSize));
     iconRect.moveTo(QPoint(iconRect.x() + m_spacing, iconRect.y() + m_spacing));
 
-    QPixmap avatar(qvariant_cast<QPixmap>(index.data(KTp::ContactAvatarPixmapRole)));
+    QPixmap avatar;
+
+    if (index.data(ChannelContactModel::IsTypingRole).toBool()) {
+        avatar = KIcon(QLatin1String("document-edit")).pixmap(KIconLoader::SizeSmallMedium);
+    } else {
+        avatar = qvariant_cast<QPixmap>(index.data(KTp::ContactAvatarPixmapRole));
+    }
 
     if (!avatar.isNull()) {
         style->drawItemPixmap(painter, iconRect, Qt::AlignCenter, avatar.scaled(iconRect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list