Dekko
Loading...
Searching...
No Matches
NavSideBar.qml
1import QtQuick 2.4
2import Lomiri.Components 1.3
3import Dekko.Mail 1.0
4import Dekko.Mail.Accounts 1.0
5import Dekko.Mail.API 1.0
6import Dekko.Mail.Settings 1.0
7import Dekko.Mail.Stores.Accounts 1.0
8import Dekko.Mail.Stores.Mail 1.0
9import Dekko.Mail.Stores.Views 1.0
10import Dekko.Components 1.0
11import MazDB 1.0
12import PlugMan 1.0
13import Dekko.Lomiri.Components 1.0
14import "../delegates"
16StyledItem {
17 width: parent.width
18 height: parent.height
19
20 property bool panelMode: false
21
22 theme: ThemeSettings{
23 name: "Lomiri.Components.Themes.SuruDark"
24 }
25
26 MazDBSettings {
27 category: "ui-property-cache"
28 property alias smartFoldersExpanded: smf.expanded
29 property alias accountFoldersExpanded: acg.expanded
30 }
31
32 Rectangle {
33 anchors.fill: parent
34 color: LomiriColors.inkstone
35 }
36
38 id: headerRegistry
39 location: "Dekko::Mail::NavHeadAction"
40 defaultActions: [
41 Action {
42 iconName: "edit"
43 onTriggered: ViewActions.openComposer()
44 visible: dekko.isLargeFF
45 },
46 Action {
47 iconName: "like"
48 visible: dekko.isSmallFF
49 },
50 Action {
51 iconName: "settings"
52 visible: dekko.isSmallFF
53 onTriggered: ViewActions.openSettings()
54 }
55 ]
56 }
57
58 StretchColumn {
59 anchors {
60 fill: parent
61 }
62
63 Item {
64 width: parent.width
65 height: units.gu(5)
66 implicitHeight: height
67 visible: !dekko.isMediumFF
68
69 StretchRow {
70 anchors {
71 leftMargin: units.gu(1)
72 fill: parent
73 rightMargin: units.gu(1)
74 }
75
77 height: units.gu(5.5)
78 width: units.gu(5)
79 implicitWidth: width
80 iconColor: LomiriColors.silk
81 iconSize: units.gu(2.5)
82 highlightColor: LomiriColors.slate
83 action: Action {
84 visible: dekko.isSmallFF
85 iconName: "navigation-menu"
86 onTriggered: ViewActions.toggleNavDrawer()
87 }
88 }
89
90 Stretcher {}
91
92 Repeater {
93 model: headerRegistry.actions
94 delegate: HeaderButton {
95 height: units.gu(5.5)
96 width: units.gu(5)
97 implicitWidth: width
98 iconColor: LomiriColors.silk
99 iconSize: units.gu(2.5)
100 highlightColor: LomiriColors.slate
101 action: modelData
102 }
103 }
104 }
105 }
106
107 Stretcher {
108 anchors {
109 left: parent.left
110 right: parent.right
111 }
112
113 ScrollView {
114 anchors.fill: parent
115 Flickable {
116 anchors.fill: parent
117 contentHeight: col.height
118
119 Column {
120 id: col
121 anchors {
122 left: parent.left
123 right: parent.right
124 top: parent.top
125 }
126
127 Repeater {
128 id: inboxList
129 model: MailboxStore.standardFoldersModel
131 id: folderDelegate
132 folder: qtObject
133 supportsDescendents: true
134 onClicked: {
135 if (model.index === 0) {
136 MessageActions.openFolder(folder.displayName, folder.descendentsKey)
137 } else {
138 MessageActions.openFolder(folder.displayName, folder.messageKey)
139 }
140 }
141 onSubFolderClicked: MessageActions.openFolder(name, key)
142 Component.onCompleted: {
143 if (model.index === 0 && !panelMode) {
144 ViewActions.delayCallWithArgs(MessageKeys.openFolder, {
145 folderName: folder.displayName,
146 folderKey: folder.descendentsKey
147 })
148 }
149 }
150 }
151 }
152
154 id: smf
155 title: qsTr("Smart folders")
156 model: MailboxStore.smartFoldersModel
157// expansion.expanded: PolicyManager.views.smartFoldersExpanded
158// onExpandClicked: PolicyManager.views.smartFoldersExpanded = !PolicyManager.views.smartFoldersExpanded
159 delegate: SmartFolderDelegate {
160 id: smartFolderDelegate
161 folder: qtObject
162 smartFolder: true
163 onClicked: MessageActions.openFolder(folder.displayName, folder.messageKey)
164 }
165 }
166
168 id: acg
169 title: qsTr("Folders")
170 model: AccountStore.receiveAccountsModel
171// expansion.expanded: PolicyManager.views.accountsExpanded
172// onExpandClicked: PolicyManager.views.accountsExpanded = !PolicyManager.views.accountsExpanded
173 delegate: ListItem {
174 height: dLayout.height
175 divider.visible: false
176 onClicked: MessageActions.openAccountFolder(qtObject.name, qtObject.id)
177 Rectangle {
178 anchors.fill: parent
179 color: Qt.rgba(0, 0, 0, 0.05)
180 visible: dLayout ? dLayout.title.text === ViewStore.selectedNavFolder : false
181 }
182 ListItemLayout {
183 id: dLayout
184 height: units.gu(6)
185 title.text: qtObject.name
186 Icon {
187 height: units.gu(2.5)
188 width: height
189 name: "contact"
190 SlotsLayout.position: SlotsLayout.Leading
191 }
192 ProgressionSlot{}
193 }
194 }
195 }
196// Item {
197// anchors {
198// left: parent.left
199// right: parent.right
200// }
201// height: lbl.height + units.gu(2)
202// implicitHeight: height
203// Label {
204// id: lbl
205// anchors {
206// left: parent.left
207// leftMargin: units.gu(1)
208// right: parent.right
209// verticalCenter: parent.verticalCenter
210// }
211// text: "Smart Folders"
212// color: LomiriColors.ash
213// }
214// }
215// Line {
216// anchors {
217// left: parent.left
218// leftMargin: units.gu(1)
219// right: parent.right
220// rightMargin: units.gu(1)
221// }
222// color: LomiriColors.slate
223// }
224
225
226// ListItem {
227// implicitHeight: i1.implicitHeight
228// divider.visible: false
229// highlightColor: LomiriColors.ash
230// ListItemLayout {
231// title.text: "Today"
232// title.font.weight: Font.DemiBold
233// title.color: LomiriColors.silk
234// Icon {
235// name: "calendar-today"
236// color: LomiriColors.silk
237// height: units.gu(2.2)
238// width: height
239
240// SlotsLayout.position: SlotsLayout.Leading
241// }
242// }
243// onClicked: console.log("Clicked")
244// }
245// ListItem {
246// implicitHeight: i1.implicitHeight
247// divider.visible: false
248// highlightColor: LomiriColors.ash
249// ListItemLayout {
250// title.text: "Todo"
251// title.font.weight: Font.DemiBold
252// title.color: LomiriColors.silk
253// Icon {
254// name: "view-list-symbolic"
255// color: LomiriColors.silk
256// height: units.gu(2.2)
257// width: height
258
259// SlotsLayout.position: SlotsLayout.Leading
260// }
261// }
262// onClicked: console.log("Clicked")
263// }
264// ListItem {
265// implicitHeight: i1.implicitHeight
266// divider.visible: false
267// highlightColor: LomiriColors.ash
268// ListItemLayout {
269// title.text: "Done"
270// title.font.weight: Font.DemiBold
271// title.color: LomiriColors.silk
272// Icon {
273// name: "tick"
274// color: LomiriColors.silk
275// height: units.gu(2.2)
276// width: height
277
278// SlotsLayout.position: SlotsLayout.Leading
279// }
280// }
281// onClicked: console.log("Clicked")
282// }
283
284// ListItem {
285// implicitHeight: i1.implicitHeight
286// divider.visible: false
287// highlightColor: LomiriColors.ash
288// ListItemLayout {
289// title.text: "Mailing Lists"
290// title.font.weight: Font.DemiBold
291// title.color: LomiriColors.silk
292// Icon {
293// name: "contact-group"
294// color: LomiriColors.silk
295// height: units.gu(2.2)
296// width: height
297
298// SlotsLayout.position: SlotsLayout.Leading
299// }
300// }
301// onClicked: console.log("Clicked")
302// }
303// ListItem {
304// implicitHeight: i1.implicitHeight
305// divider.visible: false
306// highlightColor: LomiriColors.ash
307// ListItemLayout {
308// title.text: "Search: \"dekko-dev\""
309// title.font.weight: Font.DemiBold
310// title.color: LomiriColors.silk
311// Icon {
312// name: "search"
313// color: LomiriColors.silk
314// height: units.gu(2.2)
315// width: height
316
317// SlotsLayout.position: SlotsLayout.Leading
318// }
319// }
320// onClicked: console.log("Clicked")
321// }
322
323// Item {
324// anchors {
325// left: parent.left
326// right: parent.right
327// }
328// height: lbl2.height + units.gu(2)
329// implicitHeight: height
330// Label {
331// id: lbl2
332// anchors {
333// left: parent.left
334// leftMargin: units.gu(1)
335// right: parent.right
336// verticalCenter: parent.verticalCenter
337// }
338// text: "Folders"
339// color: LomiriColors.ash
340// }
341// }
342
343// Line {
344// anchors {
345// left: parent.left
346// leftMargin: units.gu(1)
347// right: parent.right
348// rightMargin: units.gu(1)
349// }
350// color: LomiriColors.slate
351// }
352
353// Item {
354// height: tf.height + units.gu(2)
355// implicitHeight: height
356// width: parent.width
357// TextField {
358// id: tf
359// anchors {
360// left: parent.left
361// leftMargin: units.gu(2)
362// right: parent.right
363// rightMargin: units.gu(2)
364// verticalCenter: parent.verticalCenter
365// }
366// placeholderText: "Search folders"
367// }
368// }
369
370// ListItem {
371// implicitHeight: i1.implicitHeight
372// divider.visible: false
373// highlightColor: LomiriColors.ash
374// ListItemLayout {
375// title.text: "GMail"
376// title.font.weight: Font.DemiBold
377// title.color: LomiriColors.silk
378// Icon {
379// name: "contact"
380// color: LomiriColors.silk
381// height: units.gu(2.2)
382// width: height
383
384// SlotsLayout.position: SlotsLayout.Leading
385// }
386// }
387// onClicked: console.log("Clicked")
388// }
389// ListItem {
390// implicitHeight: i1.implicitHeight
391// divider.visible: false
392// highlightColor: LomiriColors.ash
393// ListItemLayout {
394// title.text: "Dekko"
395// title.font.weight: Font.DemiBold
396// title.color: LomiriColors.silk
397// Icon {
398// name: "contact"
399// color: LomiriColors.silk
400// height: units.gu(2.2)
401// width: height
402
403// SlotsLayout.position: SlotsLayout.Leading
404// }
405// }
406// onClicked: console.log("Clicked")
407// }
408// ListItem {
409// implicitHeight: i1.implicitHeight
410// divider.visible: false
411// highlightColor: LomiriColors.ash
412// ListItemLayout {
413// title.text: "Home"
414// title.font.weight: Font.DemiBold
415// title.color: LomiriColors.silk
416// Icon {
417// name: "contact"
418// color: LomiriColors.silk
419// height: units.gu(2.2)
420// width: height
421
422// SlotsLayout.position: SlotsLayout.Leading
423// }
424// }
425// onClicked: console.log("Clicked")
426// }
427 }
428 }
429 }
430 }
431 }
432}