Dekko
Loading...
Searching...
No Matches
NavPluginSideBar.qml
1import QtQuick 2.4
2import Lomiri.Components 1.3
3import Dekko.Mail.API 1.0
4import Dekko.Components 1.0
5import MazDB 1.0
6import Dekko.Lomiri.Components 1.0
7import Dekko.Mail.Stores.Views 1.0
8
9Rectangle {
10 id: bar
11 color: LomiriColors.inkstone
12
13 NavPluginModel {
14 id: navPlugins
15 }
16
17 Line {
18 anchors {
19 right: parent.right
20 top: parent.top
21 bottom: parent.bottom
22 }
23 color: LomiriColors.slate
24 }
25
26 StretchColumn {
27 anchors.fill: parent
28
29 AbstractButton {
30 id: drawerBtn
31 height: units.gu(6)
32 width: bar.width
33 implicitHeight: height
34 visible: !dekko.isLargeFF
35
36 onClicked: ViewActions.toggleNavDrawer()
37
38 Rectangle {
39 anchors.fill: parent
40 visible: drawerBtn.pressed
41 color: LomiriColors.slate
42 }
43
44 Icon {
45 name: "navigation-menu"
46 color: LomiriColors.silk
47 height: units.gu(3)
48 width: height
49 anchors.centerIn: parent
50 }
51
52 }
53
54 Line {
55 color: LomiriColors.slate
56 visible: !dekko.isLargeFF
57 anchors {
58 left: parent.left
59 right: parent.right
60 leftMargin: units.gu(1)
61 rightMargin: units.gu(1)
62 }
63 }
64
65 Stretcher {
66 clip: true
67 Flickable {
68 anchors.fill: parent
69 contentHeight: col.height + units.gu(5)
70 Column {
71 id: col
72 anchors {
73 left: parent.left
74 right: parent.right
75 top: parent.top
76 }
77
78 Repeater {
79 model: navPlugins.plugins
80
81 delegate: AbstractButton {
82 id: btn
83
84 readonly property bool isSelected: ViewStore.selectedNavIndex === index
85
86 action: modelData
87 height: units.gu(7)
88 width: bar.width
89 implicitHeight: height
90 visible: action.visible
91
92 onClicked: ViewStore.selectedNavIndex = index
93
94 Rectangle {
95 anchors.fill: parent
96 visible: btn.pressed
97 color: LomiriColors.slate
98 }
99
100 Rectangle {
101 color: LomiriColors.blue
102 width: units.dp(2)
103 anchors {
104 left: parent.left
105 top: parent.top
106 bottom: parent.bottom
107 }
108 visible: btn.isSelected
109 }
110
111 Icon {
112 name: action.iconName
113 color: btn.isSelected ? LomiriColors.blue : LomiriColors.silk
114 height: units.gu(3.4)
115 width: height
116 anchors.centerIn: parent
117 }
118 }
119 }
120 }
121 }
122 }
123
124 Line {
125 color: LomiriColors.slate
126 anchors {
127 left: parent.left
128 right: parent.right
129 leftMargin: units.gu(1)
130 rightMargin: units.gu(1)
131 }
132 }
133
134 AbstractButton {
135 id: settingsBtn
136 height: units.gu(7)
137 width: bar.width
138 implicitHeight: height
139
140 onClicked: ViewActions.openSettings()
141
142 Rectangle {
143 anchors.fill: parent
144 visible: settingsBtn.pressed
145 color: LomiriColors.slate
146 }
147
148 Icon {
149 name: "settings"
150 color: LomiriColors.silk
151 height: units.gu(3.4)
152 width: height
153 anchors.centerIn: parent
154 }
155 }
156 }
157}