Skip to content

Commit

Permalink
Merge pull request #3865
Browse files Browse the repository at this point in the history
62748b6 AddressBook: fix adding new entry (selsta)
  • Loading branch information
luigi1111 committed Mar 18, 2022
2 parents 1dba06a + 62748b6 commit 002fe8e
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions pages/AddressBook.qml
Original file line number Diff line number Diff line change
Expand Up @@ -468,21 +468,25 @@ Rectangle {
text: (root.editEntry ? qsTr("Save") : qsTr("Add")) + translationManager.emptyString
enabled: root.checkInformation(addressLine.text, appWindow.persistentSettings.nettype)
onClicked: {
console.log("Add")
if (!root.editEntry && !currentWallet.addressBook.addRow(addressLine.text.trim(),"", descriptionLine.text)) {
informationPopup.title = qsTr("Error") + translationManager.emptyString;
// TODO: check currentWallet.addressBook.errorString() instead.
if(currentWallet.addressBook.errorCode() === AddressBook.Invalid_Address)
informationPopup.text = qsTr("Invalid address") + translationManager.emptyString
else if(currentWallet.addressBook.errorCode() === AddressBook.Invalid_Payment_Id)
informationPopup.text = currentWallet.addressBook.errorString()
else
informationPopup.text = qsTr("Can't create entry") + translationManager.emptyString

informationPopup.onCloseCallback = null
informationPopup.open();
if (!root.editEntry) {
if (currentWallet.addressBook.addRow(addressLine.text.trim(),"", descriptionLine.text)) {
console.log("Entry added")
} else {
informationPopup.title = qsTr("Error") + translationManager.emptyString;
// TODO: check currentWallet.addressBook.errorString() instead.
if (currentWallet.addressBook.errorCode() === AddressBook.Invalid_Address)
informationPopup.text = qsTr("Invalid address") + translationManager.emptyString
else if (currentWallet.addressBook.errorCode() === AddressBook.Invalid_Payment_Id)
informationPopup.text = currentWallet.addressBook.errorString()
else
informationPopup.text = qsTr("Can't create entry") + translationManager.emptyString

informationPopup.onCloseCallback = null
informationPopup.open();
}
} else {
currentWallet.addressBook.setDescription(addressBookListView.currentIndex, descriptionLine.text);
console.log("Description edited")
}
root.showAddressBook()
}
Expand Down

0 comments on commit 002fe8e

Please sign in to comment.