Fix right click menu on migration screen

This commit is contained in:
Aditya Kulkarni
2019-05-22 15:43:12 -07:00
parent 0ac6e90c81
commit 18a3ae82fb
2 changed files with 10 additions and 2 deletions

View File

@@ -268,8 +268,10 @@ void MainWindow::turnstileProgress() {
void MainWindow::turnstileDoMigration(QString fromAddr) {
// Return if there is no connection
if (rpc->getAllZAddresses() == nullptr)
if (rpc->getAllZAddresses() == nullptr || rpc->getAllBalances() == nullptr) {
QMessageBox::information(this, tr("Not yet ready"), tr("zcashd is not yet ready. Please wait for the UI to load"), QMessageBox::Ok);
return;
}
// If a migration is already in progress, show the progress dialog instead
if (rpc->getTurnstile()->isMigrationPresent()) {
@@ -288,7 +290,7 @@ void MainWindow::turnstileDoMigration(QString fromAddr) {
auto fnGetAllSproutBalance = [=] () {
double bal = 0;
for (auto addr : *rpc->getAllZAddresses()) {
if (Settings::getInstance()->isSproutAddress(addr)) {
if (Settings::getInstance()->isSproutAddress(addr) && rpc->getAllBalances()) {
bal += rpc->getAllBalances()->value(addr);
}
}

View File

@@ -402,6 +402,10 @@ void Turnstile::showZcashdMigration(MainWindow* parent) {
QMenu menu(parent);
QString txid = model.getTxid(index.row());
menu.addAction("Copy txid", [=]() {
QGuiApplication::clipboard()->setText(txid);
});
menu.addAction(QObject::tr("View on block explorer"), [=] () {
QString url;
if (Settings::getInstance()->isTestnet()) {
@@ -411,6 +415,8 @@ void Turnstile::showZcashdMigration(MainWindow* parent) {
}
QDesktopServices::openUrl(QUrl(url));
});
menu.exec(md.tblTxids->viewport()->mapToGlobal(pos));
});
auto* status = parent->getRPC()->getMigrationStatus();