Add migration option on balances table context menu
This commit is contained in:
@@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user