diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 77445f9..24ea586 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -137,7 +137,7 @@ void MainWindow::turnstileProgress() { } } -void MainWindow::turnstileDoMigration() { +void MainWindow::turnstileDoMigration(QString fromAddr) { // Return if there is no connection if (rpc->getAllZAddresses() == nullptr) return; @@ -166,8 +166,7 @@ void MainWindow::turnstileDoMigration() { if (Settings::getInstance()->isSaplingAddress(addr)) { turnstile.migrateTo->addItem(addr); } else { - if (rpc->getAllBalances()->value(addr) > 0) - turnstile.migrateZaddList->addItem(addr); + turnstile.migrateZaddList->addItem(addr); } } @@ -194,7 +193,11 @@ void MainWindow::turnstileDoMigration() { } }; + if (!fromAddr.isEmpty()) + turnstile.migrateZaddList->setCurrentText(fromAddr); + fnUpdateSproutBalance(turnstile.migrateZaddList->currentText()); + // Combo box selection event QObject::connect(turnstile.migrateZaddList, &QComboBox::currentTextChanged, fnUpdateSproutBalance); @@ -447,6 +450,12 @@ void MainWindow::setupBalancesTab() { }); } + if (Settings::getInstance()->isSproutAddress(addr)) { + menu.addAction("Migrate to Sapling", [=] () { + this->turnstileDoMigration(addr); + }); + } + menu.exec(ui->balancesTable->viewport()->mapToGlobal(pos)); }); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 19874d6..2cf57c0 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -58,7 +58,7 @@ private: Tx createTxFromSendPage(); bool confirmTx(Tx tx, ToFields devFee); - void turnstileDoMigration(); + void turnstileDoMigration(QString fromAddr = ""); void turnstileProgress(); void cancelButton();