From 62748b61215da976bc4ab2212939930d56310aa5 Mon Sep 17 00:00:00 2001 From: selsta Date: Wed, 16 Mar 2022 13:39:59 +0100 Subject: AddressBook: fix adding new entry --- pages/AddressBook.qml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'pages') diff --git a/pages/AddressBook.qml b/pages/AddressBook.qml index 56e9048d..27821e4c 100644 --- a/pages/AddressBook.qml +++ b/pages/AddressBook.qml @@ -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() } -- cgit v1.2.3