Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpadx/src/applet/touchpadservice.cpp
- 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 | #include "touchpadservice.h" | ||||
19 | | ||||
20 | #include <Plasma/ServiceJob> | ||||
21 | | ||||
22 | #include "touchpadinterface.h" | ||||
23 | | ||||
24 | TouchpadService::TouchpadService(OrgKdeTouchpadInterface *daemon, | ||||
25 | const QString &destination, | ||||
26 | QObject *parent) | ||||
27 | : Plasma::Service(parent), m_daemon(daemon), m_destination(destination) | ||||
28 | { | ||||
29 | setName("touchpad"); | ||||
30 | } | ||||
31 | | ||||
32 | TouchpadService::~TouchpadService() | ||||
33 | { | ||||
34 | } | ||||
35 | | ||||
36 | class TouchpadJob : public Plasma::ServiceJob | ||||
37 | { | ||||
38 | public: | ||||
39 | TouchpadJob(OrgKdeTouchpadInterface *daemon, | ||||
40 | const QString &destination, const QString &operation, | ||||
41 | const QMap<QString, QVariant> ¶meters, QObject *parent = 0) | ||||
42 | : Plasma::ServiceJob(destination, operation, parameters, parent), | ||||
43 | m_daemon(daemon) | ||||
44 | { | ||||
45 | } | ||||
46 | | ||||
47 | void start() override | ||||
48 | { | ||||
49 | if (m_daemon) { | ||||
50 | QMetaObject::invokeMethod(m_daemon, operationName().toLatin1()); | ||||
51 | } | ||||
52 | emitResult(); | ||||
53 | } | ||||
54 | | ||||
55 | private: | ||||
56 | OrgKdeTouchpadInterface *m_daemon; | ||||
57 | }; | ||||
58 | | ||||
59 | Plasma::ServiceJob *TouchpadService::createJob(const QString &operation, | ||||
60 | QMap<QString, QVariant> ¶ms) | ||||
61 | { | ||||
62 | return new TouchpadJob(m_daemon, m_destination, operation, params, this); | ||||
63 | } |