diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 448e1d7..840296a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -278,9 +278,6 @@ void MainWindow::setupSettingsModal() { // Custom fees settings.chkCustomFees->setChecked(Settings::getInstance()->getAllowCustomFees()); - // Auto shielding - settings.chkAutoShield->setChecked(Settings::getInstance()->getAutoShield()); - // Check for updates settings.chkCheckUpdates->setChecked(Settings::getInstance()->getCheckForUpdates()); @@ -342,9 +339,6 @@ void MainWindow::setupSettingsModal() { if (!customFees) ui->minerFeeAmt->setText(Settings::getDecimalString(Settings::getMinerFee())); - // Auto shield - Settings::getInstance()->setAutoShield(settings.chkAutoShield->isChecked()); - // Check for updates Settings::getInstance()->setCheckForUpdates(settings.chkCheckUpdates->isChecked()); diff --git a/src/sendtab.cpp b/src/sendtab.cpp index ddbf6f3..9a61edd 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -495,30 +495,34 @@ void MainWindow::maxAmountChecked(int checked) { Tx MainWindow::createTxFromSendPage() { Tx tx; - bool sendChangeToSapling = Settings::getInstance()->getAutoShield(); - // Gather the from / to addresses tx.fromAddr = ui->inputsCombo->currentText(); - sendChangeToSapling = sendChangeToSapling && Settings::isTAddress(tx.fromAddr); // For each addr/amt in the sendTo tab int totalItems = ui->sendToWidgets->children().size() - 2; // The last one is a spacer, so ignore that - double totalAmt = 0; + qint64 totalAmt = 0; for (int i=0; i < totalItems; i++) { QString addr = ui->sendToWidgets->findChild(QString("Address") % QString::number(i+1))->text().trimmed(); // Remove label if it exists addr = AddressBook::addressFromAddressLabel(addr); - // If address is sprout, then we can't send change to sapling, because of turnstile. - sendChangeToSapling = sendChangeToSapling && !Settings::getInstance()->isSproutAddress(addr); - QString amtStr = ui->sendToWidgets->findChild(QString("Amount") % QString::number(i+1))->text().trimmed(); if (amtStr.isEmpty()) { amtStr = "-1";; // The user didn't specify an amount } - double amt = amtStr.toDouble(); - totalAmt += amt; + bool ok; + qint64 amt; + + // Make sure it parses + amtStr.toDouble(&ok); + if (!ok) { + amt = -1; + } else { + amt = Settings::getAmountFromUserDecimalStr(amtStr); + totalAmt += amt; + } + QString memo = ui->sendToWidgets->findChild(QString("MemoTxt") % QString::number(i+1))->text().trimmed(); tx.toAddrs.push_back( ToFields{addr, amt, memo} ); @@ -529,31 +533,6 @@ Tx MainWindow::createTxFromSendPage() { } else { tx.fee = Settings::getMinerFee(); } - - if (Settings::getInstance()->getAutoShield() && sendChangeToSapling) { - auto saplingAddr = std::find_if(rpc->getModel()->getAllZAddresses().begin(), rpc->getModel()->getAllZAddresses().end(), [=](auto i) -> bool { - // We're finding a sapling address that is not one of the To addresses, because zcash doesn't allow duplicated addresses - bool isSapling = Settings::getInstance()->isSaplingAddress(i); - if (!isSapling) return false; - - // Also check all the To addresses - for (auto t : tx.toAddrs) { - if (t.addr == i) - return false; - } - - return true; - }); - - if (saplingAddr != rpc->getModel()->getAllZAddresses().end()) { - double change = rpc->getModel()->getAllBalances().value(tx.fromAddr) - totalAmt - tx.fee; - - if (Settings::getDecimalString(change) != "0") { - QString changeMemo = tr("Change from ") + tx.fromAddr; - tx.toAddrs.push_back(ToFields{ *saplingAddr, change, changeMemo }); - } - } - } return tx; } diff --git a/src/settings.ui b/src/settings.ui index 50401b2..ad8240c 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -145,30 +145,16 @@ Options - - - - Connect to github on startup to check for updates - - - - - + + - Normally, change from t-Addresses goes to another t-Address. Checking this option will send the change to your shielded sapling address instead. Check this option to increase your privacy. + Shielded transactions are saved locally and shown in the transactions tab. If you uncheck this, shielded transactions will not appear in the transactions tab. true - - - - Clear History - - - @@ -176,84 +162,68 @@ - - + + - Connect to the internet to fetch ZEC prices + Allow custom fees - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + - Allow overriding the default fees when sending transactions. Enabling this option may compromise your privacy since fees are transparent. - - - true + Connect to github on startup to check for updates - + - Check github for updates at startup + Fetch ZEC / USD prices - - + + - Shielded transactions are saved locally and shown in the transactions tab. If you uncheck this, shielded transactions will not appear in the transactions tab. - - - true + Connect to the internet to fetch ZEC prices - - + + - Shield change from t-Addresses to your sapling address + Connect to the Tor network via SOCKS proxy running on 127.0.0.1:9050. Please note that you'll have to install and run the Tor service externally. + + + true - - + + - + 0 0 - - Qt::Horizontal + + Theme + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - Connect to the Tor network via SOCKS proxy running on 127.0.0.1:9050. Please note that you'll have to install and run the Tor service externally. - - - true + Clear History - + Qt::Vertical @@ -266,44 +236,44 @@ - - + + - Connect via Tor + Allow overriding the default fees when sending transactions. Enabling this option may compromise your privacy since fees are transparent. + + + true - - + + - Allow custom fees + Check github for updates at startup - - + + - Fetch ZEC / USD prices + Connect via Tor - - - - - 0 - 0 - - - - Theme + + + + Qt::Horizontal - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 40 + 20 + - + - + @@ -333,6 +303,19 @@ + + + + + 0 + 0 + + + + Qt::Horizontal + + +