summaryrefslogtreecommitdiff
path: root/metawatchwatchlets/metawatch-digital-notification.qml
blob: 72f7bc9e1fb682b6f496ff8ba63dd5f188be8299 (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
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
	}

	Item {
		id: container
		anchors.top: title.bottom
		anchors.bottom: parent.bottom
		anchors.left: parent.left
		anchors.right: parent.right

		Item {
			id: emailContainer
			visible: curNotification.type === Notification.EmailNotification
			anchors.fill: parent

			MWLabel {
				anchors.centerIn: parent
				text: "Email"
			}
		}

		Item {
			id: chatContainer
			visible: curNotification.type === Notification.ImNotification
			anchors.fill: parent

			MWLabel {
				id: chatTitle
				text: curNotification.title
			}

			Image {
				x: 20
				y: chatBubble.y - 8
				source: "bubble_tip.png"
				z: 1
			}

			BorderImage {
				id: chatBubble
				anchors {
					top: chatTitle.bottom; left: parent.left; right: parent.right;
					leftMargin: 2; topMargin: 8; rightMargin: 2; bottomMargin: 2;
				}
				border { left: 16; top: 16; right: 16; bottom: 16; }
				height: childrenRect.height + 16
				source: "bubble.png"

				MWLabel {
					anchors {
						top: parent.top; left: parent.left; right: parent.right;
						margins: 16 / 2
					}
					text: curNotification.body
					width: parent.width
					wrapMode: Text.Wrap
				}
			}
		}
	}



	function handlesNotification(notification) {
		return false;
	}

	function openNotification(notification) {
		curNotification = notification;
	}
}