Rework determining of scripted effect config
Currently the plugin needs to set a property in oder to be considered configurable. In kpackage we have the concept of optional and required files, based on the existence of those optional files we can define different behavior. For example in Plasma the applets can optionally have a config ui. Because here we don not use The KPackage:Package class, it is simpler to check the existence of the files on disk.
This commit is contained in:
parent
f2dd50e1f9
commit
a1340a9815
6 changed files with 5 additions and 13 deletions
|
@ -99,5 +99,4 @@ X-Plasma-API=javascript
|
|||
X-Plasma-MainScript=code/main.js
|
||||
X-KDE-PluginKeyword=kwin4_effect_frozenapp
|
||||
X-KDE-Library=kcm_kwin4_genericscripted
|
||||
X-KDE-ParentComponents=kwin4_effect_frozen
|
||||
X-KWin-Config-TranslationDomain=kwin_effects
|
||||
|
|
|
@ -169,5 +169,4 @@ X-Plasma-API=javascript
|
|||
X-Plasma-MainScript=code/main.js
|
||||
X-KDE-PluginKeyword=kwin4_effect_login
|
||||
X-KDE-Library=kcm_kwin4_genericscripted
|
||||
X-KDE-ParentComponents=kwin4_effect_login
|
||||
X-KWin-Config-TranslationDomain=kwin_effects
|
||||
|
|
|
@ -88,6 +88,5 @@ X-Plasma-API=javascript
|
|||
X-Plasma-MainScript=code/main.js
|
||||
X-KDE-PluginKeyword=kwin4_effect_scale
|
||||
X-KDE-Library=kcm_kwin4_genericscripted
|
||||
X-KDE-ParentComponents=kwin4_effect_scale
|
||||
X-KWin-Config-TranslationDomain=kwin_effects
|
||||
X-KWin-Exclusive-Category=toplevel-open-close-animation
|
||||
|
|
|
@ -167,5 +167,4 @@ X-Plasma-API=javascript
|
|||
X-Plasma-MainScript=code/main.js
|
||||
X-KDE-PluginKeyword=kwin4_effect_translucency
|
||||
X-KDE-Library=kcm_kwin4_genericscripted
|
||||
X-KDE-ParentComponents=kwin4_effect_translucency
|
||||
X-KWin-Config-TranslationDomain=kwin_effects
|
||||
|
|
|
@ -316,14 +316,11 @@ void EffectsModel::loadJavascriptEffects(const KConfigGroup &kwinConfig)
|
|||
|
||||
const QString pluginKeyword = plugin.value(QStringLiteral("X-KDE-PluginKeyword"));
|
||||
if (!pluginKeyword.isEmpty()) {
|
||||
// scripted effects have their pluginName() as the keyword
|
||||
const QStringList parentComponents = plugin.value(QStringLiteral("X-KDE-ParentComponents"), QStringList{});
|
||||
|
||||
if (parentComponents.isEmpty()) {
|
||||
effect.configurable = false;
|
||||
} else {
|
||||
effect.configurable = parentComponents.first() == pluginKeyword;
|
||||
}
|
||||
QDir package(QFileInfo(plugin.fileName()).dir());
|
||||
package.cd(QStringLiteral("contents"));
|
||||
const QString xmlFile = package.filePath(QStringLiteral("config/main.xml"));
|
||||
const QString uiFile =package.filePath(QStringLiteral("ui/config.ui"));
|
||||
effect.configurable = QFileInfo::exists(xmlFile) && QFileInfo::exists(uiFile);
|
||||
} else {
|
||||
effect.configurable = false;
|
||||
}
|
||||
|
|
|
@ -112,6 +112,5 @@ X-KDE-ServiceTypes=KWin/Script,KCModule
|
|||
|
||||
X-KDE-Library=kwin/effects/configs/kcm_kwin4_genericscripted
|
||||
X-KDE-PluginKeyword=videowall
|
||||
X-KDE-ParentComponents=videowall
|
||||
|
||||
Type=Service
|
||||
|
|
Loading…
Reference in a new issue