summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-11-09 00:13:22 +0100
committerJavier S. Pedro <maemo@javispedro.com>2011-11-09 00:13:22 +0100
commit88d6c8d388bd73e1f2ee1c23df221f8d3c6208d9 (patch)
tree5d3e08c47a640590db07a5d3f5897f337172178e
parent3733cb7e3c0932ee281fce64c153c7c1fc0f18f9 (diff)
downloadsowatch-88d6c8d388bd73e1f2ee1c23df221f8d3c6208d9.tar.gz
sowatch-88d6c8d388bd73e1f2ee1c23df221f8d3c6208d9.zip
Add support for scrolling the notifications view
-rw-r--r--notificationswatchlet/metawatch-digital.qml39
1 files changed, 32 insertions, 7 deletions
diff --git a/notificationswatchlet/metawatch-digital.qml b/notificationswatchlet/metawatch-digital.qml
index 4a69a0d..be662ab 100644
--- a/notificationswatchlet/metawatch-digital.qml
+++ b/notificationswatchlet/metawatch-digital.qml
@@ -1,5 +1,4 @@
import QtQuick 1.0
-import QtMobility.location 1.2
Rectangle {
width: 96
@@ -12,26 +11,52 @@ Rectangle {
anchors.fill: parent
model: watch.notifications
delegate: Column {
- Text { text: model.modelData.title }
- Text { text: model.modelData.body }
+ width: parent.width
+ Text {
+ width: parent.width
+ text: model.modelData.title
+ wrapMode: Text.Wrap
+ }
+ Text {
+ width: parent.width
+ text: model.modelData.body
+ wrapMode: Text.Wrap
+ }
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: "black"
+ }
}
visible: count > 0;
}
+
Text {
anchors.fill: parent
- text: "No notifications"
+ text: qsTr("No notifications");
visible: notifs.count == 0;
+ wrapMode: Text.Wrap
}
Connections {
target: watch
onButtonPressed : {
- switch(button) {
+ var increment = (3 * (notifs.width / 4));
+ var maxy = notifs.contentHeight - notifs.height;
+ var newy;
+
+ if (maxy < 0) maxy = 0;
+
+ switch (button) {
case 1:
- notifs.decrementCurrentIndex();
+ newy = notifs.contentY - increment;
+ if (newy < 0) newy = 0;
+ notifs.contentY = newy;
break;
case 2:
- notifs.incrementCurrentIndex();
+ newy = notifs.contentY + increment;
+ if (newy > maxy) newy = maxy;
+ notifs.contentY = newy;
break;
}
}