diff --git a/client/ui/qml/Pages2/PageSettingsApplication.qml b/client/ui/qml/Pages2/PageSettingsApplication.qml index a6472656..7ed733e0 100644 --- a/client/ui/qml/Pages2/PageSettingsApplication.qml +++ b/client/ui/qml/Pages2/PageSettingsApplication.qml @@ -15,43 +15,9 @@ PageType { defaultActiveFocusItem: focusItem - function getNextComponentInFocusChain(componentId) { - const componentsList = [focusItem, - backButton, - switcher, - switcherAutoStart, - switcherAutoConnect, - switcherStartMinimized, - labelWithButtonLanguage, - labelWithButtonLogging, - labelWithButtonReset, - ] - - const idx = componentsList.indexOf(componentId) - - if (idx === -1) { - return null - } - - let nextIndex = idx + 1 - if (nextIndex >= componentsList.length) { - nextIndex = 0 - } - - if (componentsList[nextIndex].visible) { - if ((nextIndex) >= 6) { - return componentsList[nextIndex].rightButton - } else { - return componentsList[nextIndex] - } - } else { - return getNextComponentInFocusChain(componentsList[nextIndex]) - } - } - Item { id: focusItem - KeyNavigation.tab: root.getNextComponentInFocusChain(focusItem) + KeyNavigation.tab: backButton onFocusChanged: { if (focusItem.activeFocus) { @@ -68,7 +34,7 @@ PageType { anchors.right: parent.right anchors.topMargin: 20 - KeyNavigation.tab: root.getNextComponentInFocusChain(backButton) + KeyNavigation.tab: GC.isMobile() ? switcher : switcherAutoStart } FlickableType { @@ -108,7 +74,7 @@ PageType { } } - KeyNavigation.tab: root.getNextComponentInFocusChain(switcher) + KeyNavigation.tab: labelWithButtonLanguage.rightButton parentFlickable: fl } @@ -126,7 +92,7 @@ PageType { text: qsTr("Auto start") descriptionText: qsTr("Launch the application every time the device is starts") - KeyNavigation.tab: root.getNextComponentInFocusChain(switcherAutoStart) + KeyNavigation.tab: switcherAutoConnect parentFlickable: fl checked: SettingsController.isAutoStartEnabled() @@ -151,7 +117,7 @@ PageType { text: qsTr("Auto connect") descriptionText: qsTr("Connect to VPN on app start") - KeyNavigation.tab: root.getNextComponentInFocusChain(switcherAutoConnect) + KeyNavigation.tab: switcherStartMinimized parentFlickable: fl checked: SettingsController.isAutoConnectEnabled() @@ -176,7 +142,7 @@ PageType { text: qsTr("Start minimized") descriptionText: qsTr("Launch application minimized") - KeyNavigation.tab: root.getNextComponentInFocusChain(switcherStartMinimized) + KeyNavigation.tab: labelWithButtonLanguage.rightButton parentFlickable: fl checked: SettingsController.isStartMinimizedEnabled() @@ -199,7 +165,7 @@ PageType { descriptionText: LanguageModel.currentLanguageName rightImageSource: "qrc:/images/controls/chevron-right.svg" - KeyNavigation.tab: root.getNextComponentInFocusChain(labelWithButtonLanguage) + KeyNavigation.tab: labelWithButtonLogging.rightButton parentFlickable: fl clickedFunction: function() { @@ -218,7 +184,7 @@ PageType { descriptionText: SettingsController.isLoggingEnabled ? qsTr("Enabled") : qsTr("Disabled") rightImageSource: "qrc:/images/controls/chevron-right.svg" - KeyNavigation.tab: root.getNextComponentInFocusChain(labelWithButtonLogging) + KeyNavigation.tab: labelWithButtonReset.rightButton parentFlickable: fl clickedFunction: function() { diff --git a/client/ui/qml/Pages2/PageSettingsConnection.qml b/client/ui/qml/Pages2/PageSettingsConnection.qml index 18035f65..218ffe28 100644 --- a/client/ui/qml/Pages2/PageSettingsConnection.qml +++ b/client/ui/qml/Pages2/PageSettingsConnection.qml @@ -101,9 +101,15 @@ PageType { PageController.goToPage(PageEnum.PageSettingsSplitTunneling) } - Keys.onTabPressed: splitTunnelingButton2.visible ? - splitTunnelingButton2.forceActiveFocus() : - lastItemTabClicked() + Keys.onTabPressed: { + if (splitTunnelingButton2.visible) { + return splitTunnelingButton2.rightButton.forceActiveFocus() + } else if (killSwitchSwitcher.visible) { + return killSwitchSwitcher.forceActiveFocus() + } else { + lastItemTabClicked() + } + } } DividerType { @@ -124,7 +130,13 @@ PageType { PageController.goToPage(PageEnum.PageSettingsAppSplitTunneling) } - Keys.onTabPressed: lastItemTabClicked() + Keys.onTabPressed: { + if (killSwitchSwitcher.visible) { + return killSwitchSwitcher.forceActiveFocus() + } else { + lastItemTabClicked() + } + } } DividerType { @@ -132,6 +144,7 @@ PageType { } SwitcherType { + id: killSwitchSwitcher visible: !GC.isMobile() Layout.fillWidth: true @@ -152,6 +165,8 @@ PageType { PageController.showNotificationMessage(qsTr("Cannot change killSwitch settings during active connection")) } } + + Keys.onTabPressed: lastItemTabClicked() } DividerType {