add navigation using enter + buttons will be clicked if enter (if but… (#556)

Enter navigation
This commit is contained in:
agalehaga 2024-02-17 23:09:05 +02:00 committed by GitHub
parent 16db23c159
commit 698cfe910c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 3655 additions and 4373 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -55,7 +55,7 @@ DrawerType2 {
text: yesButtonText text: yesButtonText
onClicked: { clickedFunc: function() {
if (yesButtonFunction && typeof yesButtonFunction === "function") { if (yesButtonFunction && typeof yesButtonFunction === "function") {
yesButtonFunction() yesButtonFunction()
} }
@ -76,7 +76,7 @@ DrawerType2 {
text: noButtonText text: noButtonText
onClicked: { clickedFunc: function() {
if (noButtonFunction && typeof noButtonFunction === "function") { if (noButtonFunction && typeof noButtonFunction === "function") {
noButtonFunction() noButtonFunction()
} }

View file

@ -74,7 +74,7 @@ DrawerType2 {
text: qsTr("Share") text: qsTr("Share")
imageSource: "qrc:/images/controls/share-2.svg" imageSource: "qrc:/images/controls/share-2.svg"
onClicked: { clickedFunc: function() {
var fileName = "" var fileName = ""
if (GC.isMobile()) { if (GC.isMobile()) {
fileName = configFileName + configExtension fileName = configFileName + configExtension
@ -107,6 +107,13 @@ DrawerType2 {
text: qsTr("Copy") text: qsTr("Copy")
imageSource: "qrc:/images/controls/copy.svg" imageSource: "qrc:/images/controls/copy.svg"
clickedFunc: function() {
configText.selectAll()
configText.copy()
configText.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
}
} }
BasicButtonType { BasicButtonType {
@ -125,6 +132,13 @@ DrawerType2 {
text: qsTr("Copy config string") text: qsTr("Copy config string")
imageSource: "qrc:/images/controls/copy.svg" imageSource: "qrc:/images/controls/copy.svg"
clickedFunc: function() {
nativeConfigString.selectAll()
nativeConfigString.copy()
nativeConfigString.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
}
} }
BasicButtonType { BasicButtonType {
@ -140,7 +154,7 @@ DrawerType2 {
text: qsTr("Show connection settings") text: qsTr("Show connection settings")
onClicked: { clickedFunc: function() {
configContentDrawer.open() configContentDrawer.open()
} }
} }

View file

@ -16,47 +16,37 @@ Button {
property string textColor: "#0E0E11" property string textColor: "#0E0E11"
property string borderColor: "#D7D8DB" property string borderColor: "#D7D8DB"
property string borderFocusedColor: "#D7D8DB"
property int borderWidth: 0 property int borderWidth: 0
property int borderFocusedWidth: 1
property string imageSource property string imageSource
property bool squareLeftSide: false property bool squareLeftSide: false
property var clickedFunc
implicitHeight: 56 implicitHeight: 56
hoverEnabled: true hoverEnabled: true
background: Rectangle { background: Rectangle {
id: background id: background_border
color: "transparent"
border.color: root.activeFocus ? root.borderFocusedColor : "transparent"
border.width: root.activeFocus ? root.borderFocusedWidth : "transparent"
anchors.fill: parent anchors.fill: parent
radius: 16 radius: 16
color: {
if (root.enabled) {
if (root.pressed) {
return pressedColor
}
return root.hovered ? hoveredColor : defaultColor
} else {
return disabledColor
}
}
border.color: borderColor
border.width: borderWidth
Behavior on color {
PropertyAnimation { duration: 200 }
}
Rectangle { Rectangle {
visible: root.squareLeftSide id: background
z: 1 anchors.fill: background_border
anchors.margins: root.activeFocus ? 2: 0
width: parent.radius radius: 16
height: parent.radius
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
color: { color: {
if (root.enabled) { if (root.enabled) {
if (root.pressed) { if (root.pressed) {
@ -67,24 +57,53 @@ Button {
return disabledColor return disabledColor
} }
} }
border.color: root.activeFocus ? "transparent" : borderColor
border.width: root.activeFocus ? 0 : borderWidth
Behavior on color { Behavior on color {
PropertyAnimation { duration: 200 } PropertyAnimation { duration: 200 }
} }
Rectangle {
visible: root.squareLeftSide
z: 1
width: parent.radius
height: parent.radius
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
color: {
if (root.enabled) {
if (root.pressed) {
return pressedColor
}
return root.hovered ? hoveredColor : defaultColor
} else {
return disabledColor
}
}
Behavior on color {
PropertyAnimation { duration: 200 }
}
}
} }
} }
MouseArea { MouseArea {
anchors.fill: background anchors.fill: background_border
enabled: false enabled: false
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
} }
contentItem: Item { contentItem: Item {
anchors.fill: background anchors.fill: background_border
implicitWidth: content.implicitWidth implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight implicitHeight: content.implicitHeight
RowLayout { RowLayout {
id: content id: content
anchors.centerIn: parent anchors.centerIn: parent
@ -114,4 +133,22 @@ Button {
} }
} }
} }
Keys.onEnterPressed: {
if (root.clickedFunc && typeof root.clickedFunc === "function") {
root.clickedFunc()
}
}
Keys.onReturnPressed: {
if (root.clickedFunc && typeof root.clickedFunc === "function") {
root.clickedFunc()
}
}
onClicked: {
if (root.clickedFunc && typeof root.clickedFunc === "function") {
root.clickedFunc()
}
}
} }

View file

@ -7,6 +7,8 @@ Item {
property StackView stackView: StackView.view property StackView stackView: StackView.view
property var defaultActiveFocusItem: null
// MouseArea { // MouseArea {
// id: globalMouseArea // id: globalMouseArea
// z: 99 // z: 99
@ -19,4 +21,17 @@ Item {
// mouse.accepted = false // mouse.accepted = false
// } // }
// } // }
// Set a timer to set focus after a short delay
Timer {
id: timer
interval: 100 // Milliseconds
onTriggered: {
if (defaultActiveFocusItem) {
defaultActiveFocusItem.forceActiveFocus()
}
}
repeat: false // Stop the timer after one trigger
running: true // Start the timer
}
} }

View file

@ -66,7 +66,7 @@ Popup {
borderWidth: 0 borderWidth: 0
text: qsTr("Close") text: qsTr("Close")
onClicked: { clickedFunc: function() {
root.close() root.close()
} }
} }

View file

@ -69,6 +69,7 @@ Item {
TextField { TextField {
id: textField id: textField
activeFocusOnTab: false
enabled: root.textFieldEditable enabled: root.textFieldEditable
color: root.enabled ? root.textFieldTextColor : root.textFieldTextDisabledColor color: root.enabled ? root.textFieldTextColor : root.textFieldTextDisabledColor
@ -142,7 +143,7 @@ Item {
Layout.preferredWidth: content.implicitHeight Layout.preferredWidth: content.implicitHeight
squareLeftSide: true squareLeftSide: true
onClicked: { clickedFunc: function() {
if (root.clickedFunc && typeof root.clickedFunc === "function") { if (root.clickedFunc && typeof root.clickedFunc === "function") {
root.clickedFunc() root.clickedFunc()
} }
@ -186,4 +187,12 @@ Item {
function getBackgroundBorderColor(noneFocusedColor) { function getBackgroundBorderColor(noneFocusedColor) {
return textField.focus ? root.borderFocusedColor : noneFocusedColor return textField.focus ? root.borderFocusedColor : noneFocusedColor
} }
Keys.onEnterPressed: {
KeyNavigation.tab.forceActiveFocus();
}
Keys.onReturnPressed: {
KeyNavigation.tab.forceActiveFocus();
}
} }

View file

@ -12,9 +12,12 @@ import "../Controls2/TextTypes"
import "../Config" import "../Config"
import "../Components" import "../Components"
PageType { PageType {
id: root id: root
defaultActiveFocusItem: listview.currentItem.portTextField.textField
ColumnLayout { ColumnLayout {
id: backButton id: backButton
@ -44,6 +47,8 @@ PageType {
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess() enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
ListView { ListView {
id: listview id: listview
width: parent.width width: parent.width
@ -55,9 +60,13 @@ PageType {
model: AwgConfigModel model: AwgConfigModel
delegate: Item { delegate: Item {
id: _delegate
implicitWidth: listview.width implicitWidth: listview.width
implicitHeight: col.implicitHeight implicitHeight: col.implicitHeight
property alias portTextField:portTextField
ColumnLayout { ColumnLayout {
id: col id: col
@ -93,6 +102,8 @@ PageType {
} }
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: junkPacketCountTextField.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -116,6 +127,8 @@ PageType {
} }
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: junkPacketMinSizeTextField.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -134,6 +147,8 @@ PageType {
} }
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: junkPacketMaxSizeTextField.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -152,6 +167,8 @@ PageType {
} }
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: initPacketJunkSizeTextField.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -170,6 +187,8 @@ PageType {
} }
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: responsePacketJunkSizeTextField.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -188,6 +207,8 @@ PageType {
} }
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: initPacketMagicHeaderTextField.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -206,6 +227,8 @@ PageType {
} }
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: responsePacketMagicHeaderTextField.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -224,6 +247,8 @@ PageType {
} }
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: transportPacketMagicHeaderTextField.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -242,6 +267,8 @@ PageType {
} }
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: underloadPacketMagicHeaderTextField.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -260,6 +287,8 @@ PageType {
} }
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: saveRestartButton
} }
BasicButtonType { BasicButtonType {
@ -291,6 +320,8 @@ PageType {
} }
BasicButtonType { BasicButtonType {
id: saveRestartButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 24 Layout.topMargin: 24
Layout.bottomMargin: 24 Layout.bottomMargin: 24
@ -308,7 +339,7 @@ PageType {
text: qsTr("Save and Restart Amnezia") text: qsTr("Save and Restart Amnezia")
onClicked: { clickedFunc: function() {
forceActiveFocus() forceActiveFocus()
PageController.goToPage(PageEnum.PageSetupWizardInstalling); PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(AwgConfigModel.getConfig()) InstallController.updateContainer(AwgConfigModel.getConfig())
@ -316,6 +347,7 @@ PageType {
} }
} }
} }
} }
} }
} }

View file

@ -15,6 +15,8 @@ import "../Components"
PageType { PageType {
id: root id: root
defaultActiveFocusItem: listview.currentItem.trafficFromField.textField
ColumnLayout { ColumnLayout {
id: backButton id: backButton
@ -58,6 +60,8 @@ PageType {
implicitWidth: listview.width implicitWidth: listview.width
implicitHeight: col.implicitHeight implicitHeight: col.implicitHeight
property alias trafficFromField: trafficFromField
ColumnLayout { ColumnLayout {
id: col id: col
@ -77,6 +81,8 @@ PageType {
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
id: trafficFromField
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 32 Layout.topMargin: 32
@ -96,9 +102,13 @@ PageType {
} }
} }
} }
KeyNavigation.tab: portTextField.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
id: portTextField
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
@ -112,6 +122,8 @@ PageType {
port = textFieldText port = textFieldText
} }
} }
KeyNavigation.tab: saveRestartButton
} }
DropDownType { DropDownType {
@ -156,13 +168,15 @@ PageType {
} }
BasicButtonType { BasicButtonType {
id: saveRestartButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 24 Layout.topMargin: 24
Layout.bottomMargin: 24 Layout.bottomMargin: 24
text: qsTr("Save and Restart Amnezia") text: qsTr("Save and Restart Amnezia")
onClicked: { clickedFunc: function() {
forceActiveFocus() forceActiveFocus()
PageController.goToPage(PageEnum.PageSetupWizardInstalling); PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(CloakConfigModel.getConfig()) InstallController.updateContainer(CloakConfigModel.getConfig())

View file

@ -16,6 +16,8 @@ import "../Components"
PageType { PageType {
id: root id: root
defaultActiveFocusItem: listview.currentItem.vpnAddressSubnetTextField.textField
ColumnLayout { ColumnLayout {
id: backButton id: backButton
@ -53,12 +55,14 @@ PageType {
clip: true clip: true
interactive: false interactive: false
model: OpenVpnConfigModel model: OpenVpnConfigModel
delegate: Item { delegate: Item {
implicitWidth: listview.width implicitWidth: listview.width
implicitHeight: col.implicitHeight implicitHeight: col.implicitHeight
property alias vpnAddressSubnetTextField: vpnAddressSubnetTextField
ColumnLayout { ColumnLayout {
id: col id: col
@ -78,6 +82,8 @@ PageType {
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
id: vpnAddressSubnetTextField
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 32 Layout.topMargin: 32
@ -89,6 +95,8 @@ PageType {
subnetAddress = textFieldText subnetAddress = textFieldText
} }
} }
KeyNavigation.tab: portTextField.enabled ? portTextField.textField : saveRestartButton
} }
ParagraphTextType { ParagraphTextType {
@ -119,6 +127,9 @@ PageType {
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
id: portTextField
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 40 Layout.topMargin: 40
@ -134,6 +145,8 @@ PageType {
port = textFieldText port = textFieldText
} }
} }
KeyNavigation.tab: saveRestartButton
} }
SwitcherType { SwitcherType {
@ -367,7 +380,7 @@ PageType {
text: qsTr("Remove OpenVPN") text: qsTr("Remove OpenVPN")
onClicked: { clickedFunc: function() {
var headerText = qsTr("Remove OpenVpn from server?") var headerText = qsTr("Remove OpenVpn from server?")
var descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.") var descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.")
var yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
@ -385,13 +398,15 @@ PageType {
} }
BasicButtonType { BasicButtonType {
id: saveRestartButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 24 Layout.topMargin: 24
Layout.bottomMargin: 24 Layout.bottomMargin: 24
text: qsTr("Save and Restart Amnezia") text: qsTr("Save and Restart Amnezia")
onClicked: { clickedFunc: function() {
forceActiveFocus() forceActiveFocus()
PageController.goToPage(PageEnum.PageSetupWizardInstalling); PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(OpenVpnConfigModel.getConfig()) InstallController.updateContainer(OpenVpnConfigModel.getConfig())

View file

@ -15,6 +15,8 @@ import "../Components"
PageType { PageType {
id: root id: root
defaultActiveFocusItem: listview.currentItem.portTextField.textField
ColumnLayout { ColumnLayout {
id: backButton id: backButton
@ -58,6 +60,8 @@ PageType {
implicitWidth: listview.width implicitWidth: listview.width
implicitHeight: col.implicitHeight implicitHeight: col.implicitHeight
property alias portTextField: portTextField
ColumnLayout { ColumnLayout {
id: col id: col
@ -77,6 +81,8 @@ PageType {
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
id: portTextField
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 40 Layout.topMargin: 40
@ -90,6 +96,8 @@ PageType {
port = textFieldText port = textFieldText
} }
} }
KeyNavigation.tab: saveRestartButton
} }
DropDownType { DropDownType {
@ -134,13 +142,15 @@ PageType {
} }
BasicButtonType { BasicButtonType {
id: saveRestartButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 24 Layout.topMargin: 24
Layout.bottomMargin: 24 Layout.bottomMargin: 24
text: qsTr("Save and Restart Amnezia") text: qsTr("Save and Restart Amnezia")
onClicked: { clickedFunc: function() {
forceActiveFocus() forceActiveFocus()
PageController.goToPage(PageEnum.PageSetupWizardInstalling); PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(ShadowSocksConfigModel.getConfig()) InstallController.updateContainer(ShadowSocksConfigModel.getConfig())

View file

@ -170,7 +170,7 @@ PageType {
text: qsTr("Mount folder on device") text: qsTr("Mount folder on device")
onClicked: { clickedFunc: function() {
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
InstallController.mountSftpDrive(port, password, username) InstallController.mountSftpDrive(port, password, username)
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
@ -229,7 +229,7 @@ PageType {
text: qsTr("Detailed instructions") text: qsTr("Detailed instructions")
onClicked: { clickedFunc: function() {
// Qt.openUrlExternally("https://github.com/amnezia-vpn/desktop-client/releases/latest") // Qt.openUrlExternally("https://github.com/amnezia-vpn/desktop-client/releases/latest")
} }
} }
@ -247,7 +247,7 @@ PageType {
text: qsTr("Remove SFTP and all data stored there") text: qsTr("Remove SFTP and all data stored there")
onClicked: { clickedFunc: function() {
var headerText = qsTr("Remove SFTP and all data stored there?") var headerText = qsTr("Remove SFTP and all data stored there?")
var yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
var noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")

View file

@ -125,7 +125,7 @@ PageType {
text: qsTr("Remove website") text: qsTr("Remove website")
onClicked: { clickedFunc: function() {
var headerText = qsTr("The site with all data will be removed from the tor network.") var headerText = qsTr("The site with all data will be removed from the tor network.")
var yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
var noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")

View file

@ -81,7 +81,7 @@ PageType {
text: qsTr("Card on Patreon") text: qsTr("Card on Patreon")
onClicked: function() { clickedFunc: function() {
Qt.openUrlExternally(qsTr("https://www.patreon.com/amneziavpn")) Qt.openUrlExternally(qsTr("https://www.patreon.com/amneziavpn"))
} }
} }
@ -101,7 +101,9 @@ PageType {
text: qsTr("Show other methods on Github") text: qsTr("Show other methods on Github")
onClicked: Qt.openUrlExternally(qsTr("https://github.com/amnezia-vpn/amnezia-client#donate")) clickedFunc: function() {
Qt.openUrlExternally(qsTr("https://github.com/amnezia-vpn/amnezia-client#donate"))
}
} }
ParagraphTextType { ParagraphTextType {
@ -191,7 +193,7 @@ PageType {
text: qsTr("Check for updates") text: qsTr("Check for updates")
onClicked: { clickedFunc: function() {
Qt.openUrlExternally("https://github.com/amnezia-vpn/desktop-client/releases/latest") Qt.openUrlExternally("https://github.com/amnezia-vpn/desktop-client/releases/latest")
} }
} }

View file

@ -88,7 +88,7 @@ PageType {
text: qsTr("Make a backup") text: qsTr("Make a backup")
onClicked: { clickedFunc: function() {
var fileName = "" var fileName = ""
if (GC.isMobile()) { if (GC.isMobile()) {
fileName = "AmneziaVPN.backup" fileName = "AmneziaVPN.backup"
@ -121,7 +121,7 @@ PageType {
text: qsTr("Restore from backup") text: qsTr("Restore from backup")
onClicked: { clickedFunc: function() {
var filePath = SystemController.getFileName(qsTr("Open backup file"), var filePath = SystemController.getFileName(qsTr("Open backup file"),
qsTr("Backup files (*.backup)")) qsTr("Backup files (*.backup)"))
if (filePath !== "") { if (filePath !== "") {

View file

@ -13,6 +13,8 @@ import "../Components"
PageType { PageType {
id: root id: root
defaultActiveFocusItem: primaryDns.textField
BackButtonType { BackButtonType {
id: backButton id: backButton
@ -68,6 +70,8 @@ PageType {
textField.validator: RegularExpressionValidator { textField.validator: RegularExpressionValidator {
regularExpression: InstallController.ipAddressRegExp() regularExpression: InstallController.ipAddressRegExp()
} }
KeyNavigation.tab: secondaryDns.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -80,6 +84,8 @@ PageType {
textField.validator: RegularExpressionValidator { textField.validator: RegularExpressionValidator {
regularExpression: InstallController.ipAddressRegExp() regularExpression: InstallController.ipAddressRegExp()
} }
KeyNavigation.tab: saveButton
} }
BasicButtonType { BasicButtonType {
@ -94,7 +100,7 @@ PageType {
text: qsTr("Restore default") text: qsTr("Restore default")
onClicked: function() { clickedFunc: function() {
var headerText = qsTr("Restore default DNS settings?") var headerText = qsTr("Restore default DNS settings?")
var yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
var noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
@ -114,11 +120,13 @@ PageType {
} }
BasicButtonType { BasicButtonType {
id: saveButton
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Save") text: qsTr("Save")
onClicked: function() { clickedFunc: function() {
if (primaryDns.textFieldText !== SettingsController.primaryDns) { if (primaryDns.textFieldText !== SettingsController.primaryDns) {
SettingsController.primaryDns = primaryDns.textFieldText SettingsController.primaryDns = primaryDns.textFieldText
} }
@ -130,4 +138,5 @@ PageType {
} }
} }
} }
} }

View file

@ -106,14 +106,18 @@ PageType {
textFieldText: name textFieldText: name
textField.maximumLength: 30 textField.maximumLength: 30
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: saveButton
} }
BasicButtonType { BasicButtonType {
id: saveButton
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Save") text: qsTr("Save")
onClicked: { clickedFunc: function() {
if (serverName.textFieldText === "") { if (serverName.textFieldText === "") {
return return
} }
@ -124,6 +128,12 @@ PageType {
serverNameEditDrawer.close() serverNameEditDrawer.close()
} }
} }
Component.onCompleted: {
if (header.itemAt(0)) {
defaultActiveFocusItem = serverName.textField
}
}
} }
} }
} }

View file

@ -20,6 +20,8 @@ import "../Components"
PageType { PageType {
id: root id: root
defaultActiveFocusItem: website_ip_field.textField
property bool pageEnabled: { property bool pageEnabled: {
return !ConnectionController.isConnected && !ServersModel.isDefaultServerFromApi() return !ConnectionController.isConnected && !ServersModel.isDefaultServerFromApi()
} }
@ -245,6 +247,8 @@ PageType {
anchors.bottomMargin: 24 anchors.bottomMargin: 24
TextFieldWithHeaderType { TextFieldWithHeaderType {
id: website_ip_field
Layout.fillWidth: true Layout.fillWidth: true
textFieldPlaceholderText: qsTr("website or IP") textFieldPlaceholderText: qsTr("website or IP")

View file

@ -12,6 +12,8 @@ import "../Controls2/TextTypes"
PageType { PageType {
id: root id: root
defaultActiveFocusItem: hostname.textField
BackButtonType { BackButtonType {
id: backButton id: backButton
@ -57,6 +59,8 @@ PageType {
onFocusChanged: { onFocusChanged: {
textField.text = textField.text.replace(/^\s+|\s+$/g, ''); textField.text = textField.text.replace(/^\s+|\s+$/g, '');
} }
KeyNavigation.tab: username.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -65,6 +69,8 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("Login to connect via SSH") headerText: qsTr("Login to connect via SSH")
textFieldPlaceholderText: "root" textFieldPlaceholderText: "root"
KeyNavigation.tab: secretData.textField
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -85,15 +91,19 @@ PageType {
onFocusChanged: { onFocusChanged: {
textField.text = textField.text.replace(/^\s+|\s+$/g, ''); textField.text = textField.text.replace(/^\s+|\s+$/g, '');
} }
KeyNavigation.tab: continueButton
} }
BasicButtonType { BasicButtonType {
id: continueButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 24 Layout.topMargin: 24
text: qsTr("Continue") text: qsTr("Continue")
onClicked: function() { clickedFunc: function() {
forceActiveFocus() forceActiveFocus()
if (!isCredentialsFilled()) { if (!isCredentialsFilled()) {
return return

View file

@ -158,7 +158,7 @@ PageType {
text: qsTr("Continue") text: qsTr("Continue")
onClicked: function() { clickedFunc: function() {
if (root.isEasySetup) { if (root.isEasySetup) {
ContainersModel.setCurrentlyProcessedContainerIndex(containers.dockerContainer) ContainersModel.setCurrentlyProcessedContainerIndex(containers.dockerContainer)
PageController.goToPage(PageEnum.PageSetupWizardInstalling) PageController.goToPage(PageEnum.PageSetupWizardInstalling)
@ -197,7 +197,7 @@ PageType {
text: qsTr("Set up later") text: qsTr("Set up later")
onClicked: function() { clickedFunc: function() {
PageController.goToPage(PageEnum.PageSetupWizardInstalling) PageController.goToPage(PageEnum.PageSetupWizardInstalling)
InstallController.addEmptyServer() InstallController.addEmptyServer()
} }

View file

@ -165,7 +165,7 @@ PageType {
text: qsTr("Cancel installation") text: qsTr("Cancel installation")
onClicked: { clickedFunc: function() {
InstallController.cancelInstallation() InstallController.cancelInstallation()
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
} }

View file

@ -52,6 +52,8 @@ PageType {
implicitWidth: processedContainerListView.width implicitWidth: processedContainerListView.width
implicitHeight: (delegateContent.implicitHeight > root.height) ? delegateContent.implicitHeight : root.height implicitHeight: (delegateContent.implicitHeight > root.height) ? delegateContent.implicitHeight : root.height
property alias port:port
ColumnLayout { ColumnLayout {
id: delegateContent id: delegateContent
@ -92,7 +94,7 @@ PageType {
text: qsTr("More detailed") text: qsTr("More detailed")
onClicked: { clickedFunc: function() {
showDetailsDrawer.open() showDetailsDrawer.open()
} }
} }
@ -168,7 +170,7 @@ PageType {
text: qsTr("Close") text: qsTr("Close")
onClicked: function() { clickedFunc: function() {
showDetailsDrawer.close() showDetailsDrawer.close()
} }
} }
@ -201,6 +203,8 @@ PageType {
headerText: qsTr("Port") headerText: qsTr("Port")
textField.maximumLength: 5 textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 } textField.validator: IntValidator { bottom: 1; top: 65535 }
KeyNavigation.tab: installButton
} }
Rectangle { Rectangle {
@ -216,7 +220,7 @@ PageType {
text: qsTr("Install") text: qsTr("Install")
onClicked: function() { clickedFunc: function() {
PageController.goToPage(PageEnum.PageSetupWizardInstalling); PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.install(dockerContainer, port.textFieldText, transportProtoSelector.currentIndex) InstallController.install(dockerContainer, port.textFieldText, transportProtoSelector.currentIndex)
} }
@ -236,6 +240,8 @@ PageType {
var protocolSelectorVisible = ProtocolProps.defaultTransportProtoChangeable(defaultContainerProto) var protocolSelectorVisible = ProtocolProps.defaultTransportProtoChangeable(defaultContainerProto)
transportProtoSelector.visible = protocolSelectorVisible transportProtoSelector.visible = protocolSelectorVisible
transportProtoHeader.visible = protocolSelectorVisible transportProtoHeader.visible = protocolSelectorVisible
defaultActiveFocusItem = port.textField
} }
} }
} }

View file

@ -115,7 +115,7 @@ PageType {
text: qsTr("I have the data to connect") text: qsTr("I have the data to connect")
onClicked: { clickedFunc: function() {
connectionTypeSelection.open() connectionTypeSelection.open()
} }
} }
@ -135,7 +135,9 @@ PageType {
text: qsTr("I have nothing") text: qsTr("I have nothing")
onClicked: Qt.openUrlExternally(qsTr("https://amnezia.org/instructions/0_starter-guide")) clickedFunc: function() {
Qt.openUrlExternally(qsTr("https://amnezia.org/instructions/0_starter-guide"))
}
} }
} }
} }

View file

@ -12,6 +12,8 @@ import "../Config"
PageType { PageType {
id: root id: root
defaultActiveFocusItem: textKey.textField
FlickableType { FlickableType {
id: fl id: fl
anchors.top: parent.top anchors.top: parent.top
@ -56,11 +58,15 @@ PageType {
textField.text = "" textField.text = ""
textField.paste() textField.paste()
} }
KeyNavigation.tab: continueButton
} }
} }
} }
BasicButtonType { BasicButtonType {
id: continueButton
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -70,7 +76,7 @@ PageType {
text: qsTr("Continue") text: qsTr("Continue")
onClicked: function() { clickedFunc: function() {
ImportController.extractConfigFromCode(textKey.textFieldText) ImportController.extractConfigFromCode(textKey.textFieldText)
PageController.goToPage(PageEnum.PageSetupWizardViewConfig) PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
} }

View file

@ -109,7 +109,7 @@ PageType {
text: showContent ? qsTr("Collapse content") : qsTr("Show content") text: showContent ? qsTr("Collapse content") : qsTr("Show content")
onClicked: { clickedFunc: function() {
showContent = !showContent showContent = !showContent
} }
} }
@ -151,7 +151,7 @@ PageType {
Layout.bottomMargin: 32 Layout.bottomMargin: 32
text: qsTr("Connect") text: qsTr("Connect")
onClicked: { clickedFunc: function() {
ImportController.importConfig() ImportController.importConfig()
} }
} }

View file

@ -16,6 +16,8 @@ import "../Components"
PageType { PageType {
id: root id: root
defaultActiveFocusItem: clientNameTextField.textField
enum ConfigType { enum ConfigType {
AmneziaConnection, AmneziaConnection,
OpenVpn, OpenVpn,
@ -122,7 +124,7 @@ PageType {
FlickableType { FlickableType {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
contentHeight: content.height contentHeight: content.height + 10
ColumnLayout { ColumnLayout {
id: content id: content
@ -258,6 +260,8 @@ PageType {
textField.maximumLength: 20 textField.maximumLength: 20
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: shareButton
} }
DropDownType { DropDownType {
@ -454,6 +458,8 @@ PageType {
} }
BasicButtonType { BasicButtonType {
id: shareButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 40 Layout.topMargin: 40
@ -463,7 +469,7 @@ PageType {
text: qsTr("Share") text: qsTr("Share")
imageSource: "qrc:/images/controls/share-2.svg" imageSource: "qrc:/images/controls/share-2.svg"
onClicked: { clickedFunc: function(){
if (clientNameTextField.textFieldText !== "") { if (clientNameTextField.textFieldText !== "") {
ExportController.generateConfig(root.connectionTypesModel[exportTypeSelector.currentIndex].type) ExportController.generateConfig(root.connectionTypesModel[exportTypeSelector.currentIndex].type)
} }
@ -593,7 +599,7 @@ PageType {
text: qsTr("Rename") text: qsTr("Rename")
onClicked: function() { clickedFunc: function() {
clientNameEditDrawer.open() clientNameEditDrawer.open()
} }
@ -627,14 +633,18 @@ PageType {
textFieldText: clientName textFieldText: clientName
textField.maximumLength: 20 textField.maximumLength: 20
checkEmptyText: true checkEmptyText: true
KeyNavigation.tab: saveButton
} }
BasicButtonType { BasicButtonType {
id: saveButton
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Save") text: qsTr("Save")
onClicked: { clickedFunc: function() {
if (clientNameEditor.textFieldText === "") { if (clientNameEditor.textFieldText === "") {
return return
} }
@ -666,7 +676,7 @@ PageType {
text: qsTr("Revoke") text: qsTr("Revoke")
onClicked: function() { clickedFunc: function() {
var headerText = qsTr("Revoke the config for a user - %1?").arg(clientName) var headerText = qsTr("Revoke the config for a user - %1?").arg(clientName)
var descriptionText = qsTr("The user will no longer be able to connect to your server.") var descriptionText = qsTr("The user will no longer be able to connect to your server.")
var yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")

View file

@ -123,7 +123,7 @@ PageType {
text: qsTr("Share") text: qsTr("Share")
imageSource: "qrc:/images/controls/share-2.svg" imageSource: "qrc:/images/controls/share-2.svg"
onClicked: function() { clickedFunc: function() {
shareConnectionDrawer.headerText = qsTr("Connection to ") + serverSelector.text shareConnectionDrawer.headerText = qsTr("Connection to ") + serverSelector.text
shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text

View file

@ -53,6 +53,7 @@ PageType {
function onGoToPage(page, slide) { function onGoToPage(page, slide) {
var pagePath = PageController.getPagePath(page) var pagePath = PageController.getPagePath(page)
if (slide) { if (slide) {
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition) tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition)
} else { } else {

View file

@ -178,9 +178,13 @@ Window {
clickedFunc: function() { clickedFunc: function() {
hidePassword = !hidePassword hidePassword = !hidePassword
} }
KeyNavigation.tab: saveButton
} }
BasicButtonType { BasicButtonType {
id: saveButton
Layout.fillWidth: true Layout.fillWidth: true
defaultColor: "transparent" defaultColor: "transparent"
@ -192,7 +196,7 @@ Window {
text: qsTr("Save") text: qsTr("Save")
onClicked: { clickedFunc: function() {
privateKeyPassphraseDrawer.close() privateKeyPassphraseDrawer.close()
PageController.passphraseRequestDrawerClosed(passphrase.textFieldText) PageController.passphraseRequestDrawerClosed(passphrase.textFieldText)
} }