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