2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 #include <mce/dbus-names.h>
26 #include <mce/mode-names.h>
29 #include "mceprivate.h"
31 const int DISPLAY_STATE_INDEX = 0;
33 static QDBusConnection dBusConnection = QDBusConnection::systemBus();
35 MCEPrivate::MCEPrivate(QObject *parent)
39 qDebug() << __PRETTY_FUNCTION__;
41 m_parent = static_cast<MCE*>(parent);
43 m_dBusInterface = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH,
44 MCE_REQUEST_IF, dBusConnection, this);
46 dBusConnection.connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
47 MCE_DISPLAY_SIG, this, SLOT(displayStateChanged(const QDBusMessage &)));
49 m_dBusInterface->call(MCE_DISPLAY_STATUS_GET);
52 bool MCEPrivate::isDisplayOn()
54 qDebug() << __PRETTY_FUNCTION__;
59 void MCEPrivate::displayStateChanged(const QDBusMessage &message)
61 qDebug() << __PRETTY_FUNCTION__;
63 QString content = message.arguments().at(DISPLAY_STATE_INDEX).toString();
65 if (!content.isEmpty()) {
66 if (content == MCE_DISPLAY_ON_STRING)
67 emit m_parent->displayOn(true);
68 else if (content == MCE_DISPLAY_OFF_STRING)
69 emit m_parent->displayOn(false);