Add "Shield to sapling" menu item on balances table.
This commit is contained in:
@@ -691,7 +691,7 @@ void MainWindow::setupBalancesTab() {
|
|||||||
ui->unconfirmedWarning->setVisible(false);
|
ui->unconfirmedWarning->setVisible(false);
|
||||||
|
|
||||||
// Double click on balances table
|
// Double click on balances table
|
||||||
auto fnDoSendFrom = [=](const QString& addr) {
|
auto fnDoSendFrom = [=](const QString& addr, const QString& to = QString(), bool sendMax = false) {
|
||||||
// Find the inputs combo
|
// Find the inputs combo
|
||||||
for (int i = 0; i < ui->inputsCombo->count(); i++) {
|
for (int i = 0; i < ui->inputsCombo->count(); i++) {
|
||||||
if (ui->inputsCombo->itemText(i).startsWith(addr)) {
|
if (ui->inputsCombo->itemText(i).startsWith(addr)) {
|
||||||
@@ -700,6 +700,18 @@ void MainWindow::setupBalancesTab() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there's a to address, add that as well
|
||||||
|
if (!to.isEmpty()) {
|
||||||
|
// Remember to clear any existing address fields, because we are creating a new transaction.
|
||||||
|
this->removeExtraAddresses();
|
||||||
|
ui->Address1->setText(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
// See if max button has to be checked
|
||||||
|
if (sendMax) {
|
||||||
|
ui->Max1->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
// And switch to the send tab.
|
// And switch to the send tab.
|
||||||
ui->tabWidget->setCurrentIndex(1);
|
ui->tabWidget->setCurrentIndex(1);
|
||||||
};
|
};
|
||||||
@@ -757,6 +769,13 @@ void MainWindow::setupBalancesTab() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (addr.startsWith("t")) {
|
if (addr.startsWith("t")) {
|
||||||
|
auto defaultSapling = rpc->getDefaultSaplingAddress();
|
||||||
|
if (!defaultSapling.isEmpty()) {
|
||||||
|
menu.addAction("Shield balance to Sapling", [=] () {
|
||||||
|
fnDoSendFrom(addr, defaultSapling, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
menu.addAction("View on block explorer", [=] () {
|
menu.addAction("View on block explorer", [=] () {
|
||||||
QString url;
|
QString url;
|
||||||
if (Settings::getInstance()->isTestnet()) {
|
if (Settings::getInstance()->isTestnet()) {
|
||||||
|
|||||||
12
src/rpc.cpp
12
src/rpc.cpp
@@ -1009,3 +1009,15 @@ void RPC::getZboardTopics(std::function<void(QMap<QString, QString>)> cb) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Sapling address from the user's wallet
|
||||||
|
*/
|
||||||
|
QString RPC::getDefaultSaplingAddress() {
|
||||||
|
for (QString addr: *zaddresses) {
|
||||||
|
if (Settings::getInstance()->isSaplingAddress(addr))
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
@@ -62,6 +62,8 @@ public:
|
|||||||
void shutdownZcashd();
|
void shutdownZcashd();
|
||||||
void noConnection();
|
void noConnection();
|
||||||
|
|
||||||
|
QString getDefaultSaplingAddress();
|
||||||
|
|
||||||
void getAllPrivKeys(const std::function<void(QList<QPair<QString, QString>>)>);
|
void getAllPrivKeys(const std::function<void(QList<QPair<QString, QString>>)>);
|
||||||
|
|
||||||
Turnstile* getTurnstile() { return turnstile; }
|
Turnstile* getTurnstile() { return turnstile; }
|
||||||
|
|||||||
Reference in New Issue
Block a user