[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:07:54 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=d1d3d33
The following commit has been merged in the master branch:
commit d1d3d33b25def29d88291c2073d29c36bbeac646
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Thu Oct 13 23:47:52 2011 +0100
Add a tooltip in the presence combo to show the status of each account
REVIEW: 102847
---
global-presence-chooser.cpp | 36 ++++++++++++++++++++++++++++++++++--
global-presence-chooser.h | 4 ++++
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/global-presence-chooser.cpp b/global-presence-chooser.cpp
index b721594..c0f1ef8 100644
--- a/global-presence-chooser.cpp
+++ b/global-presence-chooser.cpp
@@ -28,12 +28,15 @@
#include <KLocale>
#include <KLineEdit>
#include <KDebug>
+#include <KPixmapSequence>
+#include <KPixmapSequenceOverlayPainter>
#include <TelepathyQt4/Presence>
+#include <TelepathyQt4/Account>
#include <QMouseEvent>
-#include <KPixmapSequence>
-#include <KPixmapSequenceOverlayPainter>
+#include <QtGui/QToolTip>
+
//A sneaky class that adds an extra entry to the end of the presence model
//called "Configure Presences"
@@ -127,9 +130,38 @@ GlobalPresenceChooser::GlobalPresenceChooser(QWidget *parent) :
void GlobalPresenceChooser::setAccountManager(const Tp::AccountManagerPtr &accountManager)
{
+ m_accountManager = accountManager;
m_globalPresence->setAccountManager(accountManager);
}
+bool GlobalPresenceChooser::event(QEvent *e)
+{
+ if (e->type() == QEvent::ToolTip) {
+ if (m_accountManager.isNull()) {
+ return false;
+ }
+
+ QHelpEvent *helpEvent = static_cast<QHelpEvent *>(e);
+
+ QString toolTipText;
+
+ Q_FOREACH(const Tp::AccountPtr &account, m_accountManager->allAccounts()) {
+ if (account->isEnabled()) {
+ KPresence accountPresence(account->currentPresence());
+ QString presenceIconPath = KIconLoader::global()->iconPath(accountPresence.icon().name(), 1);
+ QString presenceIconString = QString::fromLatin1("<img src=\"%1\">").arg(presenceIconPath);
+ QString accountIconPath = KIconLoader::global()->iconPath(account->iconName(), 1);
+ QString accountIconString = QString::fromLatin1("<img src=\"%1\">").arg(accountIconPath);
+ toolTipText.append(QString::fromLatin1("<p>%1 %2 %3</p>").arg(presenceIconString, account->displayName(), accountIconString));
+ }
+ }
+
+ QToolTip::showText(helpEvent->globalPos(), toolTipText, this);
+ return true;
+ }
+ return QComboBox::event(e);
+}
+
void GlobalPresenceChooser::onCurrentIndexChanged(int index)
{
//if they select the "configure item"
diff --git a/global-presence-chooser.h b/global-presence-chooser.h
index 6c84496..a627e1a 100644
--- a/global-presence-chooser.h
+++ b/global-presence-chooser.h
@@ -36,6 +36,9 @@ public:
explicit GlobalPresenceChooser(QWidget *parent = 0);
void setAccountManager(const Tp::AccountManagerPtr &accountManager);
+protected:
+ virtual bool event(QEvent *event);
+
private slots:
void onCurrentIndexChanged(int index);
void onPresenceChanged(const Tp::Presence &presence);
@@ -45,6 +48,7 @@ private:
GlobalPresence *m_globalPresence;
PresenceModel *m_model;
KPixmapSequenceOverlayPainter *m_busyOverlay;
+ Tp::AccountManagerPtr m_accountManager;
};
#endif // GLOBALPRESENCECHOOSER_H
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list