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


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

The following commit has been merged in the master branch:
commit 37f0ecf2ef0cebd3f435331f201a4a6ecac0c233
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Sun May 1 12:43:48 2011 +0100

    Updated the channel in the contacts model when switching text channel.
---
 lib/channel-contact-model.cpp | 13 ++++++++++++-
 lib/channel-contact-model.h   |  2 ++
 lib/chat-widget.cpp           |  1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/channel-contact-model.cpp b/lib/channel-contact-model.cpp
index 8bdfdd6..7887880 100644
--- a/lib/channel-contact-model.cpp
+++ b/lib/channel-contact-model.cpp
@@ -25,7 +25,18 @@
 ChannelContactModel::ChannelContactModel(const Tp::TextChannelPtr &channel, QObject *parent)
     : QAbstractListModel(parent)
 {
-    //add existing contacts
+    setTextChannel(channel);
+}
+
+
+void ChannelContactModel::setTextChannel(const Tp::TextChannelPtr &channel)
+{
+    //remove existing contacts in list
+    beginRemoveRows(QModelIndex(), 0, m_contacts.size());
+    m_contacts.clear();
+    endRemoveRows();
+
+    //add existing contacts from channel
     addContacts(channel->groupContacts());
 
     //monitor for future changes
diff --git a/lib/channel-contact-model.h b/lib/channel-contact-model.h
index 537c3eb..d0c2cb5 100644
--- a/lib/channel-contact-model.h
+++ b/lib/channel-contact-model.h
@@ -40,6 +40,8 @@ class ChannelContactModel : public QAbstractListModel
 public:
     explicit ChannelContactModel(const Tp::TextChannelPtr &channel, QObject *parent = 0);
 
+    void setTextChannel(const Tp::TextChannelPtr &channel);
+
 signals:
     void contactPresenceChanged(const Tp::ContactPtr &contact, const Tp::Presence &presence);
     void contactAliasChanged(const Tp::ContactPtr &contact, const QString &alias);
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index d8ff9c7..99edcc1 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -311,6 +311,7 @@ void ChatWidget::setChatEnabled(bool enable)
 void ChatWidget::setTextChannel(const Tp::TextChannelPtr &newTextChannelPtr)
 {
     d->channel = newTextChannelPtr;     // set the new channel
+    d->contactModel->setTextChannel(newTextChannelPtr);
 
     // connect signals for the new textchannel
     setupChannelSignals();

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list