Browse Source

- Show no connection if zcashd connection fails

- Double click on balances table
import_zecw
adityapk00 6 years ago
parent
commit
3b43a57f35
  1. 33
      src/mainwindow.cpp
  2. 11
      src/rpc.cpp

33
src/mainwindow.cpp

@ -671,6 +671,28 @@ void MainWindow::exportAllKeys() {
void MainWindow::setupBalancesTab() {
ui->unconfirmedWarning->setVisible(false);
// Double click on balances table
auto fnDoSendFrom = [=](const QString& addr) {
// Find the inputs combo
for (int i = 0; i < ui->inputsCombo->count(); i++) {
if (ui->inputsCombo->itemText(i).startsWith(addr)) {
ui->inputsCombo->setCurrentIndex(i);
break;
}
}
// And switch to the send tab.
ui->tabWidget->setCurrentIndex(1);
};
// Double click opens up memo if one exists
QObject::connect(ui->balancesTable, &QTableView::doubleClicked, [=](auto index) {
index = index.sibling(index.row(), 0);
auto addr = ui->balancesTable->model()->data(index).toString();
fnDoSendFrom(addr);
});
// Setup context menu on balances tab
ui->balancesTable->setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(ui->balancesTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) {
@ -712,16 +734,7 @@ void MainWindow::setupBalancesTab() {
});
menu.addAction("Send from " % addr.left(40) % (addr.size() > 40 ? "..." : ""), [=]() {
// Find the inputs combo
for (int i = 0; i < ui->inputsCombo->count(); i++) {
if (ui->inputsCombo->itemText(i).startsWith(addr)) {
ui->inputsCombo->setCurrentIndex(i);
break;
}
}
// And switch to the send tab.
ui->tabWidget->setCurrentIndex(1);
fnDoSendFrom(addr);
});
if (addr.startsWith("t")) {

11
src/rpc.cpp

@ -10,7 +10,7 @@ RPC::RPC(MainWindow* main) {
auto cl = new ConnectionLoader(main, this);
// Execute the load connection async, so we can set up the rest of RPC properly.
QTimer::singleShot(1, [=]() {cl->loadConnection(); });
QTimer::singleShot(1, [=]() { cl->loadConnection(); });
this->main = main;
this->ui = main->ui;
@ -463,7 +463,7 @@ void RPC::getInfoThenRefresh(bool force) {
{"method", "getinfo"}
};
conn->doRPCIgnoreError(payload, [=] (const json& reply) {
conn->doRPC(payload, [=] (const json& reply) {
// Testnet?
if (!reply["testnet"].is_null()) {
Settings::getInstance()->setTestnet(reply["testnet"].get<json::boolean_t>());
@ -549,7 +549,12 @@ void RPC::getInfoThenRefresh(bool force) {
main->statusIcon->setToolTip(tooltip);
});
});
}, [=](QNetworkReply* reply, const json& replyJson) {
// zcashd has probably disappeared.
this->noConnection();
QMessageBox::critical(main, "Connection Error", "There was an error connecting to zcashd. The error was: \n\n"
+ reply->errorString(), QMessageBox::StandardButton::Ok);
});
}
void RPC::refreshAddresses() {

Loading…
Cancel
Save