void Gui_Wget::downloadFile()
{
if (url.size() > 1 || currentfile.size() > 1 )
{
if (is_file(currentfile)) {
qt_unlink(currentfile);
}
file = new QFile(currentfile
);
tr("Unable to save the file %1: %2.")
.arg(currentfile).arg(file->errorString()));
delete file;
file = 0;
return;
}
stopButton->setEnabled(true);
http->setHost(urls.host(),80);
http->setUser( current_user , current_pass );
statusLabel->setText(tr("Download Url:")+" "+url);
connect(http, SIGNAL(dataReadProgress(int, int)),this, SLOT(updateDataReadProgress(int, int)));
connect(http, SIGNAL(requestFinished(int, bool)),this, SLOT(httpRequestFinished(int, bool)));
connect(http, SIGNAL(dataReadProgress(int, int)),this, SLOT(updateDataReadProgress(int, int)));
connect(stopButton, SIGNAL(clicked()), this, SLOT(cancelDownload()));
httpRequestAborted = false;
httpGetId = http->get(urls.path(), file);
downloadButton->setEnabled(false);
}
}
void Gui_Wget::downloadFile()
{
if (url.size() > 1 || currentfile.size() > 1 )
{
QUrl urls(url);
if (is_file(currentfile)) {
qt_unlink(currentfile);
}
file = new QFile(currentfile);
if (!file->open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("File Error!"),
tr("Unable to save the file %1: %2.")
.arg(currentfile).arg(file->errorString()));
delete file;
file = 0;
return;
}
http = new QHttp(this);
stopButton->setEnabled(true);
http->setHost(urls.host(),80);
http->setUser( current_user , current_pass );
statusLabel->setText(tr("Download Url:")+" "+url);
connect(http, SIGNAL(dataReadProgress(int, int)),this, SLOT(updateDataReadProgress(int, int)));
connect(http, SIGNAL(requestFinished(int, bool)),this, SLOT(httpRequestFinished(int, bool)));
connect(http, SIGNAL(dataReadProgress(int, int)),this, SLOT(updateDataReadProgress(int, int)));
connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
connect(stopButton, SIGNAL(clicked()), this, SLOT(cancelDownload()));
httpRequestAborted = false;
httpGetId = http->get(urls.path(), file);
downloadButton->setEnabled(false);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks