From e2544983437df45224e09aefbdf2da1b3f6b9404 Mon Sep 17 00:00:00 2001 From: "levoncrypto1994@gmail.com" Date: Tue, 2 Apr 2024 16:14:16 +0400 Subject: [PATCH 1/4] Fix go private window behavore for exchange address --- src/qt/sendcoinsdialog.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 8880bf0af7..6ca8253786 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -341,12 +341,25 @@ void SendCoinsDialog::on_sendButton_clicked() } } else if ((fAnonymousMode == false) && (sparkAddressCount == 0)) { if (spark::IsSparkAllowed()) { - SendGoPrivateDialog goPrivateDialog; - bool clickedButton = goPrivateDialog.getClickedButton(); - if (!clickedButton) { - setAnonymizeMode(true); - fNewRecipientAllowed = true; - return; + bool openPageTag = true; + for(int i = 0; i < recipients.size(); ++i){ + std::string address = recipients[i].address.toStdString(); + CBitcoinAddress add(address); + CTxDestination dest = add.Get(); + + if (boost::get(&dest)) { + openPageTag = false; + } + } + + if (openPageTag) { + SendGoPrivateDialog goPrivateDialog; + bool clickedButton = goPrivateDialog.getClickedButton(); + if (!clickedButton) { + setAnonymizeMode(true); + fNewRecipientAllowed = true; + return; + } } } prepareStatus = model->prepareTransaction(currentTransaction, &ctrl); From 98dacc35c314abfe9d6cf69269c67ac42634ead5 Mon Sep 17 00:00:00 2001 From: "levoncrypto1994@gmail.com" Date: Wed, 3 Apr 2024 00:08:54 +0400 Subject: [PATCH 2/4] Add setting for window --- src/qt/forms/optionsdialog.ui | 14 ++++++++++++++ src/qt/optionsdialog.cpp | 2 ++ src/qt/optionsmodel.cpp | 11 +++++++++++ src/qt/optionsmodel.h | 4 ++++ src/qt/sendcoinsdialog.cpp | 2 +- 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index a7affffa67..164d659bc6 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -163,6 +163,20 @@ + + + + Disable go to private window. + + + &Disable go to private window + + + + + + + diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 6017558d4f..2e77844b47 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -165,6 +165,7 @@ void OptionsDialog::setModel(OptionsModel *_model) /* Wallet */ connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); connect(ui->reindexLelantus, &QCheckBox::clicked, this, &OptionsDialog::handleEnabledZapChanged); + connect(ui->disableGoToPrivateWindow, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); /* Network */ connect(ui->allowIncoming, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); connect(ui->connectSocks, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); @@ -184,6 +185,7 @@ void OptionsDialog::setMapper() /* Wallet */ mapper->addMapping(ui->spendZeroConfChange, OptionsModel::SpendZeroConfChange); mapper->addMapping(ui->reindexLelantus, OptionsModel::ReindexLelantus); + mapper->addMapping(ui->disableGoToPrivateWindow, OptionsModel::DisableGoToPrivate); mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures); /* Lelantus */ diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 7489e60471..c03c1b5c89 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -81,6 +81,10 @@ void OptionsModel::Init(bool resetSettings) settings.setValue("fCoinControlFeatures", false); fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool(); + if (!settings.contains("fDisableGoToPrivate")) + settings.setValue("fDisableGoToPrivate", false); + fDisableGoToPrivate = settings.value("fDisableGoToPrivate", false).toBool(); + if (!settings.contains("fAutoAnonymize")) settings.setValue("fAutoAnonymize", false); fAutoAnonymize = settings.value("fAutoAnonymize", false).toBool(); @@ -277,6 +281,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const return settings.value("language"); case CoinControlFeatures: return fCoinControlFeatures; + case DisableGoToPrivate: + return fDisableGoToPrivate; case AutoAnonymize: return fAutoAnonymize; case LelantusPage: @@ -424,6 +430,11 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in settings.setValue("fCoinControlFeatures", fCoinControlFeatures); Q_EMIT coinControlFeaturesChanged(fCoinControlFeatures); break; + case DisableGoToPrivate: + fDisableGoToPrivate = value.toBool(); + settings.setValue("fDisableGoToPrivate", fDisableGoToPrivate); + Q_EMIT disableGoToPrivateChanged(fDisableGoToPrivate); + break; case AutoAnonymize: fAutoAnonymize = value.toBool(); settings.setValue("fAutoAnonymize", fAutoAnonymize); diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index 1ff155b86d..148c4ccf38 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -46,6 +46,7 @@ class OptionsModel : public QAbstractListModel DatabaseCache, // int SpendZeroConfChange, // bool ReindexLelantus, // bool + DisableGoToPrivate, // bool Listen, // bool TorSetup, // bool AutoAnonymize, // bool @@ -73,6 +74,7 @@ class OptionsModel : public QAbstractListModel bool getRapAddresses() { return fenableRapAddresses; } const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; } bool getAutoAnonymize() { return fAutoAnonymize; } + bool getGoPrivateWindow() {return fDisableGoToPrivate;} bool getLelantusPage() {return fLelantusPage; } /* Restart flag helper */ @@ -90,6 +92,7 @@ class OptionsModel : public QAbstractListModel bool fCoinControlFeatures; bool fAutoAnonymize; bool fLelantusPage; + bool fDisableGoToPrivate; bool fenableRapAddresses; /* settings that were overridden by command-line */ @@ -106,6 +109,7 @@ class OptionsModel : public QAbstractListModel void enableRapAddressesChanged(bool); void autoAnonymizeChanged(bool); void lelantusPageChanged(bool); + void disableGoToPrivateChanged(bool); void hideTrayIconChanged(bool); }; diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 6ca8253786..a2b51c52e3 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -340,7 +340,7 @@ void SendCoinsDialog::on_sendButton_clicked() return; } } else if ((fAnonymousMode == false) && (sparkAddressCount == 0)) { - if (spark::IsSparkAllowed()) { + if (!model->getOptionsModel()->getGoPrivateWindow() && spark::IsSparkAllowed()) { bool openPageTag = true; for(int i = 0; i < recipients.size(); ++i){ std::string address = recipients[i].address.toStdString(); From 7ca765c0cfe083b51fd94356c8bffa7cb502fcc1 Mon Sep 17 00:00:00 2001 From: "levoncrypto1994@gmail.com" Date: Fri, 5 Apr 2024 21:09:09 +0400 Subject: [PATCH 3/4] Changes for optimize --- src/qt/optionsmodel.h | 2 +- src/qt/sendcoinsdialog.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index 148c4ccf38..f27f01eeec 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -74,7 +74,7 @@ class OptionsModel : public QAbstractListModel bool getRapAddresses() { return fenableRapAddresses; } const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; } bool getAutoAnonymize() { return fAutoAnonymize; } - bool getGoPrivateWindow() {return fDisableGoToPrivate;} + bool getDisableGoToPrivate() {return fDisableGoToPrivate;} bool getLelantusPage() {return fLelantusPage; } /* Restart flag helper */ diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index a2b51c52e3..2a5e4b2c9c 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -340,7 +340,7 @@ void SendCoinsDialog::on_sendButton_clicked() return; } } else if ((fAnonymousMode == false) && (sparkAddressCount == 0)) { - if (!model->getOptionsModel()->getGoPrivateWindow() && spark::IsSparkAllowed()) { + if (!model->getOptionsModel()->getDisableGoToPrivate() && spark::IsSparkAllowed()) { bool openPageTag = true; for(int i = 0; i < recipients.size(); ++i){ std::string address = recipients[i].address.toStdString(); @@ -349,6 +349,7 @@ void SendCoinsDialog::on_sendButton_clicked() if (boost::get(&dest)) { openPageTag = false; + break; } } From f897199c6df1d90dad6de45d2f036a6cf35c6be3 Mon Sep 17 00:00:00 2001 From: "levoncrypto1994@gmail.com" Date: Fri, 5 Apr 2024 22:21:08 +0400 Subject: [PATCH 4/4] Build fix --- src/qt/forms/optionsdialog.ui | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 164d659bc6..9c687bf098 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -171,22 +171,18 @@ &Disable go to private window - - - - - - - - - - Restore all Lelantus transactions following a reindex. - - - &Reindex Lelantus - - - + + + + + + Restore all Lelantus transactions following a reindex. + + + &Reindex Lelantus + + +