allow applets specify a different root than pluginname

introduce X-Plasma-RootPath: it would be used instead of
the plugin name for package root path if present
This commit is contained in:
Marco Martin 2014-08-07 16:26:51 +02:00
parent 419d97cfe0
commit 2482eb193c
2 changed files with 7 additions and 1 deletions

View File

@ -38,6 +38,9 @@ Comment[zh_TW]=Plasma 小程式
[PropertyDef::X-Plasma-API] [PropertyDef::X-Plasma-API]
Type=QString Type=QString
[PropertyDef::X-Plasma-RootPath]
Type=QString
[PropertyDef::X-Plasma-DropMimeTypes] [PropertyDef::X-Plasma-DropMimeTypes]
Type=QStringList Type=QStringList

View File

@ -132,7 +132,10 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
return; return;
} }
const QString path = packagePath.isEmpty() ? appletDescription.pluginName() : packagePath; QString path = appletDescription.property("X-Plasma-RootPath").toString();
if (path.isEmpty()) {
path = packagePath.isEmpty() ? appletDescription.pluginName() : packagePath;
}
package = new Package(PluginLoader::self()->loadPackage("Plasma/Applet", api)); package = new Package(PluginLoader::self()->loadPackage("Plasma/Applet", api));
package->setPath(path); package->setPath(path);