blob: be662ab87488b89197e60711f375db95df392578 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
import QtQuick 1.0
Rectangle {
width: 96
height: 96
color: "white"
ListView {
id: notifs
anchors.fill: parent
model: watch.notifications
delegate: Column {
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: qsTr("No notifications");
visible: notifs.count == 0;
wrapMode: Text.Wrap
}
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;
break;
case 2:
newy = notifs.contentY + increment;
if (newy > maxy) newy = maxy;
notifs.contentY = newy;
break;
}
}
}
}
|