diff options
Diffstat (limited to 'applications/kube-mail-mobile/MailListView.qml')
-rw-r--r-- | applications/kube-mail-mobile/MailListView.qml | 197 |
1 files changed, 197 insertions, 0 deletions
diff --git a/applications/kube-mail-mobile/MailListView.qml b/applications/kube-mail-mobile/MailListView.qml new file mode 100644 index 00000000..869ce5e5 --- /dev/null +++ b/applications/kube-mail-mobile/MailListView.qml | |||
@@ -0,0 +1,197 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 3 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | import QtQuick 2.4 | ||
19 | import QtQuick.Controls 1.3 | ||
20 | import QtQuick.Layouts 1.1 | ||
21 | |||
22 | Item { | ||
23 | id: root | ||
24 | |||
25 | property StackView stack; | ||
26 | property string folderId; | ||
27 | |||
28 | //toolbar | ||
29 | ToolBar { | ||
30 | id: toolBar | ||
31 | |||
32 | RowLayout { | ||
33 | |||
34 | width: parent.width | ||
35 | |||
36 | spacing: unit.width * 8 | ||
37 | |||
38 | ToolButton { | ||
39 | iconName: "go-previous" | ||
40 | |||
41 | onClicked: stack.pop() | ||
42 | } | ||
43 | |||
44 | Label { | ||
45 | Layout.fillWidth: true | ||
46 | |||
47 | text: "Current Folder Name" | ||
48 | } | ||
49 | |||
50 | ToolButton { | ||
51 | anchors.right: parent.right | ||
52 | |||
53 | iconName: "system-search" | ||
54 | } | ||
55 | } | ||
56 | } | ||
57 | |||
58 | //main content | ||
59 | ListView { | ||
60 | id: listView | ||
61 | |||
62 | anchors { | ||
63 | top: toolBar.bottom | ||
64 | right: parent.right | ||
65 | left: parent.left | ||
66 | bottom: parent.bottom | ||
67 | } | ||
68 | |||
69 | clip: true | ||
70 | |||
71 | model: MailListModel { } | ||
72 | |||
73 | delegate: Item { | ||
74 | id: delegateRoot | ||
75 | |||
76 | readonly property bool isCurrentItem: ListView.isCurrentItem | ||
77 | |||
78 | height: unit.width * 25 | ||
79 | width: parent.width | ||
80 | |||
81 | MouseArea { | ||
82 | id: mouseArea | ||
83 | |||
84 | anchors.fill: parent | ||
85 | |||
86 | onClicked: { | ||
87 | stack.push({"item": Qt.resolvedUrl("SingleMailView.qml"), properties: {stack: stack}}) | ||
88 | } | ||
89 | } | ||
90 | |||
91 | Rectangle { | ||
92 | anchors.fill: parent | ||
93 | |||
94 | color: colorPalette.background | ||
95 | |||
96 | |||
97 | //read | ||
98 | Rectangle { | ||
99 | anchors.fill: parent | ||
100 | |||
101 | color: colorPalette.read | ||
102 | opacity: 0.1 | ||
103 | |||
104 | visible: delegateRoot.isCurrentItem !== model.index && model.unread === false | ||
105 | } | ||
106 | |||
107 | //clickColor | ||
108 | Rectangle { | ||
109 | id: clickColor | ||
110 | anchors.fill: parent | ||
111 | |||
112 | color: colorPalette.selected | ||
113 | opacity: 0.4 | ||
114 | |||
115 | visible: mouseArea.pressed | ||
116 | } | ||
117 | |||
118 | //border | ||
119 | Rectangle { | ||
120 | anchors { | ||
121 | bottom: parent.bottom | ||
122 | } | ||
123 | |||
124 | height: 1 | ||
125 | width: parent.width | ||
126 | |||
127 | color: "#232629" //FIXME themeable? | ||
128 | opacity: 0.2 | ||
129 | } | ||
130 | } | ||
131 | |||
132 | |||
133 | Avatar { | ||
134 | id: avatar | ||
135 | anchors { | ||
136 | verticalCenter: parent.verticalCenter | ||
137 | left: parent.left | ||
138 | leftMargin: unit.width * 4 | ||
139 | } | ||
140 | |||
141 | width: unit.width * 15 | ||
142 | height: unit.width * 15 | ||
143 | |||
144 | name: model.senderName | ||
145 | |||
146 | } | ||
147 | |||
148 | Label { | ||
149 | id: senderName | ||
150 | |||
151 | anchors { | ||
152 | top: avatar.top | ||
153 | left: avatar.right | ||
154 | right: parent.right | ||
155 | leftMargin: unit.width * 2 | ||
156 | rightMargin: unit.width * 2 | ||
157 | } | ||
158 | |||
159 | text: model.senderName | ||
160 | |||
161 | font.pointSize: 12 //FIXME ? | ||
162 | } | ||
163 | |||
164 | Label { | ||
165 | id: subject | ||
166 | |||
167 | anchors { | ||
168 | top: senderName.bottom | ||
169 | left: senderName.left | ||
170 | right: parent.right | ||
171 | |||
172 | topMargin: unit.width * 2 | ||
173 | rightMargin: unit.width * 2 | ||
174 | } | ||
175 | |||
176 | text: model.subject | ||
177 | |||
178 | font.weight: Font.DemiBold | ||
179 | } | ||
180 | |||
181 | Label { | ||
182 | id: date | ||
183 | |||
184 | anchors { | ||
185 | top: avatar.top | ||
186 | right: parent.right | ||
187 | rightMargin: unit.width * 2 | ||
188 | } | ||
189 | |||
190 | text: model.date | ||
191 | |||
192 | font.weight: Font.Light | ||
193 | font.italic: true | ||
194 | } | ||
195 | } | ||
196 | } | ||
197 | } | ||