diff --git a/src/dialog/txconfdialog.cpp b/src/dialog/txconfdialog.cpp index bf98afb..4d8d8a6 100644 --- a/src/dialog/txconfdialog.cpp +++ b/src/dialog/txconfdialog.cpp @@ -21,6 +21,7 @@ TxConfDialog::TxConfDialog(AppContext *ctx, PendingTransaction *tx, const QStrin ui->setupUi(this); ui->label_warning->setText("You are about to send a transaction.\nVerify the information below."); + ui->label_note->hide(); QString preferredCur = config()->get(Config::preferredFiatCurrency).toString(); @@ -46,10 +47,18 @@ TxConfDialog::TxConfDialog(AppContext *ctx, PendingTransaction *tx, const QStrin ui->label_fee->setText(QString("%1 (%2 %3)").arg(amounts[1], amounts_fiat[1], preferredCur)); ui->label_total->setText(QString("%1 (%2 %3)").arg(amounts[2], amounts_fiat[2], preferredCur)); + auto subaddressIndex = m_ctx->currentWallet->subaddressIndex(address); + QString addressExtra; + if (subaddressIndex.first >= 0) { + ui->label_note->setText("Note: this is a churn transaction."); + ui->label_note->show(); + } + ui->label_address->setText(ModelUtils::displayAddress(address, 2)); ui->label_address->setFont(ModelUtils::getMonospaceFont()); ui->label_address->setToolTip(address); + ui->buttonBox->button(QDialogButtonBox::Ok)->setText("Send"); connect(ui->btn_Advanced, &QPushButton::clicked, this, &TxConfDialog::setShowAdvanced); diff --git a/src/dialog/txconfdialog.ui b/src/dialog/txconfdialog.ui index acb7a6c..5ead8f4 100644 --- a/src/dialog/txconfdialog.ui +++ b/src/dialog/txconfdialog.ui @@ -6,8 +6,8 @@ 0 0 - 844 - 248 + 612 + 288 @@ -24,6 +24,16 @@ + + + + note + + + true + + + diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 0108017..9df55af 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -150,6 +150,15 @@ QString Wallet::address(quint32 accountIndex, quint32 addressIndex) const return QString::fromStdString(m_walletImpl->address(accountIndex, addressIndex)); } +QPair Wallet::subaddressIndex(const QString &address) const +{ + std::pair i; + if (!m_walletImpl->subaddressIndex(address.toStdString(), i)) { + return QPair(-1, -1); + } + return QPair(i.first, i.second); +} + QString Wallet::path() const { return QDir::toNativeSeparators(QString::fromStdString(m_walletImpl->path())); diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index d4fb002..abf912e 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -139,6 +139,10 @@ public: //! returns wallet's public address Q_INVOKABLE QString address(quint32 accountIndex, quint32 addressIndex) const; + //! returns the subaddress index (major, minor) of the address + // (-1, -1) if address does not belong to wallet + Q_INVOKABLE QPair subaddressIndex(const QString &address) const; + //! returns wallet file's path QString path() const;