File indexing completed on 2024-04-21 03:53:54
0001 /* 0002 This file is part of the KDE libraries 0003 0004 SPDX-FileCopyrightText: 2001 Waldo Bastian <bastian@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 0008 */ 0009 #ifndef __KDEDMODULE_H__ 0010 #define __KDEDMODULE_H__ 0011 0012 #include <kdbusaddons_export.h> 0013 0014 #include <QObject> 0015 #include <memory> 0016 0017 class KDEDModulePrivate; 0018 class Kded; 0019 0020 class QDBusObjectPath; 0021 class QDBusMessage; 0022 0023 /** 0024 * \class KDEDModule kdedmodule.h <KDEDModule> 0025 * 0026 * The base class for KDED modules. 0027 * 0028 * KDED modules are constructed as shared libraries that are loaded on-demand 0029 * into the kded daemon at runtime. 0030 * 0031 * See https://invent.kde.org/frameworks/kded/-/blob/master/docs/HOWTO 0032 * for documentation about writing kded modules. 0033 * 0034 * @author Waldo Bastian <bastian@kde.org> 0035 */ 0036 class KDBUSADDONS_EXPORT KDEDModule : public QObject 0037 { 0038 Q_OBJECT 0039 Q_CLASSINFO("D-Bus Interface", "org.kde.KDEDModule") 0040 0041 friend class Kded; 0042 0043 public: 0044 /** 0045 * Constructor 0046 */ 0047 explicit KDEDModule(QObject *parent = nullptr); 0048 0049 ~KDEDModule() override; 0050 0051 /** 0052 * Sets the name of the module, and uses it to register the module to D-Bus. 0053 * 0054 * For modules loaded as plugins by a daemon, this is called automatically 0055 * by the daemon after loading the module. Module authors should NOT call this. 0056 */ 0057 void setModuleName(const QString &name); 0058 0059 QString moduleName() const; 0060 0061 /** 0062 * Returns the module being called by this D-Bus message. 0063 * Useful for autoloading modules in kded and similar daemons. 0064 * @since 5.7 0065 */ 0066 static QString moduleForMessage(const QDBusMessage &message); 0067 0068 Q_SIGNALS: 0069 /** 0070 * Emitted when a mainwindow registers itself. 0071 */ 0072 void windowRegistered(qlonglong windowId); 0073 0074 /** 0075 * Emitted when a mainwindow unregisters itself. 0076 */ 0077 void windowUnregistered(qlonglong windowId); 0078 0079 /** 0080 * Emitted after the module is registered successfully with D-Bus 0081 * 0082 * @since 4.2 0083 */ 0084 void moduleRegistered(const QDBusObjectPath &path); 0085 0086 private: 0087 std::unique_ptr<KDEDModulePrivate> const d; 0088 }; 0089 0090 #endif