Skip to content

Commit 8369467

Browse files
committed
Merge #757: Add wallet name to address book page title
58c9b50 gui: Add wallet name to address book page (pablomartin4btc) Pull request description: It fixes #756. Each address book page window it's now labeled with the wallet name they were opened with, so the user can easily identify which addresses belong to which wallet even when there are many windows opened. It's a helpful enhancement for users managing multiple wallets. ![image](https://github.com/bitcoin-core/gui/assets/110166421/628e37bb-87b9-42fb-9158-bffdd8428bcb) ACKs for top commit: hebasto: ACK 58c9b50, tested on Ubuntu 22.04. Tree-SHA512: 82febc020653560281da144cd35c672c49ca9f48b23d173eb19395e9ab4d045500295a9b5f24c82efdbf6e7ea70c87e733207cb6a31d3f84828b27e3b2df558b
2 parents ab163b0 + 58c9b50 commit 8369467

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

src/qt/addressbookpage.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode,
8181
ui->exportButton->setIcon(platformStyle->SingleColorIcon(":/icons/export"));
8282
}
8383

84-
switch(mode)
85-
{
86-
case ForSelection:
84+
if (mode == ForSelection) {
8785
switch(tab)
8886
{
8987
case SendingTab: setWindowTitle(tr("Choose the address to send coins to")); break;
@@ -94,14 +92,6 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode,
9492
ui->tableView->setFocus();
9593
ui->closeButton->setText(tr("C&hoose"));
9694
ui->exportButton->hide();
97-
break;
98-
case ForEditing:
99-
switch(tab)
100-
{
101-
case SendingTab: setWindowTitle(tr("Sending addresses")); break;
102-
case ReceivingTab: setWindowTitle(tr("Receiving addresses")); break;
103-
}
104-
break;
10595
}
10696
switch(tab)
10797
{
@@ -164,6 +154,7 @@ void AddressBookPage::setModel(AddressTableModel *_model)
164154
connect(_model, &AddressTableModel::rowsInserted, this, &AddressBookPage::selectNewAddress);
165155

166156
selectionChanged();
157+
this->updateWindowsTitleWithWalletName();
167158
}
168159

169160
void AddressBookPage::on_copyAddress_clicked()
@@ -328,3 +319,16 @@ void AddressBookPage::selectNewAddress(const QModelIndex &parent, int begin, int
328319
newAddressToSelect.clear();
329320
}
330321
}
322+
323+
void AddressBookPage::updateWindowsTitleWithWalletName()
324+
{
325+
const QString walletName = this->model->GetWalletDisplayName();
326+
327+
if (mode == ForEditing) {
328+
switch(tab)
329+
{
330+
case SendingTab: setWindowTitle(tr("Sending addresses - %1").arg(walletName)); break;
331+
case ReceivingTab: setWindowTitle(tr("Receiving addresses - %1").arg(walletName)); break;
332+
}
333+
}
334+
}

src/qt/addressbookpage.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public Q_SLOTS:
5656
AddressBookSortFilterProxyModel *proxyModel;
5757
QMenu *contextMenu;
5858
QString newAddressToSelect;
59+
void updateWindowsTitleWithWalletName();
5960

6061
private Q_SLOTS:
6162
/** Delete currently selected address entry */

src/qt/addresstablemodel.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,3 +451,5 @@ void AddressTableModel::emitDataChanged(int idx)
451451
{
452452
Q_EMIT dataChanged(index(idx, 0, QModelIndex()), index(idx, columns.length()-1, QModelIndex()));
453453
}
454+
455+
QString AddressTableModel::GetWalletDisplayName() const { return walletModel->getDisplayName(); };

src/qt/addresstablemodel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class AddressTableModel : public QAbstractTableModel
8787

8888
OutputType GetDefaultAddressType() const;
8989

90+
QString GetWalletDisplayName() const;
91+
9092
private:
9193
WalletModel* const walletModel;
9294
AddressTablePriv *priv = nullptr;

0 commit comments

Comments
 (0)