Skip to content

Commit 460e394

Browse files
committed
Merge #708: Mask values on Transactions View
4492de1 qt: mask values on transactions view (pablomartin4btc) Pull request description: Currently the mask values option (Settings menu->Mask values) hides the wallet balances shown on the Overview page including the recent transactions list from the right panel but it doesn't hide the amounts from the transaction view. ![mask values - hiding wallet balances on overview tab but not on transactions tab](https://user-images.githubusercontent.com/110166421/216876325-56a68006-1be0-4b3f-b1e2-a0575c377cf5.gif) This enhancement has been mentioned on PR #701 as a [desirable follow-up](#701 (comment)). First approach was to hide the amounts on the transactions view when mask values option is checked: ![mask values - hiding amounts on transactions tab](https://user-images.githubusercontent.com/110166421/216876440-0ff1a2ec-2ef2-405c-8b62-e4a94b9221cc.gif) But later on as reviewer **furszy** recommended, I've disabled the Transaction tab directly and switch to the Overview tab if the mask values option is set, check the new screenshots in the [comment below](#708 (comment)). ACKs for top commit: achow101: ACK 4492de1 furszy: ACK 4492de1 hernanmarino: ACK 4492de1 Tree-SHA512: 94c04064cde456ab916cb91fc4619353cf4c8ef0e92aa1522a6b2c18a8d0fa641db9fddac04c2e1a290128879db598a9dfc4a0003dcf6e3413543908ada95afb
2 parents b175bdb + 4492de1 commit 460e394

File tree

6 files changed

+40
-1
lines changed

6 files changed

+40
-1
lines changed

src/qt/bitcoingui.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ void BitcoinGUI::createActions()
456456
m_wallet_controller->closeAllWallets(this);
457457
});
458458
connect(m_mask_values_action, &QAction::toggled, this, &BitcoinGUI::setPrivacy);
459+
connect(m_mask_values_action, &QAction::toggled, this, &BitcoinGUI::enableHistoryAction);
459460
}
460461
#endif // ENABLE_WALLET
461462

@@ -668,6 +669,12 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
668669
}
669670

670671
#ifdef ENABLE_WALLET
672+
void BitcoinGUI::enableHistoryAction(bool privacy)
673+
{
674+
historyAction->setEnabled(!privacy);
675+
if (historyAction->isChecked()) gotoOverviewPage();
676+
}
677+
671678
void BitcoinGUI::setWalletController(WalletController* wallet_controller)
672679
{
673680
assert(!m_wallet_controller);
@@ -716,7 +723,9 @@ void BitcoinGUI::addWallet(WalletModel* walletModel)
716723
connect(wallet_view, &WalletView::encryptionStatusChanged, this, &BitcoinGUI::updateWalletStatus);
717724
connect(wallet_view, &WalletView::incomingTransaction, this, &BitcoinGUI::incomingTransaction);
718725
connect(this, &BitcoinGUI::setPrivacy, wallet_view, &WalletView::setPrivacy);
719-
wallet_view->setPrivacy(isPrivacyModeActivated());
726+
const bool privacy = isPrivacyModeActivated();
727+
wallet_view->setPrivacy(privacy);
728+
enableHistoryAction(privacy);
720729
const QString display_name = walletModel->getDisplayName();
721730
m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel));
722731
}

src/qt/bitcoingui.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ public Q_SLOTS:
288288
void gotoVerifyMessageTab(QString addr = "");
289289
/** Load Partially Signed Bitcoin Transaction from file or clipboard */
290290
void gotoLoadPSBT(bool from_clipboard = false);
291+
/** Enable history action when privacy is changed */
292+
void enableHistoryAction(bool privacy);
291293

292294
/** Show open dialog */
293295
void openClicked();

src/qt/transactionview.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ void TransactionView::showDetails()
531531
{
532532
TransactionDescDialog *dlg = new TransactionDescDialog(selection.at(0));
533533
dlg->setAttribute(Qt::WA_DeleteOnClose);
534+
m_opened_dialogs.append(dlg);
534535
dlg->show();
535536
}
536537
}
@@ -637,6 +638,11 @@ bool TransactionView::eventFilter(QObject *obj, QEvent *event)
637638
return true;
638639
}
639640
}
641+
if (event->type() == QEvent::EnabledChange) {
642+
if (!isEnabled()) {
643+
closeOpenedDialogs();
644+
}
645+
}
640646
return QWidget::eventFilter(obj, event);
641647
}
642648

@@ -646,3 +652,12 @@ void TransactionView::updateWatchOnlyColumn(bool fHaveWatchOnly)
646652
watchOnlyWidget->setVisible(fHaveWatchOnly);
647653
transactionView->setColumnHidden(TransactionTableModel::Watchonly, !fHaveWatchOnly);
648654
}
655+
656+
void TransactionView::closeOpenedDialogs()
657+
{
658+
// close all dialogs opened from this view
659+
for (QDialog* dlg : m_opened_dialogs) {
660+
dlg->close();
661+
}
662+
m_opened_dialogs.clear();
663+
}

src/qt/transactionview.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <QKeyEvent>
1414

1515
class PlatformStyle;
16+
class TransactionDescDialog;
1617
class TransactionFilterProxy;
1718
class WalletModel;
1819

@@ -90,6 +91,8 @@ class TransactionView : public QWidget
9091

9192
const PlatformStyle* m_platform_style;
9293

94+
QList<TransactionDescDialog*> m_opened_dialogs;
95+
9396
private Q_SLOTS:
9497
void contextualMenu(const QPoint &);
9598
void dateRangeChanged();
@@ -121,6 +124,7 @@ public Q_SLOTS:
121124
void changedAmount();
122125
void changedSearch();
123126
void exportClicked();
127+
void closeOpenedDialogs();
124128
void focusTransaction(const QModelIndex&);
125129
void focusTransaction(const uint256& txid);
126130
};

src/qt/walletview.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ WalletView::WalletView(WalletModel* wallet_model, const PlatformStyle* _platform
9393
connect(transactionView, &TransactionView::message, this, &WalletView::message);
9494

9595
connect(this, &WalletView::setPrivacy, overviewPage, &OverviewPage::setPrivacy);
96+
connect(this, &WalletView::setPrivacy, this, &WalletView::disableTransactionView);
9697

9798
// Receive and pass through messages from wallet model
9899
connect(walletModel, &WalletModel::message, this, &WalletView::message);
@@ -278,3 +279,8 @@ void WalletView::showProgress(const QString &title, int nProgress)
278279
}
279280
}
280281
}
282+
283+
void WalletView::disableTransactionView(bool disable)
284+
{
285+
transactionView->setDisabled(disable);
286+
}

src/qt/walletview.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ public Q_SLOTS:
107107
/** Show progress dialog e.g. for rescan */
108108
void showProgress(const QString &title, int nProgress);
109109

110+
private Q_SLOTS:
111+
void disableTransactionView(bool disable);
112+
110113
Q_SIGNALS:
111114
void setPrivacy(bool privacy);
112115
void transactionClicked();

0 commit comments

Comments
 (0)