diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-05-03 21:15:59 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-05-03 21:15:59 +0200 |
commit | 7897ec1596a4348cd926eff7c1d4f03616ed535c (patch) | |
tree | c21374cfcf613198dd52e39e89be982a10263fc8 | |
parent | 9e061170b3834845910749c55eda63f03d982bbf (diff) | |
download | sowatch-7897ec1596a4348cd926eff7c1d4f03616ed535c.tar.gz sowatch-7897ec1596a4348cd926eff7c1d4f03616ed535c.zip |
preparing new qorgwatchlet
-rw-r--r-- | qorgwatchlet/icon.png | bin | 0 -> 258 bytes | |||
-rw-r--r-- | qorgwatchlet/metawatch-digital.qml | 82 | ||||
-rw-r--r-- | qorgwatchlet/qorgwatchlet.cpp | 13 | ||||
-rw-r--r-- | qorgwatchlet/qorgwatchlet.h | 22 | ||||
-rw-r--r-- | qorgwatchlet/qorgwatchlet.pro | 28 | ||||
-rw-r--r-- | qorgwatchlet/qorgwatchletplugin.cpp | 38 | ||||
-rw-r--r-- | qorgwatchlet/qorgwatchletplugin.h | 25 |
7 files changed, 208 insertions, 0 deletions
diff --git a/qorgwatchlet/icon.png b/qorgwatchlet/icon.png Binary files differnew file mode 100644 index 0000000..005d9ee --- /dev/null +++ b/qorgwatchlet/icon.png 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 |