[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:04:45 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=9bbc405

The following commit has been merged in the master branch:
commit 9bbc405ba35b58d0ebe7fd079bb1178ead12dab6
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Thu Jan 19 19:47:53 2012 +0000

    Add connectionStatus to global presence
    
    REVIEW:103739
---
 KTp/global-presence.cpp | 35 +++++++++++++++++++++++++++++++++++
 KTp/global-presence.h   |  6 ++++++
 2 files changed, 41 insertions(+)

diff --git a/KTp/global-presence.cpp b/KTp/global-presence.cpp
index 4fe4407..b379e56 100644
--- a/KTp/global-presence.cpp
+++ b/KTp/global-presence.cpp
@@ -59,6 +59,11 @@ void GlobalPresence::setAccountManager(const Tp::AccountManagerPtr &accountManag
 }
 
 
+Tp::ConnectionStatus GlobalPresence::connectionStatus() const
+{
+    return m_connectionStatus;
+}
+
 Presence GlobalPresence::currentPresence() const
 {
     return m_currentPresence;
@@ -83,6 +88,7 @@ void GlobalPresence::setPresence(const Tp::Presence &presence)
 
 void GlobalPresence::onAccountAdded(const Tp::AccountPtr &account)
 {
+    connect(account.data(), SIGNAL(connectionStatusChanged(Tp::ConnectionStatus)), SLOT(onConnectionStatusChanged()));
     connect(account.data(), SIGNAL(changingPresence(bool)), SLOT(onChangingPresence()));
     connect(account.data(), SIGNAL(requestedPresenceChanged(Tp::Presence)), SLOT(onRequestedPresenceChanged()));
     connect(account.data(), SIGNAL(currentPresenceChanged(Tp::Presence)), SLOT(onCurrentPresenceChanged()));
@@ -139,6 +145,34 @@ void GlobalPresence::onChangingPresence()
     }
 }
 
+void GlobalPresence::onConnectionStatusChanged()
+{
+    Tp::ConnectionStatus connectionStatus = Tp::ConnectionStatusDisconnected;
+
+    Q_FOREACH(const Tp::AccountPtr &account, m_enabledAccounts->accounts()) {
+        switch (account->connectionStatus()) {
+        case Tp::ConnectionStatusConnecting:
+            //connecting is the highest state, use this always
+            connectionStatus = Tp::ConnectionStatusConnecting;
+            break;
+        case Tp::ConnectionStatusConnected:
+            //only set to connected if we're not at connecting
+            if (connectionStatus == Tp::ConnectionStatusDisconnected) {
+                connectionStatus = Tp::ConnectionStatusConnected;
+            }
+            break;
+        default:
+            break;
+        }
+    }
+
+    if (connectionStatus != m_connectionStatus) {
+        m_connectionStatus = connectionStatus;
+        Q_EMIT connectionStatusChanged(m_connectionStatus);
+    }
+}
+
+
 bool GlobalPresence::hasEnabledAccounts() const
 {
     if (m_enabledAccounts->accounts().isEmpty()) {
@@ -167,4 +201,5 @@ Tp::AccountSetPtr GlobalPresence::onlineAccounts() const
 
 }
 
+
 #include "global-presence.moc"
diff --git a/KTp/global-presence.h b/KTp/global-presence.h
index 01706b0..1bba3fc 100644
--- a/KTp/global-presence.h
+++ b/KTp/global-presence.h
@@ -46,6 +46,8 @@ public:
       */
     void setAccountManager(const Tp::AccountManagerPtr &accountManager);
 
+    /** Returns connecting if any account is connecting, else connected if at least one account is connected, disconnected otherwise*/
+    Tp::ConnectionStatus connectionStatus() const;
 
     /** The most online presence of any account*/
     Presence currentPresence() const;
@@ -66,6 +68,7 @@ Q_SIGNALS:
     void requestedPresenceChanged(const KTp::Presence &customPresence);
     void currentPresenceChanged(const KTp::Presence &presence);
     void changingPresence(bool isChanging);
+    void connectionStatusChanged(Tp::ConnectionStatus);
 
 public Q_SLOTS:
     /** Set all enabled accounts to the specified presence*/
@@ -80,6 +83,7 @@ private Q_SLOTS:
     void onCurrentPresenceChanged();
     void onRequestedPresenceChanged();
     void onChangingPresence();
+    void onConnectionStatusChanged();
 
     void onAccountAdded(const Tp::AccountPtr &account);
 
@@ -93,6 +97,8 @@ private:
     KTp::Presence m_requestedPresence;
     /** A cache of the last sent presence*/
     KTp::Presence m_currentPresence;
+
+    Tp::ConnectionStatus m_connectionStatus;
     bool m_changingPresence;
 };
 

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list