From 18a3ae82fbf2ff179538bebad8ec7ef0c9d5eeb4 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Wed, 22 May 2019 15:43:12 -0700 Subject: [PATCH] Fix right click menu on migration screen --- src/mainwindow.cpp | 6 ++++-- src/turnstile.cpp | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7c8dcc9..ae11759 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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); } } diff --git a/src/turnstile.cpp b/src/turnstile.cpp index 96d3b3a..0c25bc2 100644 --- a/src/turnstile.cpp +++ b/src/turnstile.cpp @@ -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();