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 @@ <rect> <x>0</x> <y>0</y> - <width>844</width> - <height>248</height> + <width>612</width> + <height>288</height> </rect> </property> <property name="windowTitle"> @@ -24,6 +24,16 @@ </property> </widget> </item> + <item> + <widget class="QLabel" name="label_note"> + <property name="text"> + <string>note</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index ed32e66..7e5816a 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<int, int> Wallet::subaddressIndex(const QString &address) const +{ + std::pair<uint32_t, uint32_t> i; + if (!m_walletImpl->subaddressIndex(address.toStdString(), i)) { + return QPair<int, int>(-1, -1); + } + return QPair<int, int>(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 c92e61b..b825929 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<int, int> subaddressIndex(const QString &address) const; + //! returns wallet file's path QString path() const;