[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:08:26 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=06598ea
The following commit has been merged in the master branch:
commit 06598ea299d5c2bbe6013844d36670514a7ffb01
Author: Martin Klapetek <mklapetek at kde.org>
Date: Tue Aug 26 13:55:34 2014 +0200
Add KAccounts integration plugin
Plugin to integrate with KAccounts' kded module
REVIEW: 119931
---
CMakeLists.txt | 11 +++
kaccounts/CMakeLists.txt | 26 ++++++
kaccounts/kaccounts-ktp-plugin.cpp | 97 ++++++++++++++++++++++
.../kaccounts-ktp-plugin.h | 47 ++++-------
4 files changed, 149 insertions(+), 32 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 17dc6d8..923d48a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,12 +23,16 @@ find_package (KF5 REQUIRED COMPONENTS
NotifyConfig
TextEditor
Wallet
+ Config
KDELibs4Support)
find_package (TelepathyQt5 0.9.2.1 REQUIRED)
find_package (TelepathyLoggerQt5 QUIET)
find_package (KPeople 0.3 QUIET)
+find_package (KAccounts)
+find_package(AccountsQt5 1.10 CONFIG)
+
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
@@ -74,6 +78,12 @@ if (KPEOPLE_FOUND AND KDEPIMLIBS_FOUND)
add_subdirectory(kpeople)
endif ()
+#If we find KAccounts library, build the plugin for it
+if (KACCOUNTS_FOUND AND AccountsQt5_FOUND)
+ include_directories(${KACCOUNTS_INCLUDE_DIRS} ${ACCOUNTSQT_INCLUDE_DIRS})
+ add_subdirectory(kaccounts)
+endif ()
+
configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
@@ -84,4 +94,5 @@ add_subdirectory(tools)
add_subdirectory(data)
add_subdirectory(tests)
+
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/kaccounts/CMakeLists.txt b/kaccounts/CMakeLists.txt
new file mode 100644
index 0000000..7305d81
--- /dev/null
+++ b/kaccounts/CMakeLists.txt
@@ -0,0 +1,26 @@
+project(kaccounts-integration-plugin)
+
+include_directories (${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+set(kaccounts_ktp_plugin_SRCS
+ kaccounts-ktp-plugin.cpp
+)
+
+add_library(kaccounts_ktp_plugin MODULE ${kaccounts_ktp_plugin_SRCS})
+
+target_link_libraries(kaccounts_ktp_plugin
+ Qt5::Core
+ KF5::ConfigCore
+ ktploggerprivate
+ ${TELEPATHY_QT5_LIBRARIES}
+ ${KACCOUNTS_LIBRARIES}
+)
+
+# Install:
+install (TARGETS kaccounts_ktp_plugin
+ DESTINATION ${PLUGIN_INSTALL_DIR}/kaccounts/daemonplugins
+)
+
+
diff --git a/kaccounts/kaccounts-ktp-plugin.cpp b/kaccounts/kaccounts-ktp-plugin.cpp
new file mode 100644
index 0000000..c7c2fe6
--- /dev/null
+++ b/kaccounts/kaccounts-ktp-plugin.cpp
@@ -0,0 +1,97 @@
+/*
+ Copyright (C) 2014 Martin Klapetek <mklapetek at kde.org>
+
+ 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "kaccounts-ktp-plugin.h"
+
+#include <TelepathyQt/AccountManager>
+
+#include <KSharedConfig>
+#include <KConfigGroup>
+
+#include <KTp/Logger/log-manager.h>
+
+class KAccountsKTpPlugin::Private {
+public:
+ Tp::AccountManagerPtr accountManager;
+};
+
+KAccountsKTpPlugin::KAccountsKTpPlugin(QObject *parent)
+ : KAccountsDPlugin(parent),
+ d(new Private)
+{
+ Tp::registerTypes();
+
+ // Start setting up the Telepathy AccountManager.
+ Tp::AccountFactoryPtr accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
+ Tp::Features() << Tp::Account::FeatureCore);
+
+ d->accountManager = Tp::AccountManager::create(accountFactory);
+ d->accountManager->becomeReady();
+}
+
+KAccountsKTpPlugin::~KAccountsKTpPlugin()
+{
+
+}
+
+void KAccountsKTpPlugin::onAccountCreated(const Accounts::AccountId accountId, const Accounts::ServiceList &serviceList)
+{
+ // TODO:
+ // Here will go account services setting up, eg. if one adds Google account
+ // in KAccounts, we need to check if he requested "Chat" service here and
+ // set up the account here
+}
+
+void KAccountsKTpPlugin::onAccountRemoved(const Accounts::AccountId accountId)
+{
+ // Lookup the config file and then proceed to remove the Tp account
+ // that corresponds with the account id
+ KSharedConfigPtr kaccountsConfig = KSharedConfig::openConfig(QStringLiteral("kaccounts-ktprc"));
+ KConfigGroup ktpKaccountsGroup = kaccountsConfig->group(QStringLiteral("kaccounts-ktp"));
+ QString accountUid = ktpKaccountsGroup.readEntry(QString::number(accountId));
+
+ if (accountUid.isEmpty()) {
+ qWarning() << "The config file returned emtpy account uid, aborting";
+ return;
+ }
+
+ Tp::AccountPtr account = d->accountManager->accountForObjectPath(accountUid);
+ if (account.isNull()) {
+ qWarning() << "Account manager returned invalid account, aborting";
+ return;
+ }
+
+ // FIXME keep this non-optional? The problem is that we can't show the "are you sure"
+ // dialog here as that's too late at this point
+ if (1) {
+ KTp::LogManager *logManager = KTp::LogManager::instance();
+ logManager->clearAccountLogs(account);
+ }
+ account->remove();
+}
+
+void KAccountsKTpPlugin::onServiceEnabled(const Accounts::AccountId accountId, const Accounts::Service& service)
+{
+
+}
+
+void KAccountsKTpPlugin::onServiceDisabled(const Accounts::AccountId accountId, const Accounts::Service& service)
+{
+
+}
+
diff --git a/KTp/circular-countdown.h b/kaccounts/kaccounts-ktp-plugin.h
similarity index 52%
copy from KTp/circular-countdown.h
copy to kaccounts/kaccounts-ktp-plugin.h
index 10be991..92cbc18 100644
--- a/KTp/circular-countdown.h
+++ b/kaccounts/kaccounts-ktp-plugin.h
@@ -1,6 +1,5 @@
/*
- Circular countdown widget
- Copyright (C) 2011 Martin Klapetek <martin.klapetek at gmail.com>
+ Copyright (C) 2014 Martin Klapetek <mklapetek at kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -15,48 +14,32 @@
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 Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ */
-#ifndef CIRCULARCOUNTDOWN_H
-#define CIRCULARCOUNTDOWN_H
+#ifndef KACCOUNTSKTPPLUGIN_H
+#define KACCOUNTSKTPPLUGIN_H
-#include <QWidget>
+#include <KAccounts/kaccountsdplugin.h>
-#include <KTp/ktp-export.h>
-
-namespace KTp
-{
-
-class KTP_EXPORT CircularCountdown : public QWidget
+class KAccountsKTpPlugin : public KAccountsDPlugin
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.kde.kaccounts.DPlugin")
+ Q_INTERFACES(KAccountsDPlugin)
public:
- explicit CircularCountdown(int msec = 5000, QWidget *parent = 0);
- ~CircularCountdown();
-
- void setDuration(int msec);
- int duration() const;
+ KAccountsKTpPlugin(QObject *parent = 0);
+ ~KAccountsKTpPlugin();
public Q_SLOTS:
- void start();
- void stop();
- void pause();
- void resume();
-
-Q_SIGNALS:
- void timeout();
-
-
-protected:
- void paintEvent(QPaintEvent *event);
- QSize sizeHint() const;
+ void onAccountCreated(const Accounts::AccountId accountId, const Accounts::ServiceList &serviceList);
+ void onAccountRemoved(const Accounts::AccountId accountId);
+ void onServiceEnabled(const Accounts::AccountId accountId, const Accounts::Service &service);
+ void onServiceDisabled(const Accounts::AccountId accountId, const Accounts::Service &service);
private:
class Private;
Private * const d;
};
-}
-
-#endif // CIRCULARCOUNTDOWN_H
+#endif // KACCOUNTSKTPPLUGIN_H
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list