Merge bitcoin-core/gui#757: Add wallet name to address book page title

58c9b50a95 gui: Add wallet name to address book page (pablomartin4btc)

Pull request description:

  It fixes bitcoin-core/gui#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 58c9b50a95, tested on Ubuntu 22.04.

Tree-SHA512: 82febc020653560281da144cd35c672c49ca9f48b23d173eb19395e9ab4d045500295a9b5f24c82efdbf6e7ea70c87e733207cb6a31d3f84828b27e3b2df558b
pull/28588/head
Hennadii Stepanov 1 year ago
commit 8369467c94
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

@ -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;
}
}
}

@ -56,6 +56,7 @@ private:
AddressBookSortFilterProxyModel *proxyModel;
QMenu *contextMenu;
QString newAddressToSelect;
void updateWindowsTitleWithWalletName();
private Q_SLOTS:
/** Delete currently selected address entry */

@ -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(); };

@ -87,6 +87,8 @@ public:
OutputType GetDefaultAddressType() const;
QString GetWalletDisplayName() const;
private:
WalletModel* const walletModel;
AddressTablePriv *priv = nullptr;

Loading…
Cancel
Save