summaryrefslogtreecommitdiff
path: root/src/dbus/server/notification-backend-mlite.cpp
blob: e567d90136c10a1f54126db9cefe5bb0b2c4f80d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * Copyright (C) 2011 Intel Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) version 3.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#include <config.h>

#ifdef HAS_MLITE

#include "notification-backend-mlite.h"

#include <mlite/MNotification>
#include <QString>

SE_BEGIN_CXX

/// TODO: these should really be in a common place.
#define SYNCEVOLUTION_SERVICE_NAME "org.syncevolution"
#define SYNCEVOLUTION_OBJECT_PATH  "/org/syncevolution/Server"
#define SYNCEVOLUTION_INTERFACE    "org.syncevolution.Server"

NotificationBackendMLite::NotificationBackendMLite()
{
}

NotificationBackendMLite::~NotificationBackendMLite()
{
}

bool NotificationBackendMLite::init()
{
    return true;
}

void NotificationBackendMLite::publish(
    const std::string& summary, const std::string& body,
    const std::string& viewParams)
{
    MNotification n ("Sync");

    n.setSummary(QString::fromStdString(summary));
    n.setBody(QString::fromStdString(body));
    n.setImage("image://themedimage/icons/settings/sync");

    MRemoteAction action(SYNCEVOLUTION_SERVICE_NAME,
                         SYNCEVOLUTION_OBJECT_PATH,
                         SYNCEVOLUTION_INTERFACE,
                         "NotificationAction");
    n.setAction(action);

    n.publish();
}

SE_END_CXX

#endif