kdecore: replace component with class headers inclusion

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-19 07:02:09 +03:00
parent 687fcc041c
commit 059c365fee

View file

@ -24,10 +24,9 @@
#include "kdedmodule.h"
#include "kdebug.h"
#include <QtCore/QTimer>
#include <QtDBus/QtDBus>
#include <QTimer>
#include <QDBusObjectPath>
#include <QDBusConnection>
class KDEDModulePrivate
{
@ -36,7 +35,8 @@ public:
};
KDEDModule::KDEDModule(QObject* parent)
: QObject(parent), d(new KDEDModulePrivate)
: QObject(parent),
d(new KDEDModulePrivate())
{
}
@ -46,22 +46,19 @@ KDEDModule::~KDEDModule()
delete d;
}
void KDEDModule::setModuleName( const QString& name )
void KDEDModule::setModuleName(const QString &name)
{
d->moduleName = name;
QDBusObjectPath realPath( QString::fromLatin1("/modules/") + d->moduleName);
if (realPath.path().isEmpty())
{
if (realPath.path().isEmpty()) {
kError() << "The kded module name '" << name << "' is invalid!";
return;
}
QDBusConnection::RegisterOptions regOptions;
if (this->metaObject()->indexOfClassInfo("D-Bus Interface")!=-1)
{
if (this->metaObject()->indexOfClassInfo("D-Bus Interface") != -1) {
// 1. There are kded modules that don't have a D-Bus interface.
// 2. qt 4.4.3 crashes when trying to emit signals on class without
// Q_CLASSINFO("D-Bus Interface", "<your interface>") but
@ -70,9 +67,7 @@ void KDEDModule::setModuleName( const QString& name )
// Adaptors. But we should investigate where the sense is in registering
// the module at all. Just for autoload? Is there a better solution?
regOptions = QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors;
}
else
{
} else {
// Full functional module. Register everything.
regOptions = QDBusConnection::ExportScriptableSlots
| QDBusConnection::ExportScriptableProperties
@ -80,17 +75,13 @@ void KDEDModule::setModuleName( const QString& name )
kDebug() << "Registration of kded module " << d->moduleName << "without D-Bus interface.";
}
if (!QDBusConnection::sessionBus().registerObject(realPath.path(), this, regOptions))
{
if (!QDBusConnection::sessionBus().registerObject(realPath.path(), this, regOptions)) {
// Happens for khotkeys but the module works. Need some time to investigate.
kDebug() << "registerObject() returned false for " << d->moduleName;
}
else
{
} else {
kDebug() << "registerObject() successful for " << d->moduleName;
emit moduleRegistered(realPath);
}
}
QString KDEDModule::moduleName() const