From 67d882037c8919dc62a0da23a02f965d1fa67db7 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 4 Aug 2016 19:23:59 +0200 Subject: [PATCH] Define Plasma PackageStructure as regular KPackage PackageStructure plugins This way we can use kpackagetool5 against them (see RR 128590). REVIEW: 128596 --- src/plasma/CMakeLists.txt | 3 +- src/plasma/containmentactions.cpp | 1 - src/plasma/package.cpp | 1 - src/plasma/packagestructure/CMakeLists.txt | 12 + .../containmentactions-packagestructure.json | 14 + .../containmentactionspackage.cpp | 43 +++ .../dataengine-packagestructure.json | 14 + .../packagestructure/dataenginepackage.cpp | 56 ++++ src/plasma/packagestructure/packages.cpp | 111 ++++++++ .../packages_p.h | 32 +-- .../plasmageneric-packagestructure.json | 14 + .../packagestructure/plasmagenericpackage.cpp | 29 ++ .../plasmatheme-packagestructure.json | 14 + .../packagestructure/plasmathemepackage.cpp | 136 +++++++++ .../plasmoid-packagestructure.json | 14 + .../packagestructure/plasmoidpackage.cpp | 60 ++++ src/plasma/plasma.cpp | 1 - src/plasma/pluginloader.cpp | 51 +--- src/plasma/private/packages.cpp | 261 ------------------ src/plasma/theme.cpp | 1 - src/plasmaquick/shellpluginloader.cpp | 39 +-- src/plasmaquick/shellpluginloader.h | 15 +- 22 files changed, 530 insertions(+), 392 deletions(-) create mode 100644 src/plasma/packagestructure/CMakeLists.txt create mode 100644 src/plasma/packagestructure/containmentactions-packagestructure.json create mode 100644 src/plasma/packagestructure/containmentactionspackage.cpp create mode 100644 src/plasma/packagestructure/dataengine-packagestructure.json create mode 100644 src/plasma/packagestructure/dataenginepackage.cpp create mode 100644 src/plasma/packagestructure/packages.cpp rename src/plasma/{private => packagestructure}/packages_p.h (76%) create mode 100644 src/plasma/packagestructure/plasmageneric-packagestructure.json create mode 100644 src/plasma/packagestructure/plasmagenericpackage.cpp create mode 100644 src/plasma/packagestructure/plasmatheme-packagestructure.json create mode 100644 src/plasma/packagestructure/plasmathemepackage.cpp create mode 100644 src/plasma/packagestructure/plasmoid-packagestructure.json create mode 100644 src/plasma/packagestructure/plasmoidpackage.cpp delete mode 100644 src/plasma/private/packages.cpp diff --git a/src/plasma/CMakeLists.txt b/src/plasma/CMakeLists.txt index e9215c14b..59026a872 100644 --- a/src/plasma/CMakeLists.txt +++ b/src/plasma/CMakeLists.txt @@ -1,3 +1,5 @@ +add_subdirectory(packagestructure) + # This option should be removed, or moved down as far as possible. # That means porting the existing frameworks to the CMake automoc # feature. Porting is mostly removing explicit moc includes, and @@ -66,7 +68,6 @@ set(Plasma_LIB_SRCS #packages package.cpp packagestructure.cpp - private/packages.cpp #graphics framesvg.cpp diff --git a/src/plasma/containmentactions.cpp b/src/plasma/containmentactions.cpp index 3b9b76cac..a757e7023 100644 --- a/src/plasma/containmentactions.cpp +++ b/src/plasma/containmentactions.cpp @@ -20,7 +20,6 @@ #include "containmentactions.h" #include "containment.h" -#include "private/packages_p.h" #include "private/containmentactions_p.h" #include "private/containment_p.h" diff --git a/src/plasma/package.cpp b/src/plasma/package.cpp index a3845b4e3..ada6a8040 100644 --- a/src/plasma/package.cpp +++ b/src/plasma/package.cpp @@ -40,7 +40,6 @@ #include "pluginloader.h" #include "private/package_p.h" #include "private/packagestructure_p.h" -#include "private/packages_p.h" namespace Plasma { diff --git a/src/plasma/packagestructure/CMakeLists.txt b/src/plasma/packagestructure/CMakeLists.txt new file mode 100644 index 000000000..9d62638b9 --- /dev/null +++ b/src/plasma/packagestructure/CMakeLists.txt @@ -0,0 +1,12 @@ +function(install_package_structure name) + add_library(${name}_packagestructure MODULE ${name}package.cpp packages.cpp) + target_link_libraries(${name}_packagestructure PRIVATE KF5::Package KF5::Plasma KF5::Declarative KF5::I18n) + install(TARGETS ${name}_packagestructure DESTINATION ${KDE_INSTALL_PLUGINDIR}/kpackage/packagestructure) +endfunction() + +install_package_structure(plasmageneric) +install_package_structure(plasmoid) +install_package_structure(dataengine) +install_package_structure(plasmatheme) +install_package_structure(containmentactions) + diff --git a/src/plasma/packagestructure/containmentactions-packagestructure.json b/src/plasma/packagestructure/containmentactions-packagestructure.json new file mode 100644 index 000000000..0ea77e986 --- /dev/null +++ b/src/plasma/packagestructure/containmentactions-packagestructure.json @@ -0,0 +1,14 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "aseigo@kde.org", + "Name": "Aaron Seigo" + } + ], + "Id": "Plasma/ContainmentActions", + "Name": "Containment Actions", + "ServiceTypes": [ "KPackage/PackageStructure" ], + "Version": "1" + } +} diff --git a/src/plasma/packagestructure/containmentactionspackage.cpp b/src/plasma/packagestructure/containmentactionspackage.cpp new file mode 100644 index 000000000..95cea2360 --- /dev/null +++ b/src/plasma/packagestructure/containmentactionspackage.cpp @@ -0,0 +1,43 @@ +/****************************************************************************** +* Copyright 2007-2009 by Aaron Seigo * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 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 * +* Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public License * +* along with this library; see the file COPYING.LIB. If not, write to * +* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * +* Boston, MA 02110-1301, USA. * +*******************************************************************************/ + +#include "plasma.h" + +#include +#include +#include "packages_p.h" +#include "config-plasma.h" + +class ContainmentActionsPackage : public Plasma::ChangeableMainScriptPackage +{ + Q_OBJECT +public: + ContainmentActionsPackage(QObject *parent = 0, const QVariantList &args = QVariantList()) : ChangeableMainScriptPackage(parent, args) {} + + void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE + { + ChangeableMainScriptPackage::initPackage(package); + package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/containmentactions/")); + } +}; + + +K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(ContainmentActionsPackage, "containmentactions-packagestructure.json") + +#include "containmentactionspackage.moc" diff --git a/src/plasma/packagestructure/dataengine-packagestructure.json b/src/plasma/packagestructure/dataengine-packagestructure.json new file mode 100644 index 000000000..abedcf9e9 --- /dev/null +++ b/src/plasma/packagestructure/dataengine-packagestructure.json @@ -0,0 +1,14 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "aseigo@kde.org", + "Name": "Aaron Seigo" + } + ], + "Id": "Plasma/DataEngine", + "Name": "Data Engine", + "ServiceTypes": [ "KPackage/PackageStructure" ], + "Version": "1" + } +} diff --git a/src/plasma/packagestructure/dataenginepackage.cpp b/src/plasma/packagestructure/dataenginepackage.cpp new file mode 100644 index 000000000..cc093b75b --- /dev/null +++ b/src/plasma/packagestructure/dataenginepackage.cpp @@ -0,0 +1,56 @@ +/****************************************************************************** +* Copyright 2007-2009 by Aaron Seigo * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 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 * +* Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public License * +* along with this library; see the file COPYING.LIB. If not, write to * +* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * +* Boston, MA 02110-1301, USA. * +*******************************************************************************/ + +#include "plasma.h" + +#include +#include +#include +#include "packages_p.h" +#include "config-plasma.h" + +class DataEnginePackage : public Plasma::ChangeableMainScriptPackage +{ + Q_OBJECT +public: + DataEnginePackage(QObject *parent = 0, const QVariantList &args = QVariantList()) : ChangeableMainScriptPackage(parent, args) {} + + void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE + { + ChangeableMainScriptPackage::initPackage(package); + package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/")); + + package->addDirectoryDefinition("data", QStringLiteral("data"), i18n("Data Files")); + + package->addDirectoryDefinition("scripts", QStringLiteral("code"), i18n("Executable Scripts")); + QStringList mimetypes; + mimetypes << QStringLiteral("text/plain"); + package->setMimeTypes("scripts", mimetypes); + + package->addDirectoryDefinition("services", QStringLiteral("services/"), i18n("Service Descriptions")); + package->setMimeTypes("services", mimetypes); + + package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations")); + } +}; + + +K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(DataEnginePackage, "dataengine-packagestructure.json") + +#include "dataenginepackage.moc" diff --git a/src/plasma/packagestructure/packages.cpp b/src/plasma/packagestructure/packages.cpp new file mode 100644 index 000000000..a138dd955 --- /dev/null +++ b/src/plasma/packagestructure/packages.cpp @@ -0,0 +1,111 @@ +/****************************************************************************** +* Copyright 2007-2009 by Aaron Seigo * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 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 * +* Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public License * +* along with this library; see the file COPYING.LIB. If not, write to * +* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * +* Boston, MA 02110-1301, USA. * +*******************************************************************************/ + +#include +#include // FLT_MAX + +#include +#include +#include + +#include +#include +#include + +#include +#include "packages_p.h" +#include "config-plasma.h" + +#include + +namespace Plasma +{ + +void ChangeableMainScriptPackage::initPackage(KPackage::Package *package) +{ + package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml"), i18n("Main Script File")); + package->addFileDefinition("test", QStringLiteral("tests/test.qml"), i18n("Tests")); + package->setRequired("mainscript", true); +} + +QString ChangeableMainScriptPackage::mainScriptConfigKey() const +{ + return QStringLiteral("X-Plasma-MainScript"); +} + +void ChangeableMainScriptPackage::pathChanged(KPackage::Package *package) +{ + if (package->path().isEmpty()) { + return; + } + + KDesktopFile config(package->path() + "/metadata.desktop"); + KConfigGroup cg = config.desktopGroup(); + QString mainScript = cg.readEntry(mainScriptConfigKey(), QString()); + + if (!mainScript.isEmpty()) { + package->addFileDefinition("mainscript", mainScript, i18n("Main Script File")); + } +} + +void GenericPackage::initPackage(KPackage::Package *package) +{ + ChangeableMainScriptPackage::initPackage(package); + + QStringList platform = KDeclarative::KDeclarative::runtimePlatform(); + if (!platform.isEmpty()) { + QMutableStringListIterator it(platform); + while (it.hasNext()) { + it.next(); + it.setValue("platformcontents/" + it.value()); + } + + platform.append(QStringLiteral("contents")); + package->setContentsPrefixPaths(platform); + } + + package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/")); + + package->addDirectoryDefinition("images", QStringLiteral("images"), i18n("Images")); + package->addDirectoryDefinition("theme", QStringLiteral("theme"), i18n("Themed Images")); + QStringList mimetypes; + mimetypes << QStringLiteral("image/svg+xml") << QStringLiteral("image/png") << QStringLiteral("image/jpeg"); + package->setMimeTypes("images", mimetypes); + package->setMimeTypes("theme", mimetypes); + + package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration Definitions")); + mimetypes.clear(); + mimetypes << QStringLiteral("text/xml"); + package->setMimeTypes("config", mimetypes); + + package->addDirectoryDefinition("ui", QStringLiteral("ui"), i18n("User Interface")); + + package->addDirectoryDefinition("data", QStringLiteral("data"), i18n("Data Files")); + + package->addDirectoryDefinition("scripts", QStringLiteral("code"), i18n("Executable Scripts")); + mimetypes.clear(); + mimetypes << QStringLiteral("text/plain"); + package->setMimeTypes("scripts", mimetypes); + package->addFileDefinition("screenshot", QStringLiteral("screenshot.png"), i18n("Screenshot")); + + package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations")); +} + +} // namespace Plasma + diff --git a/src/plasma/private/packages_p.h b/src/plasma/packagestructure/packages_p.h similarity index 76% rename from src/plasma/private/packages_p.h rename to src/plasma/packagestructure/packages_p.h index 5c9dd7ad4..6863ac5aa 100644 --- a/src/plasma/private/packages_p.h +++ b/src/plasma/packagestructure/packages_p.h @@ -32,6 +32,8 @@ class ChangeableMainScriptPackage : public KPackage::PackageStructure { Q_OBJECT public: + ChangeableMainScriptPackage(QObject *parent = 0, const QVariantList &args = QVariantList()) : KPackage::PackageStructure(parent, args) {} + void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE; void pathChanged(KPackage::Package *package) Q_DECL_OVERRIDE; @@ -43,35 +45,7 @@ class GenericPackage : public ChangeableMainScriptPackage { Q_OBJECT public: - void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE; -}; - -class PlasmoidPackage : public GenericPackage -{ - Q_OBJECT -public: - void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE; - void pathChanged(KPackage::Package *package) Q_DECL_OVERRIDE; -}; - -class DataEnginePackage : public ChangeableMainScriptPackage -{ - Q_OBJECT -public: - void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE; -}; - -class ThemePackage : public KPackage::PackageStructure -{ - Q_OBJECT -public: - void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE; -}; - -class ContainmentActionsPackage : public ChangeableMainScriptPackage -{ - Q_OBJECT -public: + GenericPackage(QObject *parent = 0, const QVariantList &args = QVariantList()) : ChangeableMainScriptPackage(parent, args) {} void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE; }; diff --git a/src/plasma/packagestructure/plasmageneric-packagestructure.json b/src/plasma/packagestructure/plasmageneric-packagestructure.json new file mode 100644 index 000000000..4da86a84e --- /dev/null +++ b/src/plasma/packagestructure/plasmageneric-packagestructure.json @@ -0,0 +1,14 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "aseigo@kde.org", + "Name": "Aaron Seigo" + } + ], + "Id": "Plasma/Generic", + "Name": "Generic", + "ServiceTypes": [ "KPackage/PackageStructure" ], + "Version": "1" + } +} diff --git a/src/plasma/packagestructure/plasmagenericpackage.cpp b/src/plasma/packagestructure/plasmagenericpackage.cpp new file mode 100644 index 000000000..982247673 --- /dev/null +++ b/src/plasma/packagestructure/plasmagenericpackage.cpp @@ -0,0 +1,29 @@ +/****************************************************************************** +* Copyright 2007-2009 by Aaron Seigo * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 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 * +* Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public License * +* along with this library; see the file COPYING.LIB. If not, write to * +* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * +* Boston, MA 02110-1301, USA. * +*******************************************************************************/ + +#include "plasma.h" + +#include +#include +#include +#include "packages_p.h" + +K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(Plasma::GenericPackage, "plasmageneric-packagestructure.json") + +#include "plasmagenericpackage.moc" diff --git a/src/plasma/packagestructure/plasmatheme-packagestructure.json b/src/plasma/packagestructure/plasmatheme-packagestructure.json new file mode 100644 index 000000000..c56a68d21 --- /dev/null +++ b/src/plasma/packagestructure/plasmatheme-packagestructure.json @@ -0,0 +1,14 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "aseigo@kde.org", + "Name": "Aaron Seigo" + } + ], + "Id": "Plasma/Theme", + "Name": "Plasma Theme", + "ServiceTypes": [ "KPackage/PackageStructure" ], + "Version": "1" + } +} diff --git a/src/plasma/packagestructure/plasmathemepackage.cpp b/src/plasma/packagestructure/plasmathemepackage.cpp new file mode 100644 index 000000000..94f0c5ce5 --- /dev/null +++ b/src/plasma/packagestructure/plasmathemepackage.cpp @@ -0,0 +1,136 @@ +/****************************************************************************** +* Copyright 2007-2009 by Aaron Seigo * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 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 * +* Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public License * +* along with this library; see the file COPYING.LIB. If not, write to * +* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * +* Boston, MA 02110-1301, USA. * +*******************************************************************************/ + +#include "plasma.h" + +#include +#include +#include + +class ThemePackage : public KPackage::PackageStructure +{ + Q_OBJECT +public: + ThemePackage(QObject *parent = 0, const QVariantList &args = QVariantList()) : KPackage::PackageStructure(parent, args) {} + + void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE + { + // by default the packages have "contents/" as contentsPrefixPaths + // but for the themes we don't want that, so unset it. + package->setContentsPrefixPaths(QStringList()); + + package->addDirectoryDefinition("dialogs", QStringLiteral("dialogs/"), i18n("Images for dialogs")); + package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svg"), + i18n("Generic dialog background")); + package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svgz"), + i18n("Generic dialog background")); + package->addFileDefinition("dialogs/shutdowndialog", QStringLiteral("dialogs/shutdowndialog.svg"), + i18n("Theme for the logout dialog")); + package->addFileDefinition("dialogs/shutdowndialog", QStringLiteral("dialogs/shutdowndialog.svgz"), + i18n("Theme for the logout dialog")); + + package->addDirectoryDefinition("wallpapers", QStringLiteral("wallpapers/"), i18n("Wallpaper packages")); + + package->addDirectoryDefinition("widgets", QStringLiteral("widgets/"), i18n("Images for widgets")); + package->addFileDefinition("widgets/background", QStringLiteral("widgets/background.svg"), + i18n("Background image for widgets")); + package->addFileDefinition("widgets/background", QStringLiteral("widgets/background.svgz"), + i18n("Background image for widgets")); + package->addFileDefinition("widgets/clock", QStringLiteral("widgets/clock.svg"), + i18n("Analog clock face")); + package->addFileDefinition("widgets/clock", QStringLiteral("widgets/clock.svgz"), + i18n("Analog clock face")); + package->addFileDefinition("widgets/panel-background", QStringLiteral("widgets/panel-background.svg"), + i18n("Background image for panels")); + package->addFileDefinition("widgets/panel-background", QStringLiteral("widgets/panel-background.svgz"), + i18n("Background image for panels")); + package->addFileDefinition("widgets/plot-background", QStringLiteral("widgets/plot-background.svg"), + i18n("Background for graphing widgets")); + package->addFileDefinition("widgets/plot-background", QStringLiteral("widgets/plot-background.svgz"), + i18n("Background for graphing widgets")); + package->addFileDefinition("widgets/tooltip", QStringLiteral("widgets/tooltip.svg"), + i18n("Background image for tooltips")); + package->addFileDefinition("widgets/tooltip", QStringLiteral("widgets/tooltip.svgz"), + i18n("Background image for tooltips")); + + package->addDirectoryDefinition("opaque/dialogs", QStringLiteral("opaque/dialogs/"), i18n("Opaque images for dialogs")); + package->addFileDefinition("opaque/dialogs/background", QStringLiteral("opaque/dialogs/background.svg"), + i18n("Opaque generic dialog background")); + package->addFileDefinition("opaque/dialogs/background", QStringLiteral("opaque/dialogs/background.svgz"), + i18n("Opaque generic dialog background")); + package->addFileDefinition("opaque/dialogs/shutdowndialog", QStringLiteral("opaque/dialogs/shutdowndialog.svg"), + i18n("Opaque theme for the logout dialog")); + package->addFileDefinition("opaque/dialogs/shutdowndialog", QStringLiteral("opaque/dialogs/shutdowndialog.svgz"), + i18n("Opaque theme for the logout dialog")); + + package->addDirectoryDefinition("opaque/widgets", QStringLiteral("opaque/widgets/"), i18n("Opaque images for widgets")); + package->addFileDefinition("opaque/widgets/panel-background", QStringLiteral("opaque/widgets/panel-background.svg"), + i18n("Opaque background image for panels")); + package->addFileDefinition("opaque/widgets/panel-background", QStringLiteral("opaque/widgets/panel-background.svgz"), + i18n("Opaque background image for panels")); + package->addFileDefinition("opaque/widgets/tooltip", QStringLiteral("opaque/widgets/tooltip.svg"), + i18n("Opaque background image for tooltips")); + package->addFileDefinition("opaque/widgets/tooltip", QStringLiteral("opaque/widgets/tooltip.svgz"), + i18n("Opaque background image for tooltips")); + + package->addDirectoryDefinition("locolor/dialogs", QStringLiteral("locolor/dialogs/"), + i18n("Low color images for dialogs")); + package->addFileDefinition("locolor/dialogs/background", QStringLiteral("locolor/dialogs/background.svg"), + i18n("Low color generic dialog background")); + package->addFileDefinition("locolor/dialogs/background", QStringLiteral("locolor/dialogs/background.svgz"), + i18n("Low color generic dialog background")); + package->addFileDefinition("locolor/dialogs/shutdowndialog", QStringLiteral("locolor/dialogs/shutdowndialog.svg"), + i18n("Low color theme for the logout dialog")); + package->addFileDefinition("locolor/dialogs/shutdowndialog", QStringLiteral("locolor/dialogs/shutdowndialog.svgz"), + i18n("Low color theme for the logout dialog")); + + package->addDirectoryDefinition("locolor/widgets", QStringLiteral("locolor/widgets/"), i18n("Images for widgets")); + package->addFileDefinition("locolor/widgets/background", QStringLiteral("locolor/widgets/background.svg"), + i18n("Low color background image for widgets")); + package->addFileDefinition("locolor/widgets/background", QStringLiteral("locolor/widgets/background.svgz"), + i18n("Low color background image for widgets")); + package->addFileDefinition("locolor/widgets/clock", QStringLiteral("locolor/widgets/clock.svg"), + i18n("Low color analog clock face")); + package->addFileDefinition("locolor/widgets/clock", QStringLiteral("locolor/widgets/clock.svgz"), + i18n("Low color analog clock face")); + package->addFileDefinition("locolor/widgets/panel-background", QStringLiteral("locolor/widgets/panel-background.svg"), + i18n("Low color background image for panels")); + package->addFileDefinition("locolor/widgets/panel-background", QStringLiteral("locolor/widgets/panel-background.svgz"), + i18n("Low color background image for panels")); + package->addFileDefinition("locolor/widgets/plot-background", QStringLiteral("locolor/widgets/plot-background.svg"), + i18n("Low color background for graphing widgets")); + package->addFileDefinition("locolor/widgets/plot-background", QStringLiteral("locolor/widgets/plot-background.svgz"), + i18n("Low color background for graphing widgets")); + package->addFileDefinition("locolor/widgets/tooltip", QStringLiteral("locolor/widgets/tooltip.svg"), + i18n("Low color background image for tooltips")); + package->addFileDefinition("locolor/widgets/tooltip", QStringLiteral("locolor/widgets/tooltip.svgz"), + i18n("Low color background image for tooltips")); + + package->addFileDefinition("colors", QStringLiteral("colors"), i18n("KColorScheme configuration file")); + + QStringList mimetypes; + mimetypes << QStringLiteral("image/svg+xml"); + package->setDefaultMimeTypes(mimetypes); + } +}; + +K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(ThemePackage, "plasmatheme-packagestructure.json") + +#include "plasmathemepackage.moc" + diff --git a/src/plasma/packagestructure/plasmoid-packagestructure.json b/src/plasma/packagestructure/plasmoid-packagestructure.json new file mode 100644 index 000000000..e9f41558a --- /dev/null +++ b/src/plasma/packagestructure/plasmoid-packagestructure.json @@ -0,0 +1,14 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "aseigo@kde.org", + "Name": "Aaron Seigo" + } + ], + "Id": "Plasma/Applet", + "Name": "Plasmoid", + "ServiceTypes": [ "KPackage/PackageStructure" ], + "Version": "1" + } +} diff --git a/src/plasma/packagestructure/plasmoidpackage.cpp b/src/plasma/packagestructure/plasmoidpackage.cpp new file mode 100644 index 000000000..d3f89771b --- /dev/null +++ b/src/plasma/packagestructure/plasmoidpackage.cpp @@ -0,0 +1,60 @@ +/****************************************************************************** +* Copyright 2007-2009 by Aaron Seigo * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 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 * +* Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public License * +* along with this library; see the file COPYING.LIB. If not, write to * +* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * +* Boston, MA 02110-1301, USA. * +*******************************************************************************/ + +#include "plasma.h" + +#include +#include +#include +#include "packages_p.h" +#include "config-plasma.h" + +class PlasmoidPackage : public Plasma::GenericPackage +{ + Q_OBJECT +public: + PlasmoidPackage(QObject *parent = 0, const QVariantList &args = QVariantList()) : GenericPackage(parent, args) {} + + void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE + { + GenericPackage::initPackage(package); + package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/")); + + package->addFileDefinition("configmodel", QStringLiteral("config/config.qml"), i18n("Configuration UI pages model")); + package->addFileDefinition("mainconfigxml", QStringLiteral("config/main.xml"), i18n("Configuration XML file")); + } + + void pathChanged(KPackage::Package *package) Q_DECL_OVERRIDE + { + ChangeableMainScriptPackage::pathChanged(package); + + if (!package->metadata().isValid()) { + return; + } + if (package->metadata().serviceTypes().contains(QStringLiteral("Plasma/Containment"))) { + package->addFileDefinition("compactapplet", QStringLiteral("applet/CompactApplet.qml"), i18n("Custom expander for compact applets")); + } else { + package->removeDefinition("compactapplet"); + } + } +}; + +K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(PlasmoidPackage, "plasmoid-packagestructure.json") + +#include "plasmoidpackage.moc" diff --git a/src/plasma/plasma.cpp b/src/plasma/plasma.cpp index a6da2d526..38c5fc5c8 100644 --- a/src/plasma/plasma.cpp +++ b/src/plasma/plasma.cpp @@ -23,7 +23,6 @@ #include #include "containment.h" -#include "private/packages_p.h" namespace Plasma { diff --git a/src/plasma/pluginloader.cpp b/src/plasma/pluginloader.cpp index 6a9eb5085..b8f82dc53 100644 --- a/src/plasma/pluginloader.cpp +++ b/src/plasma/pluginloader.cpp @@ -40,7 +40,6 @@ #include "dataengine.h" #include "package.h" #include "private/applet_p.h" -#include "private/packages_p.h" #include "private/service_p.h" // for NullService #include "private/storage_p.h" #include "private/package_p.h" @@ -60,11 +59,6 @@ public: : isDefaultLoader(false), packageRE("[^a-zA-Z0-9\\-_]") { - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new PlasmoidPackage()); - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage()); - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Theme"), new ThemePackage()); - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/ContainmentActions"), new ContainmentActionsPackage()); - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Generic"), new GenericPackage()); } static QSet knownCategories(); @@ -292,10 +286,6 @@ DataEngine *PluginLoader::loadDataEngine(const QString &name) QStringList PluginLoader::listAllEngines(const QString &parentApp) { - if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/DataEngine"))) { - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage()); - } - QStringList engines; // Look for C++ plugins first auto filter = [&parentApp](const KPluginMetaData &md) -> bool @@ -323,18 +313,11 @@ QStringList PluginLoader::listAllEngines(const QString &parentApp) KPluginInfo::List PluginLoader::listEngineInfo(const QString &parentApp) { - if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/DataEngine"))) { - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage()); - } return PluginLoader::self()->listDataEngineInfo(parentApp); } KPluginInfo::List PluginLoader::listEngineInfoByCategory(const QString &category, const QString &parentApp) { - if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/DataEngine"))) { - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage()); - } - KPluginInfo::List list; // Look for C++ plugins first @@ -489,33 +472,11 @@ Package PluginLoader::loadPackage(const QString &packageFormat, const QString &s const QString hashkey = packageFormat + '%' + specialization; PackageStructure *structure = d->structures.value(hashkey).data(); - KPackage::PackageStructure *internalStructure = 0; if (structure) { return Package(structure); } - if (packageFormat.startsWith(QLatin1String("Plasma"))) { - if (packageFormat.endsWith(QLatin1String("/Applet"))) { - internalStructure = new PlasmoidPackage(); - } else if (packageFormat.endsWith(QLatin1String("/DataEngine"))) { - internalStructure = new DataEnginePackage(); - } else if (packageFormat.endsWith(QLatin1String("/Theme"))) { - internalStructure = new ThemePackage(); - } else if (packageFormat.endsWith(QLatin1String("/ContainmentActions"))) { - internalStructure = new ContainmentActionsPackage(); - } else if (packageFormat.endsWith(QLatin1String("/Generic"))) { - internalStructure = new GenericPackage(); - } - - if (internalStructure) { - structure = new PackageStructure(); - structure->d->internalStructure = internalStructure; - d->structures.insert(hashkey, structure); - return Package(structure); - } - } - - internalStructure = KPackage::PackageLoader::self()->loadPackageStructure(packageFormat); + KPackage::PackageStructure *internalStructure = KPackage::PackageLoader::self()->loadPackageStructure(packageFormat); if (internalStructure) { structure = new PackageStructure(); @@ -707,10 +668,6 @@ KPluginInfo::List PluginLoader::listContainmentsOfType(const QString &type, const QString &category, const QString &parentApp) { - if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Applet"))) { - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new PlasmoidPackage()); - } - KConfigGroup group(KSharedConfig::openConfig(), "General"); const QStringList excluded = group.readEntry("ExcludeCategories", QStringList()); auto filter = [&type, &category, &parentApp](const KPluginMetaData &md) -> bool @@ -739,9 +696,6 @@ KPluginInfo::List PluginLoader::listContainmentsOfType(const QString &type, KPluginInfo::List PluginLoader::listContainmentsForMimeType(const QString &mimeType) { - if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Applet"))) { - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new DataEnginePackage()); - } auto filter = [&mimeType](const KPluginMetaData &md) -> bool { return md.value(QStringLiteral("X-KDE-ServiceTypes")).contains(QLatin1String("Plasma/Containment")) @@ -753,9 +707,6 @@ KPluginInfo::List PluginLoader::listContainmentsForMimeType(const QString &mimeT QStringList PluginLoader::listContainmentTypes() { - if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Applet"))) { - KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new DataEnginePackage()); - } KPluginInfo::List containmentInfos = listContainments(); QSet types; diff --git a/src/plasma/private/packages.cpp b/src/plasma/private/packages.cpp deleted file mode 100644 index 0392e8ddb..000000000 --- a/src/plasma/private/packages.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/****************************************************************************** -* Copyright 2007-2009 by Aaron Seigo * -* * -* This library is free software; you can redistribute it and/or * -* modify it under the terms of the GNU Library General Public * -* License as published by the Free Software Foundation; either * -* version 2 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 * -* Library General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public License * -* along with this library; see the file COPYING.LIB. If not, write to * -* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * -* Boston, MA 02110-1301, USA. * -*******************************************************************************/ - -#include "private/packages_p.h" - -#include -#include // FLT_MAX - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include "package.h" -#include "config-plasma.h" - -#include - -namespace Plasma -{ - -void ChangeableMainScriptPackage::initPackage(KPackage::Package *package) -{ - package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml"), i18n("Main Script File")); - package->addFileDefinition("test", QStringLiteral("tests/test.qml"), i18n("Tests")); - package->setRequired("mainscript", true); -} - -QString ChangeableMainScriptPackage::mainScriptConfigKey() const -{ - return QStringLiteral("X-Plasma-MainScript"); -} - -void ChangeableMainScriptPackage::pathChanged(KPackage::Package *package) -{ - if (package->path().isEmpty()) { - return; - } - - KDesktopFile config(package->path() + "/metadata.desktop"); - KConfigGroup cg = config.desktopGroup(); - QString mainScript = cg.readEntry(mainScriptConfigKey(), QString()); - - if (!mainScript.isEmpty()) { - package->addFileDefinition("mainscript", mainScript, i18n("Main Script File")); - } -} - -void GenericPackage::initPackage(KPackage::Package *package) -{ - ChangeableMainScriptPackage::initPackage(package); - - QStringList platform = KDeclarative::KDeclarative::runtimePlatform(); - if (!platform.isEmpty()) { - QMutableStringListIterator it(platform); - while (it.hasNext()) { - it.next(); - it.setValue("platformcontents/" + it.value()); - } - - platform.append(QStringLiteral("contents")); - package->setContentsPrefixPaths(platform); - } - - package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/")); - - package->addDirectoryDefinition("images", QStringLiteral("images"), i18n("Images")); - package->addDirectoryDefinition("theme", QStringLiteral("theme"), i18n("Themed Images")); - QStringList mimetypes; - mimetypes << QStringLiteral("image/svg+xml") << QStringLiteral("image/png") << QStringLiteral("image/jpeg"); - package->setMimeTypes("images", mimetypes); - package->setMimeTypes("theme", mimetypes); - - package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration Definitions")); - mimetypes.clear(); - mimetypes << QStringLiteral("text/xml"); - package->setMimeTypes("config", mimetypes); - - package->addDirectoryDefinition("ui", QStringLiteral("ui"), i18n("User Interface")); - - package->addDirectoryDefinition("data", QStringLiteral("data"), i18n("Data Files")); - - package->addDirectoryDefinition("scripts", QStringLiteral("code"), i18n("Executable Scripts")); - mimetypes.clear(); - mimetypes << QStringLiteral("text/plain"); - package->setMimeTypes("scripts", mimetypes); - package->addFileDefinition("screenshot", QStringLiteral("screenshot.png"), i18n("Screenshot")); - - package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations")); -} - -void PlasmoidPackage::initPackage(KPackage::Package *package) -{ - GenericPackage::initPackage(package); - package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/")); - - package->addFileDefinition("configmodel", QStringLiteral("config/config.qml"), i18n("Configuration UI pages model")); - package->addFileDefinition("mainconfigxml", QStringLiteral("config/main.xml"), i18n("Configuration XML file")); -} - -void PlasmoidPackage::pathChanged(KPackage::Package *package) -{ - ChangeableMainScriptPackage::pathChanged(package); - - if (!package->metadata().isValid()) { - return; - } - if (package->metadata().serviceTypes().contains(QStringLiteral("Plasma/Containment"))) { - package->addFileDefinition("compactapplet", QStringLiteral("applet/CompactApplet.qml"), i18n("Custom expander for compact applets")); - } else { - package->removeDefinition("compactapplet"); - } -} - -void DataEnginePackage::initPackage(KPackage::Package *package) -{ - ChangeableMainScriptPackage::initPackage(package); - package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/")); - - package->addDirectoryDefinition("data", QStringLiteral("data"), i18n("Data Files")); - - package->addDirectoryDefinition("scripts", QStringLiteral("code"), i18n("Executable Scripts")); - QStringList mimetypes; - mimetypes << QStringLiteral("text/plain"); - package->setMimeTypes("scripts", mimetypes); - - package->addDirectoryDefinition("services", QStringLiteral("services/"), i18n("Service Descriptions")); - package->setMimeTypes("services", mimetypes); - - package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations")); -} - -void ThemePackage::initPackage(KPackage::Package *package) -{ - // by default the packages have "contents/" as contentsPrefixPaths - // but for the themes we don't want that, so unset it. - package->setContentsPrefixPaths(QStringList()); - - package->addDirectoryDefinition("dialogs", QStringLiteral("dialogs/"), i18n("Images for dialogs")); - package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svg"), - i18n("Generic dialog background")); - package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svgz"), - i18n("Generic dialog background")); - package->addFileDefinition("dialogs/shutdowndialog", QStringLiteral("dialogs/shutdowndialog.svg"), - i18n("Theme for the logout dialog")); - package->addFileDefinition("dialogs/shutdowndialog", QStringLiteral("dialogs/shutdowndialog.svgz"), - i18n("Theme for the logout dialog")); - - package->addDirectoryDefinition("wallpapers", QStringLiteral("wallpapers/"), i18n("Wallpaper packages")); - - package->addDirectoryDefinition("widgets", QStringLiteral("widgets/"), i18n("Images for widgets")); - package->addFileDefinition("widgets/background", QStringLiteral("widgets/background.svg"), - i18n("Background image for widgets")); - package->addFileDefinition("widgets/background", QStringLiteral("widgets/background.svgz"), - i18n("Background image for widgets")); - package->addFileDefinition("widgets/clock", QStringLiteral("widgets/clock.svg"), - i18n("Analog clock face")); - package->addFileDefinition("widgets/clock", QStringLiteral("widgets/clock.svgz"), - i18n("Analog clock face")); - package->addFileDefinition("widgets/panel-background", QStringLiteral("widgets/panel-background.svg"), - i18n("Background image for panels")); - package->addFileDefinition("widgets/panel-background", QStringLiteral("widgets/panel-background.svgz"), - i18n("Background image for panels")); - package->addFileDefinition("widgets/plot-background", QStringLiteral("widgets/plot-background.svg"), - i18n("Background for graphing widgets")); - package->addFileDefinition("widgets/plot-background", QStringLiteral("widgets/plot-background.svgz"), - i18n("Background for graphing widgets")); - package->addFileDefinition("widgets/tooltip", QStringLiteral("widgets/tooltip.svg"), - i18n("Background image for tooltips")); - package->addFileDefinition("widgets/tooltip", QStringLiteral("widgets/tooltip.svgz"), - i18n("Background image for tooltips")); - - package->addDirectoryDefinition("opaque/dialogs", QStringLiteral("opaque/dialogs/"), i18n("Opaque images for dialogs")); - package->addFileDefinition("opaque/dialogs/background", QStringLiteral("opaque/dialogs/background.svg"), - i18n("Opaque generic dialog background")); - package->addFileDefinition("opaque/dialogs/background", QStringLiteral("opaque/dialogs/background.svgz"), - i18n("Opaque generic dialog background")); - package->addFileDefinition("opaque/dialogs/shutdowndialog", QStringLiteral("opaque/dialogs/shutdowndialog.svg"), - i18n("Opaque theme for the logout dialog")); - package->addFileDefinition("opaque/dialogs/shutdowndialog", QStringLiteral("opaque/dialogs/shutdowndialog.svgz"), - i18n("Opaque theme for the logout dialog")); - - package->addDirectoryDefinition("opaque/widgets", QStringLiteral("opaque/widgets/"), i18n("Opaque images for widgets")); - package->addFileDefinition("opaque/widgets/panel-background", QStringLiteral("opaque/widgets/panel-background.svg"), - i18n("Opaque background image for panels")); - package->addFileDefinition("opaque/widgets/panel-background", QStringLiteral("opaque/widgets/panel-background.svgz"), - i18n("Opaque background image for panels")); - package->addFileDefinition("opaque/widgets/tooltip", QStringLiteral("opaque/widgets/tooltip.svg"), - i18n("Opaque background image for tooltips")); - package->addFileDefinition("opaque/widgets/tooltip", QStringLiteral("opaque/widgets/tooltip.svgz"), - i18n("Opaque background image for tooltips")); - - package->addDirectoryDefinition("locolor/dialogs", QStringLiteral("locolor/dialogs/"), - i18n("Low color images for dialogs")); - package->addFileDefinition("locolor/dialogs/background", QStringLiteral("locolor/dialogs/background.svg"), - i18n("Low color generic dialog background")); - package->addFileDefinition("locolor/dialogs/background", QStringLiteral("locolor/dialogs/background.svgz"), - i18n("Low color generic dialog background")); - package->addFileDefinition("locolor/dialogs/shutdowndialog", QStringLiteral("locolor/dialogs/shutdowndialog.svg"), - i18n("Low color theme for the logout dialog")); - package->addFileDefinition("locolor/dialogs/shutdowndialog", QStringLiteral("locolor/dialogs/shutdowndialog.svgz"), - i18n("Low color theme for the logout dialog")); - - package->addDirectoryDefinition("locolor/widgets", QStringLiteral("locolor/widgets/"), i18n("Images for widgets")); - package->addFileDefinition("locolor/widgets/background", QStringLiteral("locolor/widgets/background.svg"), - i18n("Low color background image for widgets")); - package->addFileDefinition("locolor/widgets/background", QStringLiteral("locolor/widgets/background.svgz"), - i18n("Low color background image for widgets")); - package->addFileDefinition("locolor/widgets/clock", QStringLiteral("locolor/widgets/clock.svg"), - i18n("Low color analog clock face")); - package->addFileDefinition("locolor/widgets/clock", QStringLiteral("locolor/widgets/clock.svgz"), - i18n("Low color analog clock face")); - package->addFileDefinition("locolor/widgets/panel-background", QStringLiteral("locolor/widgets/panel-background.svg"), - i18n("Low color background image for panels")); - package->addFileDefinition("locolor/widgets/panel-background", QStringLiteral("locolor/widgets/panel-background.svgz"), - i18n("Low color background image for panels")); - package->addFileDefinition("locolor/widgets/plot-background", QStringLiteral("locolor/widgets/plot-background.svg"), - i18n("Low color background for graphing widgets")); - package->addFileDefinition("locolor/widgets/plot-background", QStringLiteral("locolor/widgets/plot-background.svgz"), - i18n("Low color background for graphing widgets")); - package->addFileDefinition("locolor/widgets/tooltip", QStringLiteral("locolor/widgets/tooltip.svg"), - i18n("Low color background image for tooltips")); - package->addFileDefinition("locolor/widgets/tooltip", QStringLiteral("locolor/widgets/tooltip.svgz"), - i18n("Low color background image for tooltips")); - - package->addFileDefinition("colors", QStringLiteral("colors"), i18n("KColorScheme configuration file")); - - QStringList mimetypes; - mimetypes << QStringLiteral("image/svg+xml"); - package->setDefaultMimeTypes(mimetypes); -} - -void ContainmentActionsPackage::initPackage(KPackage::Package *package) -{ - ChangeableMainScriptPackage::initPackage(package); - package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/containmentactions/")); -} - -} // namespace Plasma - diff --git a/src/plasma/theme.cpp b/src/plasma/theme.cpp index e4a9e1784..86ebdb324 100644 --- a/src/plasma/theme.cpp +++ b/src/plasma/theme.cpp @@ -42,7 +42,6 @@ #include #include -#include "private/packages_p.h" #include "debug_p.h" namespace Plasma diff --git a/src/plasmaquick/shellpluginloader.cpp b/src/plasmaquick/shellpluginloader.cpp index e660df9f4..3b3733614 100644 --- a/src/plasmaquick/shellpluginloader.cpp +++ b/src/plasmaquick/shellpluginloader.cpp @@ -19,58 +19,25 @@ #include "shellpluginloader.h" -#include "private/packages.h" - +#include #include -// when BC can be broken, these should become class members -static Plasma::PackageStructure *m_lnfPackage = 0; -static Plasma::PackageStructure *m_qmlPackage = 0; -static Plasma::PackageStructure *m_layoutPackage = 0; - ShellPluginLoader::ShellPluginLoader() : Plasma::PluginLoader()/*, when BC can be broken, these should become class members m_lnfPackage(0), m_qmlPackage(0), m_layoutPackage(0)*/ { + Q_ASSERT(false); } ShellPluginLoader::~ShellPluginLoader() { - delete m_lnfPackage; - m_lnfPackage = 0; - delete m_qmlPackage; - m_qmlPackage = 0; - delete m_layoutPackage; - m_layoutPackage = 0; } Plasma::Package ShellPluginLoader::internalLoadPackage(const QString &packageFormat, const QString &specialization) { - Q_UNUSED(specialization) - - if (packageFormat == QLatin1String("Plasma/LookAndFeel")) { - if (!m_lnfPackage) { - m_lnfPackage = new LookAndFeelPackage(); - } - - return Plasma::Package(m_lnfPackage); - } else if (packageFormat == QLatin1String("Plasma/Wallpaper")) { - if (!m_qmlPackage) { - m_qmlPackage = new QmlWallpaperPackage(); - } - - return Plasma::Package(m_qmlPackage); - } else if (packageFormat == QLatin1String("Plasma/LayoutTemplate")) { - if (!m_layoutPackage) { - m_layoutPackage = new LayoutTemplatePackage(); - } - - return Plasma::Package(m_layoutPackage); - } else { - return Plasma::Package(); - } + Q_ASSERT(false); } void ShellPluginLoader::init() diff --git a/src/plasmaquick/shellpluginloader.h b/src/plasmaquick/shellpluginloader.h index d7e8079a3..926719c29 100644 --- a/src/plasmaquick/shellpluginloader.h +++ b/src/plasmaquick/shellpluginloader.h @@ -24,7 +24,10 @@ #include -class PLASMAQUICK_EXPORT ShellPluginLoader : public Plasma::PluginLoader +/** + * @deprecated, don't use + */ +class PLASMAQUICK_DEPRECATED_EXPORT ShellPluginLoader : public Plasma::PluginLoader { public: ShellPluginLoader(); @@ -34,16 +37,6 @@ public: protected: Plasma::Package internalLoadPackage(const QString &packageFormat, const QString &specialization) Q_DECL_OVERRIDE; - -/** - These members are actually file-static in the .cpp because binary compat must be preserved - and there is no dptr! - -private: - Plasma::PackageStructure *m_lnfPackage; - Plasma::PackageStructure *m_qmlPackage; - Plasma::PackageStructure *m_layoutPackage; -**/ }; #endif