Added tab navigation functional. (#721)

- Added tab navigation functional.
- In basic types added parentFlickable property, which will help to ensure, that the item is visible within flickable parent during tab navigation.
- Added focus state for some basic types.
- In PageType qml file added lastItemTabClicked function, which will help to focus tab bar buttons when the last tab on the current page clicked.
- Added Focus for back button for all pages and drawers.
- Added scroll on tab for Servers ListView on PageHome.
This commit is contained in:
Garegin Harutyunyan 2024-04-18 17:54:55 +04:00 committed by GitHub
parent d50e7dd3f4
commit 0e4ae26bae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 2269 additions and 143 deletions

View file

@ -16,6 +16,8 @@ import "../Components"
PageType {
id: root
defaultActiveFocusItem: focusItem
Connections {
target: InstallController
@ -24,8 +26,13 @@ PageType {
}
}
Item {
id: focusItem
KeyNavigation.tab: backButton
}
ColumnLayout {
id: backButton
id: backButtonLayout
anchors.top: parent.top
anchors.left: parent.left
@ -34,12 +41,14 @@ PageType {
anchors.topMargin: 20
BackButtonType {
id: backButton
KeyNavigation.tab: websiteName.rightButton
}
}
FlickableType {
id: fl
anchors.top: backButton.bottom
anchors.top: backButtonLayout.bottom
anchors.bottom: parent.bottom
contentHeight: content.implicitHeight
@ -61,6 +70,7 @@ PageType {
}
LabelWithButtonType {
id: websiteName
Layout.fillWidth: true
Layout.topMargin: 32
@ -77,9 +87,14 @@ PageType {
rightImageSource: "qrc:/images/controls/copy.svg"
rightImageColor: "#D7D8DB"
KeyNavigation.tab: removeButton
clickedFunction: function() {
GC.copyToClipBoard(descriptionText)
PageController.showNotificationMessage(qsTr("Copied"))
if (!GC.isMobile()) {
this.rightButton.forceActiveFocus()
}
}
}
@ -113,6 +128,7 @@ PageType {
}
BasicButtonType {
id: removeButton
Layout.topMargin: 24
Layout.bottomMargin: 16
Layout.leftMargin: 8
@ -125,6 +141,8 @@ PageType {
text: qsTr("Remove website")
Keys.onTabPressed: lastItemTabClicked(focusItem)
clickedFunc: function() {
var headerText = qsTr("The site with all data will be removed from the tor network.")
var yesButtonText = qsTr("Continue")
@ -135,6 +153,9 @@ PageType {
InstallController.removeProcessedContainer()
}
var noButtonFunction = function() {
if (!GC.isMobile()) {
removeButton.forceActiveFocus()
}
}
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)