- Show no connection if zcashd connection fails
- Double click on balances table
This commit is contained in:
@@ -671,6 +671,28 @@ void MainWindow::exportAllKeys() {
|
|||||||
void MainWindow::setupBalancesTab() {
|
void MainWindow::setupBalancesTab() {
|
||||||
ui->unconfirmedWarning->setVisible(false);
|
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
|
// Setup context menu on balances tab
|
||||||
ui->balancesTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->balancesTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
QObject::connect(ui->balancesTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) {
|
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 ? "..." : ""), [=]() {
|
menu.addAction("Send from " % addr.left(40) % (addr.size() > 40 ? "..." : ""), [=]() {
|
||||||
// Find the inputs combo
|
fnDoSendFrom(addr);
|
||||||
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);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (addr.startsWith("t")) {
|
if (addr.startsWith("t")) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ RPC::RPC(MainWindow* main) {
|
|||||||
auto cl = new ConnectionLoader(main, this);
|
auto cl = new ConnectionLoader(main, this);
|
||||||
|
|
||||||
// Execute the load connection async, so we can set up the rest of RPC properly.
|
// 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->main = main;
|
||||||
this->ui = main->ui;
|
this->ui = main->ui;
|
||||||
@@ -463,7 +463,7 @@ void RPC::getInfoThenRefresh(bool force) {
|
|||||||
{"method", "getinfo"}
|
{"method", "getinfo"}
|
||||||
};
|
};
|
||||||
|
|
||||||
conn->doRPCIgnoreError(payload, [=] (const json& reply) {
|
conn->doRPC(payload, [=] (const json& reply) {
|
||||||
// Testnet?
|
// Testnet?
|
||||||
if (!reply["testnet"].is_null()) {
|
if (!reply["testnet"].is_null()) {
|
||||||
Settings::getInstance()->setTestnet(reply["testnet"].get<json::boolean_t>());
|
Settings::getInstance()->setTestnet(reply["testnet"].get<json::boolean_t>());
|
||||||
@@ -549,6 +549,11 @@ void RPC::getInfoThenRefresh(bool force) {
|
|||||||
main->statusIcon->setToolTip(tooltip);
|
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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user