~lukas-kde/unity-notifications/cmdLineCheck

« back to all changes in this revision

Viewing changes to src/NotificationClient.cpp

  • Committer: CI Train Bot
  • Author(s): Pete Woods
  • Date: 2015-06-23 15:50:11 UTC
  • mfrom: (224.1.8 add-dbus-tests)
  • Revision ID: ci-train-bot@canonical.com-20150623155011-bnt9ubw5elnay015
Add end to end DBus tests and use XML introspection data
Approved by: Charles Kerr

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <QStringList>
23
23
#include <QDBusReply>
24
24
 
25
 
NotificationClient::NotificationClient(QObject *parent) : QObject(parent),
26
 
    service(DBUS_SERVICE_NAME, DBUS_PATH, DBUS_INTERFACE) {
27
 
 
 
25
NotificationClient::NotificationClient(const QDBusConnection& connection, QObject *parent) : QObject(parent),
 
26
    m_interface(DBUS_SERVICE_NAME, DBUS_PATH, connection) {
 
27
 
 
28
    DBusTypes::registerNotificationMetaTypes();
 
29
 
 
30
    connect(&m_interface, &OrgFreedesktopNotificationsInterface::ActionInvoked, this, &NotificationClient::ActionInvoked);
 
31
    connect(&m_interface, &OrgFreedesktopNotificationsInterface::NotificationClosed, this, &NotificationClient::NotificationClosed);
28
32
}
29
33
 
30
34
NotificationClient::~NotificationClient() {
31
 
 
32
35
}
33
36
 
34
37
NotificationID NotificationClient::sendNotification(Notification::Type ntype, Notification::Urgency urg, const QString &summary, const QString &body) {
54
57
        hints[INTERACTIVE_HINT] = "targetapp";
55
58
    }
56
59
    int timeout = 5000;
57
 
    QDBusReply<unsigned int> result = service.call("Notify",
58
 
            app_name, replaces_id, app_icon, summary, body, actions, hints, timeout);
 
60
    QDBusReply<unsigned int> result = m_interface.Notify(app_name, replaces_id, app_icon, summary, body, actions, hints, timeout);
59
61
    if(!result.isValid()) {
60
62
        return (NotificationID) -1;
61
63
    }