summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-08-11 15:30:38 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-08-11 15:30:38 +0200
commit51701e30d710ad016ddf2d306cdd7be122ddf25b (patch)
treed4a85bd4926c3f94411d3f6fa572e1a99be6bbb4
parentf0564ad9d210cc68bfb1bfc6e56b86fa941ad830 (diff)
downloadsowatch-51701e30d710ad016ddf2d306cdd7be122ddf25b.tar.gz
sowatch-51701e30d710ad016ddf2d306cdd7be122ddf25b.zip
adding test notification backend
-rw-r--r--ckitcallnotification/ckitcallprovider.cpp2
-rw-r--r--harmaccuweather/harmaccuprovider.h6
-rw-r--r--harmaccuweather/harmaccuweather.pro6
-rw-r--r--meegohandsetnotification/watchnotificationsink.cpp2
-rw-r--r--notificationswatchlet/metawatch-digital.qml2
-rw-r--r--sowatch.pro7
-rw-r--r--testnotification/testnotification.cpp48
-rw-r--r--testnotification/testnotification.h34
-rw-r--r--testnotification/testnotification.pro25
-rw-r--r--testnotification/testnotificationplugin.cpp39
-rw-r--r--testnotification/testnotificationplugin.h25
-rw-r--r--testnotification/testnotificationprovider.cpp34
-rw-r--r--testnotification/testnotificationprovider.h29
13 files changed, 249 insertions, 10 deletions
diff --git a/ckitcallnotification/ckitcallprovider.cpp b/ckitcallnotification/ckitcallprovider.cpp
index 5e00977..5247a43 100644
--- a/ckitcallnotification/ckitcallprovider.cpp
+++ b/ckitcallnotification/ckitcallprovider.cpp
@@ -45,7 +45,7 @@ void CKitCallProvider::activeCallChanged()
// Call has either been answered, rejected, missed, ..
if (_notification) {
_notification->remove();
- _notification->deleteLater();
+ delete _notification;
_notification = 0;
}
}
diff --git a/harmaccuweather/harmaccuprovider.h b/harmaccuweather/harmaccuprovider.h
index f7c7ca4..4524e12 100644
--- a/harmaccuweather/harmaccuprovider.h
+++ b/harmaccuweather/harmaccuprovider.h
@@ -1,5 +1,5 @@
-#ifndef CKITCALLPROVIDER_H
-#define CKITCALLPROVIDER_H
+#ifndef HARMACCUPROVIDER_H
+#define HARMACCUPROVIDER_H
#include <sowatch.h>
@@ -25,4 +25,4 @@ private:
}
-#endif // CKITCALLPROVIDER_H
+#endif // HARMACCUPROVIDER_H
diff --git a/harmaccuweather/harmaccuweather.pro b/harmaccuweather/harmaccuweather.pro
index f24c943..9f60ba2 100644
--- a/harmaccuweather/harmaccuweather.pro
+++ b/harmaccuweather/harmaccuweather.pro
@@ -4,11 +4,9 @@ CONFIG += plugin
CONFIG += mobility
MOBILITY += systeminfo
-SOURCES += harmaccuplugin.cpp harmaccuprovider.cpp \
- harmaccuweather.cpp
+SOURCES += harmaccuplugin.cpp harmaccuprovider.cpp harmaccuweather.cpp
-HEADERS += harmaccuplugin.h harmaccuprovider.h \
- harmaccuweather.h
+HEADERS += harmaccuplugin.h harmaccuprovider.h harmaccuweather.h
unix: LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch
diff --git a/meegohandsetnotification/watchnotificationsink.cpp b/meegohandsetnotification/watchnotificationsink.cpp
index 860c4b6..1a90dc1 100644
--- a/meegohandsetnotification/watchnotificationsink.cpp
+++ b/meegohandsetnotification/watchnotificationsink.cpp
@@ -27,7 +27,7 @@ void WatchNotificationSink::removeNotification(uint notificationId)
MeegoHandsetNotification* n = _trackedNotifications[notificationId];
_trackedNotifications.remove(notificationId);
n->remove();
- n->deleteLater();
+ delete n;
}
}
diff --git a/notificationswatchlet/metawatch-digital.qml b/notificationswatchlet/metawatch-digital.qml
index 9129226..71c52a8 100644
--- a/notificationswatchlet/metawatch-digital.qml
+++ b/notificationswatchlet/metawatch-digital.qml
@@ -26,7 +26,7 @@ Rectangle {
delegate: Rectangle {
id: notifDelegate
property bool selected: ListView.isCurrentItem
- width: notifs.width
+ width: parent.width
height: childrenRect.height
color: ListView.isCurrentItem ? "black" : "white"
Column {
diff --git a/sowatch.pro b/sowatch.pro
index 18c22b8..b5eabdc 100644
--- a/sowatch.pro
+++ b/sowatch.pro
@@ -39,6 +39,13 @@ contains(MEEGO_EDITION,harmattan) {
harmaccuweather.depends = libsowatch
}
+# Debug only watchlets
+debug {
+ SUBDIRS += testnotification
+ testnotification.depends = libsowatch
+}
+
+# Packaging stuff
OTHER_FILES += \
qtc_packaging/debian_harmattan/rules \
qtc_packaging/debian_harmattan/README \
diff --git a/testnotification/testnotification.cpp b/testnotification/testnotification.cpp
new file mode 100644
index 0000000..fa904b9
--- /dev/null
+++ b/testnotification/testnotification.cpp
@@ -0,0 +1,48 @@
+#include "testnotification.h"
+
+using namespace sowatch;
+
+TestNotification::TestNotification(Type type, const QString &title, const QString &body, QObject *parent)
+ : Notification(parent),
+ _type(type),
+ _time(QDateTime::currentDateTime()),
+ _title(title), _body(body)
+{
+}
+
+Notification::Type TestNotification::type() const
+{
+ return _type;
+}
+
+uint TestNotification::count() const
+{
+ return 1;
+}
+
+QDateTime TestNotification::dateTime() const
+{
+ return _time;
+}
+
+QString TestNotification::title() const
+{
+ return _title;
+}
+
+QString TestNotification::body() const
+{
+ return _body;
+}
+
+void TestNotification::activate()
+{
+ // Do nothing
+}
+
+void TestNotification::dismiss()
+{
+ deleteLater(); // We do not want to keep those around.
+}
+
+
diff --git a/testnotification/testnotification.h b/testnotification/testnotification.h
new file mode 100644
index 0000000..f54623d
--- /dev/null
+++ b/testnotification/testnotification.h
@@ -0,0 +1,34 @@
+#ifndef TESTNOTIFICATION_H
+#define TESTNOTIFICATION_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class TestNotification : public Notification
+{
+ Q_OBJECT
+
+public:
+ explicit TestNotification(Type type, const QString& title, const QString& body, QObject *parent = 0);
+
+ Type type() const;
+ uint count() const;
+ QDateTime dateTime() const;
+ QString title() const;
+ QString body() const;
+
+ void activate();
+ void dismiss();
+
+private:
+ Type _type;
+ QDateTime _time;
+ QString _title;
+ QString _body;
+};
+
+}
+
+#endif // TESTNOTIFICATION_H
diff --git a/testnotification/testnotification.pro b/testnotification/testnotification.pro
new file mode 100644
index 0000000..525fdac
--- /dev/null
+++ b/testnotification/testnotification.pro
@@ -0,0 +1,25 @@
+TARGET = testnotification
+TEMPLATE = lib
+CONFIG += plugin
+CONFIG += mobility
+MOBILITY += systeminfo
+
+SOURCES += testnotificationplugin.cpp testnotificationprovider.cpp \
+ testnotification.cpp
+
+HEADERS += testnotificationplugin.h testnotificationprovider.h \
+ testnotification.h
+
+unix: LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch
+INCLUDEPATH += $$PWD/../libsowatch
+DEPENDPATH += $$PWD/../libsowatch
+
+unix {
+ !isEmpty(MEEGO_VERSION_MAJOR)|maemo5 {
+ QMAKE_RPATHDIR += /opt/sowatch/lib
+ target.path = /opt/sowatch/lib/notifications
+ } else {
+ target.path = /usr/lib/sowatch/notifications
+ }
+ INSTALLS += target
+}
diff --git a/testnotification/testnotificationplugin.cpp b/testnotification/testnotificationplugin.cpp
new file mode 100644
index 0000000..7e65851
--- /dev/null
+++ b/testnotification/testnotificationplugin.cpp
@@ -0,0 +1,39 @@
+#include "testnotificationprovider.h"
+#include "testnotificationplugin.h"
+
+using namespace sowatch;
+
+static const QLatin1String providerId("testnotification");
+
+TestNotificationPlugin::TestNotificationPlugin(QObject *parent) :
+ QObject(parent)
+{
+}
+
+TestNotificationPlugin::~TestNotificationPlugin()
+{
+}
+
+QStringList TestNotificationPlugin::providers()
+{
+ QStringList providers;
+ providers << providerId;
+ return providers;
+}
+
+NotificationPluginInterface::NotificationProviderInfo TestNotificationPlugin::describeProvider(const QString &driver)
+{
+ NotificationProviderInfo info;
+ if (driver != providerId) return info;
+ info.name = "Test notifications";
+ return info;
+}
+
+NotificationProvider* TestNotificationPlugin::getProvider(const QString& id, ConfigKey *settings, QObject *parent)
+{
+ Q_UNUSED(settings);
+ if (id != providerId) return 0;
+ return new TestNotificationProvider(parent);
+}
+
+Q_EXPORT_PLUGIN2(testnotification, TestNotificationPlugin)
diff --git a/testnotification/testnotificationplugin.h b/testnotification/testnotificationplugin.h
new file mode 100644
index 0000000..03ebb30
--- /dev/null
+++ b/testnotification/testnotificationplugin.h
@@ -0,0 +1,25 @@
+#ifndef TESTNOTIFICATIONPLUGIN_H
+#define TESTNOTIFICATIONPLUGIN_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class TestNotificationPlugin : public QObject, public NotificationPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(sowatch::NotificationPluginInterface)
+
+public:
+ TestNotificationPlugin(QObject *parent = 0);
+ ~TestNotificationPlugin();
+
+ QStringList providers();
+ NotificationProviderInfo describeProvider(const QString &driver);
+ NotificationProvider* getProvider(const QString& driver, ConfigKey *settings, QObject *parent = 0);
+};
+
+}
+
+#endif // TESTNOTIFICATIONPLUGIN_H
diff --git a/testnotification/testnotificationprovider.cpp b/testnotification/testnotificationprovider.cpp
new file mode 100644
index 0000000..960f450
--- /dev/null
+++ b/testnotification/testnotificationprovider.cpp
@@ -0,0 +1,34 @@
+#include "testnotification.h"
+#include "testnotificationprovider.h"
+
+using namespace sowatch;
+
+TestNotificationProvider::TestNotificationProvider(QObject *parent) :
+ NotificationProvider(parent),
+ _timer(new QTimer(this))
+{
+ QTimer::singleShot(15000, this, SLOT(generateInitialNotification()));
+ connect(_timer, SIGNAL(timeout()), SLOT(generateNotification()));
+ _timer->setInterval(60000);
+ _timer->start();
+}
+
+TestNotificationProvider::~TestNotificationProvider()
+{
+}
+
+void TestNotificationProvider::generateInitialNotification()
+{
+ TestNotification *n = new TestNotification(Notification::EmailNotification,
+ "A friend",
+ "This is a test email notification");
+ emit incomingNotification(n);
+}
+
+void TestNotificationProvider::generateNotification()
+{
+ TestNotification *n = new TestNotification(Notification::ImNotification,
+ "A friend",
+ "I will keep talking to you");
+ emit incomingNotification(n);
+}
diff --git a/testnotification/testnotificationprovider.h b/testnotification/testnotificationprovider.h
new file mode 100644
index 0000000..9931ea0
--- /dev/null
+++ b/testnotification/testnotificationprovider.h
@@ -0,0 +1,29 @@
+#ifndef TESTNOTIFICATIONPROVIDER_H
+#define TESTNOTIFICATIONPROVIDER_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class TestNotification;
+
+class TestNotificationProvider : public NotificationProvider
+{
+ Q_OBJECT
+
+public:
+ explicit TestNotificationProvider(QObject *parent = 0);
+ ~TestNotificationProvider();
+
+private slots:
+ void generateInitialNotification();
+ void generateNotification();
+
+private:
+ QTimer *_timer;
+};
+
+}
+
+#endif // TESTNOTIFICATIONPROVIDER_H