diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2012-08-14 00:11:51 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2012-08-14 00:11:51 +0200 |
commit | 758cec1a767c056aaf9da36fd411cdf4a8fba32e (patch) | |
tree | 341cb8705e2e6c02d713860c8403ac8a3630a78a /notificationswatchlet | |
parent | 542d3489f45111aaca5514495af3847cf39e335b (diff) | |
download | sowatch-758cec1a767c056aaf9da36fd411cdf4a8fba32e.tar.gz sowatch-758cec1a767c056aaf9da36fd411cdf4a8fba32e.zip |
rewrite live notifications handling using models
Diffstat (limited to 'notificationswatchlet')
-rw-r--r-- | notificationswatchlet/metawatch-digital.qml | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/notificationswatchlet/metawatch-digital.qml b/notificationswatchlet/metawatch-digital.qml index 57a6176..fcd1081 100644 --- a/notificationswatchlet/metawatch-digital.qml +++ b/notificationswatchlet/metawatch-digital.qml @@ -18,7 +18,7 @@ MWPage { anchors.right: parent.right anchors.bottom: parent.bottom clip: true - model: watch.notifications + model: notifications delegate: Rectangle { id: notifDelegate @@ -30,14 +30,14 @@ MWPage { width: parent.width MWLabel { width: parent.width - text: model.modelData.title + text: title wrapMode: Text.WrapAtWordBoundaryOrAnywhere color: notifDelegate.selected ? "white" : "black" font.pointSize: 12 } MWLabel { width: parent.width - text: model.modelData.body + text: body wrapMode: Text.WrapAtWordBoundaryOrAnywhere color: notifDelegate.selected ? "white" : "black" } @@ -56,7 +56,7 @@ MWPage { Connections { target: watch - onButtonPressed : { + onButtonPressed: { switch (button) { case 1: notifs.scrollUp(); @@ -67,4 +67,20 @@ MWPage { } } } + + Connections { + target: notifications + onRowsInserted: { + if (!watch.active) { + // Always position into the topmost notification if + // user is not looking at this list + notifs.scrollTop(); + } + } + onRowsRemoved: { + if (!watch.active) { + notifs.scrollTop(); + } + } + } } |