blob: 616185bb3d4a277ce8e223135f248a1165595321 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
import QtQuick 1.0
import com.javispedro.sowatch 1.0
import com.javispedro.sowatch.metawatch 1.0
MWPage {
id: page
property QtObject curNotification: null;
MWTitle {
id: title
}
MWScrollable {
id: scrollable
anchors.top: title.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
Column {
id: defaultContainer
visible: true
anchors.left: parent.left
anchors.leftMargin: 1
width: page.width - 3
MWLabel {
text: curNotification ? curNotification.title : ""
font.pixelSize: 16
wrapMode: Text.WordWrap
}
MWLabel {
text: curNotification ? curNotification.body : ""
wrapMode: Text.WordWrap
}
}
Column {
id: callContainer
visible: false
anchors.top: parent.top
anchors.topMargin: 10
anchors.left: parent.left
anchors.leftMargin: 1
width: page.width - 5
spacing: 2
Image {
source: "notification-phone.png"
anchors.horizontalCenter: parent.horizontalCenter
}
MWLabel {
text: curNotification ? curNotification.title : ""
font.pixelSize: 16
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
width: parent.width
}
MWLabel {
text: curNotification ? curNotification.body : ""
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
width: parent.width
}
}
Column {
id: emailContainer
visible: false
anchors.left: parent.left
anchors.leftMargin: 1
width: page.width - 3
Image {
source: "notification-email.png"
}
MWLabel {
text: curNotification ? curNotification.title : ""
font.pixelSize: 16
wrapMode: Text.WordWrap
}
MWLabel {
text: curNotification ? curNotification.body : ""
wrapMode: Text.WordWrap
}
}
Column {
id: chatContainer
visible: false
anchors.left: parent.left
anchors.leftMargin: 1
width: page.width - 5
MWLabel {
id: chatTitle
font.pixelSize: 16
text: curNotification ? curNotification.title : ""
}
ChatBubble {
width: parent.width
MWLabel {
width: parent.width
text: curNotification ? curNotification.body : ""
wrapMode: Text.Wrap
}
}
}
}
states: [
State {
name: "CallNotification"
when: curNotification.type === Notification.CallNotification
PropertyChanges { target: defaultContainer; visible: false; }
PropertyChanges { target: callContainer; visible: true; }
},
State {
name: "EmailNotification"
when: curNotification.type === Notification.EmailNotification
PropertyChanges { target: defaultContainer; visible: false; }
PropertyChanges { target: emailContainer; visible: true; }
},
State {
name: "ImNotification"
when: curNotification.type === Notification.ImNotification ||
curNotification.type === Notification.SmsNotification ||
curNotification.type === Notification.MmsNotification
PropertyChanges { target: defaultContainer; visible: false; }
PropertyChanges { target: chatContainer; visible: true; }
}
]
function handlesNotification(notification) {
return false;
}
function openNotification(notification) {
scrollable.scrollTop();
curNotification = notification;
}
Connections {
target: watch
onButtonPressed: {
switch (button) {
case 1:
scrollable.scrollUp();
break;
case 2:
scrollable.scrollDown();
break;
}
}
}
}
|