From 88d6c8d388bd73e1f2ee1c23df221f8d3c6208d9 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Wed, 9 Nov 2011 00:13:22 +0100 Subject: Add support for scrolling the notifications view --- notificationswatchlet/metawatch-digital.qml | 39 +++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'notificationswatchlet') 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; } } -- cgit v1.2.3