mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-18 00:37:58 +00:00
Merge pull request #3569
ffd31c5
AddressBook: use LineEdit on descriptionLine; add tab/backtab; forceActiveFocus on addressLine; use Enter/Return key to save; cancel/delete buttons (rating89us)
This commit is contained in:
commit
286a3d140d
2 changed files with 35 additions and 27 deletions
|
@ -68,6 +68,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
property alias error: input.error
|
property alias error: input.error
|
||||||
|
property alias cursorPosition: input.cursorPosition
|
||||||
|
|
||||||
property string labelFontColor: MoneroComponents.Style.defaultFontColor
|
property string labelFontColor: MoneroComponents.Style.defaultFontColor
|
||||||
property bool labelFontBold: false
|
property bool labelFontBold: false
|
||||||
|
@ -91,6 +92,8 @@ ColumnLayout {
|
||||||
signal labelButtonClicked();
|
signal labelButtonClicked();
|
||||||
signal inputLabelLinkActivated();
|
signal inputLabelLinkActivated();
|
||||||
signal editingFinished();
|
signal editingFinished();
|
||||||
|
signal returnPressed();
|
||||||
|
signal enterPressed();
|
||||||
|
|
||||||
onActiveFocusChanged: activeFocus && input.forceActiveFocus()
|
onActiveFocusChanged: activeFocus && input.forceActiveFocus()
|
||||||
|
|
||||||
|
@ -176,6 +179,8 @@ ColumnLayout {
|
||||||
fontColor: item.fontColor
|
fontColor: item.fontColor
|
||||||
mouseSelection: item.mouseSelection
|
mouseSelection: item.mouseSelection
|
||||||
onEditingFinished: item.editingFinished()
|
onEditingFinished: item.editingFinished()
|
||||||
|
Keys.onReturnPressed: item.returnPressed()
|
||||||
|
Keys.onEnterPressed: item.enterPressed()
|
||||||
|
|
||||||
MoneroComponents.TextPlain {
|
MoneroComponents.TextPlain {
|
||||||
id: placeholderLabel
|
id: placeholderLabel
|
||||||
|
|
|
@ -319,6 +319,8 @@ Rectangle {
|
||||||
MoneroComponents.LineEditMulti {
|
MoneroComponents.LineEditMulti {
|
||||||
id: addressLine
|
id: addressLine
|
||||||
Layout.topMargin: 20
|
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"
|
labelText: "<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style> %1"
|
||||||
.arg(qsTr("Address")) + translationManager.emptyString
|
.arg(qsTr("Address")) + translationManager.emptyString
|
||||||
placeholderText: {
|
placeholderText: {
|
||||||
|
@ -340,6 +342,8 @@ Rectangle {
|
||||||
descriptionLine.text = parsed.tx_description;
|
descriptionLine.text = parsed.tx_description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onEnterPressed: addButton.enabled ? addButton.clicked() : ""
|
||||||
|
onReturnPressed: addButton.enabled ? addButton.clicked() : ""
|
||||||
|
|
||||||
MoneroComponents.InlineButton {
|
MoneroComponents.InlineButton {
|
||||||
buttonColor: MoneroComponents.Style.orange
|
buttonColor: MoneroComponents.Style.orange
|
||||||
|
@ -355,6 +359,8 @@ Rectangle {
|
||||||
|
|
||||||
MoneroComponents.StandardButton {
|
MoneroComponents.StandardButton {
|
||||||
id: resolveButton
|
id: resolveButton
|
||||||
|
KeyNavigation.backtab: addressLine
|
||||||
|
KeyNavigation.tab: descriptionLine
|
||||||
Layout.topMargin: 10
|
Layout.topMargin: 10
|
||||||
text: qsTr("Resolve") + translationManager.emptyString
|
text: qsTr("Resolve") + translationManager.emptyString
|
||||||
visible: TxUtils.isValidOpenAliasAddress(addressLine.text)
|
visible: TxUtils.isValidOpenAliasAddress(addressLine.text)
|
||||||
|
@ -392,17 +398,25 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MoneroComponents.LineEditMulti {
|
MoneroComponents.LineEdit {
|
||||||
id: descriptionLine
|
id: descriptionLine
|
||||||
|
KeyNavigation.backtab: resolveButton.visible ? resolveButton : addressLine
|
||||||
|
KeyNavigation.tab: addButton.enabled ? addButton : cancelButton
|
||||||
Layout.topMargin: 20
|
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"
|
labelText: "<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style> %1"
|
||||||
.arg(qsTr("Description")) + translationManager.emptyString
|
.arg(qsTr("Description")) + translationManager.emptyString
|
||||||
placeholderText: qsTr("Add a name...") + translationManager.emptyString
|
placeholderText: qsTr("Add a name...") + translationManager.emptyString
|
||||||
|
onAccepted: addButton.enabled ? addButton.clicked() : ""
|
||||||
}
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
MoneroComponents.StandardButton {
|
MoneroComponents.StandardButton {
|
||||||
id: addButton
|
id: addButton
|
||||||
|
KeyNavigation.backtab: descriptionLine
|
||||||
|
KeyNavigation.tab: cancelButton
|
||||||
text: (root.editEntry ? qsTr("Save") : qsTr("Add")) + translationManager.emptyString
|
text: (root.editEntry ? qsTr("Save") : qsTr("Add")) + translationManager.emptyString
|
||||||
enabled: root.checkInformation(addressLine.text, appWindow.persistentSettings.nettype)
|
enabled: root.checkInformation(addressLine.text, appWindow.persistentSettings.nettype)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -428,35 +442,22 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
MoneroComponents.StandardButton {
|
||||||
id: cancelButton
|
id: cancelButton
|
||||||
Layout.leftMargin: 20
|
KeyNavigation.backtab: addButton
|
||||||
font.pixelSize: 16
|
KeyNavigation.tab: deleteButton.visible ? deleteButton : addressLine
|
||||||
font.bold: false
|
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
|
||||||
text: qsTr("Cancel") + translationManager.emptyString
|
text: qsTr("Cancel") + translationManager.emptyString
|
||||||
|
primary: false
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: root.showAddressBook();
|
onClicked: root.showAddressBook();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
MoneroComponents.StandardButton {
|
||||||
id: deleteButton
|
id: deleteButton
|
||||||
|
KeyNavigation.backtab: cancelButton
|
||||||
|
KeyNavigation.tab: addressLine
|
||||||
visible: root.editEntry
|
visible: root.editEntry
|
||||||
Layout.leftMargin: 20
|
|
||||||
font.pixelSize: 16
|
|
||||||
font.bold: false
|
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
|
||||||
text: qsTr("Delete") + translationManager.emptyString
|
text: qsTr("Delete") + translationManager.emptyString
|
||||||
|
primary: false
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
currentWallet.addressBook.deleteRow(addressBookListView.currentIndex);
|
currentWallet.addressBook.deleteRow(addressBookListView.currentIndex);
|
||||||
root.showAddressBook();
|
root.showAddressBook();
|
||||||
|
@ -465,7 +466,6 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function checkInformation(address, nettype) {
|
function checkInformation(address, nettype) {
|
||||||
address = address.trim()
|
address = address.trim()
|
||||||
|
@ -491,6 +491,7 @@ Rectangle {
|
||||||
addressBookEmptyLayout.visible = false
|
addressBookEmptyLayout.visible = false
|
||||||
addressBookLayout.visible = false;
|
addressBookLayout.visible = false;
|
||||||
addContactLayout.visible = true;
|
addContactLayout.visible = true;
|
||||||
|
addressLine.forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showEditAddress(address, description) {
|
function showEditAddress(address, description) {
|
||||||
|
@ -501,6 +502,8 @@ Rectangle {
|
||||||
addContactLayout.visible = true;
|
addContactLayout.visible = true;
|
||||||
addressLine.text = address;
|
addressLine.text = address;
|
||||||
descriptionLine.text = description;
|
descriptionLine.text = description;
|
||||||
|
addressLine.forceActiveFocus();
|
||||||
|
addressLine.cursorPosition = addressLine.text.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFromQrCode(address, payment_id, amount, tx_description, recipient_name) {
|
function updateFromQrCode(address, payment_id, amount, tx_description, recipient_name) {
|
||||||
|
|
Loading…
Reference in a new issue