19import Lomiri.Components 1.3
20import Lomiri.Components.Popups 1.3
22import Dekko.Components 1.0
23import Dekko.Mail.Stores.Views 1.0
24import Dekko.Lomiri.Components 1.0
25import Dekko.Lomiri.Constants 1.0
31 signal subFolderClicked(string name, var key)
32 property bool supportsDescendents: false
33 property bool smartFolder: false
34 readonly property bool isCurrentIndex: layout ? layout.title.text === ViewStore.selectedNavFolder : false
36 expansion.expanded: false
37 expansion.height: layout.height + col.height
39 divider.visible: false
41 trailingActions: ListItemActions {
47 function getIconForFolderType(f) {
50 case SmartFolderSet.SmartTodayFolder:
51 return Icons.CalendarTodayIcon;
52 case SmartFolderSet.SmartTodoFolder:
53 return Icons.ViewListSymbolic;
54 case SmartFolderSet.SmartDoneFolder:
55 return Icons.SelectIcon;
56 case SmartFolderSet.SmartCustomFolder:
57 return Icons.FilterIcon;
59 return Icons.FilterIcon;
62 switch (f.folderType) {
63 case StandardFolderSet.StandardFolder:
64 return Icons.FolderIcon
65 case StandardFolderSet.SpecialUseInboxFolder:
66 if (f.hasDescendents) {
67 return Icons.CombineInboxIcon
69 return Icons.InboxIcon
71 case StandardFolderSet.SpecialUseOutboxFolder:
72 return Icons.InboxIcon
73 case StandardFolderSet.SpecialUseDraftsFolder:
74 return Icons.DraftIcon
75 case StandardFolderSet.SpecialUseSentFolder:
76 return Icons.SendIcon;
77 case StandardFolderSet.SpecialUseTrashFolder:
78 return Icons.DeleteIcon
79 case StandardFolderSet.SpecialUseJunkFolder:
89 iconName:
"contextual-menu"
90 onTriggered: PopupUtils.open(Qt.resolvedUrl(
"../popovers/NavViewContextMenu.qml"), li, {folder: li.folder})
94 anchors.fill: layout ? layout : parent
95 color: Qt.rgba(0, 0, 0, 0.05)
96 visible: li.isCurrentIndex
100 acceptedButtons: Qt.RightButton
102 if (mouse.button === Qt.RightButton) {
103 openCtxtMenu.trigger()
104 mouse.accepted =
true
106 mouse.accepted =
false
113 title.text: folder ? folder.displayName :
""
114 title.font.weight: Font.DemiBold
115 title.color: LomiriColors.silk
120 height: units.gu(2.6)
122 name: folder ? getIconForFolderType(folder) :
""
123 color: LomiriColors.silk
124 SlotsLayout.position: SlotsLayout.Leading
130 visible: folder && folder.unreadCount > 0
131 aspect: LomiriShape.Flat
132 color: LomiriColors.slate
133 height: units.gu(2.2)
134 width: countLable.width < height ? height : countLable.width + units.gu(1)
137 anchors.margins: units.gu(0.5)
138 anchors.centerIn: parent
140 color: LomiriColors.porcelain
141 text: folder ? folder.unreadCount :
""
146 visible: model.index === 0 && supportsDescendents
150 anchors.left: parent.left
151 height: parent.height
153 color: LomiriColors.slate
156 height:
Style.defaultSpacing
158 anchors.right: parent.right
159 anchors.rightMargin: units.gu(0.5)
160 anchors.verticalCenter: parent.verticalCenter
161 name: li.expansion.expanded ?
"up" :
"down"
163 SlotsLayout.position: SlotsLayout.Last
166 onClicked: li.expansion.expanded = !li.expansion.expanded
172 visible: folder && folder.hasDescendents
173 anchors.left: parent.left
174 anchors.leftMargin: units.gu(1.5)
175 anchors.top: layout.bottom
176 anchors.right: parent.right
178 model: folder ? folder.descendents : 0
181 divider.visible: false
182 height: dlayout.height
183 onClicked: li.subFolderClicked(dlayout.title.text, model.qtObject.messageKey)
186 color: Qt.rgba(0, 0, 0, 0.05)
187 visible: layout ? dlayout.title.text === ViewStore.selectedNavFolder : false
192 title.text: qsTr(
"Inbox (%1)").arg(qtObject.displayName)
193 title.color: LomiriColors.silk
196 height: units.gu(2.4)
198 name: Icons.InboxIcon
199 color: LomiriColors.silk
200 SlotsLayout.position: SlotsLayout.Leading
205 visible: qtObject.unreadCount > 0
206 aspect: LomiriShape.Flat
207 color: LomiriColors.slate
208 height: units.gu(2.2)
209 width: dcountLable.width < height ? height : dcountLable.width + units.gu(1)
212 anchors.margins: units.gu(0.5)
213 anchors.centerIn: parent
214 text: qtObject.unreadCount
216 color: LomiriColors.porcelain