Browse Source

Add migration option on balances table context menu

recurring
Aditya Kulkarni 6 years ago
parent
commit
2fe2b44696
  1. 15
      src/mainwindow.cpp
  2. 2
      src/mainwindow.h

15
src/mainwindow.cpp

@ -137,7 +137,7 @@ void MainWindow::turnstileProgress() {
} }
} }
void MainWindow::turnstileDoMigration() { void MainWindow::turnstileDoMigration(QString fromAddr) {
// Return if there is no connection // Return if there is no connection
if (rpc->getAllZAddresses() == nullptr) if (rpc->getAllZAddresses() == nullptr)
return; return;
@ -166,8 +166,7 @@ void MainWindow::turnstileDoMigration() {
if (Settings::getInstance()->isSaplingAddress(addr)) { if (Settings::getInstance()->isSaplingAddress(addr)) {
turnstile.migrateTo->addItem(addr); turnstile.migrateTo->addItem(addr);
} else { } 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()); fnUpdateSproutBalance(turnstile.migrateZaddList->currentText());
// Combo box selection event // Combo box selection event
QObject::connect(turnstile.migrateZaddList, &QComboBox::currentTextChanged, fnUpdateSproutBalance); 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)); menu.exec(ui->balancesTable->viewport()->mapToGlobal(pos));
}); });
} }

2
src/mainwindow.h

@ -58,7 +58,7 @@ private:
Tx createTxFromSendPage(); Tx createTxFromSendPage();
bool confirmTx(Tx tx, ToFields devFee); bool confirmTx(Tx tx, ToFields devFee);
void turnstileDoMigration(); void turnstileDoMigration(QString fromAddr = "");
void turnstileProgress(); void turnstileProgress();
void cancelButton(); void cancelButton();

Loading…
Cancel
Save