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


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

The following commit has been merged in the master branch:
commit 665e061725ea75a8e2536aab801f273b7374e33e
Author: George Kiagiadakis <george.kiagiadakis at collabora.co.uk>
Date:   Sun Jan 30 19:51:56 2011 +0200

    Let mainwindow know the correct chat window icon from the beggining of the session.
    
    Previously the mainwindow started with the "online" icon always
    and only changed it when the remote contact's presence changed.
---
 app/mainwindow.cpp |  2 +-
 lib/chatwindow.cpp | 16 ++++++++++++++++
 lib/chatwindow.h   |  3 +++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp
index 3cdca5b..54ac071 100644
--- a/app/mainwindow.cpp
+++ b/app/mainwindow.cpp
@@ -68,7 +68,7 @@ void MainWindow::handleChannels(const Tp::MethodInvocationContextPtr<> & context
 
     ChatWindow* newWindow = new ChatWindow(textChannel, this);
 
-    addTab(newWindow, KIcon("user-online"), newWindow->title());
+    addTab(newWindow, newWindow->icon(), newWindow->title());
 
     connect(newWindow, SIGNAL(titleChanged(QString)), SLOT(updateTabText(QString)));
     connect(newWindow,SIGNAL(iconChanged(KIcon)), SLOT(updateTabIcon(KIcon)));
diff --git a/lib/chatwindow.cpp b/lib/chatwindow.cpp
index 2f6a093..f378fac 100644
--- a/lib/chatwindow.cpp
+++ b/lib/chatwindow.cpp
@@ -37,6 +37,7 @@
 #include <TelepathyQt4/Types>
 #include <TelepathyQt4/AvatarData>
 #include <TelepathyQt4/Connection>
+#include <TelepathyQt4/Presence>
 
 class MessageBoxEventFilter : public QObject
 {
@@ -211,6 +212,21 @@ QString ChatWindow::title() const
     return d->title;
 }
 
+KIcon ChatWindow::icon() const
+{
+    //normal chat - self and one other person.
+    if (!d->isGroupChat) {
+        //find the other contact which isn't self.
+        foreach(const Tp::ContactPtr & contact, d->channel->groupContacts()) {
+            if (contact != d->channel->groupSelfContact()) {
+                return iconForPresence(contact->presence().type());
+            }
+        }
+    }
+
+    //group chat
+    return iconForPresence(Tp::ConnectionPresenceTypeAvailable);
+}
 
 void ChatWindow::handleIncomingMessage(const Tp::ReceivedMessage &message)
 {
diff --git a/lib/chatwindow.h b/lib/chatwindow.h
index 4925a98..1e4db5a 100644
--- a/lib/chatwindow.h
+++ b/lib/chatwindow.h
@@ -39,6 +39,9 @@ public:
     /** Returns the name of this chat window*/
     QString title() const;
 
+    /** Returns the icon of this chat window */
+    KIcon icon() const;
+
 protected:
     void changeEvent(QEvent *e);
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list