Commit 04e60d7e authored by Alexander Lohnau's avatar Alexander Lohnau 💬

Launch plugin with argument, change signals

Summary:
The kcms/runners plugin is now able to launch a specific plugin using the --arg parameter of kcmshell5 and the deprecated signals have been changed.
And the QLatin1String has been replaced by the QStringLiteral Macro, because the open config method does not have an overload with the QLatin1String class.

Test Plan: You can just type "kcmshell5 plasmasearch --args Dictionary" and additionally to the KRunner configs it should open the plugin config

Reviewers: broulik, mart

Reviewed By: mart

Subscribers: apol, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26738
parent 9f57c39b
......@@ -53,6 +53,10 @@ SearchConfigModule::SearchConfigModule(QWidget* parent, const QVariantList& args
setAboutData(about);
setButtons(Apply | Default);
if(!args.at(0).toString().isEmpty()) {
m_pluginID = args.at(0).toString();
}
QVBoxLayout* layout = new QVBoxLayout(this);
QHBoxLayout *headerLayout = new QHBoxLayout(this);
......@@ -74,15 +78,11 @@ SearchConfigModule::SearchConfigModule(QWidget* parent, const QVariantList& args
m_pluginSelector = new KPluginSelector(this);
auto markAsChanged = [this] {
emit changed();
};
connect(m_pluginSelector, &KPluginSelector::changed, this, markAsChanged);
connect(m_pluginSelector, &KPluginSelector::configCommitted, this, markAsChanged);
connect(m_pluginSelector, &KPluginSelector::changed, this, &SearchConfigModule::markAsChanged);
connect(m_pluginSelector, &KPluginSelector::configCommitted, this, &SearchConfigModule::markAsChanged);
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 67, 0)
connect(m_pluginSelector, &KPluginSelector::defaulted,
this, &KCModule::defaulted);
connect(m_pluginSelector, &KPluginSelector::defaulted, this, &KCModule::defaulted);
#endif
layout->addLayout(headerLayout);
......@@ -100,8 +100,12 @@ void SearchConfigModule::load()
m_pluginSelector->addPlugins(Plasma::RunnerManager::listRunnerInfo(),
KPluginSelector::ReadConfigFile,
i18n("Available Plugins"), QString(),
KSharedConfig::openConfig(QLatin1String( "krunnerrc" )));
KSharedConfig::openConfig(QStringLiteral( "krunnerrc" )));
m_pluginSelector->load();
if(!m_pluginID.isEmpty()){
m_pluginSelector->showConfiguration(m_pluginID);
}
}
......
......@@ -46,6 +46,7 @@ public Q_SLOTS:
private:
KPluginSelector *m_pluginSelector;
KConfig m_config;
QString m_pluginID;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment