[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:07:44 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=33e4c28
The following commit has been merged in the master branch:
commit 33e4c287cdbcbf62230c3c66ff946eeb931c6a5d
Author: Siddhartha Sahu <sh.siddhartha at gmail.com>
Date: Sun Oct 20 22:50:35 2013 +0200
Added functions for setting user typing status
REVIEW:112597
---
KTp/Declarative/conversation.cpp | 28 ++++++++++++++++++++++++++++
KTp/Declarative/conversation.h | 2 ++
2 files changed, 30 insertions(+)
diff --git a/KTp/Declarative/conversation.cpp b/KTp/Declarative/conversation.cpp
index 8284d81..a3644fd 100644
--- a/KTp/Declarative/conversation.cpp
+++ b/KTp/Declarative/conversation.cpp
@@ -40,6 +40,7 @@ class Conversation::ConversationPrivate
bool delegated;
bool valid;
Tp::AccountPtr account;
+ QTimer *pausedStateTimer;
};
Conversation::Conversation(const Tp::TextChannelPtr &channel,
@@ -59,6 +60,9 @@ Conversation::Conversation(const Tp::TextChannelPtr &channel,
d->delegated = false;
+ d->pausedStateTimer = new QTimer(this);
+ d->pausedStateTimer->setSingleShot(true);
+ connect(d->pausedStateTimer, SIGNAL(timeout()), this, SLOT(onChatPausedTimerExpired()));
}
Conversation::Conversation(QObject *parent) : QObject(parent)
@@ -148,6 +152,30 @@ void Conversation::requestClose()
Q_EMIT conversationCloseRequested();
}
+void Conversation::updateTextChanged(const QString &message)
+{
+ if (!message.isEmpty()) {
+ //if the timer is active, it means the user is continuously typing
+ if (d->pausedStateTimer->isActive()) {
+ //just restart the timer and don't spam with chat state changes
+ d->pausedStateTimer->start(5000);
+ } else {
+ //if the user has just typed some text, set state to Composing and start the timer
+ d->messages->textChannel()->requestChatState(Tp::ChannelChatStateComposing);
+ d->pausedStateTimer->start(5000);
+ }
+ } else {
+ //if the user typed no text/cleared the input field, set Active and stop the timer
+ d->messages->textChannel()->requestChatState(Tp::ChannelChatStateActive);
+ d->pausedStateTimer->stop();
+ }
+}
+
+void Conversation::onChatPausedTimerExpired()
+{
+ d->messages->textChannel()->requestChatState(Tp::ChannelChatStatePaused);
+}
+
Conversation::~Conversation()
{
kDebug();
diff --git a/KTp/Declarative/conversation.h b/KTp/Declarative/conversation.h
index 6f50709..38b313e 100644
--- a/KTp/Declarative/conversation.h
+++ b/KTp/Declarative/conversation.h
@@ -59,11 +59,13 @@ Q_SIGNALS:
public Q_SLOTS:
void delegateToProperClient();
void requestClose();
+ void updateTextChanged(const QString &message);
private Q_SLOTS:
void onChannelInvalidated(Tp::DBusProxy *proxy, const QString &errorName, const QString &errorMessage);
void onAccountConnectionChanged(const Tp::ConnectionPtr &connection);
void onCreateChannelFinished(Tp::PendingOperation *op);
+ void onChatPausedTimerExpired();
private:
class ConversationPrivate;
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list