[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:55 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=1966be0
The following commit has been merged in the master branch:
commit 1966be03e58b8a643c29c63ba8a1f00d92170a31
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Mon Oct 24 15:32:30 2011 +0100
Updated with moving global-presence and kpresence to the common lib.
---
CMakeLists.txt | 4 +-
common | 2 +-
global-presence-chooser.cpp | 3 +-
global-presence.cpp | 148 --------------------------------------------
global-presence.h | 84 -------------------------
kpresence.cpp | 98 -----------------------------
kpresence.h | 41 ------------
presence-model.h | 2 +-
8 files changed, 6 insertions(+), 376 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f1249c9..9bc4171 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,7 +47,6 @@ set (contactlist_SRCS
main.cpp
main-widget.cpp
fetch-avatar-job.cpp
- global-presence.cpp
global-presence-chooser.cpp
dialogs/add-contact-dialog.cpp
dialogs/join-chat-room-dialog.cpp
@@ -63,8 +62,9 @@ set (contactlist_SRCS
common/models/groups-model.cpp
common/models/proxy-tree-node.cpp
common/service-availability-checker.cpp
+ common/global-presence.cpp
+ common/kpresence.cpp
presence-model.cpp
- kpresence.cpp
)
diff --git a/common b/common
index e11a41b..0f23ea4 160000
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit e11a41b5010744f7f0a544495551b4c17f0a5895
+Subproject commit 0f23ea4338afab252a5b39a523b18cedc0536d3f
diff --git a/global-presence-chooser.cpp b/global-presence-chooser.cpp
index 867f2e6..44c081a 100644
--- a/global-presence-chooser.cpp
+++ b/global-presence-chooser.cpp
@@ -20,8 +20,9 @@
#include "global-presence-chooser.h"
-#include "global-presence.h"
#include "presence-model.h"
+
+#include "common/global-presence.h"
#include "dialogs/custom-presence-dialog.h"
#include <KIcon>
diff --git a/global-presence.cpp b/global-presence.cpp
deleted file mode 100644
index ba772b8..0000000
--- a/global-presence.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Global Presence - wraps calls to set and get presence for all accounts.
- *
- * Copyright (C) 2011 David Edmundson <kde at davidedmundson.co.uk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "global-presence.h"
-
-#include <TelepathyQt4/AccountSet>
-#include <TelepathyQt4/Account>
-
-#include <KDebug>
-
-GlobalPresence::GlobalPresence(QObject *parent)
- : QObject(parent),
- m_requestedPresence(Tp::Presence::offline()),
- m_currentPresence(Tp::Presence::offline()),
- m_changingPresence(false)
-{
- m_presenceSorting[Tp::ConnectionPresenceTypeAvailable] = 0;
- m_presenceSorting[Tp::ConnectionPresenceTypeBusy] = 1;
- m_presenceSorting[Tp::ConnectionPresenceTypeHidden] = 2;
- m_presenceSorting[Tp::ConnectionPresenceTypeAway] = 3;
- m_presenceSorting[Tp::ConnectionPresenceTypeExtendedAway] = 4;
- //don't distinguish between the following three presences
- m_presenceSorting[Tp::ConnectionPresenceTypeError] = 5;
- m_presenceSorting[Tp::ConnectionPresenceTypeUnknown] = 5;
- m_presenceSorting[Tp::ConnectionPresenceTypeUnset] = 5;
- m_presenceSorting[Tp::ConnectionPresenceTypeOffline] = 6;
-
-}
-
-void GlobalPresence::setAccountManager(const Tp::AccountManagerPtr &accountManager)
-{
- if (! accountManager->isReady()) {
- kFatal("GlobalPresence used with unready account manager");
- }
-
- m_enabledAccounts = accountManager->enabledAccounts();
-
- Q_FOREACH(const Tp::AccountPtr &account, m_enabledAccounts->accounts()) {
- onAccountAdded(account);
- }
-
- onCurrentPresenceChanged();
- onRequestedPresenceChanged();
- onChangingPresence();
-
- connect(m_enabledAccounts.data(), SIGNAL(accountAdded(Tp::AccountPtr)), SLOT(onAccountAdded(Tp::AccountPtr)));
-}
-
-
-Tp::Presence GlobalPresence::currentPresence() const
-{
- return m_currentPresence;
-}
-
-Tp::Presence GlobalPresence::requestedPresence() const
-{
- return m_requestedPresence;
-}
-
-bool GlobalPresence::isChangingPresence() const
-{
- return m_changingPresence;
-}
-
-
-void GlobalPresence::setPresence(const Tp::Presence &presence)
-{
- Q_FOREACH(const Tp::AccountPtr &account, m_enabledAccounts->accounts()) {
- account->setRequestedPresence(presence);
- }
-}
-
-
-void GlobalPresence::onAccountAdded(const Tp::AccountPtr &account)
-{
- 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()));
-}
-
-void GlobalPresence::onCurrentPresenceChanged()
-{
- Tp::Presence highestCurrentPresence = Tp::Presence::offline();
- Q_FOREACH(const Tp::AccountPtr &account, m_enabledAccounts->accounts()) {
- if (m_presenceSorting[account->currentPresence().type()] < m_presenceSorting[highestCurrentPresence.type()]) {
- highestCurrentPresence = account->currentPresence();
- }
- }
-
- qDebug() << "current presence changed";
-
- if (highestCurrentPresence.type() != m_currentPresence.type() ||
- highestCurrentPresence.status() != m_requestedPresence.status()) {
- m_currentPresence = highestCurrentPresence;
- qDebug() << "emit";
- Q_EMIT currentPresenceChanged(m_currentPresence);
- }
-}
-
-void GlobalPresence::onRequestedPresenceChanged()
-{
- Tp::Presence highestRequestedPresence = Tp::Presence::offline();
- Q_FOREACH(const Tp::AccountPtr &account, m_enabledAccounts->accounts()) {
- if (m_presenceSorting[account->requestedPresence().type()] < m_presenceSorting[highestRequestedPresence.type()]) {
- highestRequestedPresence = account->currentPresence();
- }
- }
-
- if (highestRequestedPresence.type() != m_requestedPresence.type() &&
- highestRequestedPresence.status() != m_requestedPresence.status()) {
- m_requestedPresence = highestRequestedPresence;
- Q_EMIT requestedPresenceChanged(m_requestedPresence);
- }
-}
-
-void GlobalPresence::onChangingPresence()
-{
- bool isChangingPresence = false;
- Q_FOREACH(const Tp::AccountPtr &account, m_enabledAccounts->accounts()) {
- if (account->isChangingPresence()) {
- isChangingPresence = true;
- }
- }
-
- if (isChangingPresence != m_changingPresence) {
- m_changingPresence = isChangingPresence;
- Q_EMIT changingPresence(m_changingPresence);
- }
-}
-
-#include "global-presence.moc"
diff --git a/global-presence.h b/global-presence.h
deleted file mode 100644
index 3ffe8b7..0000000
--- a/global-presence.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Global Presence - wraps calls to set and get presence for all accounts.
- *
- * Copyright (C) 2011 David Edmundson <kde at davidedmundson.co.uk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef GLOBALPRESENCE_H
-#define GLOBALPRESENCE_H
-
-#include <QObject>
-#include <TelepathyQt4/AccountManager>
-#include <TelepathyQt4/AccountSet>
-
-
-/** This class handles the presence between all enabled accounts
- * It shows the highest current available presence, indicates if any accounts are changing, and what they are changing to.
-*/
-
-class GlobalPresence : public QObject
-{
- Q_OBJECT
-public:
-
- explicit GlobalPresence(QObject *parent = 0);
-
- /** Set the account manager to use
- * @param accountManager should be ready.
- */
- void setAccountManager(const Tp::AccountManagerPtr &accountManager);
-
-
- /** The most online presence of any account*/
- Tp::Presence currentPresence() const;
-
- /** The most online presence requested for any account if any of the accounts are changing state.
- otherwise returns current presence*/
- Tp::Presence requestedPresence() const;
-
- /** Returns true if any account is changing state (i.e connecting*/
- bool isChangingPresence() const;
-
- /** Set all enabled accounts to the specified presence*/
- void setPresence(const Tp::Presence &presence);
-
-signals:
- void requestedPresenceChanged(const Tp::Presence &customPresence);
- void currentPresenceChanged(const Tp::Presence &presence);
- void changingPresence(bool isChanging);
-
-private slots:
- void onCurrentPresenceChanged();
- void onRequestedPresenceChanged();
- void onChangingPresence();
-
- void onAccountAdded(const Tp::AccountPtr &account);
-
-private:
- Tp::AccountSetPtr m_enabledAccounts;
-
- /** A cache of the last sent requested presence, to avoid resignalling*/
- Tp::Presence m_requestedPresence;
- /** A cache of the last sent presence*/
- Tp::Presence m_currentPresence;
- bool m_changingPresence;
-
- /// Sets the sorting order of presences
- QHash<uint, int> m_presenceSorting;
-};
-
-#endif // GLOBALPRESENCE_H
diff --git a/kpresence.cpp b/kpresence.cpp
deleted file mode 100644
index 3ec484e..0000000
--- a/kpresence.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Global Presence - wrap Tp::Presence with KDE functionality
- *
- * Copyright (C) 2011 David Edmundson <kde at davidedmundson.co.uk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "kpresence.h"
-#include <KLocalizedString>
-
-KPresence::KPresence() :
- Tp::Presence()
-{
-}
-
-KPresence::KPresence(const Tp::Presence &presence) :
- Tp::Presence(presence)
-{
-}
-
-KIcon KPresence::icon() const
-{
- switch (type()) {
- case Tp::ConnectionPresenceTypeAvailable:
- return KIcon(QLatin1String("user-online"));
- case Tp::ConnectionPresenceTypeBusy:
- return KIcon("user-busy");
- case Tp::ConnectionPresenceTypeAway:
- return KIcon("user-away");
- case Tp::ConnectionPresenceTypeExtendedAway:
- return KIcon("user-away-extended");
- case Tp::ConnectionPresenceTypeHidden:
- return KIcon("user-invisible");
- case Tp::ConnectionPresenceTypeOffline:
- return KIcon("user-offline");
- default:
- return KIcon();
- }
-}
-
-bool KPresence::operator <(const KPresence &other) const
-{
- /// Sets the sorting order of presences
- QHash<uint, int> m_presenceSorting;
-
- m_presenceSorting[Tp::ConnectionPresenceTypeAvailable] = 0;
- m_presenceSorting[Tp::ConnectionPresenceTypeBusy] = 1;
- m_presenceSorting[Tp::ConnectionPresenceTypeHidden] = 2;
- m_presenceSorting[Tp::ConnectionPresenceTypeAway] = 3;
- m_presenceSorting[Tp::ConnectionPresenceTypeExtendedAway] = 4;
- m_presenceSorting[Tp::ConnectionPresenceTypeHidden] = 5;
- //don't distinguish between the following three presences
- m_presenceSorting[Tp::ConnectionPresenceTypeError] = 6;
- m_presenceSorting[Tp::ConnectionPresenceTypeUnknown] = 6;
- m_presenceSorting[Tp::ConnectionPresenceTypeUnset] = 6;
- m_presenceSorting[Tp::ConnectionPresenceTypeOffline] = 7;
-
- if (m_presenceSorting[type()] < m_presenceSorting[other.type()]) {
- return true;
- } else if (m_presenceSorting[type()] == m_presenceSorting[other.type()]) {
- return (statusMessage() < other.statusMessage());
- } else {
- return false;
- }
-}
-
-QString KPresence::displayString() const
-{
- switch (type()) {
- case Tp::ConnectionPresenceTypeAvailable:
- return i18n("Available");
- case Tp::ConnectionPresenceTypeBusy:
- return i18n("Busy");
- case Tp::ConnectionPresenceTypeAway:
- return i18n("Away");
- case Tp::ConnectionPresenceTypeExtendedAway:
- return i18n("Not available");
- case Tp::ConnectionPresenceTypeHidden:
- return i18n("Invisible");
- case Tp::ConnectionPresenceTypeOffline:
- return i18n("Offline");
- default:
- return QString();
- }
-}
diff --git a/kpresence.h b/kpresence.h
deleted file mode 100644
index 2321816..0000000
--- a/kpresence.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Global Presence - wrap Tp::Presence with KDE functionality
- *
- * Copyright (C) 2011 David Edmundson <kde at davidedmundson.co.uk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef KPRESENCE_H
-#define KPRESENCE_H
-
-#include <TelepathyQt4/Presence>
-
-#include <KIcon>
-
-class KPresence : public Tp::Presence
-{
-public:
- KPresence();
- KPresence(const Tp::Presence &presence);
- KIcon icon() const;
-
- /** Returns which presence is "more available" */
- bool operator <(const KPresence &other) const;
-
- QString displayString() const;
-};
-
-#endif // KPRESENCE_H
diff --git a/presence-model.h b/presence-model.h
index 0c0869d..3ddef47 100644
--- a/presence-model.h
+++ b/presence-model.h
@@ -21,7 +21,7 @@
#ifndef PRESENCEMODEL_H
#define PRESENCEMODEL_H
-#include "kpresence.h"
+#include "common/kpresence.h"
#include <QAbstractListModel>
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list