@@ -0,0 +1,119 @@
2+ * Copyright (C) 2016 Canonical, Ltd.
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+import Ubuntu.Components 1.3
19+import Ubuntu.Components.ListItems 1.3 as ListItem
24+ property bool expanded
26+ property int selectedIndex: -1
27+ readonly property double itemHeight: units.gu(4)
29+ color: theme.palette.normal.background
30+ height: expanded ? optionToggleRepeater.count * itemHeight : itemHeight
32+ UbuntuNumberAnimation {}
36+ radius: units.gu(0.6)
38+ border.width: units.dp(1)
39+ border.color: theme.palette.normal.base
42+ id: optionToggleContent
46+ id: optionToggleRepeater
47+ model: optionToggle.model
51+ visible: status === Loader.Ready
54+ id: optionToggleEntry
57+ width: optionToggleContent.width
58+ height: optionToggle.itemHeight
61+ selectedIndex = index;
66+ ListItem.ThinDivider {
74+ leftMargin: units.gu(1)
76+ rightMargin: units.gu(1)
77+ verticalCenter: parent.verticalCenter
81+ text: expanded ? modelData : optionToggle.model[selectedIndex]
82+ color: theme.palette.normal.backgroundSecondaryText
83+ font.weight: Font.Light
85+ elide: Text.ElideRight
91+ rightMargin: units.gu(1)
92+ verticalCenter: parent.verticalCenter
96+ name: optionToggle.height === optionToggle.itemHeight ? "down" : "up"
105+ rightMargin: units.gu(1)
106+ verticalCenter: parent.verticalCenter
108+ visible: expanded && index == optionToggle.selectedIndex && index != 0
109+ height: units.gu(1.5)
110+ fillMode: Image.PreserveAspectFit
111+ source: Qt.resolvedUrl("Pages/data/Tick@30.png")
115+ sourceComponent: optionToggleEntry