diff --git a/src/plasma/packagestructure/plasmathemepackage.cpp b/src/plasma/packagestructure/plasmathemepackage.cpp index 94f0c5ce5..8c554a0d0 100644 --- a/src/plasma/packagestructure/plasmathemepackage.cpp +++ b/src/plasma/packagestructure/plasmathemepackage.cpp @@ -22,6 +22,7 @@ #include #include #include +#include "config-plasma.h" class ThemePackage : public KPackage::PackageStructure { @@ -34,6 +35,7 @@ public: // by default the packages have "contents/" as contentsPrefixPaths // but for the themes we don't want that, so unset it. package->setContentsPrefixPaths(QStringList()); + package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/")); package->addDirectoryDefinition("dialogs", QStringLiteral("dialogs/"), i18n("Images for dialogs")); package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svg"), diff --git a/src/plasmapkg/main.cpp b/src/plasmapkg/main.cpp index b61b2e572..b1d4d517b 100644 --- a/src/plasmapkg/main.cpp +++ b/src/plasmapkg/main.cpp @@ -23,13 +23,70 @@ #include #include +#include + +QString typeFromLegacy(const QString &type) +{ + if (type == QStringLiteral("plasmoid")) { + return QStringLiteral("Plasma/Applet"); + } else if (type == QStringLiteral("package")) { + return QStringLiteral("Plasma/Generic"); + } else if (type == QStringLiteral("theme")) { + return QStringLiteral("Plasma/Theme"); + } else if (type == QStringLiteral("wallpaper")) { + return QStringLiteral("Plasma/ImageWallpaper"); + } else if (type == QStringLiteral("dataengine")) { + return QStringLiteral("Plasma/DataEngine"); + } else if (type == QStringLiteral("runner")) { + return QStringLiteral("Plasma/Runner"); + } else if (type == QStringLiteral("wallpaperplugin")) { + return QStringLiteral("Plasma/Wallpaper"); + } else if (type == QStringLiteral("lookandfeel")) { + return QStringLiteral("Plasma/LookAndFeel"); + } else if (type == QStringLiteral("shell")) { + return QStringLiteral("Plasma/Shell"); + } else if (type == QStringLiteral("layout-template")) { + return QStringLiteral("Plasma/LayoutTemplate"); + } else if (type == QStringLiteral("kwineffect")) { + return QStringLiteral("KWin/Effect"); + } else if (type == QStringLiteral("windowswitcher")) { + return QStringLiteral("KWin/WindowSwitcher"); + } else if (type == QStringLiteral("kwinscript")) { + return QStringLiteral("KWin/Script"); + } else { + return type; + } +} int main(int argc, char **argv) { QCoreApplication app(argc, argv); + + QStringList params = app.arguments().mid(1); + + //plasmapkg2 had some hardcoded types, kpackagetool5 requires the servicetype passed as the type parameter + //convert between the two + //user passed -t typeName + int typeIndex = params.indexOf(QStringLiteral("-t")); + if (typeIndex > -1 && params.length() > typeIndex + 1) { + params[typeIndex + 1] = typeFromLegacy(params.value(typeIndex + 1)); + } else { + //user passed --type typeName + typeIndex = params.indexOf(QStringLiteral("--type")); + if (typeIndex > -1 && params.length() > typeIndex + 1) { + params[typeIndex + 1] = typeFromLegacy(params.value(typeIndex + 1)); + } else { + //user passed --type=typeName + typeIndex = params.indexOf(QRegularExpression("--type=.*")); + if (typeIndex > -1) { + params[typeIndex] = QStringLiteral("--type=") + typeFromLegacy(params.value(typeIndex).replace(QStringLiteral("--type="), QString())); + } + } + } + QProcess p; p.setProcessChannelMode(QProcess::ForwardedChannels); - p.start("kpackagetool5", app.arguments().mid(1)); + p.start(QLatin1String("kpackagetool5"), params); p.waitForFinished(); return p.exitCode();