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

Fix go private window behavior for exchange address #1426

Closed
wants to merge 4 commits into from
Closed
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
20 changes: 15 additions & 5 deletions src/qt/forms/optionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,25 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="reindexLelantus">
<widget class="QCheckBox" name="disableGoToPrivateWindow">
<property name="toolTip">
<string>Restore all Lelantus transactions following a reindex.</string>
<string>Disable go to private window.</string>
</property>
<property name="text">
<string>&amp;Reindex Lelantus</string>
<string>&amp;Disable go to private window</string>
</property>
</widget>
</item>
</widget>
</item>
<item>
<widget class="QCheckBox" name="reindexLelantus">
<property name="toolTip">
<string>Restore all Lelantus transactions following a reindex.</string>
</property>
<property name="text">
<string>&amp;Reindex Lelantus</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
2 changes: 2 additions & 0 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 */
Expand Down
11 changes: 11 additions & 0 deletions src/qt/optionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/qt/optionsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class OptionsModel : public QAbstractListModel
DatabaseCache, // int
SpendZeroConfChange, // bool
ReindexLelantus, // bool
DisableGoToPrivate, // bool
Listen, // bool
TorSetup, // bool
AutoAnonymize, // bool
Expand Down Expand Up @@ -73,6 +74,7 @@ class OptionsModel : public QAbstractListModel
bool getRapAddresses() { return fenableRapAddresses; }
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
bool getAutoAnonymize() { return fAutoAnonymize; }
bool getDisableGoToPrivate() {return fDisableGoToPrivate;}
bool getLelantusPage() {return fLelantusPage; }

/* Restart flag helper */
Expand All @@ -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 */
Expand All @@ -106,6 +109,7 @@ class OptionsModel : public QAbstractListModel
void enableRapAddressesChanged(bool);
void autoAnonymizeChanged(bool);
void lelantusPageChanged(bool);
void disableGoToPrivateChanged(bool);
void hideTrayIconChanged(bool);
};

Expand Down
28 changes: 21 additions & 7 deletions src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,27 @@ void SendCoinsDialog::on_sendButton_clicked()
return;
}
} else if ((fAnonymousMode == false) && (sparkAddressCount == 0)) {
if (spark::IsSparkAllowed()) {
SendGoPrivateDialog goPrivateDialog;
bool clickedButton = goPrivateDialog.getClickedButton();
if (!clickedButton) {
setAnonymizeMode(true);
fNewRecipientAllowed = true;
return;
if (!model->getOptionsModel()->getDisableGoToPrivate() && spark::IsSparkAllowed()) {
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<CExchangeKeyID>(&dest)) {
openPageTag = false;
break;
}
}

if (openPageTag) {
SendGoPrivateDialog goPrivateDialog;
bool clickedButton = goPrivateDialog.getClickedButton();
if (!clickedButton) {
setAnonymizeMode(true);
fNewRecipientAllowed = true;
return;
}
}
}
prepareStatus = model->prepareTransaction(currentTransaction, &ctrl);
Expand Down
Loading