File indexing completed on 2024-05-12 05:38:19

0001 /*
0002     SPDX-FileCopyrightText: 2009 Jan Gerrit Marker <jangerrit@weiler-marker.com>
0003     SPDX-FileCopyrightText: 2020 Alexander Lohnau <alexander.lohnau@gmx.de>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #pragma once
0009 
0010 #include <KRunner/AbstractRunner>
0011 #include <KRunner/Action>
0012 
0013 #include "config_keys.h"
0014 
0015 namespace KSysGuard
0016 {
0017 class Processes;
0018 class Process;
0019 }
0020 
0021 class KillRunner : public KRunner::AbstractRunner
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     KillRunner(QObject *parent, const KPluginMetaData &metaData);
0027 
0028     void match(KRunner::RunnerContext &context) override;
0029     void run(const KRunner::RunnerContext &context, const KRunner::QueryMatch &match) override;
0030     void reloadConfiguration() override;
0031 
0032 private:
0033     const KRunner::Actions m_actionList;
0034     QString m_triggerWord;
0035     bool m_hasTrigger = false;
0036 
0037     // process lister
0038     KSysGuard::Processes *const m_processes;
0039     Sort m_sorting;
0040 
0041     // If the process list needs to be refreshed when matching. This is only done once the trigger word (if set) is used
0042     bool m_needsRefresh;
0043 };