summaryrefslogtreecommitdiff
path: root/meegohandsetnotification/meegohandsetnotificationprovider.cpp
blob: 0297ebbc0513a5a83f318791d5bdd30398c83adf (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
#include <QtDBus/QDBusConnection>
#include <notificationsystem/metatypedeclarations.h>
#include <notificationsystem/notificationsinkadaptor.h>
#include "watchnotificationsink.h"
#include "mnotificationmanagerinterface.h"
#include "meegohandsetnotificationprovider.h"

using namespace sowatch;

MeegoHandsetNotificationProvider::MeegoHandsetNotificationProvider(QObject *parent) :
	sowatch::NotificationProvider(parent),
	_manager(new MNotificationManagerInterface("com.meego.core.MNotificationManager", "/notificationsinkmanager", QDBusConnection::sessionBus(), this)),
	_sink(new WatchNotificationSink(this))
{
	qDBusRegisterMetaType< ::Notification >(); // Avoid a name collision with sowatch::Notification
	qDBusRegisterMetaType<QList< ::Notification > >();
	qDBusRegisterMetaType<NotificationGroup>();
	qDBusRegisterMetaType<QList<NotificationGroup> >();
	qDBusRegisterMetaType<NotificationParameters>();

	new NotificationSinkAdaptor(_sink);
	QDBusConnection::sessionBus().registerService("com.javispedro.sowatch.MeegoHandsetNotificationSink");
	QDBusConnection::sessionBus().registerObject("/meegohandsetnotificationsink", _sink);

	connect(_sink, SIGNAL(incomingNotification(sowatch::Notification*)),
			SLOT(newNotification(sowatch::Notification*)));

	_manager->registerSink("com.javispedro.sowatch.MeegoHandsetNotificationSink", "/meegohandsetnotificationsink");
}

MeegoHandsetNotificationProvider::~MeegoHandsetNotificationProvider()
{

}


void MeegoHandsetNotificationProvider::newNotification(Notification* n)
{
	emit incomingNotification(n);
}