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


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

The following commit has been merged in the master branch:
commit ceca8bc2dc4c56b382749a5a42fbdf060fbfcd1a
Author: Rohan Garg <rohangarg at kubuntu.org>
Date:   Wed Mar 21 20:03:30 2012 +0530

    Set ChannelChatState as Paused when the user has not typed for the past 5 seconds
    
    REVIEW: 104354
    BUG: 296439
---
 lib/chat-widget.cpp | 17 ++++++++++++++---
 lib/chat-widget.h   |  1 +
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index e852972..4da2d07 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -69,6 +69,7 @@ public:
     Ui::ChatWidget ui;
     ChannelContactModel *contactModel;
     LogManager *logManager;
+    QTimer *pausedStateTimer;
 
     KComponentData telepathyComponentData();
 };
@@ -173,6 +174,9 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
 
     d->ui.sendMessageBox->setSpellCheckingLanguage(KGlobal::locale()->language());
 
+    d->pausedStateTimer = new QTimer(this);
+    d->pausedStateTimer->setSingleShot(true);
+
     //connect signals/slots from format toolbar
     connect(d->ui.formatColor, SIGNAL(released()), SLOT(onFormatColorReleased()));
     connect(d->ui.formatBold, SIGNAL(toggled(bool)), d->ui.sendMessageBox, SLOT(setFontBold(bool)));
@@ -191,6 +195,8 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
 
     connect(this, SIGNAL(searchTextComplete(bool)), d->ui.searchBar, SLOT(onSearchTextComplete(bool)));
 
+    connect(d->pausedStateTimer, SIGNAL(timeout()), this, SLOT(onChatPausedTimerExpired()));
+
     // initialize LogManager
     if (!d->isGroupChat) {
         d->logManager->setFetchAmount(3);
@@ -807,14 +813,15 @@ void ChatWidget::onChannelInvalidated()
 void ChatWidget::onInputBoxChanged()
 {
     //if the box is empty
-    bool currentlyTyping = !d->ui.sendMessageBox->toPlainText().isEmpty();
+    bool textBoxEmpty = !d->ui.sendMessageBox->toPlainText().isEmpty();
 
     //FIXME buffer what we've sent to telepathy, make this more efficient.
-    //FIXME check spec (with olly) as to whether we have to handle idle state etc.
-    if(currentlyTyping) {
+    if(textBoxEmpty) {
         d->channel->requestChatState(Tp::ChannelChatStateComposing);
+        d->pausedStateTimer->start(5000);
     } else {
         d->channel->requestChatState(Tp::ChannelChatStateActive);
+        d->pausedStateTimer->stop();
     }
 }
 
@@ -864,5 +871,9 @@ Tp::ChannelChatState ChatWidget::remoteChatState()
     return d->remoteContactChatState;
 }
 
+void ChatWidget::onChatPausedTimerExpired()
+{
+        d->channel->requestChatState(Tp::ChannelChatStatePaused);
+}
 
 #include "chat-widget.moc"
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 3d72798..e1efbbb 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -156,6 +156,7 @@ private Q_SLOTS:
     void findPreviousTextInChat(const QString &text, QWebPage::FindFlags flags);
     void onFormatColorReleased();
     void onHistoryFetched(const QList<AdiumThemeContentInfo> &messages);
+    void onChatPausedTimerExpired();
 
 private:
     /** connects necessary signals for the channel */

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list