2
* Copyright (C) 2012-2013 Canonical, Ltd.
5
* Ugo Riboni <ugo.riboni@canonical.com>
7
* This file is part of messaging-app.
9
* messaging-app is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 3.
13
* messaging-app is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#include "messagingappdbus.h"
23
#include "messagingappadaptor.h"
26
#include <QtDBus/QDBusConnection>
28
static const char* DBUS_SERVICE = "com.canonical.MessagingApp";
29
static const char* DBUS_OBJECT_PATH = "/com/canonical/MessagingApp";
31
MessagingAppDBus::MessagingAppDBus(QObject* parent) : QObject(parent)
35
MessagingAppDBus::~MessagingAppDBus()
40
MessagingAppDBus::connectToBus()
42
bool ok = QDBusConnection::sessionBus().registerService(DBUS_SERVICE);
46
new MessagingAppAdaptor(this);
47
QDBusConnection::sessionBus().registerObject(DBUS_OBJECT_PATH, this);
53
MessagingAppDBus::ShowMessages(const QString &number)
55
Q_EMIT request(QString("message://%1").arg(number));
58
void MessagingAppDBus::ShowMessage(const QString &messageId)
60
Q_EMIT request(QString("messageId://%1").arg(messageId));
63
void MessagingAppDBus::NewMessage()
65
Q_EMIT request(QString("message://"));
68
void MessagingAppDBus::SendMessage(const QString &number, const QString &message)
70
Q_EMIT messageSendRequested(number, message);
73
void MessagingAppDBus::SendAppMessage(const QString &message)
75
Q_EMIT request(message);