Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpadx/src/kded/kded.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2013 Alexander Mezin <mezin.alexander@gmail.com> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU General Public License as published by | ||||
6 | * the Free Software Foundation; either version 2 of the License, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU General Public License | ||||
15 | * along with this program; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
17 | */ | ||||
18 | | ||||
19 | #ifndef KDED_H | ||||
20 | #define KDED_H | ||||
21 | | ||||
22 | #include <QVariantList> | ||||
23 | #include <QTimer> | ||||
24 | #include <QDBusServiceWatcher> | ||||
25 | #include <QDBusPendingCallWatcher> | ||||
26 | | ||||
27 | #include <KDEDModule> | ||||
28 | | ||||
29 | #include "touchpadbackend.h" | ||||
30 | #include "kdedsettings.h" | ||||
31 | | ||||
32 | class TouchpadDisabler : public KDEDModule | ||||
33 | { | ||||
34 | Q_OBJECT | ||||
35 | Q_CLASSINFO("D-Bus Interface", "org.kde.touchpad") | ||||
36 | | ||||
37 | public: | ||||
38 | TouchpadDisabler(QObject *, const QVariantList &); | ||||
39 | | ||||
40 | Q_SIGNALS: | ||||
41 | Q_SCRIPTABLE void enabledChanged(bool); | ||||
42 | Q_SCRIPTABLE void mousePluggedInChanged(bool); | ||||
43 | Q_SCRIPTABLE void workingTouchpadFoundChanged(bool); | ||||
44 | | ||||
45 | public Q_SLOTS: | ||||
46 | Q_SCRIPTABLE Q_NOREPLY void reloadSettings(); | ||||
47 | Q_SCRIPTABLE Q_NOREPLY void toggle(); | ||||
48 | Q_SCRIPTABLE Q_NOREPLY void disable(); | ||||
49 | Q_SCRIPTABLE Q_NOREPLY void enable(); | ||||
50 | Q_SCRIPTABLE bool isEnabled() const; | ||||
51 | Q_SCRIPTABLE bool workingTouchpadFound() const; | ||||
52 | Q_SCRIPTABLE bool isMousePluggedIn() const; | ||||
53 | | ||||
54 | private Q_SLOTS: | ||||
55 | void keyboardActivityStarted(); | ||||
56 | void keyboardActivityFinished(); | ||||
57 | void timerElapsed(); | ||||
58 | void mousePlugged(); | ||||
59 | void updateCurrentState(); | ||||
60 | void serviceRegistered(const QString &); | ||||
61 | void handleReset(); | ||||
62 | void serviceNameFetchFinished(QDBusPendingCallWatcher *); | ||||
63 | void onPrepareForSleep(bool sleep); | ||||
64 | | ||||
65 | private: | ||||
66 | void showNotification(const QString &name, const QString &text); | ||||
67 | void lateInit(); | ||||
68 | void updateWorkingTouchpadFound(); | ||||
69 | void showOsd(); | ||||
70 | | ||||
71 | TouchpadBackend *m_backend; | ||||
72 | TouchpadDisablerSettings m_settings; | ||||
73 | QTimer m_keyboardActivityTimeout; | ||||
74 | QDBusServiceWatcher m_dependecies; | ||||
75 | | ||||
76 | TouchpadBackend::TouchpadOffState m_keyboardDisableState; | ||||
77 | bool m_userRequestedState, m_touchpadEnabled; | ||||
78 | bool m_workingTouchpadFound; | ||||
79 | bool m_keyboardActivity, m_mouse; | ||||
80 | | ||||
81 | bool m_preparingForSleep = false; | ||||
82 | }; | ||||
83 | | ||||
84 | #endif // KDED_H |