@@ -17,6 +17,7 @@
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
1919import Unity.Indicators 0.1 as Indicators
20+import Utils 0.1
2021import "../Components"
2122
2223// FIXME : We dont want to use MainView.
@@ -27,7 +28,7 @@ MainView {
2728
2829 property QtObject indicatorsModel: null
2930 property bool __contentActive: false
30− readonly property int currentMenuIndex : tabs.selectedTabIndex
31+ readonly property int currentMenuIndex : filteredIndicators.mapToSource(tabs.selectedTabIndex)
3132 backgroundColor: "#221e1c" // FIXME not in palette yet
3233 property int contentReleaseInterval: 20000
3334 property bool activeHeader: false
@@ -36,11 +37,13 @@ MainView {
3637 height: units.gu(42)
3738
3839 function setCurrentMenuIndex(index) {
39− if (currentMenuIndex !== index) {
40− if (currentMenuIndex == -1) {
40+ var filteredIndex = filteredIndicators.mapFromSource(index)
41+
42+ if (tabs.selectedTabIndex !== filteredIndex) {
43+ if (tabs.selectedTabIndex == -1) {
4144 tabs.tabBar.animate = false;
4245 }
43− tabs.selectedTabIndex = index;
46+ tabs.selectedTabIndex = filteredIndex;
4447 tabs.tabBar.animate = true;
4548 }
4649 }
@@ -61,6 +64,15 @@ MainView {
6164 tabs.tabBar.alwaysSelectionMode = activeHeader;
6265 }
6366
67+ SortFilterProxyModel {
68+ id: filteredIndicators
69+ model: indicatorsModel
70+ dynamicSortFilter: true
71+
72+ filterRole: Indicators.IndicatorsModelRole.IsVisible
73+ filterRegExp: RegExp("^true$")
74+ }
75+
6476 Tabs {
6577 id: tabs
6678 objectName: "tabs"
@@ -69,7 +81,7 @@ MainView {
6981
7082 Repeater {
7183 id: repeater
72− model: indicatorsModel
84+ model: filteredIndicators
7385 objectName: "menus"
7486
7587 // FIXME: This is needed because tabs dont handle repeaters well.