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


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

The following commit has been merged in the master branch:
commit ec407145cdf9762d02c378a0f53b7b61e9170503
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Sat Jan 19 03:27:40 2013 +0000

    Show icon in channel contacts list when a user is typing in a group chat
    
    BUG: 291707
    REVIEW: 108486
---
 lib/channel-contact-model.cpp | 22 +++++++++++++++++++++-
 lib/channel-contact-model.h   |  3 +++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/lib/channel-contact-model.cpp b/lib/channel-contact-model.cpp
index 49a1799..da37766 100644
--- a/lib/channel-contact-model.cpp
+++ b/lib/channel-contact-model.cpp
@@ -34,6 +34,7 @@ void ChannelContactModel::setTextChannel(const Tp::TextChannelPtr &channel)
     //remove existing contacts in list
     beginRemoveRows(QModelIndex(), 0, m_contacts.size());
     m_contacts.clear();
+    m_chatState.clear();
     endRemoveRows();
 
     //add existing contacts from channel
@@ -45,6 +46,10 @@ void ChannelContactModel::setTextChannel(const Tp::TextChannelPtr &channel)
                                        Tp::Contacts,Tp::Channel::GroupMemberChangeDetails)),
             SLOT(onGroupMembersChanged(Tp::Contacts,Tp::Contacts,Tp::Contacts,
                                      Tp::Contacts,Tp::Channel::GroupMemberChangeDetails)));
+
+    connect(channel.data(),
+            SIGNAL(chatStateChanged(Tp::ContactPtr,Tp::ChannelChatState)),
+            SLOT(onChatStateChanged(Tp::ContactPtr,Tp::ChannelChatState)));
 }
 
 bool ChannelContactModel::containsNick(const QString& nick)
@@ -79,8 +84,14 @@ QVariant ChannelContactModel::data(const QModelIndex &index, int role) const
         return QVariant(m_contacts[row]->alias());
 
     case Qt::DecorationRole:
-        return KTp::Presence(m_contacts[row]->presence()).icon();
+    {
+        const Tp::ContactPtr contact = m_contacts[row];
+        if (m_chatState.contains(contact) && m_chatState[contact] == Tp::ChannelChatStateComposing) {
+            return KIcon(QLatin1String("document-edit"));
 
+        }
+        return KTp::Presence(contact->presence()).icon();
+    }
     default:
         return QVariant();
     }
@@ -160,7 +171,16 @@ void ChannelContactModel::removeContacts(const Tp::Contacts &contacts)
 
         beginRemoveRows(QModelIndex(), m_contacts.indexOf(contact), m_contacts.indexOf(contact));
         m_contacts.removeAll(contact);
+        m_chatState.remove(contact);
         endRemoveRows();
     }
 }
 
+void ChannelContactModel::onChatStateChanged(const Tp::ContactPtr &contact, Tp::ChannelChatState state)
+{
+    const QModelIndex index = createIndex(m_contacts.lastIndexOf(contact), 0);
+
+    m_chatState[contact] = state;
+    dataChanged(index, index);
+}
+
diff --git a/lib/channel-contact-model.h b/lib/channel-contact-model.h
index d2f6f6f..031a98c 100644
--- a/lib/channel-contact-model.h
+++ b/lib/channel-contact-model.h
@@ -63,11 +63,14 @@ private Q_SLOTS:
     void onContactPresenceChanged(const Tp::Presence &presence);
     void onContactAliasChanged(const QString &alias);
     void onContactBlockStatusChanged(bool blocked);
+    void onChatStateChanged(const Tp::ContactPtr &contact, Tp::ChannelChatState state);
+
 
 private:
     void addContacts(const Tp::Contacts &contacts);
     void removeContacts(const Tp::Contacts &contacts);
     QList<Tp::ContactPtr> m_contacts;
+    QHash<Tp::ContactPtr, Tp::ChannelChatState> m_chatState;
 };
 
 #endif // CHANNEL_CONTACT_MODEL_H

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list