diff options
| author | rating89us <45968869+rating89us@users.noreply.github.com> | 2021-06-17 13:24:16 +0200 |
|---|---|---|
| committer | rating89us <rating89us@rating89us.com> | 2021-06-17 13:37:19 +0200 |
| commit | ffd31c50dadc64e44f03b623d9a730cdc2d83eaa (patch) | |
| tree | 2838a4c9298cc0381829211e84282b0989632b8b /pages/AddressBook.qml | |
| parent | b970cad48b9e8b7abe465e738a488f6f4b48a794 (diff) | |
| download | monzero-gui-ffd31c50dadc64e44f03b623d9a730cdc2d83eaa.tar.gz monzero-gui-ffd31c50dadc64e44f03b623d9a730cdc2d83eaa.tar.xz monzero-gui-ffd31c50dadc64e44f03b623d9a730cdc2d83eaa.zip | |
AddressBook: use LineEdit on descriptionLine; add tab/backtab; forceActiveFocus on addressLine; use Enter/Return key to save; cancel/delete buttons
Diffstat (limited to 'pages/AddressBook.qml')
| -rw-r--r-- | pages/AddressBook.qml | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/pages/AddressBook.qml b/pages/AddressBook.qml index 06f7ba64..7cfabf49 100644 --- a/pages/AddressBook.qml +++ b/pages/AddressBook.qml @@ -319,6 +319,8 @@ Rectangle { MoneroComponents.LineEditMulti { id: addressLine Layout.topMargin: 20 + KeyNavigation.backtab: deleteButton.visible ? deleteButton: cancelButton + KeyNavigation.tab: resolveButton.visible ? resolveButton : descriptionLine labelText: "<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style> %1" .arg(qsTr("Address")) + translationManager.emptyString placeholderText: { @@ -340,6 +342,8 @@ Rectangle { descriptionLine.text = parsed.tx_description; } } + onEnterPressed: addButton.enabled ? addButton.clicked() : "" + onReturnPressed: addButton.enabled ? addButton.clicked() : "" MoneroComponents.InlineButton { buttonColor: MoneroComponents.Style.orange @@ -355,6 +359,8 @@ Rectangle { MoneroComponents.StandardButton { id: resolveButton + KeyNavigation.backtab: addressLine + KeyNavigation.tab: descriptionLine Layout.topMargin: 10 text: qsTr("Resolve") + translationManager.emptyString visible: TxUtils.isValidOpenAliasAddress(addressLine.text) @@ -392,17 +398,25 @@ Rectangle { } } - MoneroComponents.LineEditMulti { + MoneroComponents.LineEdit { id: descriptionLine + KeyNavigation.backtab: resolveButton.visible ? resolveButton : addressLine + KeyNavigation.tab: addButton.enabled ? addButton : cancelButton Layout.topMargin: 20 + Layout.fillWidth: true + fontSize: 16 + placeholderFontSize: 16 labelText: "<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style> %1" .arg(qsTr("Description")) + translationManager.emptyString placeholderText: qsTr("Add a name...") + translationManager.emptyString + onAccepted: addButton.enabled ? addButton.clicked() : "" } RowLayout { Layout.topMargin: 20 MoneroComponents.StandardButton { id: addButton + KeyNavigation.backtab: descriptionLine + KeyNavigation.tab: cancelButton text: (root.editEntry ? qsTr("Save") : qsTr("Add")) + translationManager.emptyString enabled: root.checkInformation(addressLine.text, appWindow.persistentSettings.nettype) onClicked: { @@ -428,39 +442,25 @@ Rectangle { } } - Text { + MoneroComponents.StandardButton { id: cancelButton - Layout.leftMargin: 20 - font.pixelSize: 16 - font.bold: false - color: MoneroComponents.Style.defaultFontColor + KeyNavigation.backtab: addButton + KeyNavigation.tab: deleteButton.visible ? deleteButton : addressLine text: qsTr("Cancel") + translationManager.emptyString - - MouseArea { - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onClicked: root.showAddressBook(); - } + primary: false + onClicked: root.showAddressBook(); } - Text { + MoneroComponents.StandardButton { id: deleteButton + KeyNavigation.backtab: cancelButton + KeyNavigation.tab: addressLine visible: root.editEntry - Layout.leftMargin: 20 - font.pixelSize: 16 - font.bold: false - color: MoneroComponents.Style.defaultFontColor text: qsTr("Delete") + translationManager.emptyString - - MouseArea { - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onClicked: { - currentWallet.addressBook.deleteRow(addressBookListView.currentIndex); - root.showAddressBook(); - } + primary: false + onClicked: { + currentWallet.addressBook.deleteRow(addressBookListView.currentIndex); + root.showAddressBook(); } } } @@ -491,6 +491,7 @@ Rectangle { addressBookEmptyLayout.visible = false addressBookLayout.visible = false; addContactLayout.visible = true; + addressLine.forceActiveFocus(); } function showEditAddress(address, description) { @@ -501,6 +502,8 @@ Rectangle { addContactLayout.visible = true; addressLine.text = address; descriptionLine.text = description; + addressLine.forceActiveFocus(); + addressLine.cursorPosition = addressLine.text.length; } function updateFromQrCode(address, payment_id, amount, tx_description, recipient_name) { |
