[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=b1d9d1d

The following commit has been merged in the master branch:
commit b1d9d1df41e8993a79550366e7b5ef4c59942406
Author: Dan Vrátil <dvratil at redhat.com>
Date:   Sun Jan 20 17:59:00 2013 +0100

    Change tab and window icon when someone is typing or there is unread message
    
    Tabs will have 'unread-message' icon when there is an unread message.
    When there are no unread messages, but other side is typing, it shows
    a 'typing' icon. Otherwise contact's presence icon is used.
    
    The window will have 'unread-message' icon when there is an unread message
    in any tab. Otherwise will show 'typing' if user in current tab is typing.
    Otherwise it shows current tab presence icon.
    
    REVIEW: 108500
    BUG: 311859
    FIXED-IN: 0.6
---
 app/chat-window.cpp | 42 +++++++++++++++++++++++++++++++++++++++++-
 app/chat-window.h   |  3 +++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index b48f148..cb7a234 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -292,7 +292,11 @@ void ChatWindow::onCurrentIndexChanged(int index)
     ChatTab *currentChatTab = qobject_cast<ChatTab*>(m_tabWidget->widget(index));
     currentChatTab->acknowledgeMessages();
     setWindowTitle(currentChatTab->title());
-    setWindowIcon(currentChatTab->icon());
+    if (hasUnreadMessages()) {
+        setWindowIcon(KIcon(QLatin1String("mail-mark-unread-new")));
+    } else {
+        setWindowIcon(currentChatTab->icon());
+    }
 
     //call this to update the "Typing.." in window title
     onUserTypingChanged(currentChatTab->remoteChatState());
@@ -443,11 +447,34 @@ void ChatWindow::onTabStateChanged()
 {
     kDebug();
 
+    KIcon windowIcon;
     ChatTab *sender = qobject_cast<ChatTab*>(QObject::sender());
     if (sender) {
         int tabIndex = m_tabWidget->indexOf(sender);
         setTabTextColor(tabIndex, sender->titleColor());
+
+        if (sender->remoteChatState() == Tp::ChannelChatStateComposing) {
+            setTabIcon(tabIndex, KIcon(QLatin1String("document-edit")));
+            if (sender == m_tabWidget->currentWidget()) {
+                windowIcon = KIcon(QLatin1String("document-edit"));
+            } else {
+                windowIcon = qobject_cast<ChatTab*>(m_tabWidget->currentWidget())->icon();
+            }
+        } else {
+            setTabIcon(tabIndex, sender->icon());
+            windowIcon = sender->icon();
+        }
+
+        if (sender->unreadMessageCount() > 0) {
+            setTabIcon(tabIndex, KIcon(QLatin1String("mail-mark-unread-new")));
+        }
+    }
+
+    if (hasUnreadMessages()) {
+        windowIcon = KIcon(QLatin1String("mail-mark-unread-new"));
     }
+
+    setWindowIcon(windowIcon);
 }
 
 void ChatWindow::onTabIconChanged(const KIcon & newIcon)
@@ -848,4 +875,17 @@ void ChatWindow::onAddEmoticon(const QString& emoticon)
     currentChatTab->addEmoticonToChat(emoticon);
 }
 
+bool ChatWindow::hasUnreadMessages() const
+{
+    for (int i = 0; i < m_tabWidget->count(); i++) {
+        ChatTab *tab = qobject_cast<ChatTab*>(m_tabWidget->widget(i));
+        if (tab && tab->unreadMessageCount() > 0) {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+
 #include "chat-window.moc"
diff --git a/app/chat-window.h b/app/chat-window.h
index 5a90c91..38329bb 100644
--- a/app/chat-window.h
+++ b/app/chat-window.h
@@ -161,6 +161,9 @@ private:
      */
     void startShareDesktop(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
 
+    /** Returns whether there's at least one tab with unread message */
+    bool hasUnreadMessages() const;
+
     KTabWidget *m_tabWidget;
 
     Sonnet::DictionaryComboBox *m_spellDictCombo;

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list