diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2011-09-19 01:51:04 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2011-09-19 01:51:04 +0200 |
commit | 77a98ac21c2520d9fb4bb9c8f70967a8e36dc872 (patch) | |
tree | 687d1cc8820296d56e06c8fab3eaf9ef935cba23 /meegohandsetnotification/meegohandsetnotificationprovider.cpp | |
parent | 03af539d69d903dfb5df19b447707a35ebaa4a54 (diff) | |
download | sowatch-77a98ac21c2520d9fb4bb9c8f70967a8e36dc872.tar.gz sowatch-77a98ac21c2520d9fb4bb9c8f70967a8e36dc872.zip |
adding notification provider plugins, idle screen
Diffstat (limited to 'meegohandsetnotification/meegohandsetnotificationprovider.cpp')
-rw-r--r-- | meegohandsetnotification/meegohandsetnotificationprovider.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
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 <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(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); +} |