From aabb8d47f9bd363ab29dcc9a0802acdd419e8052 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Wed, 13 Jul 2011 20:20:36 +0200 Subject: [PATCH] prep for Package loading --- pluginloader.cpp | 22 ++++++++++++++++++++-- pluginloader.h | 26 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/pluginloader.cpp b/pluginloader.cpp index 43a5b7cf7..6ccaf48ba 100644 --- a/pluginloader.cpp +++ b/pluginloader.cpp @@ -204,7 +204,7 @@ AbstractRunner *PluginLoader::loadRunner(const QString &name) } Service *PluginLoader::loadService(const QString &name, const QVariantList &args, QObject *parent) -{ +{ Service *service = internalLoadService(name, args, parent); if (service) { return service; @@ -244,6 +244,17 @@ Service *PluginLoader::loadService(const QString &name, const QVariantList &args return service; } +Package PluginLoader::loadPackage(const QString &name, const QVariantList &args) +{ + Package p = internalLoadPackage(name, args); + if (p.isValid()) { + return p; + } + + //TODO: pull code from PackageStructure over here + return p; +} + KPluginInfo::List PluginLoader::listAppletInfo(const QString &category, const QString &parentApp) { KPluginInfo::List list; @@ -337,13 +348,20 @@ AbstractRunner* PluginLoader::internalLoadRunner(const QString &name) } Service* PluginLoader::internalLoadService(const QString &name, const QVariantList &args, QObject *parent) -{ +{ Q_UNUSED(name) Q_UNUSED(args) Q_UNUSED(parent) return 0; } +Package PluginLoader::internalLoadPackage(const QString &name, const QVariantList &args) +{ + Q_UNUSED(name); + Q_UNUSED(args); + return Package(); +} + KPluginInfo::List PluginLoader::internalAppletInfo(const QString &category) const { Q_UNUSED(category) diff --git a/pluginloader.h b/pluginloader.h index 3a648e50e..06aa2067e 100644 --- a/pluginloader.h +++ b/pluginloader.h @@ -20,6 +20,7 @@ #ifndef PLUGIN_LOADER_H #define PLUGIN_LOADER_H +#include #include #include @@ -93,6 +94,16 @@ public: **/ Service *loadService(const QString &name, const QVariantList &args, QObject *parent = 0); + /** + * Load a Package plugin. + * + * @param name the plugin name of the package to load + * @param args a list of arguments to supply to the service plugin when loading it + * + * @return a Package object matching name, or an invalid package on failure + **/ + Package loadPackage(const QString &name, const QVariantList &args); + /** * Returns a list of all known applets. * This may skip applets based on security settings and ExcludeCategories in the application's config. @@ -205,6 +216,21 @@ protected: **/ virtual Service *internalLoadService(const QString &name, const QVariantList &args, QObject *parent = 0); + /** + * A re-implementable method that allows subclasses to override + * the default behaviour of loadPackage. If the service requested is not recognized, + * then the implementation should return a NULL pointer. This method is called + * by loadService prior to attempting to load a Service using the standard Plasma + * plugin mechanisms. + * + * @param name the plugin name of the service to load + * @param args a list of arguments to supply to the service plugin when loading it + * @param parent the parent object, if any, for the service + * + * @return a Service object, unlike Plasma::Service::loadService, this can return null. + **/ + virtual Package internalLoadPackage(const QString &name, const QVariantList &args); + /** * A re-implementable method that allows subclasses to provide additional applets * for listAppletInfo. If the application has no applets to give to the application,