#include <mce/dbus-names.h> #include <mce/mode-names.h> static QDBusConnection dBusConnection = QDBusConnection::systemBus(); MCE::MCE(QObject *parent) : QObject(parent) { dBusInterface = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH, MCE_REQUEST_IF, dBusConnection, this); dBusConnection.connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF, MCE_DISPLAY_SIG, this, SLOT(displayStateChanged(const QDBusMessage &))); dBusInterface->callWithCallback(MCE_DISPLAY_STATUS_GET, QList<QVariant>(), this, SLOT(setDisplayState(QString)), SLOT(displayStateError(QDBusError))); } void MCE::displayStateChanged(const QDBusMessage &message) { QString state = message.arguments().at(0).toString(); setDisplayState(state); } void MCE::displayStateError(const QDBusError &error) { } void MCE::setDisplayState(const QString &state) { if (!state.isEmpty()) { if (state == MCE_DISPLAY_ON_STRING) ; //Display on else if (state == MCE_DISPLAY_OFF_STRING) ; //Display off } }