diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a4a3d28..e31fc44 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1266,6 +1266,11 @@ void MainWindow::importPrivKey() { tr("Please paste your private keys here, one per line") % ".\n" % tr("The keys will be imported into your connected Hush node")); + // if rescan is not checked, disable the rescan height input + QObject::connect(pui.chkrescan, &QCheckBox::stateChanged, [=](auto checked) { + pui.rescanfrom->setEnabled(checked); + }); + if (d.exec() == QDialog::Accepted && !pui.privKeyTxt->toPlainText().trimmed().isEmpty()) { auto rawkeys = pui.privKeyTxt->toPlainText().trimmed().split("\n"); @@ -1276,7 +1281,7 @@ void MainWindow::importPrivKey() { }); auto keys = new QList(); - // split multiple privkeys seperated by spaces on a single line + // ignore anything after the first space of a line, such as if you paste a line from z_exportwallet output std::transform(keysTmp.begin(), keysTmp.end(), std::back_inserter(*keys), [=](auto key) { return key.trimmed().split(" ")[0]; }); @@ -1302,17 +1307,8 @@ void MainWindow::importPrivKey() { }); DEBUG("found " << keysValidated->size() << " valid privkeys"); - bool rescan = pui.chkrescan->isChecked(); - //TODO: if rescan is not checked, disable the rescan height input - // Why don't these work? - if (rescan) { - //pui.rescanfrom->setEnabled(true); - pui.rescanfrom->setReadOnly(false); - } else { - //pui.rescanfrom->setDisabled(true); - pui.rescanfrom->setReadOnly(true); - } + bool rescan = pui.chkrescan->isChecked(); // avoid giving invalid data to RPCs and a rescan if there were no valid privkeys if(keysValidated->size() == 0) {