on xenial help sign in
use client-side hiding of the indicator
c9fb383Lukáš Tinkl
qml/Components/KeymapSwitcher.qml−22
@@ -16,7 +16,6 @@
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18import AccountsService 0.1
18import AccountsService 0.1
19−import GSettings 1.0
20import GlobalShortcut 1.0
19import GlobalShortcut 1.0
21import QMenuModel 0.1
20import QMenuModel 0.1
22import Unity.Application 0.1
21import Unity.Application 0.1
@@ -24,9 +23,6 @@ import Unity.Application 0.1
24Item {
23Item {
25 id: root
24 id: root
26
25
27− // to be set from Shell.qml
28− property bool hasKeyboard
29−
30 GlobalShortcut {
26 GlobalShortcut {
31 shortcut: Qt.MetaModifier|Qt.Key_Space
27 shortcut: Qt.MetaModifier|Qt.Key_Space
32 onTriggered: root.nextKeymap()
28 onTriggered: root.nextKeymap()
@@ -93,22 +89,4 @@ Item {
93 currentKeymapIndex = activeActionState;
89 currentKeymapIndex = activeActionState;
94 }
90 }
95 }
91 }
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− }
114}
92}
qml/Panel/IndicatorItemRow.qml+6−2
@@ -17,6 +17,7 @@
17import QtQuick 2.4
17import QtQuick 2.4
18import QtQuick.Window 2.2
18import QtQuick.Window 2.2
19import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
20+import AccountsService 0.1
20
21
21Item {
22Item {
22 id: root
23 id: root
@@ -184,9 +185,12 @@ Item {
184
185
185 property int ownIndex: index
186 property int ownIndex: index
186 property bool overflow: row.width - x > overFlowWidth
187 property bool overflow: row.width - x > overFlowWidth
187− property bool hidden: !expanded && (overflow || !indicatorVisible || hideSessionIndicator)
188+ property bool hidden: !expanded && (overflow || !indicatorVisible || hideSessionIndicator || hideKeyboardIndicator)
188 // HACK for indicator-session
189 // HACK for indicator-session
189 readonly property bool hideSessionIndicator: identifier == "indicator-session" && Math.min(Screen.width, Screen.height) <= units.gu(60)
190 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+
190
194
191 height: row.height
195 height: row.height
192 expanded: root.expanded
196 expanded: root.expanded
@@ -202,7 +206,7 @@ Item {
202 NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing: UbuntuAnimation.StandardEasing }
206 NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing: UbuntuAnimation.StandardEasing }
203 }
207 }
204
208
205− width: ((expanded || indicatorVisible) && !hideSessionIndicator) ? implicitWidth : 0
209+ width: ((expanded || indicatorVisible) && !hideSessionIndicator && !hideKeyboardIndicator) ? implicitWidth : 0
206
210
207 Behavior on width {
211 Behavior on width {
208 NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing: UbuntuAnimation.StandardEasing }
212 NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing: UbuntuAnimation.StandardEasing }
qml/Shell.qml+1−3
@@ -789,9 +789,7 @@ StyledItem {
789 }
789 }
790
790
791 // non-visual object
791 // non-visual object
792− KeymapSwitcher {
792+ KeymapSwitcher {}
793− hasKeyboard: shell.hasKeyboard
794− }
795
793
796 Rectangle {
794 Rectangle {
797 id: shutdownFadeOutRectangle
795 id: shutdownFadeOutRectangle