[SCM] ktp-kded-integration-module packaging branch, master, updated. debian/15.12.1-2-382-gbd961c2

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:15:36 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-kded-module.git;a=commitdiff;h=645d85f

The following commit has been merged in the master branch:
commit 645d85f52d69ffc22529eb0853ebf061e5f4e4fd
Author: Alexandr Akulich <akulichalexander at gmail.com>
Date:   Mon Feb 10 15:53:29 2014 +0600

    Manually constructed factories and managers replaced by KTp ones.
    
    Such change makes code cleaner and let freely use KTp methods
    without dbus traffic duplication.
    
    As according things:
        Reworked includes.
        Fixed a lot of coding style issues.
        ContactNotify: Removed "using namespace KTp" from header.
    
    REVIEW: 115618
---
 autoaway.cpp                     |  6 ++--
 autoaway.h                       |  2 +-
 autoconnect.cpp                  | 24 +++++++-------
 autoconnect.h                    | 10 +++---
 contact-request-handler.cpp      | 31 +++++++++---------
 contact-request-handler.h        | 16 ++++-----
 contactnotify.cpp                | 29 ++++++-----------
 contactnotify.h                  |  8 ++---
 error-handler.cpp                | 34 +++++++++----------
 error-handler.h                  |  6 ++--
 screensaveraway.cpp              | 33 ++++++++++---------
 telepathy-kded-module-plugin.cpp |  2 +-
 telepathy-module.cpp             | 70 +++++++++++++---------------------------
 telepathy-module.h               |  3 +-
 telepathy-mpris.cpp              | 14 ++++----
 15 files changed, 124 insertions(+), 164 deletions(-)

diff --git a/autoaway.cpp b/autoaway.cpp
index 79f62f0..13b71a5 100644
--- a/autoaway.cpp
+++ b/autoaway.cpp
@@ -19,14 +19,14 @@
 
 #include "autoaway.h"
 
+#include <KTp/global-presence.h>
+
 #include <KDebug>
 #include <KIdleTime>
 #include <KConfig>
 #include <KConfigGroup>
 
-#include <KTp/global-presence.h>
-
-AutoAway::AutoAway(KTp::GlobalPresence* globalPresence, QObject* parent)
+AutoAway::AutoAway(KTp::GlobalPresence *globalPresence, QObject *parent)
     : TelepathyKDEDModulePlugin(globalPresence, parent),
       m_awayTimeoutId(-1),
       m_extAwayTimeoutId(-1)
diff --git a/autoaway.h b/autoaway.h
index ac42718..5e2a561 100644
--- a/autoaway.h
+++ b/autoaway.h
@@ -32,7 +32,7 @@ class AutoAway : public TelepathyKDEDModulePlugin
     Q_OBJECT
 
 public:
-    explicit AutoAway(KTp::GlobalPresence *globalPresence, QObject* parent = 0);
+    explicit AutoAway(KTp::GlobalPresence *globalPresence, QObject *parent = 0);
     ~AutoAway();
 
     QString pluginName() const;
diff --git a/autoconnect.cpp b/autoconnect.cpp
index b779426..dd36493 100644
--- a/autoconnect.cpp
+++ b/autoconnect.cpp
@@ -19,9 +19,12 @@
 
 #include "autoconnect.h"
 
-#include <KConfig>
-
 #include <KTp/presence.h>
+#include <KTp/core.h>
+
+#include <TelepathyQt/AccountManager>
+
+#include <KConfig>
 
 AutoConnect::AutoConnect(QObject *parent)
     : QObject(parent)
@@ -29,15 +32,6 @@ AutoConnect::AutoConnect(QObject *parent)
     KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
     m_kdedConfig = config->group("KDED");
     m_presenceConfig = config->group("LastPresence");
-}
-
-AutoConnect::~AutoConnect()
-{
-}
-
-void AutoConnect::setAccountManager(const Tp::AccountManagerPtr &accountManager)
-{
-    m_accountManager = accountManager;
 
     uint presenceType = m_presenceConfig.readEntry<uint>(QLatin1String("PresenceType"), (uint)Tp::ConnectionPresenceTypeOffline);
     QString presenceStatus = m_presenceConfig.readEntry(QLatin1String("PresenceStatus"), QString());
@@ -47,12 +41,16 @@ void AutoConnect::setAccountManager(const Tp::AccountManagerPtr &accountManager)
     Mode autoConnectMode = stringToMode(autoConnectString);
 
     if (autoConnectMode == AutoConnect::Enabled) {
-        Q_FOREACH(Tp::AccountPtr account, m_accountManager->allAccounts()) {
-            account->setRequestedPresence(Tp::Presence((Tp::ConnectionPresenceType)presenceType, presenceStatus,               presenceMessage));
+        Q_FOREACH(Tp::AccountPtr account, KTp::accountManager()->allAccounts()) {
+            account->setRequestedPresence(Tp::Presence((Tp::ConnectionPresenceType)presenceType, presenceStatus, presenceMessage));
         }
     }
 }
 
+AutoConnect::~AutoConnect()
+{
+}
+
 void AutoConnect::savePresence(const KTp::Presence &presence)
 {
     m_presenceConfig.writeEntry(QLatin1String("PresenceType"), (uint)presence.type());
diff --git a/autoconnect.h b/autoconnect.h
index aeb4b54..9af58e7 100644
--- a/autoconnect.h
+++ b/autoconnect.h
@@ -20,11 +20,11 @@
 #ifndef AUTOCONNECT_H
 #define AUTOCONNECT_H
 
-#include <TelepathyQt/AccountManager>
-
 #include <KConfigGroup>
 #include <KDebug>
 
+#include <TelepathyQt/Presence>
+
 namespace KTp {
     class Presence;
 }
@@ -43,7 +43,6 @@ public:
     AutoConnect(QObject *parent = 0 );
     ~AutoConnect();
 
-    void setAccountManager(const Tp::AccountManagerPtr &accountManager);
     void savePresence(const KTp::Presence &presence);
 
     /**
@@ -67,7 +66,7 @@ public:
             kWarning() << "Treat as AutoConnect::Manual (" << AutoConnect::Manual << ").";
             return QString::fromLatin1("manual");
         }
-    };
+    }
 
     /**
      * rief Returns the enum value for the given string.
@@ -88,10 +87,9 @@ public:
             kWarning() << "Got not recognized string: '" << mode << "'. Treat as 'manual'";
             return AutoConnect::Manual;
         }
-    };
+    }
 
 private:
-    Tp::AccountManagerPtr m_accountManager;
     Tp::Presence m_presence;
     KConfigGroup m_kdedConfig;
     KConfigGroup m_presenceConfig;
diff --git a/contact-request-handler.cpp b/contact-request-handler.cpp
index 1b13194..b3a3c1d 100644
--- a/contact-request-handler.cpp
+++ b/contact-request-handler.cpp
@@ -20,17 +20,17 @@
 
 #include "contact-request-handler.h"
 
+#include <KTp/error-dictionary.h>
+#include <KTp/contact-info-dialog.h>
+#include <KTp/core.h>
+
+#include <TelepathyQt/Account>
+#include <TelepathyQt/AccountManager>
 #include <TelepathyQt/Connection>
 #include <TelepathyQt/Contact>
 #include <TelepathyQt/ContactManager>
-#include <TelepathyQt/PendingOperation>
 #include <TelepathyQt/PendingComposite>
-#include <TelepathyQt/Account>
-
-#include <KTp/error-dictionary.h>
-#include <KTp/contact-info-dialog.h>
-
-#include <QtCore/QFutureWatcher>
+#include <TelepathyQt/PendingOperation>
 
 #include <KDebug>
 #include <KGlobal>
@@ -39,6 +39,8 @@
 #include <KAction>
 #include <KStatusNotifierItem>
 
+#include <QtCore/QFutureWatcher>
+
 Q_DECLARE_METATYPE(Tp::ContactPtr)
 
 static bool kde_tp_filter_contacts_by_publication_status(const Tp::ContactPtr &contact)
@@ -46,14 +48,13 @@ static bool kde_tp_filter_contacts_by_publication_status(const Tp::ContactPtr &c
     return contact->publishState() == Tp::Contact::PresenceStateAsk && !contact->isBlocked();
 }
 
-ContactRequestHandler::ContactRequestHandler(const Tp::AccountManagerPtr& am, QObject *parent)
+ContactRequestHandler::ContactRequestHandler(QObject *parent)
     : QObject(parent)
 {
-    m_accountManager = am;
-    connect(m_accountManager.data(), SIGNAL(newAccount(Tp::AccountPtr)),
+    connect(KTp::accountManager().data(), SIGNAL(newAccount(Tp::AccountPtr)),
             this, SLOT(onNewAccountAdded(Tp::AccountPtr)));
 
-    QList<Tp::AccountPtr> accounts = m_accountManager->allAccounts();
+    QList<Tp::AccountPtr> accounts = KTp::accountManager()->allAccounts();
 
     Q_FOREACH(const Tp::AccountPtr &account, accounts) {
         onNewAccountAdded(account);
@@ -66,7 +67,7 @@ ContactRequestHandler::~ContactRequestHandler()
 
 }
 
-void ContactRequestHandler::onNewAccountAdded(const Tp::AccountPtr& account)
+void ContactRequestHandler::onNewAccountAdded(const Tp::AccountPtr &account)
 {
     kWarning();
     Q_ASSERT(account->isReady(Tp::Account::FeatureCore));
@@ -80,7 +81,7 @@ void ContactRequestHandler::onNewAccountAdded(const Tp::AccountPtr& account)
             this, SLOT(onConnectionChanged(Tp::ConnectionPtr)));
 }
 
-void ContactRequestHandler::onConnectionChanged(const Tp::ConnectionPtr& connection)
+void ContactRequestHandler::onConnectionChanged(const Tp::ConnectionPtr &connection)
 {
     if (!connection.isNull()) {
         handleNewConnection(connection);
@@ -134,7 +135,7 @@ void ContactRequestHandler::onAccountsPresenceStatusFiltered()
     watcher->deleteLater();
 }
 
-void ContactRequestHandler::onPresencePublicationRequested(const Tp::Contacts& contacts)
+void ContactRequestHandler::onPresencePublicationRequested(const Tp::Contacts &contacts)
 {
     kDebug() << "New contact requested";
 
@@ -263,7 +264,7 @@ void ContactRequestHandler::onShowContactDetails()
     if (!contactId.isEmpty()) {
         const Tp::ContactPtr contact = m_pendingContacts.find(contactId).value();
         const Tp::ContactManagerPtr manager = contact->manager();
-        Q_FOREACH (const Tp::AccountPtr &account, m_accountManager->allAccounts()) {
+        Q_FOREACH (const Tp::AccountPtr &account, KTp::accountManager()->allAccounts()) {
             if (account->connection() == manager->connection()) {
                 KTp::ContactInfoDialog *dialog = new KTp::ContactInfoDialog(account, contact);
                 connect(dialog, SIGNAL(closeClicked()), dialog, SLOT(deleteLater()));
diff --git a/contact-request-handler.h b/contact-request-handler.h
index 69d2a1e..93807b6 100644
--- a/contact-request-handler.h
+++ b/contact-request-handler.h
@@ -21,8 +21,9 @@
 #ifndef CONTACT_REQUEST_HANDLER_H
 #define CONTACT_REQUEST_HANDLER_H
 
+#include <TelepathyQt/Constants>
 #include <TelepathyQt/Types>
-#include <TelepathyQt/AccountManager>
+#include <TelepathyQt/PendingOperation>
 
 class KMenu;
 class KAction;
@@ -31,7 +32,7 @@ class ContactRequestHandler : public QObject
 {
     Q_OBJECT
 public:
-    explicit ContactRequestHandler(const Tp::AccountManagerPtr& am, QObject *parent = 0);
+    explicit ContactRequestHandler(QObject *parent = 0);
     virtual ~ContactRequestHandler();
 
 private Q_SLOTS:
@@ -39,15 +40,15 @@ private Q_SLOTS:
     void onContactManagerStateChanged(Tp::ContactListState state);
     void onContactManagerStateChanged(const Tp::ContactManagerPtr &contactManager, Tp::ContactListState state);
     void onAccountsPresenceStatusFiltered();
-    void onPresencePublicationRequested(const Tp::Contacts& contacts);
-    void onConnectionChanged(const Tp::ConnectionPtr& connection);
+    void onPresencePublicationRequested(const Tp::Contacts &contacts);
+    void onConnectionChanged(const Tp::ConnectionPtr &connection);
 
     void onContactRequestApproved();
     void onContactRequestDenied();
     void onShowContactDetails();
-    void onAuthorizePresencePublicationFinished(Tp::PendingOperation*);
-    void onRemovePresencePublicationFinished(Tp::PendingOperation*);
-    void onFinalizeSubscriptionFinished(Tp::PendingOperation*);
+    void onAuthorizePresencePublicationFinished(Tp::PendingOperation *op);
+    void onRemovePresencePublicationFinished(Tp::PendingOperation *op);
+    void onFinalizeSubscriptionFinished(Tp::PendingOperation *op);
     void onContactInvalidated();
 
     void onNotifierActivated(bool active, const QPoint &pos);
@@ -57,7 +58,6 @@ private:
     void handleNewConnection(const Tp::ConnectionPtr &connection);
 
     QWeakPointer<KStatusNotifierItem> m_notifierItem;
-    Tp::AccountManagerPtr m_accountManager;
     QHash<QString, Tp::ContactPtr> m_pendingContacts;
     QHash<QString, KMenu*> m_menuItems;
 };
diff --git a/contactnotify.cpp b/contactnotify.cpp
index 9f001f4..2ce6a8a 100644
--- a/contactnotify.cpp
+++ b/contactnotify.cpp
@@ -18,32 +18,23 @@
 
 #include "contactnotify.h"
 
-#include <KDebug>
+#include <KTp/core.h>
+#include <KTp/presence.h>
+#include <KTp/global-contact-manager.h>
 
 #include <TelepathyQt/ContactManager>
 #include <TelepathyQt/AccountManager>
 #include <TelepathyQt/Contact>
 
-#include <KNotification>
 #include <KAboutData>
 #include <KConfigGroup>
+#include <KDebug>
+#include <KNotification>
 
-#include <KTp/core.h>
-#include <KTp/presence.h>
-#include <KTp/global-contact-manager.h>
-
-using namespace KTp;
-
-ContactNotify::ContactNotify(const Tp::AccountManagerPtr &accountMgr, QObject *parent) :
+ContactNotify::ContactNotify(QObject *parent) :
     QObject(parent)
 {
-    Q_ASSERT(accountMgr);
-    m_accountManager = accountMgr;
-    if (!m_accountManager) {
-        return;
-    }
-
-    GlobalContactManager *contactManager = KTp::contactManager();
+    KTp::GlobalContactManager *contactManager = KTp::contactManager();
     Tp::Presence currentPresence;
 
     Q_FOREACH(const Tp::ContactPtr &contact, contactManager->allKnownContacts()) {
@@ -51,7 +42,7 @@ ContactNotify::ContactNotify(const Tp::AccountManagerPtr &accountMgr, QObject *p
                 SLOT(contactPresenceChanged(Tp::Presence)));
 
         currentPresence = contact->presence();
-        m_presenceHash[contact->id()] = Presence::sortPriority(currentPresence.type());
+        m_presenceHash[contact->id()] = KTp::Presence::sortPriority(currentPresence.type());
     }
 
     connect(contactManager, SIGNAL(allKnownContactsChanged(Tp::Contacts,Tp::Contacts)),
@@ -78,7 +69,7 @@ void ContactNotify::contactPresenceChanged(const Tp::Presence &presence)
                          contact);
     }
 
-    m_presenceHash.insert(contact->id(), Presence::sortPriority(presence.type()));
+    m_presenceHash.insert(contact->id(), KTp::Presence::sortPriority(presence.type()));
 }
 
 void ContactNotify::sendNotification(const QString &text, const QPixmap &pixmap, const Tp::ContactPtr &contact)
@@ -107,7 +98,7 @@ void ContactNotify::onContactsChanged(const Tp::Contacts &contactsAdded, const T
                 SLOT(contactAvatarTokenChanged(QString)));
 
         currentPresence = contact->presence();
-        m_presenceHash[contact->id()] = Presence::sortPriority(currentPresence.type());
+        m_presenceHash[contact->id()] = KTp::Presence::sortPriority(currentPresence.type());
 
     }
 
diff --git a/contactnotify.h b/contactnotify.h
index 4dc71e4..f2a55b8 100644
--- a/contactnotify.h
+++ b/contactnotify.h
@@ -19,19 +19,16 @@
 #ifndef CONTACTNOTIFY_H
 #define CONTACTNOTIFY_H
 
+#include <TelepathyQt/Presence>
 #include <TelepathyQt/Types>
 
-#include <KTp/global-contact-manager.h>
-
 class QPixmap;
 
-using namespace KTp;
-
 class ContactNotify : public QObject
 {
     Q_OBJECT
 public:
-    ContactNotify(const Tp::AccountManagerPtr &accountMgr, QObject *parent = 0);
+    ContactNotify(QObject *parent = 0);
 
 private Q_SLOTS:
     void onContactsChanged(const Tp::Contacts &contactsAdded, const Tp::Contacts &contactsRemoved);
@@ -42,7 +39,6 @@ private Q_SLOTS:
 private:
     void sendNotification(const QString &text, const QPixmap &pixmap, const Tp::ContactPtr &contact);
 
-    Tp::AccountManagerPtr m_accountManager;
     QHash<QString, int> m_presenceHash;
     QHash<QString, QString> m_avatarTokensHash;
 };
diff --git a/error-handler.cpp b/error-handler.cpp
index 2b84784..66ea576 100644
--- a/error-handler.cpp
+++ b/error-handler.cpp
@@ -20,20 +20,22 @@
 
 #include "error-handler.h"
 
-#include <QScopedPointer>
-#include <QTimer>
-
-#include <KNotification>
-#include <KAboutData>
-#include <KDebug>
-
+#include <KTp/core.h>
 #include <KTp/error-dictionary.h>
 
 #include <TelepathyQt/Account>
+#include <TelepathyQt/AccountManager>
 #include <TelepathyQt/Connection>
 
+#include <KNotification>
+#include <KAboutData>
+#include <KDebug>
+
 #include <Solid/Networking>
 
+#include <QScopedPointer>
+#include <QTimer>
+
 /** Stores the last error message for an account
     For every new error if we're online we wait 30 seconds and show 1 notification for all errors. This will be the only error we show for that account until the user reconnects.
 */
@@ -102,16 +104,14 @@ void ConnectionError::setShown(bool)
 }
 
 
-ErrorHandler::ErrorHandler(const Tp::AccountManagerPtr& am, QObject* parent)
+ErrorHandler::ErrorHandler(QObject *parent)
     : QObject(parent)
 {
-    m_accountManager = am;
-
-    Q_FOREACH(const Tp::AccountPtr &account, am->allAccounts()) {
+    Q_FOREACH(const Tp::AccountPtr &account, KTp::accountManager()->allAccounts()) {
         onNewAccount(account);
     }
 
-    connect(m_accountManager.data(), SIGNAL(newAccount(Tp::AccountPtr)),
+    connect(KTp::accountManager().data(), SIGNAL(newAccount(Tp::AccountPtr)),
             this, SLOT(onNewAccount(Tp::AccountPtr)));
 }
 
@@ -142,9 +142,9 @@ void ErrorHandler::showErrorNotification()
                 errorMessage += i18nc("%1 is the account name", "Could not connect %1. There was a network error, check your connection", account->displayName()) + QLatin1String("<br>");
                 break;
             default:
-	        if (error.connectionError() == QLatin1String(TP_QT_ERROR_CANCELLED)) {
-		    break;
-		}
+                if (error.connectionError() == QLatin1String(TP_QT_ERROR_CANCELLED)) {
+                    break;
+                }
                 if (error.connectionErrorDetails().hasServerMessage()) {
                     errorMessage += i18nc("%1 is the account name, %2 the error message", "There was a problem while trying to connect %1 - %2", account->displayName(), error.connectionErrorDetails().serverMessage()) + QLatin1String("<br>");
                 } else {
@@ -213,12 +213,12 @@ void ErrorHandler::showMessageToUser(const QString &text, const ErrorHandler::Sy
     notification->sendEvent();
 }
 
-void ErrorHandler::onNewAccount(const Tp::AccountPtr& account)
+void ErrorHandler::onNewAccount(const Tp::AccountPtr &account)
 {
     connect(account.data(), SIGNAL(connectionStatusChanged(Tp::ConnectionStatus)),
             this, SLOT(onConnectionStatusChanged(Tp::ConnectionStatus)));
 
-    connect(account.data(), SIGNAL(requestedPresenceChanged(Tp::Presence)) , SLOT(onRequestedPresenceChanged()));
+    connect(account.data(), SIGNAL(requestedPresenceChanged(Tp::Presence)), SLOT(onRequestedPresenceChanged()));
     connect(account.data(), SIGNAL(removed()), SLOT(onAccountRemoved()));
 }
 
diff --git a/error-handler.h b/error-handler.h
index dd62822..40eef43 100644
--- a/error-handler.h
+++ b/error-handler.h
@@ -23,7 +23,8 @@
 
 #include <QObject>
 
-#include <TelepathyQt/AccountManager>
+#include <TelepathyQt/Constants>
+#include <TelepathyQt/Types>
 
 class ConnectionError;
 
@@ -31,7 +32,7 @@ class ErrorHandler : public QObject
 {
     Q_OBJECT
 public:
-    explicit ErrorHandler(const Tp::AccountManagerPtr& am, QObject *parent = 0);
+    explicit ErrorHandler(QObject *parent = 0);
     virtual ~ErrorHandler();
 
     enum SystemMessageType {
@@ -62,7 +63,6 @@ private Q_SLOTS:
 
 private:
     void showMessageToUser(const QString &text, const ErrorHandler::SystemMessageType type);
-    Tp::AccountManagerPtr m_accountManager;
     QHash<Tp::AccountPtr, ConnectionError> m_errorMap;
 };
 
diff --git a/screensaveraway.cpp b/screensaveraway.cpp
index 6c47cfb..e01e067 100644
--- a/screensaveraway.cpp
+++ b/screensaveraway.cpp
@@ -19,26 +19,27 @@
 
 #include "screensaveraway.h"
 
-#include <QDBusConnectionInterface>
-#include <QDBusInterface>
+#include <KTp/global-presence.h>
 
 #include <KDebug>
 #include <KConfig>
 #include <KConfigGroup>
-#include <KTp/global-presence.h>
+
+#include <QDBusConnectionInterface>
+#include <QDBusInterface>
 
 ScreenSaverAway::ScreenSaverAway(KTp::GlobalPresence *globalPresence, QObject *parent)
     : TelepathyKDEDModulePlugin(globalPresence, parent)
 {
     reloadConfig();
 
-  //watch for screen locked
-  QDBusConnection::sessionBus().connect(QString(),
-				      QLatin1String("/ScreenSaver"),
-				      QLatin1String("org.freedesktop.ScreenSaver"),
-				      QLatin1String("ActiveChanged"),
-				      this,
-				      SLOT(onActiveChanged(bool)) );
+    //watch for screen locked
+    QDBusConnection::sessionBus().connect(QString(),
+                                          QLatin1String("/ScreenSaver"),
+                                          QLatin1String("org.freedesktop.ScreenSaver"),
+                                          QLatin1String("ActiveChanged"),
+                                          this,
+                                          SLOT(onActiveChanged(bool)));
 }
 
 ScreenSaverAway::~ScreenSaverAway()
@@ -53,16 +54,16 @@ QString ScreenSaverAway::pluginName() const
 void ScreenSaverAway::onActiveChanged(bool newState)
 {
     if (!isEnabled()) {
-      return;
+        return;
     }
 
     if (newState) {
-      m_screenSaverAwayMessage.replace(QLatin1String("%time"), QDateTime::currentDateTimeUtc().toString(QLatin1String("hh:mm:ss")), Qt::CaseInsensitive);
-      setRequestedPresence(Tp::Presence::away(m_screenSaverAwayMessage));
-      setActive(true);
+        m_screenSaverAwayMessage.replace(QLatin1String("%time"), QDateTime::currentDateTimeUtc().toString(QLatin1String("hh:mm:ss")), Qt::CaseInsensitive);
+        setRequestedPresence(Tp::Presence::away(m_screenSaverAwayMessage));
+        setActive(true);
     } else {
-      kDebug();
-      setActive(false);
+        kDebug();
+        setActive(false);
     }
 }
 
diff --git a/telepathy-kded-module-plugin.cpp b/telepathy-kded-module-plugin.cpp
index 43cb383..daf73c6 100644
--- a/telepathy-kded-module-plugin.cpp
+++ b/telepathy-kded-module-plugin.cpp
@@ -22,7 +22,7 @@
 
 #include <KTp/global-presence.h>
 
-TelepathyKDEDModulePlugin::TelepathyKDEDModulePlugin(KTp::GlobalPresence* globalPresence, QObject* parent)
+TelepathyKDEDModulePlugin::TelepathyKDEDModulePlugin(KTp::GlobalPresence *globalPresence, QObject *parent)
     : QObject(parent),
       m_enabled(false),
       m_active(false)
diff --git a/telepathy-module.cpp b/telepathy-module.cpp
index bf154c6..32e3a43 100644
--- a/telepathy-module.cpp
+++ b/telepathy-module.cpp
@@ -19,33 +19,33 @@
 
 #include "telepathy-module.h"
 
-#include <KPluginFactory>
-#include <KDebug>
+#include "autoaway.h"
+#include "autoconnect.h"
+#include "contact-cache.h"
+#include "contact-request-handler.h"
+#include "contactnotify.h"
+#include "error-handler.h"
+#include "screensaveraway.h"
+#include "telepathy-kded-module-plugin.h"
+#include "telepathy-mpris.h"
+
+#include <KTp/contact-factory.h>
+#include <KTp/core.h>
+#include <KTp/global-presence.h>
 
 #include <TelepathyQt/AccountFactory>
 #include <TelepathyQt/PendingOperation>
 #include <TelepathyQt/PendingReady>
 #include <TelepathyQt/Debug>
 
-#include <KTp/contact-factory.h>
-#include <KTp/global-presence.h>
-
-#include "telepathy-mpris.h"
-#include "autoaway.h"
-#include "autoconnect.h"
-#include "error-handler.h"
-#include "telepathy-kded-module-plugin.h"
-#include "contactnotify.h"
-#include "screensaveraway.h"
-#include "contact-cache.h"
-
 #include <KConfigGroup>
-#include "contact-request-handler.h"
+#include <KDebug>
+#include <KPluginFactory>
 
 K_PLUGIN_FACTORY(TelepathyModuleFactory, registerPlugin<TelepathyModule>(); )
 K_EXPORT_PLUGIN(TelepathyModuleFactory("ktp_integration_module", "kded_ktp_integration_module"))
 
-TelepathyModule::TelepathyModule(QObject* parent, const QList<QVariant>& args)
+TelepathyModule::TelepathyModule(QObject *parent, const QList<QVariant> &args)
     : KDEDModule(parent)
     , m_autoAway( 0 )
     , m_mpris( 0 )
@@ -62,30 +62,7 @@ TelepathyModule::TelepathyModule(QObject* parent, const QList<QVariant>& args)
     Tp::enableDebug(false);
     Tp::enableWarnings(false);
 
-    // Start setting up the Telepathy AccountManager.
-    Tp::AccountFactoryPtr  accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
-                                                                       Tp::Features() << Tp::Account::FeatureCore);
-
-    Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
-                                                                               Tp::Features() << Tp::Connection::FeatureCore
-                                                                                              << Tp::Connection::FeatureRoster);
-
-    Tp::ContactFactoryPtr contactFactory = KTp::ContactFactory::create(Tp::Features() << Tp::Contact::FeatureAlias
-                                                                                      << Tp::Contact::FeatureSimplePresence
-                                                                                      << Tp::Contact::FeatureAvatarToken
-                                                                                      << Tp::Contact::FeatureCapabilities);
-
-    Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
-
-    m_accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
-                                                  accountFactory,
-                                                  connectionFactory,
-                                                  channelFactory,
-                                                  contactFactory);
-
-
-    connect(m_accountManager->becomeReady(),
-            SIGNAL(finished(Tp::PendingOperation*)),
+    connect(KTp::accountManager()->becomeReady(), SIGNAL(finished(Tp::PendingOperation*)),
             SLOT(onAccountManagerReady(Tp::PendingOperation*)));
 
     QDBusConnection::sessionBus().connect(QString(), QLatin1String("/Telepathy"), QLatin1String("org.kde.Telepathy"),
@@ -97,14 +74,14 @@ TelepathyModule::~TelepathyModule()
 {
 }
 
-void TelepathyModule::onAccountManagerReady(Tp::PendingOperation* op)
+void TelepathyModule::onAccountManagerReady(Tp::PendingOperation *op)
 {
     if (op->isError()) {
         return;
     }
 
     m_globalPresence = new KTp::GlobalPresence(this);
-    m_globalPresence->setAccountManager(m_accountManager);
+    m_globalPresence->setAccountManager(KTp::accountManager());
     connect(m_globalPresence, SIGNAL(requestedPresenceChanged(KTp::Presence)),
             this, SLOT(onRequestedPresenceChanged(KTp::Presence)));
 
@@ -130,14 +107,13 @@ void TelepathyModule::onAccountManagerReady(Tp::PendingOperation* op)
             m_mpris, SLOT(reloadConfig()));
 
     m_autoConnect = new AutoConnect(this);
-    m_autoConnect->setAccountManager(m_accountManager);
 
     //earlier in list = higher priority
     m_pluginStack << m_autoAway << m_screenSaverAway << m_mpris;
 
-    m_errorHandler = new ErrorHandler(m_accountManager, this);
-    m_contactHandler = new ContactRequestHandler(m_accountManager, this);
-    m_contactNotify = new ContactNotify(m_accountManager, this);
+    m_errorHandler = new ErrorHandler(this);
+    m_contactHandler = new ContactRequestHandler(this);
+    m_contactNotify = new ContactNotify(this);
 
     new ContactCache(this);
 
@@ -174,7 +150,7 @@ void TelepathyModule::onPluginActivated(bool active)
 
 void TelepathyModule::setPresence(const KTp::Presence &presence)
 {
-    Q_FOREACH(const Tp::AccountPtr &account, m_accountManager->allAccounts()) {
+    Q_FOREACH(const Tp::AccountPtr &account, KTp::accountManager()->allAccounts()) {
         if (account->isEnabled() &&
             (account->connectionStatusReason() == Tp::ConnectionStatusReasonNoneSpecified ||
              account->connectionStatusReason() == Tp::ConnectionStatusReasonRequested)) {
diff --git a/telepathy-module.h b/telepathy-module.h
index ec08c6e..a99c990 100644
--- a/telepathy-module.h
+++ b/telepathy-module.h
@@ -55,7 +55,7 @@ Q_SIGNALS:
     void settingsChanged();
 
 private Q_SLOTS:
-    void onAccountManagerReady(Tp::PendingOperation*);
+    void onAccountManagerReady(Tp::PendingOperation *op);
     void onRequestedPresenceChanged(const KTp::Presence &presence);
     void onPluginActivated(bool);
 
@@ -65,7 +65,6 @@ private:
     void setPresence(const KTp::Presence &presence);
 
 private:
-    Tp::AccountManagerPtr    m_accountManager;
     AutoAway                *m_autoAway;
     TelepathyMPRIS          *m_mpris;
     AutoConnect             *m_autoConnect;
diff --git a/telepathy-mpris.cpp b/telepathy-mpris.cpp
index 1c7b98c..12d049d 100644
--- a/telepathy-mpris.cpp
+++ b/telepathy-mpris.cpp
@@ -19,17 +19,17 @@
 
 #include "telepathy-mpris.h"
 
-#include <QDBusConnectionInterface>
-#include <QDBusInterface>
-#include <QDBusReply>
-#include <QVariant>
+#include <KTp/global-presence.h>
 
-#include <KDebug>
-#include <KSharedConfig>
 #include <KConfigGroup>
+#include <KDebug>
 #include <KLocalizedString>
+#include <KSharedConfig>
 
-#include <KTp/global-presence.h>
+#include <QDBusConnectionInterface>
+#include <QDBusInterface>
+#include <QDBusReply>
+#include <QVariant>
 
 static const QLatin1String dbusInterfaceProperties("org.freedesktop.DBus.Properties");
 

-- 
ktp-kded-integration-module packaging



More information about the pkg-kde-commits mailing list