[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:24:35 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=f42b8c5
The following commit has been merged in the master branch:
commit f42b8c58734a0c527bf8e3f0821aea85fc0de96a
Author: Leon Handreke <leonh at ndreke.de>
Date: Mon Apr 14 00:08:23 2014 +0200
Overlay presence icon with phone as tab icon if user is on mobile
REVIEW: 117554
Reviewed-By: David Edmundson <david at davidedmundson.co.uk>
BUG: 304057
---
lib/channel-contact-model.cpp | 14 ++++++++++++++
lib/channel-contact-model.h | 2 ++
lib/chat-widget.cpp | 33 +++++++++++++++++++++++++--------
lib/chat-widget.h | 2 ++
4 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/lib/channel-contact-model.cpp b/lib/channel-contact-model.cpp
index 0a7bb9a..df8c491 100644
--- a/lib/channel-contact-model.cpp
+++ b/lib/channel-contact-model.cpp
@@ -151,6 +151,16 @@ void ChannelContactModel::onContactBlockStatusChanged(bool blocked)
Q_EMIT contactBlockStatusChanged(contact, blocked);
}
+void ChannelContactModel::onContactClientTypesChanged(const QStringList &clientTypes)
+{
+ Tp::ContactPtr contact(qobject_cast<Tp::Contact*>(sender()));
+
+ QModelIndex index = createIndex(m_contacts.lastIndexOf(contact), 0);
+ Q_EMIT dataChanged(index, index);
+
+ Q_EMIT contactClientTypesChanged(contact, clientTypes);
+}
+
void ChannelContactModel::addContacts(const Tp::Contacts &contacts)
{
QList<Tp::ContactPtr> newContacts = contacts.toList();
@@ -159,6 +169,10 @@ void ChannelContactModel::addContacts(const Tp::Contacts &contacts)
connect(contact.data(), SIGNAL(aliasChanged(QString)), SLOT(onContactAliasChanged(QString)));
connect(contact.data(), SIGNAL(presenceChanged(Tp::Presence)), SLOT(onContactPresenceChanged(Tp::Presence)));
connect(contact.data(), SIGNAL(blockStatusChanged(bool)), SLOT(onContactBlockStatusChanged(bool)));
+ connect(contact.data(),
+ SIGNAL(clientTypesChanged(QStringList)),
+ SLOT(onContactClientTypesChanged(QStringList)));
+
}
if (!newContacts.isEmpty()) {
diff --git a/lib/channel-contact-model.h b/lib/channel-contact-model.h
index 4776339..7e0ae45 100644
--- a/lib/channel-contact-model.h
+++ b/lib/channel-contact-model.h
@@ -57,6 +57,7 @@ Q_SIGNALS:
void contactPresenceChanged(const Tp::ContactPtr &contact, const KTp::Presence &presence);
void contactAliasChanged(const Tp::ContactPtr &contact, const QString &alias);
void contactBlockStatusChanged(const Tp::ContactPtr &contact, bool blocked);
+ void contactClientTypesChanged(const Tp::ContactPtr &contact, const QStringList &clientTypes);
private Q_SLOTS:
void onGroupMembersChanged(const Tp::Contacts &groupMembersAdded,
@@ -67,6 +68,7 @@ private Q_SLOTS:
void onContactPresenceChanged(const Tp::Presence &presence);
void onContactAliasChanged(const QString &alias);
void onContactBlockStatusChanged(bool blocked);
+ void onContactClientTypesChanged(const QStringList &clientTypes);
void onChatStateChanged(const Tp::ContactPtr &contact, Tp::ChannelChatState state);
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index f71cdb6..5afed20 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -256,7 +256,17 @@ KIcon ChatWidget::icon() const
//normal chat - self and one other person.
//find the other contact which isn't self.
Tp::ContactPtr otherContact = d->channel->targetContact();
- return KTp::Presence(otherContact->presence()).icon();
+ KIcon presenceIcon = KTp::Presence(otherContact->presence()).icon();
+
+ if (otherContact->clientTypes().contains(QLatin1String("phone"))) {
+ //we paint a warning symbol in the right-bottom corner
+ QPixmap phonePixmap = KIconLoader::global()->loadIcon(QLatin1String("phone"), KIconLoader::NoGroup, 16);
+ QPixmap pixmap = presenceIcon.pixmap(32, 32);
+ QPainter painter(&pixmap);
+ painter.drawPixmap(8, 8, 24, 24, phonePixmap);
+ return KIcon(pixmap);
+ }
+ return presenceIcon;
} else {
return KTp::Presence(Tp::Presence::offline()).icon();
}
@@ -509,9 +519,10 @@ void ChatWidget::setupContactModelSignals()
SLOT(onContactAliasChanged(Tp::ContactPtr,QString)));
connect(d->contactModel, SIGNAL(contactBlockStatusChanged(Tp::ContactPtr,bool)),
SLOT(onContactBlockStatusChanged(Tp::ContactPtr,bool)));
+ connect(d->contactModel,SIGNAL(contactClientTypesChanged(Tp::ContactPtr,QStringList)),
+ SLOT(onContactClientTypesChanged(Tp::ContactPtr,QStringList)));
}
-
void ChatWidget::onHistoryFetched(const QList<KTp::Message> &messages)
{
d->chatViewInitialized = true;
@@ -805,7 +816,7 @@ void ChatWidget::onContactPresenceChange(const Tp::ContactPtr & contact, const K
//if in a non-group chat situation, and the other contact has changed state...
if (!d->isGroupChat && !isYou) {
- Q_EMIT iconChanged(presence.icon());
+ Q_EMIT iconChanged(icon());
}
Q_EMIT contactPresenceChanged(presence);
@@ -855,6 +866,16 @@ void ChatWidget::onContactBlockStatusChanged(const Tp::ContactPtr &contact, bool
Q_EMIT contactBlockStatusChanged(blocked);
}
+void ChatWidget::onContactClientTypesChanged(const Tp::ContactPtr &contact, const QStringList &clientTypes)
+{
+ Q_UNUSED(clientTypes)
+ bool isYou = (contact == d->channel->groupSelfContact());
+
+ if (!d->isGroupChat && !isYou) {
+ Q_EMIT iconChanged(icon());
+ }
+}
+
void ChatWidget::onParticipantsChanged()
{
// Temporarily detect on-demand rooms by checking for gabble-created string "private-chat"
@@ -1116,11 +1137,7 @@ void ChatWidget::currentPresenceChanged(const Tp::Presence &presence)
{
if (presence == Tp::Presence::offline()) {
d->ui.chatArea->addStatusMessage(i18n("You are now offline"), d->yourName);
- if(!d->isGroupChat) {
- Q_EMIT iconChanged(KTp::Presence(Tp::Presence::offline()).icon());
- } else {
- Q_EMIT iconChanged(KIcon(groupChatOfflineIcon));
- }
+ iconChanged(icon());
}
}
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 648f587..5428104 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -146,6 +146,8 @@ protected Q_SLOTS:
void onContactAliasChanged(const Tp::ContactPtr &contact, const QString &alias);
+ void onContactClientTypesChanged(const Tp::ContactPtr &contact, const QStringList &clientTypes);
+
void onParticipantsChanged();
void onChannelInvalidated();
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list