1 | /* |
2 | This file is part of the KDE libraries |
3 | |
4 | SPDX-FileCopyrightText: 2001 Waldo Bastian <bastian@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | |
8 | */ |
9 | #ifndef __KDEDMODULE_H__ |
10 | #define __KDEDMODULE_H__ |
11 | |
12 | #include <kdbusaddons_export.h> |
13 | |
14 | #include <QObject> |
15 | #include <memory> |
16 | |
17 | class KDEDModulePrivate; |
18 | class Kded; |
19 | |
20 | class QDBusObjectPath; |
21 | class QDBusMessage; |
22 | |
23 | /** |
24 | * \class KDEDModule kdedmodule.h <KDEDModule> |
25 | * |
26 | * The base class for KDED modules. |
27 | * |
28 | * KDED modules are constructed as shared libraries that are loaded on-demand |
29 | * into the kded daemon at runtime. |
30 | * |
31 | * See https://invent.kde.org/frameworks/kded/-/blob/master/docs/HOWTO |
32 | * for documentation about writing kded modules. |
33 | * |
34 | * @author Waldo Bastian <bastian@kde.org> |
35 | */ |
36 | class KDBUSADDONS_EXPORT KDEDModule : public QObject |
37 | { |
38 | Q_OBJECT |
39 | Q_CLASSINFO("D-Bus Interface" , "org.kde.KDEDModule" ) |
40 | |
41 | friend class Kded; |
42 | |
43 | public: |
44 | /** |
45 | * Constructor |
46 | */ |
47 | explicit KDEDModule(QObject *parent = nullptr); |
48 | |
49 | ~KDEDModule() override; |
50 | |
51 | /** |
52 | * Sets the name of the module, and uses it to register the module to D-Bus. |
53 | * |
54 | * For modules loaded as plugins by a daemon, this is called automatically |
55 | * by the daemon after loading the module. Module authors should NOT call this. |
56 | */ |
57 | void setModuleName(const QString &name); |
58 | |
59 | QString moduleName() const; |
60 | |
61 | /** |
62 | * Returns the module being called by this D-Bus message. |
63 | * Useful for autoloading modules in kded and similar daemons. |
64 | * @since 5.7 |
65 | */ |
66 | static QString moduleForMessage(const QDBusMessage &message); |
67 | |
68 | Q_SIGNALS: |
69 | /** |
70 | * Emitted when a mainwindow registers itself. |
71 | */ |
72 | void windowRegistered(qlonglong windowId); |
73 | |
74 | /** |
75 | * Emitted when a mainwindow unregisters itself. |
76 | */ |
77 | void windowUnregistered(qlonglong windowId); |
78 | |
79 | /** |
80 | * Emitted after the module is registered successfully with D-Bus |
81 | * |
82 | * @since 4.2 |
83 | */ |
84 | void moduleRegistered(const QDBusObjectPath &path); |
85 | |
86 | private: |
87 | std::unique_ptr<KDEDModulePrivate> const d; |
88 | }; |
89 | |
90 | #endif |
91 | |