[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:38 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=5ec3955
The following commit has been merged in the master branch:
commit 5ec3955b9320b6234712f75703ccde77930530f2
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Sat Sep 15 11:54:05 2012 +0200
Set icon to offline when account goes offline
This also monitors account presence instead of channel connection
for the icon and the "You are now offline" string
Reviewed-by: David Edmundson
---
lib/chat-widget.cpp | 16 ++++++++--------
lib/chat-widget.h | 3 +--
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 6c9c7ed..1a148c1 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -96,6 +96,8 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
d->account = account;
d->logManager = new LogManager(this);
+ connect(d->account.data(), SIGNAL(currentPresenceChanged(Tp::Presence)),
+ this, SLOT(currentPresenceChanged(Tp::Presence)));
//load translations for this library. keep this before any i18n() calls in library code
KGlobal::locale()->insertCatalog(QLatin1String("ktpchat"));
@@ -294,8 +296,8 @@ void ChatWidget::setChatEnabled(bool enable)
void ChatWidget::setTextChannel(const Tp::TextChannelPtr &newTextChannelPtr)
{
- if (!d->channel.isNull()) {
- onChannelConnectionChanged(newTextChannelPtr->connection()->status());
+ if (!d->channel.isNull() && d->channel->connection()->status() == Tp::ConnectionStatusConnected) {
+ onContactPresenceChange(d->channel->groupSelfContact(), KTp::Presence(d->channel->groupSelfContact()->presence()));
}
d->channel = newTextChannelPtr; // set the new channel
d->contactModel->setTextChannel(newTextChannelPtr);
@@ -499,8 +501,6 @@ 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()));
@@ -1044,18 +1044,18 @@ void ChatWidget::onChatPausedTimerExpired()
d->channel->requestChatState(Tp::ChannelChatStatePaused);
}
-void ChatWidget::onChannelConnectionChanged(Tp::ConnectionStatus status)
+void ChatWidget::currentPresenceChanged(const Tp::Presence &presence)
{
- if (status == Tp::ConnectionStatusConnected) {
- onContactPresenceChange(d->channel->groupSelfContact(), KTp::Presence(d->channel->groupSelfContact()->presence()));
- } else if (status == Tp::ConnectionStatusDisconnected) {
+ if (presence == Tp::Presence::offline()) {
// 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);
+ Q_EMIT iconChanged(KTp::Presence(Tp::Presence::offline()).icon());
}
}
+
#include "chat-widget.moc"
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 7d2dcf2..fd1d660 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -135,8 +135,6 @@ 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);
@@ -171,6 +169,7 @@ private Q_SLOTS:
void onFormatColorReleased();
void onHistoryFetched(const QList<AdiumThemeContentInfo> &messages);
void onChatPausedTimerExpired();
+ void currentPresenceChanged(const Tp::Presence &presence);
void temporaryFileTransferChannelCreated(Tp::PendingOperation *operation);
void temporaryFileTransferStateChanged(Tp::FileTransferState, Tp::FileTransferStateChangeReason);
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list