KDBusAddons

kdedmodule.h
1 /*
2  This file is part of the KDE libraries
3 
4  SPDX-FileCopyrightText: 2001 Waldo Bastian <[email protected]>
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 <[email protected]>
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 the module is being deleted.
71  */
72  void moduleDeleted(KDEDModule *);
73 
74  /**
75  * Emitted when a mainwindow registers itself.
76  */
77  void windowRegistered(qlonglong windowId);
78 
79  /**
80  * Emitted when a mainwindow unregisters itself.
81  */
82  void windowUnregistered(qlonglong windowId);
83 
84  /**
85  * Emitted after the module is registered successfully with D-Bus
86  *
87  * @since 4.2
88  */
89  void moduleRegistered(const QDBusObjectPath &path);
90 
91 private:
92  std::unique_ptr<KDEDModulePrivate> const d;
93 };
94 
95 #endif
Q_CLASSINFO(Name, Value)
Q_SIGNALSQ_SIGNALS
QString message
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Dec 11 2023 03:47:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.