From 77a98ac21c2520d9fb4bb9c8f70967a8e36dc872 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 19 Sep 2011 01:51:04 +0200 Subject: adding notification provider plugins, idle screen --- .../meegohandsetnotificationprovider.cpp | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 meegohandsetnotification/meegohandsetnotificationprovider.cpp (limited to 'meegohandsetnotification/meegohandsetnotificationprovider.cpp') diff --git a/meegohandsetnotification/meegohandsetnotificationprovider.cpp b/meegohandsetnotification/meegohandsetnotificationprovider.cpp new file mode 100644 index 0000000..fc84e46 --- /dev/null +++ b/meegohandsetnotification/meegohandsetnotificationprovider.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +#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 >(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType >(); + qDBusRegisterMetaType(); + + new NotificationSinkAdaptor(_sink); + QDBusConnection::sessionBus().registerService("com.javispedro.sowatch.MeegoHandsetNotificationSink"); + QDBusConnection::sessionBus().registerObject("/meegohandsetnotificationsink", _sink); + + connect(_sink, SIGNAL(incomingNotification(sowatch::Notification)), + SLOT(sinkNotification(sowatch::Notification))); + connect(_sink, SIGNAL(countsChanged(sowatch::Notification::Type)), + SLOT(sinkUnreadCountChanged(sowatch::Notification::Type))); + + _manager->registerSink("com.javispedro.sowatch.MeegoHandsetNotificationSink", "/meegohandsetnotificationsink"); +} + +MeegoHandsetNotificationProvider::~MeegoHandsetNotificationProvider() +{ + +} + +int MeegoHandsetNotificationProvider::getCount(sowatch::Notification::Type type) +{ + return _sink->getCount(type); +} + +void MeegoHandsetNotificationProvider::sinkNotification(const Notification &n) +{ + emit notification(n); +} + +void MeegoHandsetNotificationProvider::sinkUnreadCountChanged(Notification::Type type) +{ + emit unreadCountChanged(type); +} -- cgit v1.2.3