mirror of
https://github.com/monero-project/monero-gui
synced 2024-12-23 02:52:58 +01:00
Merge pull request #3096
AddressBook: description edits, remove hack (selsta)
This commit is contained in:
commit
051282931a
@ -313,11 +313,12 @@ Rectangle {
|
|||||||
MoneroComponents.Label {
|
MoneroComponents.Label {
|
||||||
fontSize: 32
|
fontSize: 32
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
text: (root.editEntry ? qsTr("Edit an address") : qsTr("Add an address")) + translationManager.emptyString
|
text: (root.editEntry ? qsTr("Edit entry") : qsTr("Add an address")) + translationManager.emptyString
|
||||||
}
|
}
|
||||||
|
|
||||||
MoneroComponents.LineEditMulti {
|
MoneroComponents.LineEditMulti {
|
||||||
id: addressLine
|
id: addressLine
|
||||||
|
visible: !root.editEntry
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
KeyNavigation.backtab: deleteButton.visible ? deleteButton: cancelButton
|
KeyNavigation.backtab: deleteButton.visible ? deleteButton: cancelButton
|
||||||
KeyNavigation.tab: resolveButton.visible ? resolveButton : descriptionLine
|
KeyNavigation.tab: resolveButton.visible ? resolveButton : descriptionLine
|
||||||
@ -444,7 +445,7 @@ Rectangle {
|
|||||||
enabled: root.checkInformation(addressLine.text, appWindow.persistentSettings.nettype)
|
enabled: root.checkInformation(addressLine.text, appWindow.persistentSettings.nettype)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("Add")
|
console.log("Add")
|
||||||
if (!currentWallet.addressBook.addRow(addressLine.text.trim(),"", descriptionLine.text)) {
|
if (!root.editEntry && !currentWallet.addressBook.addRow(addressLine.text.trim(),"", descriptionLine.text)) {
|
||||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||||
// TODO: check currentWallet.addressBook.errorString() instead.
|
// TODO: check currentWallet.addressBook.errorString() instead.
|
||||||
if(currentWallet.addressBook.errorCode() === AddressBook.Invalid_Address)
|
if(currentWallet.addressBook.errorCode() === AddressBook.Invalid_Address)
|
||||||
@ -457,11 +458,9 @@ Rectangle {
|
|||||||
informationPopup.onCloseCallback = null
|
informationPopup.onCloseCallback = null
|
||||||
informationPopup.open();
|
informationPopup.open();
|
||||||
} else {
|
} else {
|
||||||
if (root.editEntry) {
|
currentWallet.addressBook.setDescription(addressBookListView.currentIndex, descriptionLine.text);
|
||||||
currentWallet.addressBook.deleteRow(addressBookListView.currentIndex);
|
|
||||||
}
|
|
||||||
root.showAddressBook();
|
|
||||||
}
|
}
|
||||||
|
root.showAddressBook()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,3 +132,19 @@ QString AddressBook::getDescription(const QString &address) const
|
|||||||
}
|
}
|
||||||
return QString::fromStdString(m_rows.value(*it)->getDescription());
|
return QString::fromStdString(m_rows.value(*it)->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddressBook::setDescription(int index, const QString &description)
|
||||||
|
{
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
{
|
||||||
|
QWriteLocker locker(&m_lock);
|
||||||
|
|
||||||
|
result = m_addressBookImpl->setDescription(index, description.toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
getAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -52,6 +52,7 @@ public:
|
|||||||
Q_INVOKABLE QString errorString() const;
|
Q_INVOKABLE QString errorString() const;
|
||||||
Q_INVOKABLE int errorCode() const;
|
Q_INVOKABLE int errorCode() const;
|
||||||
Q_INVOKABLE QString getDescription(const QString &address) const;
|
Q_INVOKABLE QString getDescription(const QString &address) const;
|
||||||
|
Q_INVOKABLE void setDescription(int index, const QString &label);
|
||||||
|
|
||||||
enum ErrorCode {
|
enum ErrorCode {
|
||||||
Status_Ok,
|
Status_Ok,
|
||||||
|
Loading…
Reference in New Issue
Block a user