From 36c90e7137ce1927b35c9f2271e7ccb6ecf8cb8e Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 6 Aug 2010 01:26:11 +0000 Subject: [PATCH] prep DataEngine::Private for direct loading of packages, ala plasmoids svn path=/trunk/KDE/kdelibs/; revision=1159707 --- dataengine.cpp | 21 +++++++++++---------- private/dataengine_p.h | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dataengine.cpp b/dataengine.cpp index 2365baaa1..2a9e0fea4 100644 --- a/dataengine.cpp +++ b/dataengine.cpp @@ -48,13 +48,13 @@ namespace Plasma DataEngine::DataEngine(QObject *parent, KService::Ptr service) : QObject(parent), - d(new DataEnginePrivate(this, service)) + d(new DataEnginePrivate(this, KPluginInfo(service))) { } DataEngine::DataEngine(QObject *parent, const QVariantList &args) : QObject(parent), - d(new DataEnginePrivate(this, KService::serviceByStorageId(args.count() > 0 ? args[0].toString() : QString()))) + d(new DataEnginePrivate(this, KPluginInfo(KService::serviceByStorageId(args.count() > 0 ? args[0].toString() : QString())))) { } @@ -508,9 +508,9 @@ void DataEngine::setStorageEnable(const QString &source, bool store) } // Private class implementations -DataEnginePrivate::DataEnginePrivate(DataEngine *e, KService::Ptr service) +DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info) : q(e), - dataEngineDescription(service), + dataEngineDescription(info), refCount(-1), // first ref checkSourcesTimerId(0), updateTimerId(0), @@ -523,17 +523,17 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, KService::Ptr service) { updateTimestamp.start(); - if (!service) { + if (!info.isValid()) { engineName = i18n("Unnamed"); return; } - engineName = service->name(); + engineName = info.name(); if (engineName.isEmpty()) { engineName = i18n("Unnamed"); } e->setObjectName(engineName); - icon = service->icon(); + icon = info.icon(); if (dataEngineDescription.isValid()) { QString api = dataEngineDescription.property("X-Plasma-API").toString(); @@ -542,8 +542,7 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, KService::Ptr service) const QString path = KStandardDirs::locate("data", "plasma/dataengines/" + dataEngineDescription.pluginName() + '/'); - PackageStructure::Ptr structure = - Plasma::packageStructure(api, Plasma::DataEngineComponent); + PackageStructure::Ptr structure = Plasma::packageStructure(api, Plasma::DataEngineComponent); structure->setPath(path); package = new Package(path, structure); @@ -737,9 +736,11 @@ void DataEnginePrivate::setupScriptSupport() return; } - kDebug() << "setting up script support, package is in" << package->path() + /* + kDebug() << "sletting up script support, package is in" << package->path() << "which is a" << package->structure()->type() << "package" << ", main script is" << package->filePath("mainscript"); + */ QString translationsPath = package->filePath("translations"); if (!translationsPath.isEmpty()) { diff --git a/private/dataengine_p.h b/private/dataengine_p.h index 62763b087..302b6057c 100644 --- a/private/dataengine_p.h +++ b/private/dataengine_p.h @@ -35,7 +35,7 @@ class Service; class DataEnginePrivate { public: - DataEnginePrivate(DataEngine *e, KService::Ptr service); + DataEnginePrivate(DataEngine *e, const KPluginInfo &info); ~DataEnginePrivate(); DataContainer *source(const QString &sourceName, bool createWhenMissing = true); void connectSource(DataContainer *s, QObject *visualization, uint pollingInterval,