Changeset View
Changeset View
Standalone View
Standalone View
runners/kill/killrunner.h
1 | /* Copyright 2009 <Jan Gerrit Marker> <jangerrit@weiler-marker.com> | 1 | /* Copyright 2009 <Jan Gerrit Marker> <jangerrit@weiler-marker.com> | ||
---|---|---|---|---|---|
2 | * Copyright 2020 <Alexander Lohnau> <alexander.lohnau@gmx.de> | ||||
2 | * | 3 | * | ||
3 | * This library is free software; you can redistribute it and/or | 4 | * This library is free software; you can redistribute it and/or | ||
4 | * modify it under the terms of the GNU Lesser General Public | 5 | * modify it under the terms of the GNU Lesser General Public | ||
5 | * License as published by the Free Software Foundation; either | 6 | * License as published by the Free Software Foundation; either | ||
6 | * version 2.1 of the License, or (at your option) version 3, or any | 7 | * version 2.1 of the License, or (at your option) version 3, or any | ||
7 | * later version accepted by the membership of KDE e.V. (or its | 8 | * later version accepted by the membership of KDE e.V. (or its | ||
8 | * successor approved by the membership of KDE e.V.), which shall | 9 | * successor approved by the membership of KDE e.V.), which shall | ||
9 | * act as a proxy defined in Section 6 of version 3 of the license. | 10 | * act as a proxy defined in Section 6 of version 3 of the license. | ||
Show All 24 Lines | 33 | { | |||
34 | class Process; | 35 | class Process; | ||
35 | } | 36 | } | ||
36 | 37 | | |||
37 | class KillRunner : public Plasma::AbstractRunner | 38 | class KillRunner : public Plasma::AbstractRunner | ||
38 | { | 39 | { | ||
39 | Q_OBJECT | 40 | Q_OBJECT | ||
40 | 41 | | |||
41 | public: | 42 | public: | ||
42 | KillRunner(QObject *parent, const QVariantList& args); | 43 | KillRunner(QObject *parent, const QVariantList &args); | ||
43 | ~KillRunner() override; | 44 | ~KillRunner() override; | ||
44 | 45 | | |||
45 | void match(Plasma::RunnerContext &context) override; | 46 | void match(Plasma::RunnerContext &context) override; | ||
46 | void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) override; | 47 | void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) override; | ||
47 | QList<QAction*> actionsForMatch(const Plasma::QueryMatch &match) override; | 48 | QList<QAction*> actionsForMatch(const Plasma::QueryMatch &match) override; | ||
48 | void reloadConfiguration() override; | 49 | void reloadConfiguration() override; | ||
49 | 50 | | |||
50 | private Q_SLOTS: | 51 | private Q_SLOTS: | ||
51 | void prep(); | 52 | void prep(); | ||
52 | void cleanup(); | 53 | void cleanup(); | ||
53 | 54 | | |||
54 | private: | 55 | private: | ||
55 | /** @param uid the uid of the user | | |||
56 | * @return the username of the user with the UID uid | | |||
57 | */ | | |||
58 | QString getUserName(qlonglong uid); | | |||
59 | | ||||
60 | /** The trigger word */ | 56 | /** The trigger word */ | ||
61 | QString m_triggerWord; | 57 | QString m_triggerWord; | ||
62 | 58 | | |||
63 | /** How to sort */ | 59 | /** How to sort */ | ||
64 | Sort m_sorting; | 60 | Sort m_sorting; | ||
65 | 61 | | |||
66 | /** process lister */ | 62 | /** process lister */ | ||
67 | KSysGuard::Processes *m_processes; | 63 | KSysGuard::Processes *m_processes; | ||
68 | 64 | | |||
69 | /** lock for initializing m_processes */ | 65 | /** lock for initializing m_processes */ | ||
70 | QReadWriteLock m_prepLock; | 66 | QReadWriteLock m_prepLock; | ||
71 | 67 | | |||
72 | /** timer for retrying the cleanup due to lock contention */ | 68 | /** timer for retrying the cleanup due to lock contention */ | ||
73 | QTimer m_delayedCleanupTimer; | 69 | QTimer m_delayedCleanupTimer; | ||
70 | | ||||
71 | /** Reuse actions */ | ||||
72 | QList<QAction *> m_actionList; | ||||
73 | | ||||
74 | /** Reuse value */ | ||||
75 | bool m_hasTrigger; | ||||
74 | }; | 76 | }; | ||
75 | 77 | | |||
76 | #endif | 78 | #endif |