SubaddressAccount: cleanup

This commit is contained in:
tobtoht
2025-03-11 16:05:43 +01:00
parent de37f9a8b7
commit c10190ea2e
9 changed files with 74 additions and 136 deletions
+10 -11
View File
@@ -67,21 +67,25 @@ void AccountSwitcherDialog::switchAccount(const QModelIndex &index) {
}
void AccountSwitcherDialog::copyLabel() {
auto row = this->currentEntry();
if (!row) {
QModelIndex index = m_proxyModel->mapToSource(ui->accounts->currentIndex());
if (!index.isValid()) {
return;
}
Utils::copyToClipboard(row->getLabel());
auto& row = m_wallet->subaddressAccountModel()->entryFromIndex(index);
Utils::copyToClipboard(row.label);
}
void AccountSwitcherDialog::copyBalance() {
auto row = this->currentEntry();
if (!row) {
QModelIndex index = m_proxyModel->mapToSource(ui->accounts->currentIndex());
if (!index.isValid()) {
return;
}
Utils::copyToClipboard(row->getBalance());
auto& row = m_wallet->subaddressAccountModel()->entryFromIndex(index);
Utils::copyToClipboard(WalletManager::displayAmount(row.balance));
}
void AccountSwitcherDialog::editLabel() {
@@ -115,9 +119,4 @@ void AccountSwitcherDialog::showContextMenu(const QPoint &point) {
menu->popup(ui->accounts->viewport()->mapToGlobal(point));
}
AccountRow* AccountSwitcherDialog::currentEntry() {
QModelIndex index = m_proxyModel->mapToSource(ui->accounts->currentIndex());
return m_wallet->subaddressAccountModel()->entryFromIndex(index);
}
AccountSwitcherDialog::~AccountSwitcherDialog() = default;