1/*
2 * Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License version 2 as
6 * published by the Free Software Foundation
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
12 *
13 * You should have received a copy of the GNU Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef KRUNNERAPP_H
20#define KRUNNERAPP_H
21
22#include <kuniqueapplication.h>
23
24class KActionCollection;
25class KDialog;
26
27namespace Plasma
28{
29 class RunnerManager;
30}
31
32class KRunnerDialog;
33class KSystemActivityDialog;
34class StartupId;
35
36class KRunnerApp : public KUniqueApplication
37{
38 Q_OBJECT
39 Q_CLASSINFO("D-Bus Interface", "org.kde.krunner.App")
40
41public:
42 static KRunnerApp* self();
43 ~KRunnerApp();
44
45 // The action collection of the active widget
46 KActionCollection* actionCollection();
47
48 virtual int newInstance();
49
50public Q_SLOTS:
51 // DBUS interface. if you change these methods, you MUST run:
52 // qdbuscpp2xml -m krunnerapp.h -o dbus/org.kde.krunner.App.xml
53 Q_SCRIPTABLE void initializeStartupNotification();
54
55 /** Show taskmanager */
56 Q_SCRIPTABLE void showTaskManager();
57 /** Show taskmanager, filtering by the given string */
58 Q_SCRIPTABLE void showTaskManagerWithFilter(const QString &filterText);
59
60 /** Display the interface */
61 Q_SCRIPTABLE void display();
62
63 /** Enter single runner query mode **/
64 Q_SCRIPTABLE void displaySingleRunner(const QString& runnerName);
65
66 /** Display the interface, using clipboard contents */
67 Q_SCRIPTABLE void displayWithClipboardContents();
68
69 /** Display the interface */
70 Q_SCRIPTABLE void query(const QString& term);
71
72 /** Enter single runner query mode **/
73 Q_SCRIPTABLE void querySingleRunner(const QString& runnerName, const QString &term);
74
75 /** Switch user */
76 Q_SCRIPTABLE void switchUser();
77
78 /** Clear the search history */
79 Q_SCRIPTABLE void clearHistory();
80
81 Q_SCRIPTABLE QStringList singleModeAdvertisedRunnerIds() const;
82
83private slots:
84 /**
85 * Called when the task dialog emits its finished() signal
86 */
87 void taskDialogFinished();
88 void reloadConfig();
89 void cleanUp();
90 void displayOrHide();
91 void singleRunnerModeActionTriggered();
92
93private:
94 KRunnerApp();
95 void initialize();
96
97 Plasma::RunnerManager *m_runnerManager;
98 KActionCollection *m_actionCollection;
99 KRunnerDialog *m_interface;
100 KSystemActivityDialog *m_tasks;
101 StartupId *m_startupId;
102 bool m_firstTime;
103};
104
105#endif /* KRUNNERAPP_H */
106
107