diff options
Diffstat (limited to 'components/package/contents/ui/MailListView.qml')
-rw-r--r-- | components/package/contents/ui/MailListView.qml | 199 |
1 files changed, 127 insertions, 72 deletions
diff --git a/components/package/contents/ui/MailListView.qml b/components/package/contents/ui/MailListView.qml index 68db1c43..6ec86aee 100644 --- a/components/package/contents/ui/MailListView.qml +++ b/components/package/contents/ui/MailListView.qml | |||
@@ -89,7 +89,7 @@ Item { | |||
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | ListView { | 92 | ListView { |
93 | id: listView | 93 | id: listView |
94 | 94 | ||
95 | anchors.top: toolbar.bottom | 95 | anchors.top: toolbar.bottom |
@@ -119,106 +119,161 @@ Item { | |||
119 | parentFolder: root.parentFolder | 119 | parentFolder: root.parentFolder |
120 | } | 120 | } |
121 | 121 | ||
122 | delegate: Kirigami.AbstractListItem { | 122 | delegate: Item { |
123 | id: mailListDelegate | 123 | id: origin |
124 | 124 | ||
125 | width: scrollbar.visible ? listView.width - scrollbar.width : listView.width | 125 | width: delegateRoot.width |
126 | height: Kirigami.Units.gridUnit * 4.5 | 126 | height: delegateRoot.height |
127 | 127 | ||
128 | enabled: true | 128 | QtQml.Binding { |
129 | supportsMouseEvents: true | 129 | target: root |
130 | 130 | property: "currentMail" | |
131 | checked: listView.currentIndex == index | 131 | when: listView.currentIndex == index |
132 | onClicked: { | 132 | value: model.domainObject |
133 | listView.currentIndex = model.index | 133 | } |
134 | QtQml.Binding { | ||
135 | target: root | ||
136 | property: "isDraft" | ||
137 | when: listView.currentIndex == index | ||
138 | value: model.draft | ||
134 | } | 139 | } |
135 | 140 | ||
136 | //Content | ||
137 | Item { | 141 | Item { |
138 | width: parent.width | 142 | id: delegateRoot |
139 | height: parent.height | 143 | |
140 | 144 | width: scrollbar.visible ? listView.width - scrollbar.width : listView.width | |
141 | QtQml.Binding { | 145 | height: Kirigami.Units.gridUnit * 5 |
142 | target: root | 146 | |
143 | property: "currentMail" | 147 | states: [ |
144 | when: listView.currentIndex == index | 148 | State { |
145 | value: model.domainObject | 149 | name: "dnd" |
146 | } | 150 | when: mouseArea.drag.active |
147 | QtQml.Binding { | 151 | |
148 | target: root | 152 | PropertyChanges {target: mouseArea; cursorShape: Qt.ClosedHandCursor} |
149 | property: "isDraft" | 153 | PropertyChanges {target: delegateRoot; x: x; y:y} |
150 | when: listView.currentIndex == index | 154 | PropertyChanges {target: delegateRoot; parent: root} |
151 | value: model.draft | 155 | |
156 | PropertyChanges {target: delegateRoot; opacity: 0.7} | ||
157 | PropertyChanges {target: background; color: Kirigami.Theme.highlightColor} | ||
158 | PropertyChanges {target: subject; color: Kirigami.Theme.highlightedTextColor} | ||
159 | PropertyChanges {target: sender; color: Kirigami.Theme.highlightedTextColor} | ||
160 | PropertyChanges {target: date; color: Kirigami.Theme.highlightedTextColor} | ||
161 | PropertyChanges {target: threadCounter; color: Kirigami.Theme.highlightedTextColor} | ||
162 | }, | ||
163 | State { | ||
164 | name: "selected" | ||
165 | when: listView.currentIndex == index && !mouseArea.drag.active | ||
166 | |||
167 | PropertyChanges {target: background; color: Kirigami.Theme.highlightColor} | ||
168 | PropertyChanges {target: subject; color: Kirigami.Theme.highlightedTextColor} | ||
169 | PropertyChanges {target: sender; color: Kirigami.Theme.highlightedTextColor} | ||
170 | PropertyChanges {target: date; color: Kirigami.Theme.highlightedTextColor} | ||
171 | PropertyChanges {target: threadCounter; color: Kirigami.Theme.highlightedTextColor} | ||
172 | }, | ||
173 | State { | ||
174 | name: "hovered" | ||
175 | when: mouseArea.containsMouse && !mouseArea.drag.active | ||
176 | |||
177 | PropertyChanges {target: background; color: Kirigami.Theme.buttonHoverColor; opacity: 0.7} | ||
178 | PropertyChanges {target: subject; color: Kirigami.Theme.highlightedTextColor} | ||
179 | PropertyChanges {target: sender; color: Kirigami.Theme.highlightedTextColor} | ||
180 | PropertyChanges {target: date; color: Kirigami.Theme.highlightedTextColor} | ||
181 | PropertyChanges {target: threadCounter; color: Kirigami.Theme.highlightedTextColor} | ||
152 | } | 182 | } |
183 | ] | ||
153 | 184 | ||
154 | //TODO implement bulk action | 185 | Drag.active: mouseArea.drag.active |
155 | // Controls.CheckBox { | 186 | Drag.hotSpot.x: Kirigami.Units.gridUnit * 2 |
156 | // visible: mailListDelegate.containsMouse == true | 187 | Drag.hotSpot.y: height / 2 |
157 | // } | ||
158 | 188 | ||
159 | Column { | 189 | MouseArea { |
160 | anchors { | 190 | id: mouseArea |
161 | verticalCenter: parent.verticalCenter | ||
162 | left: parent.left | ||
163 | leftMargin: Kirigami.Units.largeSpacing | ||
164 | } | ||
165 | 191 | ||
166 | Text{ | 192 | anchors.fill: parent |
167 | text: model.subject | ||
168 | color: mailListDelegate.checked ? Kirigami.Theme.highlightedTextColor : model.unread ? "#1d99f3" : Kirigami.Theme.textColor | ||
169 | 193 | ||
170 | maximumLineCount: 2 | 194 | hoverEnabled: true |
171 | width: mailListDelegate.width - Kirigami.Units.gridUnit * 3 | 195 | drag.target: parent |
172 | wrapMode: Text.WrapAnywhere | ||
173 | elide: Text.ElideRight | ||
174 | } | ||
175 | 196 | ||
176 | Text { | 197 | onClicked: { |
177 | text: model.senderName | 198 | listView.currentIndex = index |
178 | font.italic: true | ||
179 | color: mailListDelegate.checked ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor | ||
180 | width: mailListDelegate.width - Kirigami.Units.gridUnit * 3 | ||
181 | elide: Text.ElideRight | ||
182 | } | 199 | } |
183 | } | 200 | } |
184 | 201 | ||
185 | Text { | 202 | Rectangle { |
186 | anchors { | 203 | id: background |
187 | right: parent.right | 204 | |
188 | bottom: parent.bottom | 205 | anchors.fill: parent |
189 | } | 206 | |
190 | text: Qt.formatDateTime(model.date, "dd MMM yyyy") | 207 | color: Kirigami.Theme.viewBackgroundColor |
191 | font.italic: true | ||
192 | color: mailListDelegate.checked ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.disabledTextColor | ||
193 | font.pointSize: 9 | ||
194 | } | ||
195 | 208 | ||
209 | border.color: Kirigami.Theme.backgroundColor | ||
210 | border.width: 1 | ||
211 | } | ||
196 | 212 | ||
197 | Item { | 213 | Item { |
214 | id: content | ||
215 | |||
198 | anchors { | 216 | anchors { |
217 | top: parent.top | ||
218 | bottom: parent.bottom | ||
219 | left: parent.left | ||
199 | right: parent.right | 220 | right: parent.right |
221 | margins: Kirigami.Units.smallSpacing | ||
200 | } | 222 | } |
201 | 223 | ||
202 | height: Kirigami.Units.gridUnit * 1.2 | 224 | Column { |
203 | width: height | 225 | anchors { |
204 | 226 | verticalCenter: parent.verticalCenter | |
205 | visible: !mailListDelegate.checked | 227 | left: parent.left |
228 | leftMargin: Kirigami.Units.largeSpacing | ||
229 | } | ||
230 | |||
231 | Text{ | ||
232 | id: subject | ||
233 | |||
234 | text: model.subject | ||
235 | color: model.unread ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor | ||
236 | |||
237 | maximumLineCount: 2 | ||
238 | width: content.width - Kirigami.Units.gridUnit * 3 | ||
239 | wrapMode: Text.WrapAnywhere | ||
240 | elide: Text.ElideRight | ||
241 | } | ||
242 | |||
243 | Text { | ||
244 | id: sender | ||
245 | |||
246 | text: model.senderName | ||
247 | font.italic: true | ||
248 | color: Kirigami.Theme.textColor | ||
249 | width: delegateRoot.width - Kirigami.Units.gridUnit * 3 | ||
250 | elide: Text.ElideRight | ||
251 | } | ||
252 | } | ||
206 | 253 | ||
207 | Rectangle { | 254 | Text { |
208 | anchors.fill: parent | 255 | id: date |
209 | 256 | ||
210 | opacity: model.unread ? 1 : 0.5 | 257 | anchors { |
211 | radius: 80 | 258 | right: parent.right |
212 | color: model.unread ? Kirigami.Theme.highlightColor : Kirigami.Theme.disabledTextColor | 259 | bottom: parent.bottom |
260 | } | ||
261 | text: Qt.formatDateTime(model.date, "dd MMM yyyy") | ||
262 | font.italic: true | ||
263 | color: Kirigami.Theme.disabledTextColor | ||
264 | font.pointSize: 9 | ||
213 | } | 265 | } |
214 | 266 | ||
215 | Text { | 267 | Text { |
216 | anchors.centerIn: parent | 268 | id: threadCounter |
217 | 269 | ||
270 | anchors { | ||
271 | right: parent.right | ||
272 | } | ||
218 | text: model.threadSize | 273 | text: model.threadSize |
219 | color: Kirigami.Theme.highlightedTextColor | 274 | color: model.unread ? Kirigami.Theme.highlightColor : Kirigami.Theme.disabledTextColor |
275 | visible: model.threadSize > 1 | ||
220 | } | 276 | } |
221 | |||
222 | } | 277 | } |
223 | } | 278 | } |
224 | } | 279 | } |