diff --git a/runners/kill/killrunner_config.h b/runners/kill/config_keys.h copy from runners/kill/killrunner_config.h copy to runners/kill/config_keys.h --- a/runners/kill/killrunner_config.h +++ b/runners/kill/config_keys.h @@ -1,59 +1,32 @@ /* Copyright 2009 + * Copyright 2020 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. - * + * * This library 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 * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public + * + * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ -#ifndef KILLRUNNERCONFIG_H -#define KILLRUNNERCONFIG_H +#ifndef KILLRUNNER_CONFIG_KEYS_H +#define KILLRUNNER_CONFIG_KEYS_H -//Project-Includes -#include "ui_killrunner_config.h" -//KDE-Includes -#include -//Qt static const char CONFIG_USE_TRIGGERWORD[] = "useTriggerWord"; static const char CONFIG_TRIGGERWORD[] = "triggerWord"; static const char CONFIG_SORTING[] = "sorting"; -class KillRunnerConfigForm : public QWidget, public Ui::KillRunnerConfigUi -{ - Q_OBJECT - -public: - explicit KillRunnerConfigForm(QWidget* parent); -}; - -class KillRunnerConfig : public KCModule -{ - Q_OBJECT - -public: - explicit KillRunnerConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); - - /** Possibilities to sort */ - enum Sort {NONE = 0, CPU, CPUI}; - -public Q_SLOTS: - void save() override; - void load() override; - void defaults() override; +/** Possibilities to sort */ +enum Sort {NONE = 0, CPU, CPUI}; -private: - KillRunnerConfigForm* m_ui; -}; #endif diff --git a/runners/kill/killrunner.h b/runners/kill/killrunner.h --- a/runners/kill/killrunner.h +++ b/runners/kill/killrunner.h @@ -25,7 +25,7 @@ #include -#include "killrunner_config.h" +#include "config_keys.h" class QAction; namespace KSysGuard @@ -61,7 +61,7 @@ QString m_triggerWord; /** How to sort */ - KillRunnerConfig::Sort m_sorting; + Sort m_sorting; /** process lister */ KSysGuard::Processes *m_processes; diff --git a/runners/kill/killrunner.cpp b/runners/kill/killrunner.cpp --- a/runners/kill/killrunner.cpp +++ b/runners/kill/killrunner.cpp @@ -26,12 +26,11 @@ #include #include #include +#include #include "processcore/processes.h" #include "processcore/process.h" -#include "killrunner_config.h" - K_EXPORT_PLASMA_RUNNER(kill, KillRunner) KillRunner::KillRunner(QObject *parent, const QVariantList& args) @@ -63,7 +62,7 @@ m_triggerWord = grp.readEntry(CONFIG_TRIGGERWORD, i18n("kill")) + QLatin1Char(' '); } - m_sorting = (KillRunnerConfig::Sort) grp.readEntry(CONFIG_SORTING, 0); + m_sorting = (Sort) grp.readEntry(CONFIG_SORTING, static_cast(Sort::NONE)); QList syntaxes; syntaxes << Plasma::RunnerSyntax(m_triggerWord + QStringLiteral(":q:"), i18n("Terminate running applications whose names match the query.")); @@ -147,13 +146,13 @@ // Set the relevance switch (m_sorting) { - case KillRunnerConfig::CPU: + case Sort::CPU: match.setRelevance((process->userUsage() + process->sysUsage()) / 100); break; - case KillRunnerConfig::CPUI: + case Sort::CPUI: match.setRelevance(1 - (process->userUsage() + process->sysUsage()) / 100); break; - case KillRunnerConfig::NONE: + case Sort::NONE: match.setRelevance(name.compare(term, Qt::CaseInsensitive) == 0 ? 1 : 9); break; } diff --git a/runners/kill/killrunner_config.h b/runners/kill/killrunner_config.h --- a/runners/kill/killrunner_config.h +++ b/runners/kill/killrunner_config.h @@ -26,10 +26,6 @@ #include //Qt -static const char CONFIG_USE_TRIGGERWORD[] = "useTriggerWord"; -static const char CONFIG_TRIGGERWORD[] = "triggerWord"; -static const char CONFIG_SORTING[] = "sorting"; - class KillRunnerConfigForm : public QWidget, public Ui::KillRunnerConfigUi { Q_OBJECT @@ -44,9 +40,6 @@ public: explicit KillRunnerConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); - - /** Possibilities to sort */ - enum Sort {NONE = 0, CPU, CPUI}; public Q_SLOTS: void save() override; diff --git a/runners/kill/killrunner_config.cpp b/runners/kill/killrunner_config.cpp --- a/runners/kill/killrunner_config.cpp +++ b/runners/kill/killrunner_config.cpp @@ -24,6 +24,7 @@ #include #include #include +#include "config_keys.h" K_PLUGIN_FACTORY(KillRunnerConfigFactory, registerPlugin(QStringLiteral("kcm_krunner_kill"));)