summaryrefslogtreecommitdiff
path: root/notificationswatchlet/metawatch-digital.qml
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-12-02 23:02:51 +0100
committerJavier S. Pedro <maemo@javispedro.com>2011-12-02 23:02:51 +0100
commitd5b5cfc83e1247ebc18ef2024f07bdd37d41164b (patch)
treed6c44ffe944c730f4bb16a3e5a412db78027f324 /notificationswatchlet/metawatch-digital.qml
parent1abf33ab7bcbf73ebb9eeb6c388c3c1c4abef445 (diff)
downloadsowatch-d5b5cfc83e1247ebc18ef2024f07bdd37d41164b.tar.gz
sowatch-d5b5cfc83e1247ebc18ef2024f07bdd37d41164b.zip
provide a set of metawatch common qml elements
Diffstat (limited to 'notificationswatchlet/metawatch-digital.qml')
-rw-r--r--notificationswatchlet/metawatch-digital.qml57
1 files changed, 27 insertions, 30 deletions
diff --git a/notificationswatchlet/metawatch-digital.qml b/notificationswatchlet/metawatch-digital.qml
index be662ab..e5764ec 100644
--- a/notificationswatchlet/metawatch-digital.qml
+++ b/notificationswatchlet/metawatch-digital.qml
@@ -1,4 +1,5 @@
import QtQuick 1.0
+import com.javispedro.sowatch.metawatch 1.0
Rectangle {
width: 96
@@ -6,33 +7,39 @@ Rectangle {
color: "white"
- ListView {
+ MWTitle {
+ id: title
+ text: qsTr("Notifications")
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ }
+
+ MWListView {
id: notifs
- anchors.fill: parent
+ anchors.top: title.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
model: watch.notifications
- delegate: Column {
- width: parent.width
- Text {
- width: parent.width
- text: model.modelData.title
- wrapMode: Text.Wrap
- }
+ delegate: Rectangle {
+ property bool selected: ListView.isCurrentItem
+ width: notifs.width
+ height: childrenRect.height
+ color: ListView.isCurrentItem ? "black" : "white"
Text {
- width: parent.width
- text: model.modelData.body
- wrapMode: Text.Wrap
- }
- Rectangle {
- width: parent.width
- height: 1
- color: "black"
+ width: 96
+ text: "<b>" + model.modelData.title + "</b><br>" + model.modelData.body
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ color: parent.selected ? "white" : "black"
}
}
visible: count > 0;
}
Text {
- anchors.fill: parent
+ anchors.top: title.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("No notifications");
visible: notifs.count == 0;
wrapMode: Text.Wrap
@@ -41,22 +48,12 @@ Rectangle {
Connections {
target: watch
onButtonPressed : {
- var increment = (3 * (notifs.width / 4));
- var maxy = notifs.contentHeight - notifs.height;
- var newy;
-
- if (maxy < 0) maxy = 0;
-
switch (button) {
case 1:
- newy = notifs.contentY - increment;
- if (newy < 0) newy = 0;
- notifs.contentY = newy;
+ notifs.scrollUp();
break;
case 2:
- newy = notifs.contentY + increment;
- if (newy > maxy) newy = maxy;
- notifs.contentY = newy;
+ notifs.scrollDown();
break;
}
}