[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:21:31 UTC 2016


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

The following commit has been merged in the master branch:
commit ad431bf4a7a88109f2aeb4218a339236c0acc86b
Author: Rohan Garg <rohangarg at kubuntu.org>
Date:   Tue Mar 20 21:12:43 2012 +0530

    Make the chat window title show a "John Doe has entered text"
    
    When a remote user has entered a text message but has not sent it,
    we should display the correct channel state.
    
    REVIEW: 104348
    BUG: 289861
---
 app/chat-window.cpp | 14 ++++++++------
 app/chat-window.h   |  2 +-
 lib/chat-widget.cpp | 54 ++++++++++++++++++++++-------------------------------
 lib/chat-widget.h   |  8 ++++----
 4 files changed, 35 insertions(+), 43 deletions(-)

diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 5a803e6..c7147a9 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -270,7 +270,7 @@ void ChatWindow::onCurrentIndexChanged(int index)
     setWindowIcon(currentChatTab->icon());
 
     //call this to update the "Typing.." in window title
-    onUserTypingChanged();
+    onUserTypingChanged(currentChatTab->remoteChatState());
 
     kDebug() << "Current spell dictionary is" << currentChatTab->spellDictionary();
     m_spellDictCombo->setCurrentByDictionary(currentChatTab->spellDictionary());
@@ -469,7 +469,7 @@ void ChatWindow::removeChatTabSignals(ChatTab* chatTab)
 {
     disconnect(chatTab, SIGNAL(titleChanged(QString)), this, SLOT(onTabTextChanged(QString)));
     disconnect(chatTab, SIGNAL(iconChanged(KIcon)), this, SLOT(onTabIconChanged(KIcon)));
-    disconnect(chatTab, SIGNAL(userTypingChanged(bool)), this, SLOT(onTabStateChanged()));
+    disconnect(chatTab, SIGNAL(userTypingChanged(Tp::ChannelChatState)), this, SLOT(onTabStateChanged()));
     disconnect(chatTab, SIGNAL(unreadMessagesChanged()), this, SLOT(onTabStateChanged()));
     disconnect(chatTab, SIGNAL(contactPresenceChanged(Tp::Presence)), this, SLOT(onTabStateChanged()));
     disconnect(chatTab->chatSearchBar(), SIGNAL(enableSearchButtonsSignal(bool)), this, SLOT(onEnableSearchActions(bool)));
@@ -494,8 +494,8 @@ void ChatWindow::setupChatTabSignals(ChatTab *chatTab)
 {
     connect(chatTab, SIGNAL(titleChanged(QString)), this, SLOT(onTabTextChanged(QString)));
     connect(chatTab, SIGNAL(iconChanged(KIcon)), this, SLOT(onTabIconChanged(KIcon)));
-    connect(chatTab, SIGNAL(userTypingChanged(bool)), this, SLOT(onTabStateChanged()));
-    connect(chatTab, SIGNAL(userTypingChanged(bool)), this, SLOT(onUserTypingChanged()));
+    connect(chatTab, SIGNAL(userTypingChanged(Tp::ChannelChatState)), this, SLOT(onTabStateChanged()));
+    connect(chatTab, SIGNAL(userTypingChanged(Tp::ChannelChatState)), this, SLOT(onUserTypingChanged(Tp::ChannelChatState)));
     connect(chatTab, SIGNAL(unreadMessagesChanged()), this, SLOT(onTabStateChanged()));
     connect(chatTab, SIGNAL(contactPresenceChanged(KTp::Presence)), this, SLOT(onTabStateChanged()));
     connect(chatTab->chatSearchBar(), SIGNAL(enableSearchButtonsSignal(bool)), this, SLOT(onEnableSearchActions(bool)));
@@ -655,14 +655,16 @@ void ChatWindow::startShareDesktop(const Tp::AccountPtr& account, const Tp::Cont
     connect(channelRequest, SIGNAL(finished(Tp::PendingOperation*)), this, SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
 }
 
-void ChatWindow::onUserTypingChanged()
+void ChatWindow::onUserTypingChanged(Tp::ChannelChatState state)
 {
     ChatWidget *currChat =  qobject_cast<ChatWidget*>(m_tabWidget->currentWidget());
     Q_ASSERT(currChat);
     QString title = currChat->title();
 
-    if (currChat->isUserTyping()) {
+    if (state == Tp::ChannelChatStateComposing) {
         setWindowTitle(i18nc("String prepended in window title, arg is contact's name", "Typing... %1", title));
+    } else if (state == Tp::ChannelChatStatePaused) {
+        setWindowTitle(i18nc("String appended in window title, arg is contact's name", "%1 has entered text", title));
     } else {
         setWindowTitle(title);
     }
diff --git a/app/chat-window.h b/app/chat-window.h
index 4afa8a1..8ee4463 100644
--- a/app/chat-window.h
+++ b/app/chat-window.h
@@ -92,7 +92,7 @@ private Q_SLOTS:
     void onTabTextChanged(const QString &newTitle);
     void onTabIconChanged(const KIcon &newIcon);
     void onVideoCallTriggered();                                /** start a video call */
-    void onUserTypingChanged();
+    void onUserTypingChanged(Tp::ChannelChatState state);
     void onShareDesktopTriggered();                             /** start a desktop share */
     void setTabSpellDictionary(const QString &dict);            /** set the spelling language for the current chat tab*/
 
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 907dc34..4b6b09b 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -54,11 +54,11 @@ public:
     ChatWidgetPrivate()
     {
         isGroupChat = false;
-        remoteContactIsTyping = false;
+        remoteContactChatState = Tp::ChannelChatStateInactive;
     }
     /** Stores whether the channel is ready with all contacts upgraded*/
     bool chatviewlInitialised;
-    bool remoteContactIsTyping;
+    Tp::ChannelChatState remoteContactChatState;
     QAction *showFormatToolbarAction;
     bool isGroupChat;
     QString title;
@@ -333,7 +333,7 @@ QColor ChatWidget::titleColor() const
 
     KColorScheme scheme(QPalette::Active, KColorScheme::Window);
 
-    if (d->remoteContactIsTyping) {
+    if (d->remoteContactChatState == Tp::ChannelChatStateComposing) {
         kDebug() << "remote is typing";
         return scheme.foreground(KColorScheme::PositiveText).color();
     }
@@ -692,49 +692,39 @@ void ChatWidget::onChatStatusChanged(const Tp::ContactPtr & contact, Tp::Channel
         return;
     }
 
-    bool contactIsTyping = false;
-
-    switch (state) {
-    case Tp::ChannelChatStateGone:
-      {
+    if (state == Tp::ChannelChatStateGone) {
         AdiumThemeStatusInfo statusMessage;
         statusMessage.setMessage(i18n("%1 has left the chat", contact->alias()));
         statusMessage.setService(d->channel->connection()->protocolName());
         statusMessage.setStatus(QLatin1String("away"));
         statusMessage.setTime(QDateTime::currentDateTime());
         d->ui.chatArea->addStatusMessage(statusMessage);
-        break;
-      }
-    case Tp::ChannelChatStateInactive:
-        //FIXME send a 'chat timed out' message to chatview
-        break;
-    case Tp::ChannelChatStateActive:
-    case Tp::ChannelChatStatePaused:
-        break;
-    case Tp::ChannelChatStateComposing:
-        contactIsTyping = true;
-        break;
-    default:
-        kWarning() << "Unknown channel chat case" << state;
     }
 
-    if (!contactIsTyping) {
+    if (state != Tp::ChannelChatStateComposing) {
         //In a multiperson chat just because this user is no longer typing it doesn't mean that no-one is.
         //loop through each contact, check no-one is in composing mode.
+
+        Tp::ChannelChatState tempState = Tp::ChannelChatStateInactive;
+
         Q_FOREACH (const Tp::ContactPtr & contact, d->channel->groupContacts()) {
             if (contact == d->channel->groupSelfContact()) {
                 continue;
             }
 
-            if (d->channel->chatState(contact) == Tp::ChannelChatStateComposing) {
-                contactIsTyping = true;
+            tempState = d->channel->chatState(contact);
+
+            if (tempState == Tp::ChannelChatStateComposing) {
+                d->remoteContactChatState = tempState;
+            } else if (tempState == Tp::ChannelChatStatePaused) {
+                d->remoteContactChatState = tempState;
             }
         }
     }
 
-    if (contactIsTyping != d->remoteContactIsTyping) {
-        d->remoteContactIsTyping = contactIsTyping;
-        Q_EMIT userTypingChanged(contactIsTyping);
+    if (state != d->remoteContactChatState) {
+        d->remoteContactChatState = state;
+        Q_EMIT userTypingChanged(state);
     }
 }
 
@@ -859,11 +849,6 @@ void ChatWidget::onFormatColorReleased()
     d->ui.sendMessageBox->setTextColor(color);
 }
 
-bool ChatWidget::isUserTyping() const
-{
-    return d->remoteContactIsTyping;
-}
-
 void ChatWidget::setSpellDictionary(const QString &dict)
 {
     d->ui.sendMessageBox->setSpellCheckingLanguage(dict);
@@ -874,5 +859,10 @@ QString ChatWidget::spellDictionary() const
     return d->ui.sendMessageBox->spellCheckingLanguage();
 }
 
+Tp::ChannelChatState ChatWidget::remoteChatState()
+{
+    return d->remoteContactChatState;
+}
+
 
 #include "chat-widget.moc"
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index fda3106..3d72798 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -79,13 +79,13 @@ public:
 
     int unreadMessageCount() const;
 
-    /** Returns true if the user is currently typing or not */
-    bool isUserTyping() const;
-
     QString spellDictionary() const;
 
     void setSpellDictionary(const QString &dict);
 
+    /** Returns the chat state of remote contact */
+    Tp::ChannelChatState remoteChatState();
+
 public Q_SLOTS:
     /** toggle the search bar visibility */
     void toggleSearchBar() const;
@@ -140,7 +140,7 @@ Q_SIGNALS:
     void searchTextComplete(bool found);
 
     /** Emitted when another contact in the channel starts/stops typing (if supported by the protocol)*/
-    void userTypingChanged(bool);
+    void userTypingChanged(Tp::ChannelChatState);
 
     void contactPresenceChanged(KTp::Presence presence);
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list