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


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

The following commit has been merged in the master branch:
commit 8c201103c3531489e3945c7ccc296abd86fcfeef
Author: Weng Xuetian <wengxt at gmail.com>
Date:   Sat Sep 21 17:17:23 2013 -0400

    Make user-chosen presence priority higher than other presence.
    
    Change the global current presence algorithm to use the presence
    same as global requested presence if there is at least one account
    with such presence, otherwise it will fallback to the old algorithm.
    
    REVIEW: 112875
---
 KTp/global-presence.cpp | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/KTp/global-presence.cpp b/KTp/global-presence.cpp
index 8e88be9..0f08509 100644
--- a/KTp/global-presence.cpp
+++ b/KTp/global-presence.cpp
@@ -106,8 +106,35 @@ void GlobalPresence::onAccountAdded(const Tp::AccountPtr &account)
 
 void GlobalPresence::onCurrentPresenceChanged()
 {
+    /* basic idea of choosing global presence it to make it reflects the presence
+     * over all accounts, usually this is used to indicates user the whole system
+     * status.
+     *
+     * If there isn't any account, currentPresence should be offline, since there is nothing
+     * online.
+     * If there's only one account, then currentPresence should represent the presence
+     * of this account.
+     * If there're more than one accounts, the situation is more complicated.
+     * There can be some accounts is still connecting (thus it's offline), and there can be
+     * some accounts doesn't support the presence you're choosing. The user-chosen presence
+     * priority will be higher than standard presence order.
+     *
+     * Example:
+     * user choose to be online, 1 account online, 1 account offline, current presence
+     * should be online, since online priority is higher than offline.
+     * user chooses a presence supported by part of the account, current presence will be
+     * the one chosen by user, to indicate there is at least one account supports it.
+     * user choose a presence supported by no account, current presence will be chosen
+     * from all accounts based on priority, and it also indicates there is no account support
+     * the user-chosen presence.
+     */
     Tp::Presence highestCurrentPresence = Tp::Presence::offline();
     Q_FOREACH(const Tp::AccountPtr &account, m_enabledAccounts->accounts()) {
+        if (account->currentPresence().type() == m_requestedPresence.type()) {
+            highestCurrentPresence = account->currentPresence();
+            break;
+        }
+
         if (Presence::sortPriority(account->currentPresence().type()) < Presence::sortPriority(highestCurrentPresence.type())) {
             highestCurrentPresence = account->currentPresence();
         }
@@ -137,6 +164,8 @@ void GlobalPresence::onRequestedPresenceChanged()
             highestRequestedPresence.status() != m_requestedPresence.status() ||
             highestRequestedPresence.statusMessage() != m_requestedPresence.statusMessage()) {
         m_requestedPresence = Presence(highestRequestedPresence);
+        // current presence priority is affected by requested presence
+        onCurrentPresenceChanged();
         Q_EMIT requestedPresenceChanged(m_requestedPresence);
     }
 }

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list