diff options
author | pablomartin4btc <pablomartin4btc@gmail.com> | 2023-09-13 15:01:38 -0300 |
---|---|---|
committer | pablomartin4btc <pablomartin4btc@gmail.com> | 2023-10-04 17:01:49 -0300 |
commit | 58c9b50a952951cb326c99ba86cb706a1e7d533e (patch) | |
tree | 0bd58c7dbc5c751e0bc858b6066acb02044ff3bd /src/qt/addressbookpage.cpp | |
parent | ab163b0fb5bc9c4ec12f03b57ace1753354e05cf (diff) |
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/qt/addressbookpage.cpp')
-rw-r--r-- | src/qt/addressbookpage.cpp | 26 |
1 files changed, 15 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; + } + } +} |