From 1375a26b135547fdd8e07db62acf8116a8482560 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 30 Jan 2012 19:54:44 +0100 Subject: add a qt mobility messaging based watchlet --- qmsgwatchlet/icon.png | Bin 0 -> 258 bytes qmsgwatchlet/metawatch-digital.qml | 65 ++++++++++++++++++++++++++++++++++++ qmsgwatchlet/qmsgwatchlet.cpp | 11 ++++++ qmsgwatchlet/qmsgwatchlet.h | 18 ++++++++++ qmsgwatchlet/qmsgwatchlet.pro | 32 ++++++++++++++++++ qmsgwatchlet/qmsgwatchletplugin.cpp | 29 ++++++++++++++++ qmsgwatchlet/qmsgwatchletplugin.h | 24 +++++++++++++ 7 files changed, 179 insertions(+) create mode 100644 qmsgwatchlet/icon.png create mode 100644 qmsgwatchlet/metawatch-digital.qml create mode 100644 qmsgwatchlet/qmsgwatchlet.cpp create mode 100644 qmsgwatchlet/qmsgwatchlet.h create mode 100644 qmsgwatchlet/qmsgwatchlet.pro create mode 100644 qmsgwatchlet/qmsgwatchletplugin.cpp create mode 100644 qmsgwatchlet/qmsgwatchletplugin.h (limited to 'qmsgwatchlet') diff --git a/qmsgwatchlet/icon.png b/qmsgwatchlet/icon.png new file mode 100644 index 0000000..005d9ee Binary files /dev/null and b/qmsgwatchlet/icon.png 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: "" + sender + "
" + 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 + +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 + +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 -- cgit v1.2.3