diff options
| author | selsta <selsta@sent.at> | 2022-03-16 13:39:59 +0100 |
|---|---|---|
| committer | selsta <selsta@sent.at> | 2022-03-16 13:43:26 +0100 |
| commit | 62748b61215da976bc4ab2212939930d56310aa5 (patch) | |
| tree | 75b02a5933081c1f322a54b9953409f4b736e847 | |
| parent | ea92f3f2721c5cbeece01e3f11de702002a5abf9 (diff) | |
| download | monzero-gui-62748b61215da976bc4ab2212939930d56310aa5.tar.gz monzero-gui-62748b61215da976bc4ab2212939930d56310aa5.tar.xz monzero-gui-62748b61215da976bc4ab2212939930d56310aa5.zip | |
AddressBook: fix adding new entry
| -rw-r--r-- | pages/AddressBook.qml | 28 |
1 files changed, 16 insertions, 12 deletions
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 + 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(); + informationPopup.onCloseCallback = null + informationPopup.open(); + } } else { currentWallet.addressBook.setDescription(addressBookListView.currentIndex, descriptionLine.text); + console.log("Description edited") } root.showAddressBook() } |
