| 871 | } |
| 872 | |
| 873 | void PluginController::resetToDefaults() |
| 874 | { |
| 875 | Q_D(PluginController); |
| 876 | |
| 877 | KSharedConfigPtr cfg = Core::self()->activeSession()->config(); |
| 878 | cfg->deleteGroup( KEY_Plugins() ); |
| 879 | cfg->sync(); |
| 880 | KConfigGroup grp = cfg->group( KEY_Plugins() ); |
| 881 | QStringList plugins = ShellExtension::getInstance()->defaultPlugins(); |
| 882 | if( plugins.isEmpty() ) |
| 883 | { |
| 884 | for (const KPluginMetaData& info : std::as_const(d->plugins)) { |
| 885 | if (!isUserSelectable(info)) { |
| 886 | continue; |
| 887 | } |
| 888 | |
| 889 | QJsonValue enabledByDefault = info.rawData()[KEY_KPlugin()].toObject()[KEY_EnabledByDefault()]; |
| 890 | // plugins enabled until explicitly specified otherwise |
| 891 | if (enabledByDefault.isNull() || enabledByDefault.toBool()) { |
| 892 | plugins << info.pluginId(); |
| 893 | } |
| 894 | } |
| 895 | } |
| 896 | for (const QString& s : std::as_const(plugins)) { |
| 897 | grp.writeEntry(s + KEY_Suffix_Enabled(), true); |
| 898 | } |
| 899 | grp.sync(); |
| 900 | } |
| 901 | |
| 902 | } |
| 903 |
no test coverage detected