fix infinite loop when card file save fails, instead stop the execution just like the other errors in the call (#4143)
This commit is contained in:
parent
8cbc4c91f6
commit
2081639970
2 changed files with 36 additions and 44 deletions
|
@ -607,12 +607,10 @@ void SaveSetsPage::updateTotalProgress(int cardsImported, int /* setIndex */, co
|
||||||
|
|
||||||
bool SaveSetsPage::validatePage()
|
bool SaveSetsPage::validatePage()
|
||||||
{
|
{
|
||||||
bool ok = false;
|
|
||||||
QString defaultPath = SettingsCache::instance().getCardDatabasePath();
|
QString defaultPath = SettingsCache::instance().getCardDatabasePath();
|
||||||
QString windowName = tr("Save card database");
|
QString windowName = tr("Save card database");
|
||||||
QString fileType = tr("XML; card database (*.xml)");
|
QString fileType = tr("XML; card database (*.xml)");
|
||||||
|
|
||||||
do {
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
if (defaultPathCheckBox->isChecked()) {
|
if (defaultPathCheckBox->isChecked()) {
|
||||||
fileName = QFileDialog::getSaveFileName(this, windowName, defaultPath, fileType);
|
fileName = QFileDialog::getSaveFileName(this, windowName, defaultPath, fileType);
|
||||||
|
@ -630,12 +628,10 @@ bool SaveSetsPage::validatePage()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wizard()->importer->saveToFile(fileName, wizard()->getCardSourceUrl(), wizard()->getCardSourceVersion())) {
|
if (!wizard()->importer->saveToFile(fileName, wizard()->getCardSourceUrl(), wizard()->getCardSourceVersion())) {
|
||||||
ok = true;
|
|
||||||
} else {
|
|
||||||
QMessageBox::critical(this, tr("Error"), tr("The file could not be saved to %1").arg(fileName));
|
QMessageBox::critical(this, tr("Error"), tr("The file could not be saved to %1").arg(fileName));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} while (!ok);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,12 +144,10 @@ void SimpleDownloadFilePage::actDownloadFinished()
|
||||||
|
|
||||||
bool SimpleDownloadFilePage::saveToFile()
|
bool SimpleDownloadFilePage::saveToFile()
|
||||||
{
|
{
|
||||||
bool ok = false;
|
|
||||||
QString defaultPath = getDefaultSavePath();
|
QString defaultPath = getDefaultSavePath();
|
||||||
QString windowName = getWindowTitle();
|
QString windowName = getWindowTitle();
|
||||||
QString fileType = getFileType();
|
QString fileType = getFileType();
|
||||||
|
|
||||||
do {
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
if (defaultPathCheckBox->isChecked()) {
|
if (defaultPathCheckBox->isChecked()) {
|
||||||
fileName = QFileDialog::getSaveFileName(this, windowName, defaultPath, fileType);
|
fileName = QFileDialog::getSaveFileName(this, windowName, defaultPath, fileType);
|
||||||
|
@ -167,12 +165,10 @@ bool SimpleDownloadFilePage::saveToFile()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (internalSaveToFile(fileName)) {
|
if (!internalSaveToFile(fileName)) {
|
||||||
ok = true;
|
|
||||||
} else {
|
|
||||||
QMessageBox::critical(this, tr("Error"), tr("The file could not be saved to %1").arg(fileName));
|
QMessageBox::critical(this, tr("Error"), tr("The file could not be saved to %1").arg(fileName));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} while (!ok);
|
|
||||||
|
|
||||||
// clean saved downloadData
|
// clean saved downloadData
|
||||||
downloadData = QByteArray();
|
downloadData = QByteArray();
|
||||||
|
|
Loading…
Reference in a new issue