Browse Source

Fix right click menu on migration screen

Aditya Kulkarni 5 years ago
parent
commit
18a3ae82fb
  1. 6
      src/mainwindow.cpp
  2. 6
      src/turnstile.cpp

6
src/mainwindow.cpp

@ -268,8 +268,10 @@ void MainWindow::turnstileProgress() {
void MainWindow::turnstileDoMigration(QString fromAddr) { 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 || 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; return;
}
// If a migration is already in progress, show the progress dialog instead // If a migration is already in progress, show the progress dialog instead
if (rpc->getTurnstile()->isMigrationPresent()) { if (rpc->getTurnstile()->isMigrationPresent()) {
@ -288,7 +290,7 @@ void MainWindow::turnstileDoMigration(QString fromAddr) {
auto fnGetAllSproutBalance = [=] () { auto fnGetAllSproutBalance = [=] () {
double bal = 0; double bal = 0;
for (auto addr : *rpc->getAllZAddresses()) { for (auto addr : *rpc->getAllZAddresses()) {
if (Settings::getInstance()->isSproutAddress(addr)) { if (Settings::getInstance()->isSproutAddress(addr) && rpc->getAllBalances()) {
bal += rpc->getAllBalances()->value(addr); bal += rpc->getAllBalances()->value(addr);
} }
} }

6
src/turnstile.cpp

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

Loading…
Cancel
Save