~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/runners/kill/killrunner.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2009  <Jan Gerrit Marker> <jangerrit@weiler-marker.com>
 
2
 *
 
3
 * This library is free software; you can redistribute it and/or
 
4
 * modify it under the terms of the GNU Lesser General Public
 
5
 * 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
 * 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
 * act as a proxy defined in Section 6 of version 3 of the license.
 
10
 * 
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 * 
 
16
 * You should have received a copy of the GNU Lesser General Public 
 
17
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#ifndef KILLRUNNER_H
 
21
#define KILLRUNNER_H
 
22
 
 
23
#include <QReadWriteLock>
 
24
#include <QTimer>
 
25
 
 
26
#include <Plasma/AbstractRunner>
 
27
 
 
28
#include "killrunner_config.h"
 
29
class QAction;
 
30
 
 
31
namespace KSysGuard
 
32
{
 
33
    class Processes;
 
34
    class Process;
 
35
}
 
36
 
 
37
class KillRunner : public Plasma::AbstractRunner
 
38
{
 
39
    Q_OBJECT
 
40
 
 
41
public:
 
42
    KillRunner(QObject *parent, const QVariantList& args);
 
43
    ~KillRunner();
 
44
 
 
45
    void match(Plasma::RunnerContext &context);
 
46
    void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match);
 
47
    QList<QAction*> actionsForMatch(const Plasma::QueryMatch &match);
 
48
    void reloadConfiguration();
 
49
 
 
50
private Q_SLOTS:
 
51
    void prep();
 
52
    void cleanup();
 
53
 
 
54
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 */
 
61
    QString m_triggerWord;
 
62
 
 
63
    /** How to sort */
 
64
    KillRunnerConfig::Sort m_sorting;
 
65
 
 
66
    /** process lister */
 
67
    KSysGuard::Processes *m_processes;
 
68
 
 
69
    /** lock for initializing m_processes */
 
70
    QReadWriteLock m_prepLock;
 
71
 
 
72
    /** timer for retrying the cleanup due to lock contention */
 
73
    QTimer m_delayedCleanupTimer;
 
74
};
 
75
K_EXPORT_PLASMA_RUNNER(kill, KillRunner)
 
76
 
 
77
#endif