diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index cbff9f6ae895..b9f8cf5a65bd 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -97,7 +97,9 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
masternodeAction(0),
quitAction(0),
sendCoinsAction(0),
+ privateSendCoinsAction(0),
sendCoinsMenuAction(0),
+ privateSendCoinsMenuAction(0),
usedSendingAddressesAction(0),
usedReceivingAddressesAction(0),
signMessageAction(0),
@@ -334,14 +336,29 @@ void BitcoinGUI::createActions()
sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip());
sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip());
+ privateSendCoinsAction = new QAction(tr("&PrivateSend"), this);
+ privateSendCoinsAction->setStatusTip(tr("PrivateSend coins to a Dash address"));
+ privateSendCoinsAction->setToolTip(privateSendCoinsAction->statusTip());
+ privateSendCoinsAction->setCheckable(true);
+#ifdef Q_OS_MAC
+ privateSendCoinsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_3));
+#else
+ privateSendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
+#endif
+ tabGroup->addAction(privateSendCoinsAction);
+
+ privateSendCoinsMenuAction = new QAction(QIcon(":/icons/send"), privateSendCoinsAction->text(), this);
+ privateSendCoinsMenuAction->setStatusTip(privateSendCoinsAction->statusTip());
+ privateSendCoinsMenuAction->setToolTip(privateSendCoinsMenuAction->statusTip());
+
receiveCoinsAction = new QAction(tr("&Receive"), this);
receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and dash: URIs)"));
receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip());
receiveCoinsAction->setCheckable(true);
#ifdef Q_OS_MAC
- receiveCoinsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_3));
+ receiveCoinsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_4));
#else
- receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
+ receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
#endif
tabGroup->addAction(receiveCoinsAction);
@@ -354,9 +371,9 @@ void BitcoinGUI::createActions()
historyAction->setToolTip(historyAction->statusTip());
historyAction->setCheckable(true);
#ifdef Q_OS_MAC
- historyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_4));
+ historyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_5));
#else
- historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
+ historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
#endif
tabGroup->addAction(historyAction);
@@ -368,9 +385,9 @@ void BitcoinGUI::createActions()
masternodeAction->setToolTip(masternodeAction->statusTip());
masternodeAction->setCheckable(true);
#ifdef Q_OS_MAC
- masternodeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_5));
+ masternodeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_6));
#else
- masternodeAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
+ masternodeAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
#endif
tabGroup->addAction(masternodeAction);
connect(masternodeAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
@@ -385,6 +402,10 @@ void BitcoinGUI::createActions()
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
+ connect(privateSendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
+ connect(privateSendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoPrivateSendCoinsPage()));
+ connect(privateSendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
+ connect(privateSendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoPrivateSendCoinsPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
@@ -582,6 +603,7 @@ void BitcoinGUI::createToolBars()
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->addAction(overviewAction);
toolbar->addAction(sendCoinsAction);
+ toolbar->addAction(privateSendCoinsAction);
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
QSettings settings;
@@ -748,6 +770,8 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
overviewAction->setEnabled(enabled);
sendCoinsAction->setEnabled(enabled);
sendCoinsMenuAction->setEnabled(enabled);
+ privateSendCoinsAction->setEnabled(enabled && privateSendClient.fEnablePrivateSend);
+ privateSendCoinsMenuAction->setEnabled(enabled && privateSendClient.fEnablePrivateSend);
receiveCoinsAction->setEnabled(enabled);
receiveCoinsMenuAction->setEnabled(enabled);
historyAction->setEnabled(enabled);
@@ -781,6 +805,7 @@ void BitcoinGUI::createIconMenu(QMenu *pmenu)
pmenu->addAction(toggleHideAction);
pmenu->addSeparator();
pmenu->addAction(sendCoinsMenuAction);
+ pmenu->addAction(privateSendCoinsMenuAction);
pmenu->addAction(receiveCoinsMenuAction);
pmenu->addSeparator();
pmenu->addAction(signMessageAction);
@@ -939,6 +964,12 @@ void BitcoinGUI::gotoSendCoinsPage(QString addr)
if (walletFrame) walletFrame->gotoSendCoinsPage(addr);
}
+void BitcoinGUI::gotoPrivateSendCoinsPage(QString addr)
+{
+ privateSendCoinsAction->setChecked(true);
+ if (walletFrame) walletFrame->gotoPrivateSendCoinsPage(addr);
+}
+
void BitcoinGUI::gotoSignMessageTab(QString addr)
{
if (walletFrame) walletFrame->gotoSignMessageTab(addr);
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 8f22bbb40565..e927210773ff 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -101,6 +101,8 @@ class BitcoinGUI : public QMainWindow
QAction *quitAction;
QAction *sendCoinsAction;
QAction *sendCoinsMenuAction;
+ QAction *privateSendCoinsAction;
+ QAction *privateSendCoinsMenuAction;
QAction *usedSendingAddressesAction;
QAction *usedReceivingAddressesAction;
QAction *signMessageAction;
@@ -239,6 +241,8 @@ private Q_SLOTS:
void gotoReceiveCoinsPage();
/** Switch to send coins page */
void gotoSendCoinsPage(QString addr = "");
+ /** Switch to PrivateSend coins page */
+ void gotoPrivateSendCoinsPage(QString addr = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index ca4e9fbb9932..0b4b2e47c22c 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -427,13 +427,6 @@ void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column)
item->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
else {
coinControl()->Select(outpt);
- int nRounds = item->data(COLUMN_PRIVATESEND_ROUNDS, Qt::UserRole).toLongLong();
- if (coinControl()->IsUsingPrivateSend() && nRounds < privateSendClient.nPrivateSendRounds) {
- QMessageBox::warning(this, windowTitle(),
- tr("Non-mixed input selected. PrivateSend will be disabled.
If you still want to use PrivateSend, please deselect all non-mixed inputs first and then check the PrivateSend checkbox again."),
- QMessageBox::Ok, QMessageBox::Ok);
- coinControl()->UsePrivateSend(false);
- }
}
// selection changed -> update labels
@@ -494,6 +487,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
unsigned int nBytesInputs = 0;
unsigned int nQuantity = 0;
int nQuantityUncompressed = 0;
+ bool fUnselectedSpent{false};
+ bool fUnselectedNonMixed{false};
std::vector vCoinControl;
std::vector vOutputs;
@@ -508,9 +503,20 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
if (model->isSpent(outpt))
{
coinControl()->UnSelect(outpt);
+ fUnselectedSpent = true;
continue;
}
+ // unselect non-fully-mixed, this can happen when users switch from Send to PrivateSend
+ if (coinControl()->IsUsingPrivateSend()) {
+ int nRounds = model->getRealOutpointPrivateSendRounds(outpt);
+ if (nRounds < privateSendClient.nPrivateSendRounds) {
+ coinControl()->UnSelect(outpt);
+ fUnselectedNonMixed = true;
+ continue;
+ }
+ }
+
// Quantity
nQuantity++;
@@ -643,6 +649,17 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
QLabel *label = dialog->findChild("labelCoinControlInsuffFunds");
if (label)
label->setVisible(nChange < 0);
+
+ // Warn about unselected coins
+ if (fUnselectedSpent) {
+ QMessageBox::warning(dialog, "CoinControl",
+ tr("Some coins were unselected because they were spent."),
+ QMessageBox::Ok, QMessageBox::Ok);
+ } else if (fUnselectedNonMixed) {
+ QMessageBox::warning(dialog, "CoinControl",
+ tr("Some coins were unselected because they do not have enough mixing rounds."),
+ QMessageBox::Ok, QMessageBox::Ok);
+ }
}
CCoinControl* CoinControlDialog::coinControl()
@@ -696,87 +713,91 @@ void CoinControlDialog::updateView()
CAmount nSum = 0;
int nChildren = 0;
for (const COutput& out : coins.second) {
- nSum += out.tx->tx->vout[out.i].nValue;
- nChildren++;
-
- CCoinControlWidgetItem *itemOutput;
- if (treeMode) itemOutput = new CCoinControlWidgetItem(itemWalletAddress);
- else itemOutput = new CCoinControlWidgetItem(ui->treeWidget);
- itemOutput->setFlags(flgCheckbox);
- itemOutput->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked);
-
- // address
- CTxDestination outputAddress;
- QString sAddress = "";
- if(ExtractDestination(out.tx->tx->vout[out.i].scriptPubKey, outputAddress))
- {
- sAddress = QString::fromStdString(EncodeDestination(outputAddress));
-
- // if listMode or change => show dash address. In tree mode, address is not shown again for direct wallet address outputs
- if (!treeMode || (!(sAddress == sWalletAddress)))
- itemOutput->setText(COLUMN_ADDRESS, sAddress);
+ COutPoint outpoint = COutPoint(out.tx->tx->GetHash(), out.i);
+ int nRounds = model->getRealOutpointPrivateSendRounds(outpoint);
- itemOutput->setToolTip(COLUMN_ADDRESS, sAddress);
- }
+ if ((coinControl()->IsUsingPrivateSend() && nRounds >= privateSendClient.nPrivateSendRounds) || !(coinControl()->IsUsingPrivateSend())) {
+ nSum += out.tx->tx->vout[out.i].nValue;
+ nChildren++;
- // label
- if (!(sAddress == sWalletAddress)) // change
- {
- // tooltip from where the change comes from
- itemOutput->setToolTip(COLUMN_LABEL, tr("change from %1 (%2)").arg(sWalletLabel).arg(sWalletAddress));
- itemOutput->setText(COLUMN_LABEL, tr("(change)"));
- }
- else if (!treeMode)
- {
- QString sLabel = model->getAddressTableModel()->labelForAddress(sAddress);
- if (sLabel.isEmpty())
- sLabel = tr("(no label)");
- itemOutput->setText(COLUMN_LABEL, sLabel);
- }
+ CCoinControlWidgetItem* itemOutput;
+ if (treeMode) {
+ itemOutput = new CCoinControlWidgetItem(itemWalletAddress);
+ } else {
+ itemOutput = new CCoinControlWidgetItem(ui->treeWidget);
+ }
+ itemOutput->setFlags(flgCheckbox);
+ itemOutput->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
- // amount
- itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->tx->vout[out.i].nValue));
- itemOutput->setToolTip(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->tx->vout[out.i].nValue));
- itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)out.tx->tx->vout[out.i].nValue)); // padding so that sorting works correctly
+ // address
+ CTxDestination outputAddress;
+ QString sAddress = "";
+ if (ExtractDestination(out.tx->tx->vout[out.i].scriptPubKey, outputAddress)) {
+ sAddress = QString::fromStdString(EncodeDestination(outputAddress));
- // date
- itemOutput->setText(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime()));
- itemOutput->setToolTip(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime()));
- itemOutput->setData(COLUMN_DATE, Qt::UserRole, QVariant((qlonglong)out.tx->GetTxTime()));
+ // if listMode or change => show dash address. In tree mode, address is not shown again for direct wallet address outputs
+ if (!treeMode || (!(sAddress == sWalletAddress))) {
+ itemOutput->setText(COLUMN_ADDRESS, sAddress);
+ }
+ itemOutput->setToolTip(COLUMN_ADDRESS, sAddress);
+ }
- // PrivateSend rounds
- COutPoint outpoint = COutPoint(out.tx->tx->GetHash(), out.i);
- int nRounds = model->getRealOutpointPrivateSendRounds(outpoint);
+ // label
+ if (!(sAddress == sWalletAddress)) { //change
+ // tooltip from where the change comes from
+ itemOutput->setToolTip(COLUMN_LABEL, tr("change from %1 (%2)").arg(sWalletLabel).arg(sWalletAddress));
+ itemOutput->setText(COLUMN_LABEL, tr("(change)"));
+ } else if (!treeMode) {
+ QString sLabel = model->getAddressTableModel()->labelForAddress(sAddress);
+ if (sLabel.isEmpty()) {
+ sLabel = tr("(no label)");
+ }
+ itemOutput->setText(COLUMN_LABEL, sLabel);
+ }
- if (nRounds >= 0 || LogAcceptCategory(BCLog::PRIVATESEND)) itemOutput->setText(COLUMN_PRIVATESEND_ROUNDS, QString::number(nRounds));
- else itemOutput->setText(COLUMN_PRIVATESEND_ROUNDS, tr("n/a"));
- itemOutput->setData(COLUMN_PRIVATESEND_ROUNDS, Qt::UserRole, QVariant((qlonglong)nRounds));
+ // amount
+ itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->tx->vout[out.i].nValue));
+ itemOutput->setToolTip(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->tx->vout[out.i].nValue));
+ itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)out.tx->tx->vout[out.i].nValue)); // padding so that sorting works correctly
+
+ // date
+ itemOutput->setText(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime()));
+ itemOutput->setToolTip(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime()));
+ itemOutput->setData(COLUMN_DATE, Qt::UserRole, QVariant((qlonglong)out.tx->GetTxTime()));
+
+ // PrivateSend rounds
+ if (nRounds >= 0 || LogAcceptCategory(BCLog::PRIVATESEND)) {
+ itemOutput->setText(COLUMN_PRIVATESEND_ROUNDS, QString::number(nRounds));
+ } else {
+ itemOutput->setText(COLUMN_PRIVATESEND_ROUNDS, tr("n/a"));
+ }
+ itemOutput->setData(COLUMN_PRIVATESEND_ROUNDS, Qt::UserRole, QVariant((qlonglong)nRounds));
+ // confirmations
+ itemOutput->setText(COLUMN_CONFIRMATIONS, QString::number(out.nDepth));
+ itemOutput->setData(COLUMN_CONFIRMATIONS, Qt::UserRole, QVariant((qlonglong)out.nDepth));
- // confirmations
- itemOutput->setText(COLUMN_CONFIRMATIONS, QString::number(out.nDepth));
- itemOutput->setData(COLUMN_CONFIRMATIONS, Qt::UserRole, QVariant((qlonglong)out.nDepth));
+ // transaction hash
+ uint256 txhash = out.tx->GetHash();
+ itemOutput->setText(COLUMN_TXHASH, QString::fromStdString(txhash.GetHex()));
- // transaction hash
- uint256 txhash = out.tx->GetHash();
- itemOutput->setText(COLUMN_TXHASH, QString::fromStdString(txhash.GetHex()));
+ // vout index
+ itemOutput->setText(COLUMN_VOUT_INDEX, QString::number(out.i));
- // vout index
- itemOutput->setText(COLUMN_VOUT_INDEX, QString::number(out.i));
+ // disable locked coins
+ if (model->isLockedCoin(txhash, out.i)) {
+ COutPoint outpt(txhash, out.i);
+ coinControl()->UnSelect(outpt); // just to be sure
+ itemOutput->setDisabled(true);
+ itemOutput->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed"));
+ }
- // disable locked coins
- if (model->isLockedCoin(txhash, out.i))
- {
- COutPoint outpt(txhash, out.i);
- coinControl()->UnSelect(outpt); // just to be sure
- itemOutput->setDisabled(true);
- itemOutput->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed"));
+ // set checkbox
+ if (coinControl()->IsSelected(COutPoint(txhash, out.i))) {
+ itemOutput->setCheckState(COLUMN_CHECKBOX, Qt::Checked);
+ }
}
-
- // set checkbox
- if (coinControl()->IsSelected(COutPoint(txhash, out.i)))
- itemOutput->setCheckState(COLUMN_CHECKBOX, Qt::Checked);
}
// amount
diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui
index ef8c93aad481..4f00c759ad94 100644
--- a/src/qt/forms/sendcoinsdialog.ui
+++ b/src/qt/forms/sendcoinsdialog.ui
@@ -1210,22 +1210,6 @@
3
- -
-
-
-
- 95
- 0
-
-
-
- PrivateSend
-
-
- false
-
-
-
-
diff --git a/src/qt/res/css/dark.css b/src/qt/res/css/dark.css
index 6ebbd0bf22df..7d0e6b071a19 100644
--- a/src/qt/res/css/dark.css
+++ b/src/qt/res/css/dark.css
@@ -67,6 +67,10 @@ border: 0;
font-weight: bold;
}
+QToolBar > QToolButton:disabled {
+color: #444;
+}
+
QToolBar > QLabel {
border: 0;
margin:10px 0 0 0;
diff --git a/src/qt/res/css/light.css b/src/qt/res/css/light.css
index d6895df3491c..5e24d95b22a9 100644
--- a/src/qt/res/css/light.css
+++ b/src/qt/res/css/light.css
@@ -65,6 +65,10 @@ border: 0;
font-weight: bold;
}
+QToolBar > QToolButton:disabled {
+color: #444;
+}
+
QToolBar > QLabel {
border:0;
margin:10px 0 0 0;
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index 68f9620519c2..e5d0163589ed 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -59,7 +59,8 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p
model(0),
fNewRecipientAllowed(true),
fFeeMinimized(true),
- platformStyle(_platformStyle)
+ platformStyle(_platformStyle),
+ fPrivateSend(false)
{
ui->setupUi(this);
@@ -103,17 +104,6 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p
settings.remove("bUseInstantSend");
}
- if (!privateSendClient.fEnablePrivateSend) {
- ui->checkUsePrivateSend->setChecked(false);
- ui->checkUsePrivateSend->setVisible(false);
- CoinControlDialog::coinControl()->UsePrivateSend(false);
- } else {
- bool fUsePrivateSend = settings.value("bUsePrivateSend").toBool();
- ui->checkUsePrivateSend->setChecked(fUsePrivateSend);
- CoinControlDialog::coinControl()->UsePrivateSend(fUsePrivateSend);
- connect(ui->checkUsePrivateSend, SIGNAL(stateChanged ( int )), this, SLOT(updateDisplayUnit()));
- }
-
// Coin Control: clipboard actions
QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this);
QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this);
@@ -304,7 +294,7 @@ void SendCoinsDialog::send(QList recipients)
updateCoinControlState(ctrl);
- ctrl.UsePrivateSend(ui->checkUsePrivateSend->isChecked());
+ ctrl.UsePrivateSend(fPrivateSend);
prepareStatus = model->prepareTransaction(currentTransaction, ctrl);
@@ -616,14 +606,12 @@ void SendCoinsDialog::setBalance(const CAmount& balance, const CAmount& unconfir
if(model && model->getOptionsModel())
{
- uint64_t bal = 0;
- QSettings settings;
- settings.setValue("bUsePrivateSend", ui->checkUsePrivateSend->isChecked());
- if(ui->checkUsePrivateSend->isChecked()) {
- bal = anonymizedBalance;
- } else {
- bal = balance;
- }
+ uint64_t bal = 0;
+ if (fPrivateSend) {
+ bal = anonymizedBalance;
+ } else {
+ bal = balance;
+ }
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), bal));
}
@@ -633,7 +621,7 @@ void SendCoinsDialog::updateDisplayUnit()
{
setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance(), model->getAnonymizedBalance(),
model->getWatchBalance(), model->getWatchUnconfirmedBalance(), model->getWatchImmatureBalance());
- CoinControlDialog::coinControl()->UsePrivateSend(ui->checkUsePrivateSend->isChecked());
+ CoinControlDialog::coinControl()->UsePrivateSend(fPrivateSend);
coinControlUpdateLabels();
ui->customFee->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
updateMinFeeLabel();
@@ -720,7 +708,13 @@ void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
}
// Calculate available amount to send.
- CAmount amount = model->getBalance(&coin_control);
+ CAmount amount;
+ if (fPrivateSend) {
+ amount = model->getAnonymizedBalance();
+ } else {
+ amount = model->getBalance(&coin_control);
+ }
+
for (int i = 0; i < ui->entries->count(); ++i) {
SendCoinsEntry* e = qobject_cast(ui->entries->itemAt(i)->widget());
if (e && !e->isHidden() && e != entry) {
@@ -786,6 +780,22 @@ void SendCoinsDialog::updateCoinControlState(CCoinControl& ctrl)
ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex());
}
+void SendCoinsDialog::setPrivateSend(bool privateSend)
+{
+ if (fPrivateSend != privateSend) {
+ fPrivateSend = privateSend;
+ coinControlUpdateLabels();
+ updateDisplayUnit();
+ if (privateSend) {
+ ui->sendButton->setText("PrivateS&end");
+ ui->sendButton->setToolTip("Confirm the PrivateSend action");
+ } else {
+ ui->sendButton->setText("S&end");
+ ui->sendButton->setToolTip("Confirm the send action");
+ }
+ }
+}
+
void SendCoinsDialog::updateSmartFeeLabel()
{
if(!model || !model->getOptionsModel())
@@ -968,8 +978,6 @@ void SendCoinsDialog::coinControlUpdateLabels()
}
}
- ui->checkUsePrivateSend->setChecked(CoinControlDialog::coinControl()->IsUsingPrivateSend());
-
if (CoinControlDialog::coinControl()->HasSelected())
{
// actual coin control calculation
diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h
index d823a973f015..63e625de00a6 100644
--- a/src/qt/sendcoinsdialog.h
+++ b/src/qt/sendcoinsdialog.h
@@ -46,6 +46,7 @@ class SendCoinsDialog : public QDialog
void setAddress(const QString &address);
void pasteEntry(const SendCoinsRecipient &rv);
bool handlePaymentRequest(const SendCoinsRecipient &recipient);
+ void setPrivateSend(bool privateSend);
public Q_SLOTS:
void clear();
@@ -64,6 +65,7 @@ public Q_SLOTS:
void send(QList recipients);
bool fFeeMinimized;
const PlatformStyle *platformStyle;
+ bool fPrivateSend;
// Process WalletModel::SendCoinsReturn and generate a pair consisting
// of a message and message flags for use in Q_EMIT message().
diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp
index 3ced30e93bd0..6f08ac82ea70 100644
--- a/src/qt/walletframe.cpp
+++ b/src/qt/walletframe.cpp
@@ -145,6 +145,14 @@ void WalletFrame::gotoSendCoinsPage(QString addr)
i.value()->gotoSendCoinsPage(addr);
}
+void WalletFrame::gotoPrivateSendCoinsPage(QString addr)
+{
+ QMap::const_iterator i;
+ for (auto i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) {
+ i.value()->gotoPrivateSendCoinsPage(addr);
+ }
+}
+
void WalletFrame::gotoSignMessageTab(QString addr)
{
WalletView *walletView = currentWalletView();
diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h
index 432c19d94d9c..55210b080a65 100644
--- a/src/qt/walletframe.h
+++ b/src/qt/walletframe.h
@@ -72,6 +72,8 @@ public Q_SLOTS:
void gotoReceiveCoinsPage();
/** Switch to send coins page */
void gotoSendCoinsPage(QString addr = "");
+ /** Switch to PrivateSend coins page */
+ void gotoPrivateSendCoinsPage(QString addr = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp
index ba994914b9a9..3f4b5c579cbd 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -237,6 +237,17 @@ void WalletView::gotoReceiveCoinsPage()
void WalletView::gotoSendCoinsPage(QString addr)
{
+ sendCoinsPage->setPrivateSend(false);
+ setCurrentWidget(sendCoinsPage);
+
+ if (!addr.isEmpty()) {
+ sendCoinsPage->setAddress(addr);
+ }
+}
+
+void WalletView::gotoPrivateSendCoinsPage(QString addr)
+{
+ sendCoinsPage->setPrivateSend(true);
setCurrentWidget(sendCoinsPage);
if (!addr.isEmpty())
diff --git a/src/qt/walletview.h b/src/qt/walletview.h
index b4e3bcbf03be..ba92577bdfea 100644
--- a/src/qt/walletview.h
+++ b/src/qt/walletview.h
@@ -85,6 +85,8 @@ public Q_SLOTS:
void gotoReceiveCoinsPage();
/** Switch to send coins page */
void gotoSendCoinsPage(QString addr = "");
+ /** Switch to PrivateSend coins page */
+ void gotoPrivateSendCoinsPage(QString addr = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");