aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpablomartin4btc <pablomartin4btc@gmail.com>2023-02-06 00:13:43 -0300
committerpablomartin4btc <pablomartin4btc@gmail.com>2023-03-10 14:52:01 -0300
commit4492de1be11f4131811f504a037342c78f480e20 (patch)
treee4bbc669806126f651dffd599b0f166c018af165 /src
parent4f841cbb81ecce6e1aab42e8edb5bf1c6f0c36bb (diff)
qt: mask values on transactions view
Diffstat (limited to 'src')
-rw-r--r--src/qt/bitcoingui.cpp11
-rw-r--r--src/qt/bitcoingui.h2
-rw-r--r--src/qt/transactionview.cpp15
-rw-r--r--src/qt/transactionview.h4
-rw-r--r--src/qt/walletview.cpp6
-rw-r--r--src/qt/walletview.h3
6 files changed, 40 insertions, 1 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index c025d4e3aa..0eae7d3e79 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -456,6 +456,7 @@ void BitcoinGUI::createActions()
m_wallet_controller->closeAllWallets(this);
});
connect(m_mask_values_action, &QAction::toggled, this, &BitcoinGUI::setPrivacy);
+ connect(m_mask_values_action, &QAction::toggled, this, &BitcoinGUI::enableHistoryAction);
}
#endif // ENABLE_WALLET
@@ -668,6 +669,12 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
}
#ifdef ENABLE_WALLET
+void BitcoinGUI::enableHistoryAction(bool privacy)
+{
+ historyAction->setEnabled(!privacy);
+ if (historyAction->isChecked()) gotoOverviewPage();
+}
+
void BitcoinGUI::setWalletController(WalletController* wallet_controller)
{
assert(!m_wallet_controller);
@@ -716,7 +723,9 @@ void BitcoinGUI::addWallet(WalletModel* walletModel)
connect(wallet_view, &WalletView::encryptionStatusChanged, this, &BitcoinGUI::updateWalletStatus);
connect(wallet_view, &WalletView::incomingTransaction, this, &BitcoinGUI::incomingTransaction);
connect(this, &BitcoinGUI::setPrivacy, wallet_view, &WalletView::setPrivacy);
- wallet_view->setPrivacy(isPrivacyModeActivated());
+ const bool privacy = isPrivacyModeActivated();
+ wallet_view->setPrivacy(privacy);
+ enableHistoryAction(privacy);
const QString display_name = walletModel->getDisplayName();
m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel));
}
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 1a83057146..92b889263b 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -288,6 +288,8 @@ public Q_SLOTS:
void gotoVerifyMessageTab(QString addr = "");
/** Load Partially Signed Bitcoin Transaction from file or clipboard */
void gotoLoadPSBT(bool from_clipboard = false);
+ /** Enable history action when privacy is changed */
+ void enableHistoryAction(bool privacy);
/** Show open dialog */
void openClicked();
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index aa5c82ddb1..351305f3fa 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -531,6 +531,7 @@ void TransactionView::showDetails()
{
TransactionDescDialog *dlg = new TransactionDescDialog(selection.at(0));
dlg->setAttribute(Qt::WA_DeleteOnClose);
+ m_opened_dialogs.append(dlg);
dlg->show();
}
}
@@ -637,6 +638,11 @@ bool TransactionView::eventFilter(QObject *obj, QEvent *event)
return true;
}
}
+ if (event->type() == QEvent::EnabledChange) {
+ if (!isEnabled()) {
+ closeOpenedDialogs();
+ }
+ }
return QWidget::eventFilter(obj, event);
}
@@ -646,3 +652,12 @@ void TransactionView::updateWatchOnlyColumn(bool fHaveWatchOnly)
watchOnlyWidget->setVisible(fHaveWatchOnly);
transactionView->setColumnHidden(TransactionTableModel::Watchonly, !fHaveWatchOnly);
}
+
+void TransactionView::closeOpenedDialogs()
+{
+ // close all dialogs opened from this view
+ for (QDialog* dlg : m_opened_dialogs) {
+ dlg->close();
+ }
+ m_opened_dialogs.clear();
+}
diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h
index fe6e3ac7c0..29fb722afe 100644
--- a/src/qt/transactionview.h
+++ b/src/qt/transactionview.h
@@ -13,6 +13,7 @@
#include <QKeyEvent>
class PlatformStyle;
+class TransactionDescDialog;
class TransactionFilterProxy;
class WalletModel;
@@ -90,6 +91,8 @@ private:
const PlatformStyle* m_platform_style;
+ QList<TransactionDescDialog*> m_opened_dialogs;
+
private Q_SLOTS:
void contextualMenu(const QPoint &);
void dateRangeChanged();
@@ -121,6 +124,7 @@ public Q_SLOTS:
void changedAmount();
void changedSearch();
void exportClicked();
+ void closeOpenedDialogs();
void focusTransaction(const QModelIndex&);
void focusTransaction(const uint256& txid);
};
diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp
index e62821d5bd..09e0771534 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -93,6 +93,7 @@ WalletView::WalletView(WalletModel* wallet_model, const PlatformStyle* _platform
connect(transactionView, &TransactionView::message, this, &WalletView::message);
connect(this, &WalletView::setPrivacy, overviewPage, &OverviewPage::setPrivacy);
+ connect(this, &WalletView::setPrivacy, this, &WalletView::disableTransactionView);
// Receive and pass through messages from wallet model
connect(walletModel, &WalletModel::message, this, &WalletView::message);
@@ -278,3 +279,8 @@ void WalletView::showProgress(const QString &title, int nProgress)
}
}
}
+
+void WalletView::disableTransactionView(bool disable)
+{
+ transactionView->setDisabled(disable);
+}
diff --git a/src/qt/walletview.h b/src/qt/walletview.h
index ebceef9cf9..475085044d 100644
--- a/src/qt/walletview.h
+++ b/src/qt/walletview.h
@@ -107,6 +107,9 @@ public Q_SLOTS:
/** Show progress dialog e.g. for rescan */
void showProgress(const QString &title, int nProgress);
+private Q_SLOTS:
+ void disableTransactionView(bool disable);
+
Q_SIGNALS:
void setPrivacy(bool privacy);
void transactionClicked();