Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wallet name to address book page title #757

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/qt/addressbookpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down Expand Up @@ -164,6 +154,7 @@ void AddressBookPage::setModel(AddressTableModel *_model)
connect(_model, &AddressTableModel::rowsInserted, this, &AddressBookPage::selectNewAddress);

selectionChanged();
this->updateWindowsTitleWithWalletName();
}

void AddressBookPage::on_copyAddress_clicked()
Expand Down Expand Up @@ -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;
}
}
}
1 change: 1 addition & 0 deletions src/qt/addressbookpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public Q_SLOTS:
AddressBookSortFilterProxyModel *proxyModel;
QMenu *contextMenu;
QString newAddressToSelect;
void updateWindowsTitleWithWalletName();

private Q_SLOTS:
/** Delete currently selected address entry */
Expand Down
2 changes: 2 additions & 0 deletions src/qt/addresstablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); };
2 changes: 2 additions & 0 deletions src/qt/addresstablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class AddressTableModel : public QAbstractTableModel

OutputType GetDefaultAddressType() const;

QString GetWalletDisplayName() const;

private:
WalletModel* const walletModel;
AddressTablePriv *priv = nullptr;
Expand Down