Summary: migrate the enabled runners from enabledCategories to the more classic [Plugins] group the krunner framework supports both, so as long the enabledCategories entry isn't there, it will work correctly with the other config format Test Plan: ran on an existing krunnerrc with different sets of categories enabled, tested krunner and its kcm with it, all expected runner plugins were used both in the kcm and while searching with krunner Reviewers: #plasma, davidedmundson Reviewed By: #plasma, davidedmundson Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D2873wilder-5.14
parent
9216223782
commit
ad9eda5d49
4 changed files with 84 additions and 0 deletions
@ -0,0 +1,12 @@ |
||||
set(krunnerplugins_SRCS |
||||
main.cpp |
||||
) |
||||
|
||||
add_executable(krunnerplugins ${krunnerplugins_SRCS}) |
||||
|
||||
target_link_libraries(krunnerplugins KF5::CoreAddons KF5::Service KF5::Runner KF5::ConfigCore) |
||||
|
||||
install(TARGETS krunnerplugins DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/) |
||||
install(FILES krunnerplugins.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR}) |
||||
|
||||
|
||||
@ -0,0 +1,3 @@ |
||||
Version=5 |
||||
Id=5.9KRunnerPlugins |
||||
Script=krunnerplugins |
||||
@ -0,0 +1,67 @@ |
||||
/***************************************************************************
|
||||
* Copyright (C) 2016 by Marco Martin <mart@kde.org> * |
||||
* * |
||||
* This program is free software; you can redistribute it and/or modify * |
||||
* it under the terms of the GNU General Public License as published by * |
||||
* the Free Software Foundation; either version 2 of the License, or * |
||||
* (at your option) any later version. * |
||||
* * |
||||
* This program 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 General Public License for more details. * |
||||
* * |
||||
* You should have received a copy of the GNU General Public License * |
||||
* along with this program; if not, write to the * |
||||
* Free Software Foundation, Inc., * |
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * |
||||
***************************************************************************/ |
||||
|
||||
#include <QCoreApplication> |
||||
#include <QStandardPaths> |
||||
#include <QDebug> |
||||
#include <QFile> |
||||
#include <QDir> |
||||
|
||||
#include <KSharedConfig> |
||||
#include <KConfigGroup> |
||||
#include <kconfig.h> |
||||
#include <KPluginInfo> |
||||
#include <krunner/runnermanager.h> |
||||
|
||||
void migrateEnabledPlugins() |
||||
{ |
||||
KSharedConfig::Ptr config = KSharedConfig::openConfig("krunnerrc"); |
||||
KConfigGroup runnerManagerGroup(config, "PlasmaRunnerManager"); |
||||
KConfigGroup pluginsGroup(config, "Plugins"); |
||||
|
||||
QStringList enabledCategories = runnerManagerGroup.readEntry("enabledCategories", QStringList()); |
||||
|
||||
if (enabledCategories.isEmpty()) { |
||||
return; |
||||
} |
||||
|
||||
Plasma::RunnerManager *manager = new Plasma::RunnerManager(); |
||||
manager->reloadConfiguration(); |
||||
for (Plasma::AbstractRunner *runner : manager->runners()) { |
||||
pluginsGroup.writeEntry(runner->metadata().pluginName() + QStringLiteral("Enabled"), false); |
||||
for (auto category : runner->categories()) { |
||||
if (enabledCategories.contains(category)) { |
||||
pluginsGroup.writeEntry(runner->metadata().pluginName() + QStringLiteral("Enabled"), true); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
runnerManagerGroup.deleteEntry("enabledCategories"); |
||||
} |
||||
|
||||
int main(int argc, char **argv) |
||||
{ |
||||
|
||||
QCoreApplication app(argc, argv); |
||||
|
||||
migrateEnabledPlugins(); |
||||
|
||||
return 0; |
||||
} |
||||
Loading…
Reference in new issue