[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=17340d9

The following commit has been merged in the master branch:
commit 17340d9ca453bdb3edd4f87499c092536d6cfcfe
Author: Lasath Fernando <kde at lasath.org>
Date:   Sat Jul 14 22:24:11 2012 +1000

    Remove plugin management from MesssageProcessor
    
    It no longer deals with plugins or their configurations anymore. It now
    simply gets a list of plugins from PluginConfigManager and loads them.
    
    Also renames loadPlugins to loadFilters to make it clear that this class
    is to deal with Filters rather than plugins.
---
 KTp/message-processor.cpp | 47 ++++++++++++++++-------------------------------
 KTp/message-processor.h   |  6 +-----
 2 files changed, 17 insertions(+), 36 deletions(-)

diff --git a/KTp/message-processor.cpp b/KTp/message-processor.cpp
index e89ecf0..41213c8 100644
--- a/KTp/message-processor.cpp
+++ b/KTp/message-processor.cpp
@@ -19,6 +19,7 @@
 
 #include "message-processor.h"
 #include "filters.h"
+#include "plugin-config-manager.h"
 
 #include <QMutex>
 
@@ -52,7 +53,7 @@ MessageProcessor::MessageProcessor()
     m_filters.append(new EscapeFilter(this));
     m_filters.append(new UrlFilter(this));
 
-    loadPlugins();
+    loadFilters();
 }
 
 
@@ -79,39 +80,23 @@ Message MessageProcessor::processOutgoingMessage(const Tp::Message &sentMessage)
     return message;
 }
 
-void MessageProcessor::loadPlugins() {
+void MessageProcessor::loadFilters() {
     kDebug() << "Starting loading filters...";
 
-    KPluginInfo::List plugins = pluginList();
-    for (KPluginInfo::List::Iterator i = plugins.begin(); i != plugins.end(); i++) {
-        KPluginInfo &plugin = *i;
-        kDebug() << "found filter :" << plugin.pluginName();
-
-        plugin.load();
-        if (plugin.isPluginEnabled()) {
-            kDebug() << "it is enabled";
-            KService::Ptr service = plugin.service();
-
-            KPluginFactory *factory = KPluginLoader(service->library()).factory();
-            if(factory) {
-                kDebug() << "loaded factory :" << factory;
-                AbstractMessageFilter *filter = factory->create<AbstractMessageFilter>(this);
-
-                if(filter) {
-                    kDebug() << "loaded message filter : " << filter;
-                    m_filters.append(filter);
-                }
-            } else {
-                kError() << "error loading plugin :" << service->library();
+    Q_FOREACH (const KPluginInfo &plugin, PluginConfigManager::self()->enabledPlugins()) {
+        KService::Ptr service = plugin.service();
+
+        KPluginFactory *factory = KPluginLoader(service->library()).factory();
+        if(factory) {
+            kDebug() << "loaded factory :" << factory;
+            AbstractMessageFilter *filter = factory->create<AbstractMessageFilter>(this);
+
+            if(filter) {
+                kDebug() << "loaded message filter : " << filter;
+                m_filters.append(filter);
             }
+        } else {
+            kError() << "error loading plugin :" << service->library();
         }
     }
 }
-
-KPluginInfo::List MessageProcessor::pluginList()
-{
-    KService::List offers = KServiceTypeTrader::self()->query(serviceType);
-    KConfigGroup config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"))->group("Plugins");
-
-    return KPluginInfo::fromServices(offers, config);
-}
diff --git a/KTp/message-processor.h b/KTp/message-processor.h
index c6d2b12..2b070bd 100644
--- a/KTp/message-processor.h
+++ b/KTp/message-processor.h
@@ -48,17 +48,13 @@ public:
     Message processIncomingMessage(const Tp::ReceivedMessage &message);
     Message processOutgoingMessage(const Tp::Message &message);
 
-    static KPluginInfo::List pluginList();
-    static KSharedConfig::Ptr defaultConfig();
-
 protected:
     explicit MessageProcessor();
 
 private:
-    void loadPlugins();
+    void loadFilters();
     static MessageProcessor* s_instance;
     QList<AbstractMessageFilter*> m_filters;
-
 };
 
 #endif // MESSAGE_PROCESSOR_H

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list