summaryrefslogtreecommitdiffstats
path: root/components/package/contents/ui/MailListView.qml
diff options
context:
space:
mode:
Diffstat (limited to 'components/package/contents/ui/MailListView.qml')
-rw-r--r--components/package/contents/ui/MailListView.qml238
1 files changed, 131 insertions, 107 deletions
diff --git a/components/package/contents/ui/MailListView.qml b/components/package/contents/ui/MailListView.qml
index 0066ca6c..6ec86aee 100644
--- a/components/package/contents/ui/MailListView.qml
+++ b/components/package/contents/ui/MailListView.qml
@@ -119,138 +119,162 @@ 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// CheckBox { 186 Drag.hotSpot.x: Kirigami.Units.gridUnit * 2
156// id: checkBox 187 Drag.hotSpot.y: height / 2
157//
158// anchors.verticalCenter: parent.verticalCenter
159//
160// visible: mailListDelegate.containsMouse == true || checked
161// }
162 188
163 Column { 189 MouseArea {
164 id: mainContent 190 id: mouseArea
165 191
166 anchors { 192 anchors.fill: parent
167 verticalCenter: parent.verticalCenter
168 left: parent.left
169 leftMargin: Kirigami.Units.largeSpacing
170 }
171 193
172 Text{ 194 hoverEnabled: true
173 text: model.subject 195 drag.target: parent
174 color: mailListDelegate.checked ? Kirigami.Theme.highlightedTextColor : model.unread ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor
175 196
176 maximumLineCount: 2 197 onClicked: {
177 width: mailListDelegate.width - Kirigami.Units.largeSpacing * 2 - unreadCounter.width 198 listView.currentIndex = index
178 wrapMode: Text.Wrap
179 elide: Text.ElideRight
180 }
181
182 Text {
183 width: mailListDelegate.width - Kirigami.Units.largeSpacing * 2 - unreadCounter.width
184 text: model.senderName
185 font.italic: true
186 color: mailListDelegate.checked ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
187 elide: Text.ElideRight
188 } 199 }
189 } 200 }
190 201
191 Text { 202 Rectangle {
192 anchors { 203 id: background
193 right: parent.right 204
194 bottom: parent.bottom 205 anchors.fill: parent
195 }
196 text: Qt.formatDateTime(model.date, "dd MMM yyyy")
197 font.italic: true
198 color: mailListDelegate.checked ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.disabledTextColor
199 font.pointSize: 9
200 206
201 //visible: mailListDelegate.containsMouse == false 207 color: Kirigami.Theme.viewBackgroundColor
202 208
209 border.color: Kirigami.Theme.backgroundColor
210 border.width: 1
203 } 211 }
204 212
205 Text { 213 Item {
206 id: unreadCounter 214 id: content
207 215
208 anchors { 216 anchors {
217 top: parent.top
218 bottom: parent.bottom
219 left: parent.left
209 right: parent.right 220 right: parent.right
221 margins: Kirigami.Units.smallSpacing
210 } 222 }
211 223
212 visible: model.threadSize > 1 224 Column {
225 anchors {
226 verticalCenter: parent.verticalCenter
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 }
213 253
214 font.italic: true 254 Text {
215 text: model.threadSize 255 id: date
216 color: mailListDelegate.checked ? Kirigami.Theme.highlightedTextColor : model.unread ? "#1d99f3" : Kirigami.Theme.disabledTextColor
217 }
218 256
219// Row { 257 anchors {
220// id: actionButtons 258 right: parent.right
221// 259 bottom: parent.bottom
222// anchors { 260 }
223// right: parent.right 261 text: Qt.formatDateTime(model.date, "dd MMM yyyy")
224// bottom: parent.bottom 262 font.italic: true
225// } 263 color: Kirigami.Theme.disabledTextColor
226// 264 font.pointSize: 9
227// visible: mailListDelegate.containsMouse == true 265 }
228// spacing: Kirigami.Units.smallSpacing 266
229// 267 Text {
230// Controls.ToolButton { 268 id: threadCounter
231// iconName: "mail-mark-unread" 269
232// enabled: mailController.markAsReadAction.enabled 270 anchors {
233// onClicked: { 271 right: parent.right
234// //mailController.markAsReadAction.execute() 272 }
235// } 273 text: model.threadSize
236// } 274 color: model.unread ? Kirigami.Theme.highlightColor : Kirigami.Theme.disabledTextColor
237// 275 visible: model.threadSize > 1
238// Controls.ToolButton { 276 }
239// iconName: "mail-mark-important" 277 }
240// enabled: mailController.markAsImportantAction.enabled
241// onClicked: {
242// //mailController.markAsImportantAction.execute()
243// }
244// }
245//
246// Controls.ToolButton {
247// iconName: "edit-delete"
248// enabled: mailController.moveToTrashAction.enabled
249// onClicked: {
250// //mailController.moveToTrashAction.execute()
251// }
252// }
253// }
254 } 278 }
255 } 279 }
256 } 280 }