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 function getIconForFolderType(f) {
43 case SmartFolderSet.SmartTodayFolder:
44 return Icons.CalendarTodayIcon;
45 case SmartFolderSet.SmartTodoFolder:
46 return Icons.ViewListSymbolic;
47 case SmartFolderSet.SmartDoneFolder:
48 return Icons.SelectIcon;
49 case SmartFolderSet.SmartCustomFolder:
50 return Icons.FilterIcon;
52 return Icons.FilterIcon;
57 anchors.fill: layout ? layout : parent
58 color: Qt.rgba(0, 0, 0, 0.05)
59 visible: li.isCurrentIndex
63 acceptedButtons: Qt.RightButton
65 if (mouse.button === Qt.RightButton) {
66 PopupUtils.open(Qt.resolvedUrl(
"../popovers/NavViewContextMenu.qml"), li, {folder: li.folder})
69 mouse.accepted =
false
76 title.text: folder ? folder.displayName :
""
77 title.font.weight: Font.DemiBold
78 title.color: LomiriColors.silk
85 name: folder ? getIconForFolderType(folder) :
""
86 color: LomiriColors.silk
87 SlotsLayout.position: SlotsLayout.Leading
93 visible: folder && folder.smartCount > 0
94 aspect: LomiriShape.Flat
95 color: LomiriColors.slate
97 width: countLable.width < height ? height : countLable.width + units.gu(1)
100 anchors.margins: units.gu(0.5)
101 anchors.centerIn: parent
103 color: LomiriColors.porcelain
104 text: folder ? folder.smartCount :
""
109 visible: model.index === 0 && supportsDescendents
113 anchors.left: parent.left
114 height: parent.height
116 color: LomiriColors.slate
119 height:
Style.defaultSpacing
121 anchors.right: parent.right
122 anchors.rightMargin: units.gu(0.5)
123 anchors.verticalCenter: parent.verticalCenter
124 name: li.expansion.expanded ?
"up" :
"down"
126 SlotsLayout.position: SlotsLayout.Last
129 onClicked: li.expansion.expanded = !li.expansion.expanded
135 visible: folder && folder.hasDescendents
136 anchors.left: parent.left
137 anchors.leftMargin: units.gu(1.5)
138 anchors.top: layout.bottom
139 anchors.right: parent.right
141 model: folder ? folder.descendents : 0
144 divider.visible: false
145 height: dlayout.height
146 onClicked: li.subFolderClicked(dlayout.title.text, model.qtObject.messageKey)
149 color: Qt.rgba(0, 0, 0, 0.05)
150 visible: layout ? dlayout.title.text === ViewStore.selectedNavFolder : false
155 title.text: qsTr(
"Inbox (%1)").arg(qtObject.displayName)
156 title.color: LomiriColors.silk
159 height: units.gu(2.4)
161 name: Icons.InboxIcon
162 color: LomiriColors.silk
163 SlotsLayout.position: SlotsLayout.Leading
168 visible: qtObject.smartCount > 0
169 aspect: LomiriShape.Flat
170 color: LomiriColors.slate
171 height: units.gu(2.2)
172 width: dcountLable.width < height ? height : dcountLable.width + units.gu(1)
175 anchors.margins: units.gu(0.5)
176 anchors.centerIn: parent
177 text: qtObject.smartCount
179 color: LomiriColors.porcelain