summaryrefslogtreecommitdiff
path: root/qmsgwatchlet/metawatch-digital.qml
blob: 43c6e1f03df51e60b0923420d418cb836aa8583d (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
import QtQuick 1.0
import QtMobility.messaging 1.1
import com.javispedro.sowatch.metawatch 1.0

MWPage {
	MWTitle {
		id: title
		anchors.top: parent.top
		anchors.left: parent.left
		anchors.right: parent.right
		text: qsTr("Inbox")
		icon.source: "icon.png"
	}

	MWListView {
		id: list
		anchors.top: title.bottom
		anchors.left: parent.left
		anchors.right: parent.right
		anchors.bottom: parent.bottom
		model: MessageModel {
			sortBy: MessageModel.Timestamp
			sortOrder: MessageModel.DescendingOrder
			filter: MessageIntersectionFilter {
					MessageFilter {
						type: MessageFilter.Type
						comparator: MessageFilter.Equal
						value: MessageFilter.Email
					}
					MessageFilter {
						type: MessageFilter.StandardFolder
						comparator: MessageFilter.Equal
						value: MessageFilter.InboxFolder
					}
			}
			limit: 20
		}
		delegate: Rectangle {
			property bool selected: ListView.isCurrentItem
			width: list.width
			height: childrenRect.height
			color: ListView.isCurrentItem ? "black" : "white"
			Text {
				width: 96
				text: "<b>" + sender + "</b><br>" + subject
				wrapMode: Text.WrapAtWordBoundaryOrAnywhere
				color: parent.selected ? "white" : "black"
			}
		}
	}

	Connections {
		target: watch
		onButtonPressed : {
			switch (button) {
			case 1:
				list.scrollUp();
				break;
			case 2:
				list.scrollDown();
				break;
			}
		}
	}
}