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


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

The following commit has been merged in the master branch:
commit 3a5fd3e5a9cfccb7c700a5b8f9212e7ecd76e8d6
Author: Stefan Eggers <coloncolonone at gmail.com>
Date:   Tue Apr 16 12:49:33 2013 +0200

    Add option to show me typing (to others) and others typing (to me)
    
    Adding two configuration options which allow to select if:
    
    - Others get shown that I am typing.
    - I get shown that others are typing.
    
    REVIEW: 110009
    BUG: 282201
    FIXED-IN: 0.7.0
---
 app/chat-window.cpp           | 15 ++++++++-----
 config/behavior-config.cpp    | 22 +++++++++++++++++++
 config/behavior-config.h      |  4 ++++
 config/behavior-config.ui     | 23 ++++++++++++++++++++
 lib/channel-contact-model.cpp |  3 ++-
 lib/chat-widget.cpp           | 19 ++++++++++++----
 lib/text-chat-config.cpp      | 50 +++++++++++++++++++++++++++++++++++++++++++
 lib/text-chat-config.h        |  6 ++++++
 8 files changed, 132 insertions(+), 10 deletions(-)

diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 17300d8..18a77ae 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -61,6 +61,7 @@
 #include "emoticon-text-edit-action.h"
 #include "invite-contact-dialog.h"
 #include "telepathy-chat-ui.h"
+#include "text-chat-config.h"
 
 #define PREFERRED_RFB_HANDLER "org.freedesktop.Telepathy.Client.krfb_rfb_handler"
 
@@ -472,7 +473,7 @@ void ChatWindow::onTabStateChanged()
         int tabIndex = m_tabWidget->indexOf(sender);
         setTabTextColor(tabIndex, sender->titleColor());
 
-        if (sender->remoteChatState() == Tp::ChannelChatStateComposing) {
+        if (TextChatConfig::instance()->showOthersTyping() && (sender->remoteChatState() == Tp::ChannelChatStateComposing)) {
             setTabIcon(tabIndex, KIcon(QLatin1String("document-edit")));
             if (sender == m_tabWidget->currentWidget()) {
                 windowIcon = KIcon(QLatin1String("document-edit"));
@@ -843,10 +844,14 @@ void ChatWindow::onUserTypingChanged(Tp::ChannelChatState state)
     Q_ASSERT(currChat);
     QString title = currChat->title();
 
-    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));
+    if (TextChatConfig::instance()->showOthersTyping()) {
+        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);
+        }
     } else {
         setWindowTitle(title);
     }
diff --git a/config/behavior-config.cpp b/config/behavior-config.cpp
index 357ede0..9f863dc 100644
--- a/config/behavior-config.cpp
+++ b/config/behavior-config.cpp
@@ -49,6 +49,12 @@ BehaviorConfig::BehaviorConfig(QWidget *parent, const QVariantList& args)
     ui->scrollbackLength->setSuffix(ki18ncp("Part of config 'show last [spin box] messages' This is the suffix to the spin box. Be sure to include leading space"," message", " messages"));
     ui->scrollbackLength->setValue(m_scrollbackLength);
     connect(ui->scrollbackLength, SIGNAL(valueChanged(int)), this, SLOT(onScrollbackLengthChanged()));
+
+    ui->checkBoxShowMeTyping->setChecked(m_showMeTyping);
+    connect(ui->checkBoxShowMeTyping, SIGNAL(toggled(bool)), this, SLOT(onShowMeTypingChanged(bool)));
+
+    ui->checkBoxShowOthersTyping->setChecked(m_showOthersTyping);
+    connect(ui->checkBoxShowOthersTyping, SIGNAL(toggled(bool)), this, SLOT(onShowOthersTypingChanged(bool)));
 }
 
 BehaviorConfig::~BehaviorConfig()
@@ -60,12 +66,16 @@ void BehaviorConfig::load()
 {
     m_openMode = TextChatConfig::instance()->openMode();
     m_scrollbackLength = TextChatConfig::instance()->scrollbackLength();
+    m_showMeTyping = TextChatConfig::instance()->showMeTyping();
+    m_showOthersTyping = TextChatConfig::instance()->showOthersTyping();
 }
 
 void BehaviorConfig::save()
 {
     TextChatConfig::instance()->setOpenMode(m_openMode);
     TextChatConfig::instance()->setScrollbackLength(m_scrollbackLength);
+    TextChatConfig::instance()->setShowMeTyping(m_showMeTyping);
+    TextChatConfig::instance()->setShowOthersTyping(m_showOthersTyping);
     TextChatConfig::instance()->sync();
 }
 
@@ -94,3 +104,15 @@ void BehaviorConfig::onScrollbackLengthChanged()
     m_scrollbackLength = ui->scrollbackLength->value();
     Q_EMIT changed(true);
 }
+
+void BehaviorConfig::onShowMeTypingChanged(bool state)
+{
+    m_showMeTyping = state;
+    Q_EMIT changed(true);
+}
+
+void BehaviorConfig::onShowOthersTypingChanged(bool state)
+{
+    m_showOthersTyping = state;
+    Q_EMIT changed(true);
+}
diff --git a/config/behavior-config.h b/config/behavior-config.h
index fa0f686..fcbdd7f 100644
--- a/config/behavior-config.h
+++ b/config/behavior-config.h
@@ -48,10 +48,14 @@ protected:
 private Q_SLOTS:
     void onRadioSelected(int id);
     void onScrollbackLengthChanged();
+    void onShowMeTypingChanged(bool state);
+    void onShowOthersTypingChanged(bool state);
 
 private:
     TextChatConfig::TabOpenMode m_openMode;
     int m_scrollbackLength;
+    bool m_showMeTyping; // show others I am typing
+    bool m_showOthersTyping; // show me others are typing
     Ui::BehaviorConfigUi *ui;
 };
 
diff --git a/config/behavior-config.ui b/config/behavior-config.ui
index f783931..200f6ee 100644
--- a/config/behavior-config.ui
+++ b/config/behavior-config.ui
@@ -80,6 +80,29 @@
     </widget>
    </item>
    <item>
+    <widget class="KButtonGroup" name="typingGroup">
+     <property name="title">
+      <string>User Is Typing</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_7">
+      <item>
+       <widget class="QCheckBox" name="checkBoxShowOthersTyping">
+        <property name="text">
+         <string>Show me when others are typing</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBoxShowMeTyping">
+        <property name="text">
+         <string>Show others when I am typing</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
diff --git a/lib/channel-contact-model.cpp b/lib/channel-contact-model.cpp
index 109e6b1..4a6b206 100644
--- a/lib/channel-contact-model.cpp
+++ b/lib/channel-contact-model.cpp
@@ -18,6 +18,7 @@
  ***************************************************************************/
 
 #include "channel-contact-model.h"
+#include "text-chat-config.h"
 
 #include <KDebug>
 #include <KIcon>
@@ -87,7 +88,7 @@ QVariant ChannelContactModel::data(const QModelIndex &index, int role) const
     case Qt::DecorationRole:
     {
         const Tp::ContactPtr contact = m_contacts[row];
-        if (m_channel->chatState(contact) == Tp::ChannelChatStateComposing) {
+        if (TextChatConfig::instance()->showOthersTyping() && (m_channel->chatState(contact) == Tp::ChannelChatStateComposing)) {
             return KIcon(QLatin1String("document-edit"));
 
         }
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index a08f5e8..301ebf1 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -27,6 +27,7 @@
 #include "channel-contact-model.h"
 #include "logmanager.h"
 #include "notify-filter.h"
+#include "text-chat-config.h"
 
 #include <QtGui/QKeyEvent>
 #include <QtGui/QAction>
@@ -400,7 +401,7 @@ QColor ChatWidget::titleColor() const
 
     KColorScheme scheme(QPalette::Active, KColorScheme::Window);
 
-    if (d->remoteContactChatState == Tp::ChannelChatStateComposing) {
+    if (TextChatConfig::instance()->showOthersTyping() && (d->remoteContactChatState == Tp::ChannelChatStateComposing)) {
         kDebug() << "remote is typing";
         return scheme.foreground(KColorScheme::PositiveText).color();
     }
@@ -886,8 +887,14 @@ void ChatWidget::onInputBoxChanged()
             d->pausedStateTimer->start(5000);
         } else {
             //if the user has just typed some text, set state to Composing and start the timer
-            d->channel->requestChatState(Tp::ChannelChatStateComposing);
-            d->pausedStateTimer->start(5000);
+            //unless "show me typing" is off; in that case set state to Active and stop the timer
+            if (TextChatConfig::instance()->showMeTyping()) {
+                d->channel->requestChatState(Tp::ChannelChatStateComposing);
+                d->pausedStateTimer->start(5000);
+            } else {
+                d->channel->requestChatState(Tp::ChannelChatStateActive);
+                d->pausedStateTimer->stop();
+            }
         }
     } else {
         //if the user typed no text/cleared the input field, set Active and stop the timer
@@ -1040,7 +1047,11 @@ void ChatWidget::initChatArea()
 
 void ChatWidget::onChatPausedTimerExpired()
 {
-     d->channel->requestChatState(Tp::ChannelChatStatePaused);
+     if (TextChatConfig::instance()->showMeTyping()) {
+        d->channel->requestChatState(Tp::ChannelChatStatePaused);
+    } else {
+        d->channel->requestChatState(Tp::ChannelChatStateActive);
+    }
 }
 
 void ChatWidget::currentPresenceChanged(const Tp::Presence &presence)
diff --git a/lib/text-chat-config.cpp b/lib/text-chat-config.cpp
index bbcedcf..7425d5e 100644
--- a/lib/text-chat-config.cpp
+++ b/lib/text-chat-config.cpp
@@ -34,6 +34,8 @@ class TextChatConfigPrivate
 public:
     TextChatConfig::TabOpenMode m_openMode;
     int m_scrollbackLength;
+    bool m_showMeTyping;
+    bool m_showOthersTyping;
 };
 
 
@@ -74,6 +76,10 @@ void TextChatConfig::sync()
 
     behaviorConfig.writeEntry("scrollbackLength", d->m_scrollbackLength);
 
+    behaviorConfig.writeEntry("showMeTyping", d->m_showMeTyping);
+
+    behaviorConfig.writeEntry("showOthersTyping", d->m_showOthersTyping);
+
     behaviorConfig.sync();
 
     mutex.unlock();
@@ -120,6 +126,46 @@ void TextChatConfig::setScrollbackLength(int length)
 }
 
 
+bool TextChatConfig::showMeTyping()
+{
+    bool result;
+
+    mutex.lock();
+    result = d->m_showMeTyping;
+    mutex.unlock();
+
+    return result;
+}
+
+
+void TextChatConfig::setShowMeTyping(bool showTyping)
+{
+    mutex.lock();
+    d->m_showMeTyping = showTyping;
+    mutex.unlock();
+}
+
+
+bool TextChatConfig::showOthersTyping()
+{
+    bool result;
+
+    mutex.lock();
+    result = d->m_showOthersTyping;
+    mutex.unlock();
+
+    return result;
+}
+
+
+void TextChatConfig::setShowOthersTyping(bool showTyping)
+{
+    mutex.lock();
+    d->m_showOthersTyping = showTyping;
+    mutex.unlock();
+}
+
+
 TextChatConfig::TextChatConfig() :
     d(new TextChatConfigPrivate())
 {
@@ -137,6 +183,10 @@ TextChatConfig::TextChatConfig() :
     }
 
     d->m_scrollbackLength = behaviorConfig.readEntry("scrollbackLength", 4);
+
+    d->m_showMeTyping = behaviorConfig.readEntry("showMeTyping", true);
+
+    d->m_showOthersTyping = behaviorConfig.readEntry("showOthersTyping", true);
 }
 
 
diff --git a/lib/text-chat-config.h b/lib/text-chat-config.h
index 95c14e1..603c006 100644
--- a/lib/text-chat-config.h
+++ b/lib/text-chat-config.h
@@ -49,6 +49,12 @@ class KDE_TELEPATHY_CHAT_EXPORT TextChatConfig : QObject
     int scrollbackLength();
     void setScrollbackLength(int length);
 
+    bool showMeTyping();
+    void setShowMeTyping(bool showTyping);
+
+    bool showOthersTyping();
+    void setShowOthersTyping(bool showTyping);
+
 private:
     TextChatConfig();
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list