aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpablomartin4btc <pablomartin4btc@gmail.com>2023-09-13 15:01:38 -0300
committerpablomartin4btc <pablomartin4btc@gmail.com>2023-10-04 17:01:49 -0300
commit58c9b50a952951cb326c99ba86cb706a1e7d533e (patch)
tree0bd58c7dbc5c751e0bc858b6066acb02044ff3bd /src
parentab163b0fb5bc9c4ec12f03b57ace1753354e05cf (diff)
downloadbitcoin-58c9b50a952951cb326c99ba86cb706a1e7d533e.tar.xz
gui: Add wallet name to address book page
Extend addresstablemodel to return the display name from the wallet and set it to the addressbookpage window title when its model is set.
Diffstat (limited to 'src')
-rw-r--r--src/qt/addressbookpage.cpp26
-rw-r--r--src/qt/addressbookpage.h1
-rw-r--r--src/qt/addresstablemodel.cpp2
-rw-r--r--src/qt/addresstablemodel.h2
4 files changed, 20 insertions, 11 deletions
diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp
index b888fc43e2..05e58191fc 100644
--- a/src/qt/addressbookpage.cpp
+++ b/src/qt/addressbookpage.cpp
@@ -81,9 +81,7 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode,
ui->exportButton->setIcon(platformStyle->SingleColorIcon(":/icons/export"));
}
- switch(mode)
- {
- case ForSelection:
+ if (mode == ForSelection) {
switch(tab)
{
case SendingTab: setWindowTitle(tr("Choose the address to send coins to")); break;
@@ -94,14 +92,6 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode,
ui->tableView->setFocus();
ui->closeButton->setText(tr("C&hoose"));
ui->exportButton->hide();
- break;
- case ForEditing:
- switch(tab)
- {
- case SendingTab: setWindowTitle(tr("Sending addresses")); break;
- case ReceivingTab: setWindowTitle(tr("Receiving addresses")); break;
- }
- break;
}
switch(tab)
{
@@ -164,6 +154,7 @@ void AddressBookPage::setModel(AddressTableModel *_model)
connect(_model, &AddressTableModel::rowsInserted, this, &AddressBookPage::selectNewAddress);
selectionChanged();
+ this->updateWindowsTitleWithWalletName();
}
void AddressBookPage::on_copyAddress_clicked()
@@ -328,3 +319,16 @@ void AddressBookPage::selectNewAddress(const QModelIndex &parent, int begin, int
newAddressToSelect.clear();
}
}
+
+void AddressBookPage::updateWindowsTitleWithWalletName()
+{
+ const QString walletName = this->model->GetWalletDisplayName();
+
+ if (mode == ForEditing) {
+ switch(tab)
+ {
+ case SendingTab: setWindowTitle(tr("Sending addresses - %1").arg(walletName)); break;
+ case ReceivingTab: setWindowTitle(tr("Receiving addresses - %1").arg(walletName)); break;
+ }
+ }
+}
diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h
index 283209d00c..b649da4ac8 100644
--- a/src/qt/addressbookpage.h
+++ b/src/qt/addressbookpage.h
@@ -56,6 +56,7 @@ private:
AddressBookSortFilterProxyModel *proxyModel;
QMenu *contextMenu;
QString newAddressToSelect;
+ void updateWindowsTitleWithWalletName();
private Q_SLOTS:
/** Delete currently selected address entry */
diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp
index e4689e4389..c52ef7cd67 100644
--- a/src/qt/addresstablemodel.cpp
+++ b/src/qt/addresstablemodel.cpp
@@ -451,3 +451,5 @@ void AddressTableModel::emitDataChanged(int idx)
{
Q_EMIT dataChanged(index(idx, 0, QModelIndex()), index(idx, columns.length()-1, QModelIndex()));
}
+
+QString AddressTableModel::GetWalletDisplayName() const { return walletModel->getDisplayName(); };
diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h
index 599aa89cad..44808364ec 100644
--- a/src/qt/addresstablemodel.h
+++ b/src/qt/addresstablemodel.h
@@ -87,6 +87,8 @@ public:
OutputType GetDefaultAddressType() const;
+ QString GetWalletDisplayName() const;
+
private:
WalletModel* const walletModel;
AddressTablePriv *priv = nullptr;