43 INFOLOG( QString(
"Downloading '%1' in '%2'" ).arg( __remote_url.toString() ).arg( __local_file ) );
45 INFOLOG( QString(
"Downloading '%1'" ).arg( __remote_url.toString() ) );
50 QString sEnvHttpProxy = QString( getenv(
"http_proxy" ) );
52 QString sEnvHttpUser = QString( getenv(
"http_user" ) );
53 QString sEnvHttpPassword = QString( getenv(
"http_password" ) );
55 nEnvHttpPort = sEnvHttpProxy.right( sEnvHttpProxy.length() - sEnvHttpProxy.indexOf(
':') - 1 ).toInt();
56 sEnvHttpProxy = sEnvHttpProxy.left( sEnvHttpProxy.indexOf(
':') );
60 if ( ( !sEnvHttpProxy.isNull() ) && ( nEnvHttpPort != 0 ) ) {
62 proxy.setType( QNetworkProxy::DefaultProxy );
63 proxy.setHostName( sEnvHttpProxy );
64 proxy.setPort( nEnvHttpPort );
65 proxy.setUser( sEnvHttpUser );
66 proxy.setPassword( sEnvHttpPassword );
70 QNetworkRequest getReq;
72 getReq.setRawHeader(
"User-Agent" ,
"Hydrogen" );
90 __error = QString( tr(
"Importing item failed: %1" ) ).arg(
__reply->errorString() );
97 int StatusAttribute =
__reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
98 if(StatusAttribute >= 200 && StatusAttribute < 300){
100 }
else if(StatusAttribute >= 300 && StatusAttribute < 400){
101 QVariant RedirectAttribute =
__reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
103 if ( RedirectAttribute != 0 ) {
114 INFOLOG(
"Download completed. " );
122 if ( !file.open( QIODevice::WriteOnly ) ) {
125 file.write(
__reply->readAll());