[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Btelepathy-chat-handler=5D_lib=3A_Updated_the_channe?=
From: David Edmundson <kde () davidedmundson ! co ! uk>
Date: 2011-05-02 10:23:17
Message-ID: 20110502102317.A7C77A60A4 () git ! kde ! org
[Download RAW message or body]
Git commit 37f0ecf2ef0cebd3f435331f201a4a6ecac0c233 by David Edmundson.
Committed on 01/05/2011 at 13:43.
Pushed by davidedmundson into branch 'master'.
Updated the channel in the contacts model when switching text channel.
M +12 -1 lib/channel-contact-model.cpp
M +2 -0 lib/channel-contact-model.h
M +1 -0 lib/chat-widget.cpp
http://commits.kde.org/telepathy-chat-handler/37f0ecf2ef0cebd3f435331f201a4a6ecac0c233
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();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic