summaryrefslogtreecommitdiff
path: root/qmsgwatchlet
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-01-30 19:54:44 +0100
committerJavier S. Pedro <maemo@javispedro.com>2012-01-30 19:54:44 +0100
commit1375a26b135547fdd8e07db62acf8116a8482560 (patch)
tree96cb70c28d7c3cb05947caa39dde9d360e4903dc /qmsgwatchlet
parentc916a1e3cb9440737a9414d6f28505b67209e3cb (diff)
downloadsowatch-1375a26b135547fdd8e07db62acf8116a8482560.tar.gz
sowatch-1375a26b135547fdd8e07db62acf8116a8482560.zip
add a qt mobility messaging based watchlet
Diffstat (limited to 'qmsgwatchlet')
-rw-r--r--qmsgwatchlet/icon.pngbin0 -> 258 bytes
-rw-r--r--qmsgwatchlet/metawatch-digital.qml65
-rw-r--r--qmsgwatchlet/qmsgwatchlet.cpp11
-rw-r--r--qmsgwatchlet/qmsgwatchlet.h18
-rw-r--r--qmsgwatchlet/qmsgwatchlet.pro32
-rw-r--r--qmsgwatchlet/qmsgwatchletplugin.cpp29
-rw-r--r--qmsgwatchlet/qmsgwatchletplugin.h24
7 files changed, 179 insertions, 0 deletions
diff --git a/qmsgwatchlet/icon.png b/qmsgwatchlet/icon.png
new file mode 100644
index 0000000..005d9ee
--- /dev/null
+++ b/qmsgwatchlet/icon.png
Binary files differ
diff --git a/qmsgwatchlet/metawatch-digital.qml b/qmsgwatchlet/metawatch-digital.qml
new file mode 100644
index 0000000..43c6e1f
--- /dev/null
+++ b/qmsgwatchlet/metawatch-digital.qml
@@ -0,0 +1,65 @@
+import QtQuick 1.0
+import QtMobility.messaging 1.1
+import com.javispedro.sowatch.metawatch 1.0
+
+MWPage {
+ MWTitle {
+ id: title
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ text: qsTr("Inbox")
+ icon.source: "icon.png"
+ }
+
+ MWListView {
+ id: list
+ anchors.top: title.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ model: MessageModel {
+ sortBy: MessageModel.Timestamp
+ sortOrder: MessageModel.DescendingOrder
+ filter: MessageIntersectionFilter {
+ MessageFilter {
+ type: MessageFilter.Type
+ comparator: MessageFilter.Equal
+ value: MessageFilter.Email
+ }
+ MessageFilter {
+ type: MessageFilter.StandardFolder
+ comparator: MessageFilter.Equal
+ value: MessageFilter.InboxFolder
+ }
+ }
+ limit: 20
+ }
+ delegate: Rectangle {
+ property bool selected: ListView.isCurrentItem
+ width: list.width
+ height: childrenRect.height
+ color: ListView.isCurrentItem ? "black" : "white"
+ Text {
+ width: 96
+ text: "<b>" + sender + "</b><br>" + subject
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ color: parent.selected ? "white" : "black"
+ }
+ }
+ }
+
+ Connections {
+ target: watch
+ onButtonPressed : {
+ switch (button) {
+ case 1:
+ list.scrollUp();
+ break;
+ case 2:
+ list.scrollDown();
+ break;
+ }
+ }
+ }
+}
diff --git a/qmsgwatchlet/qmsgwatchlet.cpp b/qmsgwatchlet/qmsgwatchlet.cpp
new file mode 100644
index 0000000..5a95937
--- /dev/null
+++ b/qmsgwatchlet/qmsgwatchlet.cpp
@@ -0,0 +1,11 @@
+#include "qmsgwatchlet.h"
+
+using namespace sowatch;
+
+QMsgWatchlet::QMsgWatchlet(WatchServer* server) :
+ DeclarativeWatchlet(server, "com.javispedro.sowatch.qmsg")
+{
+
+ setSource(QUrl(SOWATCH_QML_DIR "/qmsgwatchlet/" + server->watch()->model() + ".qml"));
+}
+
diff --git a/qmsgwatchlet/qmsgwatchlet.h b/qmsgwatchlet/qmsgwatchlet.h
new file mode 100644
index 0000000..b731637
--- /dev/null
+++ b/qmsgwatchlet/qmsgwatchlet.h
@@ -0,0 +1,18 @@
+#ifndef QMSGWATCHLET_H
+#define QMSGWATCHLET_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class QMsgWatchlet : public DeclarativeWatchlet
+{
+ Q_OBJECT
+public:
+ explicit QMsgWatchlet(WatchServer* server);
+};
+
+}
+
+#endif // QMSGWATCHLET_H
diff --git a/qmsgwatchlet/qmsgwatchlet.pro b/qmsgwatchlet/qmsgwatchlet.pro
new file mode 100644
index 0000000..ef02f16
--- /dev/null
+++ b/qmsgwatchlet/qmsgwatchlet.pro
@@ -0,0 +1,32 @@
+
+TARGET = qmsgwatchlet
+TEMPLATE = lib
+CONFIG += plugin
+CONFIG += mobility
+MOBILITY += messaging
+
+SOURCES += qmsgwatchletplugin.cpp qmsgwatchlet.cpp
+
+HEADERS += qmsgwatchletplugin.h qmsgwatchlet.h
+
+qml_files.files = metawatch-digital.qml icon.png
+
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/release/ -lsowatch
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/debug/ -lsowatch
+else:symbian: LIBS += -lsowatch
+else:unix: LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch
+
+INCLUDEPATH += $$PWD/../libsowatch
+DEPENDPATH += $$PWD/../libsowatch
+
+unix:!symbian {
+ !isEmpty(MEEGO_VERSION_MAJOR)|maemo5 {
+ QMAKE_RPATHDIR += /opt/sowatch/lib
+ target.path = /opt/sowatch/lib/watchlets
+ qml_files.path = /opt/sowatch/qml/$$TARGET
+ } else {
+ target.path = /usr/lib/sowatch/watchlets
+ qml_files.path = /usr/share/sowatch/qml/$$TARGET
+ }
+ INSTALLS += target qml_files
+}
diff --git a/qmsgwatchlet/qmsgwatchletplugin.cpp b/qmsgwatchlet/qmsgwatchletplugin.cpp
new file mode 100644
index 0000000..64a4157
--- /dev/null
+++ b/qmsgwatchlet/qmsgwatchletplugin.cpp
@@ -0,0 +1,29 @@
+#include "qmsgwatchlet.h"
+#include "qmsgwatchletplugin.h"
+
+using namespace sowatch;
+
+QMsgWatchletPlugin::QMsgWatchletPlugin(QObject *parent) :
+ QObject(parent)
+{
+}
+
+QMsgWatchletPlugin::~QMsgWatchletPlugin()
+{
+}
+
+QStringList QMsgWatchletPlugin::watchlets()
+{
+ QStringList l;
+ l << "com.javispedro.sowatch.qmsg";
+ return l;
+}
+
+Watchlet* QMsgWatchletPlugin::getWatchlet(const QString& driver, QSettings& settings, WatchServer *server)
+{
+ Q_UNUSED(driver);
+ Q_UNUSED(settings);
+ return new QMsgWatchlet(server);
+}
+
+Q_EXPORT_PLUGIN2(qmsgwatchlet, QMsgWatchletPlugin)
diff --git a/qmsgwatchlet/qmsgwatchletplugin.h b/qmsgwatchlet/qmsgwatchletplugin.h
new file mode 100644
index 0000000..4d08e94
--- /dev/null
+++ b/qmsgwatchlet/qmsgwatchletplugin.h
@@ -0,0 +1,24 @@
+#ifndef QMSGWATCHLETPLUGIN_H
+#define QMSGWATCHLETPLUGIN_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class QMsgWatchletPlugin : public QObject, public WatchletPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(sowatch::WatchletPluginInterface)
+
+public:
+ explicit QMsgWatchletPlugin(QObject *parent = 0);
+ ~QMsgWatchletPlugin();
+
+ QStringList watchlets();
+ Watchlet* getWatchlet(const QString& driver, QSettings& settings, WatchServer* server);
+};
+
+}
+
+#endif // QMSGWATCHLETPLUGIN_H