on xenial help sign in
use client-side hiding of the indicator
commitc9fb38304ae37500b770f294eed4876156c4f9a4 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateMon 11 Jul 2016, 13:33 (10 years ago) parentc038967
3 files changed+7−27
qml/Components/KeymapSwitcher.qml−22 qml/Panel/IndicatorItemRow.qml+6−2 qml/Shell.qml+1−3
qml/Components/KeymapSwitcher.qml−22
@@ -16,7 +16,6 @@
1616
1717import QtQuick 2.4
1818import AccountsService 0.1
19−import GSettings 1.0
2019import GlobalShortcut 1.0
2120import QMenuModel 0.1
2221import Unity.Application 0.1
@@ -24,9 +23,6 @@ import Unity.Application 0.1
2423Item {
2524 id: root
2625
27− // to be set from Shell.qml
28− property bool hasKeyboard
29−
3026 GlobalShortcut {
3127 shortcut: Qt.MetaModifier|Qt.Key_Space
3228 onTriggered: root.nextKeymap()
@@ -93,22 +89,4 @@ Item {
9389 currentKeymapIndex = activeActionState;
9490 }
9591 }
96−
97− // indicator visibility
98− GSettings {
99− id: settings
100− schema.id: "com.canonical.indicator.keyboard"
101− }
102−
103− function updateIndicatorVisibility() {
104− settings.visible = keymapCount > 1 && hasKeyboard;
105− }
106−
107− onHasKeyboardChanged: updateIndicatorVisibility();
108− onKeymapCountChanged: updateIndicatorVisibility();
109−
110− Component.onCompleted: {
111− AccountsService.migrateKeymapSettings();
112− updateIndicatorVisibility();
113− }
11492}
qml/Panel/IndicatorItemRow.qml+6−2
@@ -17,6 +17,7 @@
1717import QtQuick 2.4
1818import QtQuick.Window 2.2
1919import Ubuntu.Components 1.3
20+import AccountsService 0.1
2021
2122Item {
2223 id: root
@@ -184,9 +185,12 @@ Item {
184185
185186 property int ownIndex: index
186187 property bool overflow: row.width - x > overFlowWidth
187− property bool hidden: !expanded && (overflow || !indicatorVisible || hideSessionIndicator)
188+ property bool hidden: !expanded && (overflow || !indicatorVisible || hideSessionIndicator || hideKeyboardIndicator)
188189 // HACK for indicator-session
189190 readonly property bool hideSessionIndicator: identifier == "indicator-session" && Math.min(Screen.width, Screen.height) <= units.gu(60)
191+ // HACK for indicator-keyboard
192+ readonly property bool hideKeyboardIndicator: identifier == "indicator-keyboard" && (AccountsService.keymaps.length < 2 || !hasKeyboard)
193+
190194
191195 height: row.height
192196 expanded: root.expanded
@@ -202,7 +206,7 @@ Item {
202206 NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing: UbuntuAnimation.StandardEasing }
203207 }
204208
205− width: ((expanded || indicatorVisible) && !hideSessionIndicator) ? implicitWidth : 0
209+ width: ((expanded || indicatorVisible) && !hideSessionIndicator && !hideKeyboardIndicator) ? implicitWidth : 0
206210
207211 Behavior on width {
208212 NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing: UbuntuAnimation.StandardEasing }
qml/Shell.qml+1−3
@@ -789,9 +789,7 @@ StyledItem {
789789 }
790790
791791 // non-visual object
792− KeymapSwitcher {
793− hasKeyboard: shell.hasKeyboard
794− }
792+ KeymapSwitcher {}
795793
796794 Rectangle {
797795 id: shutdownFadeOutRectangle