[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:05:25 UTC 2016


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

The following commit has been merged in the master branch:
commit 10b4349082869df03bd5b227f441dfbb865e7066
Author: Lasath Fernando <kde at lasath.org>
Date:   Sat Jul 14 22:05:35 2012 +1000

    Create PluginConfigManager
    
    Move the job of keeping a lists of offers and plugins out of
    MessageProccessor to a this new class.
    
    It also makes the KSharedConfig::Ptr for MessagesConfig.
---
 KTp/message-filter-config-manager.cpp | 94 +++++++++++++++++++++++++++++++++++
 KTp/message-filter-config-manager.h   | 46 +++++++++++++++++
 2 files changed, 140 insertions(+)

diff --git a/KTp/message-filter-config-manager.cpp b/KTp/message-filter-config-manager.cpp
new file mode 100644
index 0000000..c3c828b
--- /dev/null
+++ b/KTp/message-filter-config-manager.cpp
@@ -0,0 +1,94 @@
+/*
+ *    Copyright (C) 2012  Lasath Fernando <kde at lasath.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 "plugin-config-manager.h"
+
+#include <QMutex>
+#include <QSet>
+
+#include <KGlobal>
+#include <KDebug>
+#include <KServiceTypeTrader>
+
+typedef QSet<KPluginInfo> PluginSet;
+
+class PluginConfigManager::Private {
+public:
+    PluginSet all;
+    PluginSet enabled;
+};
+
+PluginConfigManager *PluginConfigManager::self()
+{
+    static PluginConfigManager *pcm_instance = new PluginConfigManager();
+    static QMutex mutex;
+    if (!pcm_instance)
+    {
+        mutex.lock();
+        if (!pcm_instance) {
+            pcm_instance = new PluginConfigManager;
+        }
+        mutex.unlock();
+    }
+    return pcm_instance;
+}
+
+PluginConfigManager::PluginConfigManager() :
+    d(new Private)
+{
+    generateCache();
+}
+
+KService::List offers() {
+    return KServiceTypeTrader::self()->query(QLatin1String("KTpTextUi/MessageFilter"));
+}
+
+void PluginConfigManager::generateCache()
+{
+    KPluginInfo::List all = KPluginInfo::fromServices(offers(), configGroup());
+    for (KPluginInfo::List::Iterator i = all.begin(); i != all.end(); i++) {
+        KPluginInfo &plugin = *i;
+
+        d->all.insert(plugin);
+
+        plugin.load();
+        if (plugin.isPluginEnabled()) {
+            d->enabled.insert(plugin);
+        }
+    }
+}
+
+KPluginInfo::List PluginConfigManager::allPlugins() const
+{
+    return d->all.toList();
+}
+
+KPluginInfo::List PluginConfigManager::enabledPlugins() const
+{
+    return d->enabled.toList();
+}
+
+KConfigGroup PluginConfigManager::configGroup() const
+{
+    return sharedConfig()->group("Plugins");
+}
+
+KSharedConfig::Ptr PluginConfigManager::sharedConfig() const
+{
+    return KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
+}
diff --git a/KTp/message-filter-config-manager.h b/KTp/message-filter-config-manager.h
new file mode 100644
index 0000000..4307b55
--- /dev/null
+++ b/KTp/message-filter-config-manager.h
@@ -0,0 +1,46 @@
+/*
+ *    Copyright (C) 2012  Lasath Fernando <kde at lasath.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
+*/
+
+#ifndef PLUGIN_CONFIG_MANAGER_H
+#define PLUGIN_CONFIG_MANAGER_H
+
+#include <KPluginInfo>
+#include <ktpchat_export.h>
+
+class KDE_TELEPATHY_CHAT_EXPORT PluginConfigManager
+{
+public:
+    static PluginConfigManager* self();
+
+    KPluginInfo::List allPlugins() const;
+    KPluginInfo::List enabledPlugins() const;
+
+    KConfigGroup       configGroup() const;
+    KSharedConfig::Ptr sharedConfig() const;
+
+protected:
+    PluginConfigManager();
+
+private:
+    class Private;
+    Private *d;
+
+    void generateCache();
+};
+
+#endif // PLUGIN_CONFIG_MANAGER_H

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list