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


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

The following commit has been merged in the master branch:
commit 0217e80e77ff613ef2c95b129459e5f0d39e3da3
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Fri Mar 4 14:37:27 2011 +0100

    Add an "Connecting" indicator to AccountButton
---
 accountbutton.cpp | 38 ++++++++++++++++++++++++++++++++++++--
 accountbutton.h   |  9 +++++++--
 main-widget.cpp   |  6 +++---
 3 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/accountbutton.cpp b/accountbutton.cpp
index 8b83f59..3fe0e55 100644
--- a/accountbutton.cpp
+++ b/accountbutton.cpp
@@ -24,6 +24,8 @@
 
 #include <KIcon>
 #include <KLocale>
+#include <KPixmapSequenceOverlayPainter>
+#include <KPixmapSequence>
 
 #include <TelepathyQt4/PendingOperation>
 
@@ -37,11 +39,15 @@ Tp::ConnectionPresenceTypeHidden, Tp::ConnectionPresenceTypeOffline };
 static const char *accountPresenceStatuses[] = { "available", "away", "brb", "busy",
 "dnd", "xa", "hidden", "offline" };
 
-AccountButton::AccountButton(const Tp::AccountPtr &account, QWidget* parent): QToolButton(parent)
+AccountButton::AccountButton(const Tp::AccountPtr &account, QWidget* parent): QToolButton(parent),m_busyOverlay(0)
 {
     m_account = account;
     m_statusIndex = -1;
     
+    m_busyOverlay = new KPixmapSequenceOverlayPainter(this);
+    m_busyOverlay->setWidget(this);
+    m_busyOverlay->setSequence(KPixmapSequence(QString("process-working")));
+    
     QString iconPath = account->iconName();
     
     //if the icon has not been set, we use the protocol icon    
@@ -113,6 +119,9 @@ AccountButton::AccountButton(const Tp::AccountPtr &account, QWidget* parent): QT
     connect(this, SIGNAL(triggered(QAction*)),
             this, SLOT(setAccountStatus(QAction*)));
     
+    connect(m_account.data(),SIGNAL(connectionStatusChanged(Tp::ConnectionStatus)), 
+            this, SLOT(connectionChanged(Tp::ConnectionStatus)));
+    
     if(m_statusIndex == -1) {
         m_statusIndex = 7;
     }
@@ -150,4 +159,29 @@ void AccountButton::updateToolTip()
                                         .arg(actions().value(m_statusIndex)->text())
                                         .arg(m_account->currentPresence().statusMessage()));
     }
-}   
\ No newline at end of file
+}
+
+void AccountButton::connectionChanged(Tp::ConnectionStatus status)
+{
+    switch (status) {
+        case Tp::ConnectionStatusConnecting:
+                showBusyIndicator();
+            break;
+        case Tp::ConnectionStatusConnected:
+        case Tp::ConnectionStatusDisconnected:
+                hideBusyIndicator();            
+            break;
+        default:
+            break;
+    }
+}
+
+void AccountButton::showBusyIndicator()
+{
+    m_busyOverlay->start();
+}
+
+void AccountButton::hideBusyIndicator()
+{
+    m_busyOverlay->stop();
+}
\ No newline at end of file
diff --git a/accountbutton.h b/accountbutton.h
index e93fbef..4c688b8 100644
--- a/accountbutton.h
+++ b/accountbutton.h
@@ -27,6 +27,7 @@
 #include <TelepathyQt4/Account>
 
 class QAction;
+class KPixmapSequenceOverlayPainter;
 
 class AccountButton : public QToolButton
 {
@@ -38,10 +39,14 @@ public:
 public Q_SLOTS:
     void setAccountStatus(QAction *action);
     void updateToolTip();
+    void connectionChanged(Tp::ConnectionStatus status);
+    void showBusyIndicator();
+    void hideBusyIndicator();
     
 private:
-    Tp::AccountPtr m_account;
-    int            m_statusIndex;
+    Tp::AccountPtr                  m_account;
+    int                             m_statusIndex;
+    KPixmapSequenceOverlayPainter*  m_busyOverlay;
 };
 
 #endif // TELEPATHY_ACCOUNTBUTTON_H
diff --git a/main-widget.cpp b/main-widget.cpp
index ab04567..e69494e 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -221,11 +221,11 @@ void MainWidget::onAccountConnectionStatusChanged(Tp::ConnectionStatus status)
     kDebug() << "Connection status is" << status;
     switch (status) {
     case Tp::ConnectionStatusConnecting:
-         showMessageToUser(i18n("Connecting..."), MainWidget::SystemMessageInfo);
+         //showMessageToUser(i18n("Connecting..."), MainWidget::SystemMessageInfo);
         break;
     case Tp::ConnectionStatusConnected:
-        showMessageToUser(i18n("Connected!"), MainWidget::SystemMessageInfo);
-        m_model->onNewAccount(Tp::AccountPtr(dynamic_cast<Tp::Account*>(sender())));
+        //showMessageToUser(i18n("Connected!"), MainWidget::SystemMessageInfo);
+        m_model->onNewAccount(Tp::AccountPtr(static_cast<Tp::Account*>(sender())));
         m_contactsListView->expandAll();
         break;
     case Tp::ConnectionStatusDisconnected:

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list