[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:22:21 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=c29f348
The following commit has been merged in the master branch:
commit c29f348f4137bea383d1c061d69bb15c56694633
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Mon Aug 6 18:50:31 2012 +0200
Handle connection states and print a service message when it changes
Until now we print "Connected" and "Connection closed" strings when the channel is connected or invalidated. This patch watches for channel connection and prints the corresponding presence as a service message, ie. "You are now offline" and "You are now marked as %1" instead of those "Connected"/"Connection closed" strings.
Reviewed-by: David Edmundson
BUG: 304092
FIXED-IN: 0.5
---
lib/chat-widget.cpp | 36 +++++++++++++++++++++---------------
lib/chat-widget.h | 2 ++
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index c439505..cef9b0c 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -288,24 +288,14 @@ ChatSearchBar *ChatWidget::chatSearchBar() const
void ChatWidget::setChatEnabled(bool enable)
{
d->ui.sendMessageBox->setEnabled(enable);
-
- // show a message informing the user
- AdiumThemeStatusInfo statusMessage;
-
- if (!enable) {
- statusMessage.setMessage(i18n("Connection closed"));
- } else {
- statusMessage.setMessage(i18nc("Connected to IM service", "Connected"));
- }
- statusMessage.setService(d->channel->connection()->protocolName());
- statusMessage.setTime(QDateTime::currentDateTime());
- d->ui.chatArea->addStatusMessage(statusMessage);
-
Q_EMIT iconChanged(icon());
}
void ChatWidget::setTextChannel(const Tp::TextChannelPtr &newTextChannelPtr)
{
+ if (!d->channel.isNull()) {
+ onChannelConnectionChanged(newTextChannelPtr->connection()->status());
+ }
d->channel = newTextChannelPtr; // set the new channel
d->contactModel->setTextChannel(newTextChannelPtr);
@@ -508,6 +498,8 @@ void ChatWidget::setupChannelSignals()
SLOT(onChatStatusChanged(Tp::ContactPtr,Tp::ChannelChatState)));
connect(d->channel.data(), SIGNAL(invalidated(Tp::DBusProxy*,QString,QString)),
this, SLOT(onChannelInvalidated()));
+ connect(d->channel.data()->connection().data(), SIGNAL(statusChanged(Tp::ConnectionStatus)),
+ this, SLOT(onChannelConnectionChanged(Tp::ConnectionStatus)));
if (d->channel->hasChatStateInterface()) {
connect(d->ui.sendMessageBox, SIGNAL(textChanged()), SLOT(onInputBoxChanged()));
@@ -727,11 +719,11 @@ void ChatWidget::notifyAboutIncomingMessage(const Tp::ReceivedMessage & message)
if (message.sender() == d->channel->groupSelfContact()) {
return;
}
-
+
if (message.isDeliveryReport()) {
return;
}
-
+
// kde_telepathy_contact_highlight (contains your name)
// kde_telepathy_info_event
@@ -1051,4 +1043,18 @@ void ChatWidget::onChatPausedTimerExpired()
d->channel->requestChatState(Tp::ChannelChatStatePaused);
}
+void ChatWidget::onChannelConnectionChanged(Tp::ConnectionStatus status)
+{
+ if (status == Tp::ConnectionStatusConnected) {
+ onContactPresenceChange(d->channel->groupSelfContact(), KTp::Presence(d->channel->groupSelfContact()->presence()));
+ } else if (status == Tp::ConnectionStatusDisconnected) {
+ // show a message informing the user
+ AdiumThemeStatusInfo statusMessage;
+ statusMessage.setMessage(i18n("You are now offline"));
+ statusMessage.setService(d->channel->connection()->protocolName());
+ statusMessage.setTime(QDateTime::currentDateTime());
+ d->ui.chatArea->addStatusMessage(statusMessage);
+ }
+}
+
#include "chat-widget.moc"
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 9b6f08e..7d2dcf2 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -135,6 +135,8 @@ protected Q_SLOTS:
void chatViewReady();
+ void onChannelConnectionChanged(Tp::ConnectionStatus status);
+
Q_SIGNALS:
/** Emitted whenever the title for the chat changes, normally the name of the contact or a topic*/
void titleChanged(const QString &title);
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list