mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
kdecore: replace component with class headers inclusion
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
687fcc041c
commit
059c365fee
1 changed files with 38 additions and 47 deletions
|
@ -24,78 +24,69 @@
|
|||
#include "kdedmodule.h"
|
||||
|
||||
#include "kdebug.h"
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
|
||||
#include <QTimer>
|
||||
#include <QDBusObjectPath>
|
||||
#include <QDBusConnection>
|
||||
|
||||
class KDEDModulePrivate
|
||||
{
|
||||
public:
|
||||
QString moduleName;
|
||||
QString moduleName;
|
||||
};
|
||||
|
||||
KDEDModule::KDEDModule(QObject* parent)
|
||||
: QObject(parent), d(new KDEDModulePrivate)
|
||||
: QObject(parent),
|
||||
d(new KDEDModulePrivate())
|
||||
{
|
||||
}
|
||||
|
||||
KDEDModule::~KDEDModule()
|
||||
{
|
||||
emit moduleDeleted(this);
|
||||
delete d;
|
||||
emit moduleDeleted(this);
|
||||
delete d;
|
||||
}
|
||||
|
||||
void KDEDModule::setModuleName( const QString& name )
|
||||
void KDEDModule::setModuleName(const QString &name)
|
||||
{
|
||||
d->moduleName = name;
|
||||
QDBusObjectPath realPath( QString::fromLatin1("/modules/") + d->moduleName);
|
||||
d->moduleName = name;
|
||||
QDBusObjectPath realPath( QString::fromLatin1("/modules/") + d->moduleName);
|
||||
|
||||
if (realPath.path().isEmpty())
|
||||
{
|
||||
kError() << "The kded module name '" << name << "' is invalid!";
|
||||
return;
|
||||
}
|
||||
if (realPath.path().isEmpty()) {
|
||||
kError() << "The kded module name '" << name << "' is invalid!";
|
||||
return;
|
||||
}
|
||||
|
||||
QDBusConnection::RegisterOptions regOptions;
|
||||
|
||||
QDBusConnection::RegisterOptions regOptions;
|
||||
|
||||
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
|
||||
// ExportSignal set.
|
||||
// We try to solve that for now with just registering Properties and
|
||||
// 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
|
||||
{
|
||||
// Full functional module. Register everything.
|
||||
regOptions = QDBusConnection::ExportScriptableSlots
|
||||
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
|
||||
// ExportSignal set.
|
||||
// We try to solve that for now with just registering Properties and
|
||||
// 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 {
|
||||
// Full functional module. Register everything.
|
||||
regOptions = QDBusConnection::ExportScriptableSlots
|
||||
| QDBusConnection::ExportScriptableProperties
|
||||
| QDBusConnection::ExportAdaptors;
|
||||
kDebug() << "Registration of kded module " << d->moduleName << "without D-Bus interface.";
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
kDebug() << "registerObject() successful for " << d->moduleName;
|
||||
emit moduleRegistered(realPath);
|
||||
}
|
||||
kDebug() << "Registration of kded module " << d->moduleName << "without D-Bus interface.";
|
||||
}
|
||||
|
||||
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 {
|
||||
kDebug() << "registerObject() successful for " << d->moduleName;
|
||||
emit moduleRegistered(realPath);
|
||||
}
|
||||
}
|
||||
|
||||
QString KDEDModule::moduleName() const
|
||||
{
|
||||
return d->moduleName;
|
||||
return d->moduleName;
|
||||
}
|
||||
|
||||
#include "moc_kdedmodule.cpp"
|
||||
|
|
Loading…
Add table
Reference in a new issue