From 7897ec1596a4348cd926eff7c1d4f03616ed535c Mon Sep 17 00:00:00 2001
From: "Javier S. Pedro" <maemo@javispedro.com>
Date: Fri, 3 May 2013 21:15:59 +0200
Subject: preparing new qorgwatchlet

---
 qorgwatchlet/icon.png               | Bin 0 -> 258 bytes
 qorgwatchlet/metawatch-digital.qml  |  82 ++++++++++++++++++++++++++++++++++++
 qorgwatchlet/qorgwatchlet.cpp       |  13 ++++++
 qorgwatchlet/qorgwatchlet.h         |  22 ++++++++++
 qorgwatchlet/qorgwatchlet.pro       |  28 ++++++++++++
 qorgwatchlet/qorgwatchletplugin.cpp |  38 +++++++++++++++++
 qorgwatchlet/qorgwatchletplugin.h   |  25 +++++++++++
 7 files changed, 208 insertions(+)
 create mode 100644 qorgwatchlet/icon.png
 create mode 100644 qorgwatchlet/metawatch-digital.qml
 create mode 100644 qorgwatchlet/qorgwatchlet.cpp
 create mode 100644 qorgwatchlet/qorgwatchlet.h
 create mode 100644 qorgwatchlet/qorgwatchlet.pro
 create mode 100644 qorgwatchlet/qorgwatchletplugin.cpp
 create mode 100644 qorgwatchlet/qorgwatchletplugin.h

(limited to 'qorgwatchlet')

diff --git a/qorgwatchlet/icon.png b/qorgwatchlet/icon.png
new file mode 100644
index 0000000..005d9ee
Binary files /dev/null and b/qorgwatchlet/icon.png differ
diff --git a/qorgwatchlet/metawatch-digital.qml b/qorgwatchlet/metawatch-digital.qml
new file mode 100644
index 0000000..e5e999f
--- /dev/null
+++ b/qorgwatchlet/metawatch-digital.qml
@@ -0,0 +1,82 @@
+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
+		clip: true
+		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 {
+			id: msgDelegate
+			property bool selected: ListView.isCurrentItem
+			width: parent.width
+			height: childrenRect.height
+			color: ListView.isCurrentItem ? "black" : "white"
+			Column {
+				width: parent.width
+				MWLabel {
+					width: parent.width
+					text: sender
+					wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+					color: msgDelegate.selected ? "white" : "black"
+					font.pointSize: 12
+				}
+				MWLabel {
+					width: parent.width
+					text: subject
+					wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+					color: msgDelegate.selected ? "white" : "black"
+				}
+			}
+		}
+	}
+
+	Connections {
+		target: watch
+		onButtonPressed: {
+			switch (button) {
+			case 1:
+				list.scrollUp();
+				break;
+			case 2:
+				list.scrollDown();
+				break;
+			}
+		}
+		onActiveChanged: {
+			if (watch.active) {
+				list.scrollTop();
+			}
+		}
+	}
+}
diff --git a/qorgwatchlet/qorgwatchlet.cpp b/qorgwatchlet/qorgwatchlet.cpp
new file mode 100644
index 0000000..7111c81
--- /dev/null
+++ b/qorgwatchlet/qorgwatchlet.cpp
@@ -0,0 +1,13 @@
+#include <QtCore/QDebug>
+
+#include "qmsgwatchlet.h"
+
+QTM_USE_NAMESPACE
+using namespace sowatch;
+
+QMsgWatchlet::QMsgWatchlet(WatchServer* server) :
+	DeclarativeWatchlet(server, "com.javispedro.sowatch.qmsg"),
+    _qms(new QMessageService(this))
+{
+	setSource(QUrl(SOWATCH_QML_DIR "/qmsgwatchlet/" + server->watch()->model() + ".qml"));
+}
diff --git a/qorgwatchlet/qorgwatchlet.h b/qorgwatchlet/qorgwatchlet.h
new file mode 100644
index 0000000..6fa331c
--- /dev/null
+++ b/qorgwatchlet/qorgwatchlet.h
@@ -0,0 +1,22 @@
+#ifndef QMSGWATCHLET_H
+#define QMSGWATCHLET_H
+
+#include <QtMessaging/QMessageService>
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class QMsgWatchlet : public DeclarativeWatchlet
+{
+    Q_OBJECT
+public:
+	explicit QMsgWatchlet(WatchServer* server);
+
+private:
+	QtMobility::QMessageService *_qms;
+};
+
+}
+
+#endif // QMSGWATCHLET_H
diff --git a/qorgwatchlet/qorgwatchlet.pro b/qorgwatchlet/qorgwatchlet.pro
new file mode 100644
index 0000000..9e18e42
--- /dev/null
+++ b/qorgwatchlet/qorgwatchlet.pro
@@ -0,0 +1,28 @@
+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
+
+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/qorgwatchlet/qorgwatchletplugin.cpp b/qorgwatchlet/qorgwatchletplugin.cpp
new file mode 100644
index 0000000..2471d03
--- /dev/null
+++ b/qorgwatchlet/qorgwatchletplugin.cpp
@@ -0,0 +1,38 @@
+#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;
+}
+
+WatchletPluginInterface::WatchletInfo QMsgWatchletPlugin::describeWatchlet(const QString &id)
+{
+	WatchletInfo info;
+	if (id != "com.javispedro.sowatch.qmsg") return info;
+	info.name = "Inbox";
+	info.icon = QUrl::fromLocalFile(SOWATCH_QML_DIR "/qmsgwatchlet/icon.png");
+	return info;
+}
+
+Watchlet* QMsgWatchletPlugin::getWatchlet(const QString &id, ConfigKey *config, WatchServer *server)
+{
+	Q_UNUSED(config);
+	if (id != "com.javispedro.sowatch.qmsg") return 0;
+	return new QMsgWatchlet(server);
+}
+
+Q_EXPORT_PLUGIN2(qmsgwatchlet, QMsgWatchletPlugin)
diff --git a/qorgwatchlet/qorgwatchletplugin.h b/qorgwatchlet/qorgwatchletplugin.h
new file mode 100644
index 0000000..01cb83e
--- /dev/null
+++ b/qorgwatchlet/qorgwatchletplugin.h
@@ -0,0 +1,25 @@
+#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();
+	WatchletInfo describeWatchlet(const QString &id);
+	Watchlet* getWatchlet(const QString &id, ConfigKey *config, WatchServer *server);
+};
+
+}
+
+#endif // QMSGWATCHLETPLUGIN_H
-- 
cgit v1.2.3