1 /* BEGIN_COMMON_COPYRIGHT_HEADER
2  * (c)LGPL2+
3  *
4  * LXQt - a lightweight, Qt based, desktop toolset
5  * https://lxqt.org
6  *
7  * Copyright: 2013 Razor team
8  * Authors:
9  *   Kuzma Shapran <kuzma.shapran@gmail.com>
10  *
11  * This program or library is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20 
21  * You should have received a copy of the GNU Lesser General
22  * Public License along with this library; if not, write to the
23  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24  * Boston, MA 02110-1301 USA
25  *
26  * END_COMMON_COPYRIGHT_HEADER */
27 
28 #ifndef GLOBAL_ACTION_DAEMON__DBUS_ACTION__INCLUDED
29 #define GLOBAL_ACTION_DAEMON__DBUS_ACTION__INCLUDED
30 
31 
32 #include "base_action.h"
33 
34 #include <QString>
35 #include <QDBusObjectPath>
36 #include <QDBusConnection>
37 
38 
39 class ClientProxy;
40 
41 class ClientAction : public BaseAction
42 {
43 public:
44     ClientAction(LogTarget *logTarget, const QDBusObjectPath &path, const QString &description);
45     ClientAction(LogTarget *logTarget, const QDBusConnection &connection, const QString &service, const QDBusObjectPath &path, const QString &description);
46     ~ClientAction() override;
47 
id()48     static const char *id() { return "client"; }
49 
type()50     const char *type() const override { return id(); }
51 
52     bool call() override;
53 
54     void shortcutChanged(const QString &oldShortcut, const QString &newShortcut);
55 
service()56     const QString &service() const { return mService; }
path()57     const QDBusObjectPath &path() const { return mPath; }
58 
59     void appeared(const QDBusConnection &connection, const QString &service);
60     void disappeared();
61 
isPresent()62     bool isPresent() const { return mProxy; }
63 
64 private:
65     ClientProxy *mProxy;
66 
67     QString mService;
68     QDBusObjectPath mPath;
69 };
70 
71 #endif // GLOBAL_ACTION_DAEMON__DBUS_ACTION__INCLUDED
72