diff --git a/src/qt/pivx/send.cpp b/src/qt/pivx/send.cpp index 2e0c01a1eaf7c..6c7a521481ec6 100644 --- a/src/qt/pivx/send.cpp +++ b/src/qt/pivx/send.cpp @@ -727,7 +727,8 @@ void SendWidget::onContactsClicked(SendMultiRow* entry) menuContacts->setWalletModel(walletModel, AddressTableModel::Send); connect(menuContacts, &ContactsDropdown::contactSelected, [this](QString address, QString label) { if (focusedEntry) { - focusedEntry->setLabel(label); + if (label != "(no label)") + focusedEntry->setLabel(label); focusedEntry->setAddress(address); } }); diff --git a/src/qt/pivx/sendmultirow.cpp b/src/qt/pivx/sendmultirow.cpp index b3233b5e0eac5..c157264becdb1 100644 --- a/src/qt/pivx/sendmultirow.cpp +++ b/src/qt/pivx/sendmultirow.cpp @@ -57,7 +57,7 @@ SendMultiRow::SendMultiRow(PWidget *parent) : iconNumber->move(posIconX, posIconY); connect(ui->lineEditAmount, &QLineEdit::textChanged, this, &SendMultiRow::amountChanged); - connect(ui->lineEditAddress, &QLineEdit::textChanged, this, &SendMultiRow::addressChanged); + connect(ui->lineEditAddress, &QLineEdit::textChanged, [this](){addressChanged(ui->lineEditAddress->text());}); connect(btnContact, &QAction::triggered, [this](){Q_EMIT onContactsClicked(this);}); connect(ui->btnMenu, &QPushButton::clicked, [this](){Q_EMIT onMenuClicked(this);}); } @@ -83,9 +83,8 @@ CAmount SendMultiRow::getAmountValue(QString amount){ return isValid ? value : -1; } -bool SendMultiRow::addressChanged(const QString& str) +bool SendMultiRow::addressChanged(const QString& str, bool fOnlyValidate) { - ui->lineEditDescription->clear(); if(!str.isEmpty()) { QString trimmedStr = str.trimmed(); const bool valid = walletModel->validateAddress(trimmedStr, this->onlyStakingAddressAccepted); @@ -108,9 +107,11 @@ bool SendMultiRow::addressChanged(const QString& str) } } else { setCssProperty(ui->lineEditAddress, "edit-primary-multi-book"); - QString label = walletModel->getAddressTableModel()->labelForAddress(trimmedStr); - if (!label.isNull()){ - ui->lineEditDescription->setText(label); + if (!fOnlyValidate) { + QString label = walletModel->getAddressTableModel()->labelForAddress(trimmedStr); + if (!label.isEmpty()) { + ui->lineEditDescription->setText(label); + } } } updateStyle(ui->lineEditAddress); @@ -162,7 +163,7 @@ bool SendMultiRow::validate() retval = false; setCssProperty(ui->lineEditAddress, "edit-primary-multi-book-error", true); } else - retval = addressChanged(address); + retval = addressChanged(address, true); CAmount value = getAmountValue(ui->lineEditAmount->text()); diff --git a/src/qt/pivx/sendmultirow.h b/src/qt/pivx/sendmultirow.h index 317e3ab892f42..bf69471a5d2d6 100644 --- a/src/qt/pivx/sendmultirow.h +++ b/src/qt/pivx/sendmultirow.h @@ -73,7 +73,7 @@ public Q_SLOTS: private Q_SLOTS: void amountChanged(const QString&); - bool addressChanged(const QString&); + bool addressChanged(const QString&, bool fOnlyValidate = false); void deleteClicked(); //void on_payTo_textChanged(const QString& address); //void on_addressBookButton_clicked();