Skip to content

Commit

Permalink
don't silently fail if download fails, show error message instead
Browse files Browse the repository at this point in the history
  • Loading branch information
gkovacs committed Oct 10, 2011
1 parent 4c735c5 commit 87bb77a
Show file tree
Hide file tree
Showing 53 changed files with 6,061 additions and 5,783 deletions.
174 changes: 91 additions & 83 deletions po/unetbootin.pot

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions src/unetbootin/unetbootin.cpp
Expand Up @@ -184,6 +184,7 @@ bool unetbootin::ubninitialize(QList<QPair<QString, QString> > oppairs)
overwriteall = false;
searchsymlinks = false;
ignoreoutofspace = false;
downloadFailed = false;
persistenceSpaceMB = 0;
#ifdef Q_OS_MAC
ignoreoutofspace = true;
Expand Down Expand Up @@ -2470,6 +2471,7 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile)
dloutfile.close();
rmFile(dloutfile);
downloadfile(dlresponse.value("Location"), targetfile);
return;
}
}
if (isftp)
Expand All @@ -2485,6 +2487,19 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile)
{
dloutfile.rename(targetfile);
}
if (QFile(targetfile).size() < 1024*512)
{
// download failed
progresslayer->setEnabled(false);
progresslayer->hide();
rebootlayer->setEnabled(true);
rebootlayer->show();
rebootmsgtext->setText(tr("Download of %1 %2 from %3 failed. Please try downloading the ISO file from the website directly and supply it via the diskimage option.").arg(nameDistro).arg(nameVersion).arg(fileurl));
this->frebootbutton->setEnabled(false);
this->frebootbutton->hide();
this->downloadFailed = true;
return;
}
pdesc4->setText("");
pdesc3->setText("");
pdesc2->setText("");
Expand Down Expand Up @@ -3349,6 +3364,10 @@ void unetbootin::runinst()
{
rmFile(QString("%1\\7z.dll").arg(ubntmpf));
}
if (downloadFailed)
{
return;
}
}
if (!sdesc1->text().contains(trdone))
{
Expand Down
1 change: 1 addition & 0 deletions src/unetbootin/unetbootin.h
Expand Up @@ -201,6 +201,7 @@ class unetbootin : public QWidget, private Ui::unetbootinui
bool searchsymlinks;
bool ignoreoutofspace;
bool dontgeneratesyslinuxcfg;
bool downloadFailed;
int persistenceSpaceMB;
QString extraBootOptions;
QStringList locatedsyslinuxcfgfiles;
Expand Down
233 changes: 119 additions & 114 deletions src/unetbootin/unetbootin.ts

Large diffs are not rendered by default.

0 comments on commit 87bb77a

Please sign in to comment.