summaryrefslogtreecommitdiff
path: root/libsowatch/declarativewatchwrapper.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-10-02 16:39:40 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-10-02 16:39:40 +0200
commit0a656b75f3fc80f13424db0e7ec403dff28a366e (patch)
tree23f72a2fde3f718048b49d9806ded3d315d50a80 /libsowatch/declarativewatchwrapper.cpp
parentd9f132f3d5bf41ee4f30e7ea2bd1b61120fa29b7 (diff)
downloadsowatch-0a656b75f3fc80f13424db0e7ec403dff28a366e.tar.gz
sowatch-0a656b75f3fc80f13424db0e7ec403dff28a366e.zip
new notifications list, time syncing
Diffstat (limited to 'libsowatch/declarativewatchwrapper.cpp')
-rw-r--r--libsowatch/declarativewatchwrapper.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/libsowatch/declarativewatchwrapper.cpp b/libsowatch/declarativewatchwrapper.cpp
index f7914f8..d972d86 100644
--- a/libsowatch/declarativewatchwrapper.cpp
+++ b/libsowatch/declarativewatchwrapper.cpp
@@ -1,11 +1,14 @@
#include <QtCore/QDebug>
+#include "watchserver.h"
#include "watch.h"
+#include "notification.h"
#include "declarativewatchwrapper.h"
using namespace sowatch;
-DeclarativeWatchWrapper::DeclarativeWatchWrapper(Watch* watch, QObject *parent) :
- QObject(parent), _watch(watch), _active(false)
+DeclarativeWatchWrapper::DeclarativeWatchWrapper(WatchServer* server, Watch* watch, QObject* parent) :
+ QObject(parent), _server(server), _watch(watch),
+ _active(false)
{
}
@@ -20,6 +23,19 @@ bool DeclarativeWatchWrapper::active() const
return _active;
}
+QList<QObject*> DeclarativeWatchWrapper::notifications() const
+{
+ // TODO: Figure a better way for this; QAbstractListModel, etc.
+ QList<Notification*> nl = _server->liveNotifications();
+ QList<QObject*> ol;
+ foreach (Notification* n, nl) {
+ QObject * o = n;
+ ol.append(o);
+ }
+ qDebug() << "notifications declarative: " << ol;
+ return ol;
+}
+
void DeclarativeWatchWrapper::vibrate(int msecs)
{
if (_active) {
@@ -34,6 +50,9 @@ void DeclarativeWatchWrapper::activate()
connect(_watch, SIGNAL(buttonReleased(int)), this, SIGNAL(buttonReleased(int)));
_active = true;
emit activeChanged();
+ // Since a notification currently causes the active watchlet to be deactivated,
+ // we can assume notifications only change when we are deactivated.
+ emit notificationsChanged();
}
}