[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:05:47 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=ff2ea50

The following commit has been merged in the master branch:
commit ff2ea50a4d10f6113d343a48b3a6a1c2c230dd77
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Sat Apr 2 22:08:17 2011 +0200

    Add a possibility to set a different status message per account. If the status message is changed from CL's main status line edit, this gets changed as well. Plus some minor fixes/improvements in AccountButton.
    Reviewed by: David Edmundson
    REVIEW: 101011
---
 account-button.cpp | 51 +++++++++++++++++++++++++++++++++++++++------------
 account-button.h   |  3 +++
 2 files changed, 42 insertions(+), 12 deletions(-)

diff --git a/account-button.cpp b/account-button.cpp
index 7a5f27d..db00d7b 100644
--- a/account-button.cpp
+++ b/account-button.cpp
@@ -27,6 +27,7 @@
 #include <KPixmapSequenceOverlayPainter>
 #include <KPixmapSequence>
 #include <KIconLoader>
+#include <KLineEdit>
 
 #include <TelepathyQt4/Account>
 #include <TelepathyQt4/PendingOperation>
@@ -81,6 +82,21 @@ AccountButton::AccountButton(const Tp::AccountPtr &account, QWidget* parent)
     KAction *invisibleAction =  new KAction(KIcon("user-invisible"), i18nc("@action:inmenu", "Invisible"), this);
     KAction *offlineAction =    new KAction(KIcon("user-offline"), i18nc("@action:inmenu", "Offline"), this);
 
+    m_presenceMessageWidget = new KLineEdit(this);
+    m_presenceMessageWidget->setClearButtonShown(true);
+    m_presenceMessageWidget->setClickMessage(i18n("Set message..."));
+    m_presenceMessageWidget->setTrapReturnKey(true);
+
+    connect(m_presenceMessageWidget, SIGNAL(returnPressed(QString)),
+            this, SLOT(setCustomPresenceMessage(QString)));
+
+    //this makes sure the klineedit loses focus once enter was pressed
+    connect(m_presenceMessageWidget, SIGNAL(returnPressed(QString)),
+            this, SLOT(setFocus()));
+
+    QWidgetAction *presenceMessageAction = new QWidgetAction(this);
+    presenceMessageAction->setDefaultWidget(m_presenceMessageWidget);
+
     //let's set the presences as data so we can easily just use the Tp::Presence when the action has been triggered
     onlineAction->setData(qVariantFromValue(Tp::Presence::available()));
     awayAction->setData(qVariantFromValue(Tp::Presence::away()));
@@ -99,24 +115,18 @@ AccountButton::AccountButton(const Tp::AccountPtr &account, QWidget* parent)
     presenceActions->addAction(xaAction);
     presenceActions->addAction(invisibleAction);
     presenceActions->addAction(offlineAction);
+    presenceActions->addAction(presenceMessageAction);
 
     addActions(presenceActions->actions());
 
-    //make all the actions checkable and set the current status as checked
+    //make all the actions checkable
     foreach (QAction *a, actions()) {
         a->setCheckable(true);
-
-        if (m_account->currentPresence().status() == qVariantValue<Tp::Presence>(a->data()).status()) {
-            a->setChecked(true);
-
-            QPixmap pixmap = icon().pixmap(32, 32);
-            QPainter painter(&pixmap);
-            KIcon(a->icon()).paint(&painter, 15, 15, 16, 16);
-
-            setIcon(KIcon(pixmap));
-        }
     }
 
+    //set the current status as checked and paint presence overlay
+    presenceChanged(m_account->currentPresence());
+
     connect(this, SIGNAL(triggered(QAction*)),
             this, SLOT(setAccountStatus(QAction*)));
 
@@ -195,13 +205,28 @@ void AccountButton::hideBusyIndicator()
 
 void AccountButton::presenceChanged(const Tp::Presence &presence)
 {
+    bool accountPresenceFound = false;
+
     foreach (QAction *a, actions()) {
         if (presence.status() == qVariantValue<Tp::Presence>(a->data()).status()) {
             a->setChecked(true);
             updateToolTip();
+
+            accountPresenceFound = true;
+
+            QPixmap pixmap = icon().pixmap(32, 32);
+            QPainter painter(&pixmap);
+            KIcon(a->icon()).paint(&painter, 15, 15, 16, 16);
+
+            setIcon(KIcon(pixmap));
+
             break;
         }
     }
+
+    if (!accountPresenceFound) {
+        presenceChanged(Tp::Presence::offline());
+    }
 }
 
 /*  since there is no easy way to get this string by Tp::Presence,
@@ -210,7 +235,7 @@ void AccountButton::presenceChanged(const Tp::Presence &presence)
 QString AccountButton::presenceDisplayString(const Tp::Presence &presence)
 {
     foreach (QAction *a, actions()) {
-        if (m_account->currentPresence().status() == qVariantValue<Tp::Presence>(a->data()).status()) {
+        if (presence.status() == qVariantValue<Tp::Presence>(a->data()).status()) {
             return a->text();
         }
     }
@@ -233,4 +258,6 @@ void AccountButton::setCustomPresenceMessage(const QString& message)
 
     connect(presenceRequest, SIGNAL(finished(Tp::PendingOperation*)),
             this, SLOT(updateToolTip()));
+
+    m_presenceMessageWidget->setText(message);
 }
diff --git a/account-button.h b/account-button.h
index c5ac84a..451af7e 100644
--- a/account-button.h
+++ b/account-button.h
@@ -28,6 +28,7 @@
 
 class QAction;
 class KPixmapSequenceOverlayPainter;
+class KLineEdit;
 
 class AccountButton : public QToolButton
 {
@@ -74,6 +75,8 @@ private:
     ///The busy icon which is painted when connecting
     KPixmapSequenceOverlayPainter  *m_busyOverlay;
 
+    KLineEdit *m_presenceMessageWidget;
+
     QPixmap m_errorPixmap;
     QPixmap m_onlinePixmap;
     QPixmap m_awayPixmap;

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list