|
|
@ -1548,6 +1548,8 @@ class Download: public Command { |
|
|
|
} |
|
|
|
} |
|
|
|
bool execute(Script* script, QWebFrame* frame) { |
|
|
|
bool execute(Script* script, QWebFrame* frame) { |
|
|
|
Logger log(this, script); |
|
|
|
Logger log(this, script); |
|
|
|
|
|
|
|
_realfilename = script->replacevars(_filename); |
|
|
|
|
|
|
|
log("REALFILENAME="+_realfilename); |
|
|
|
frame->page()->setForwardUnsupportedContent(true); |
|
|
|
frame->page()->setForwardUnsupportedContent(true); |
|
|
|
connect(frame->page(), SIGNAL(unsupportedContent(QNetworkReply*)), |
|
|
|
connect(frame->page(), SIGNAL(unsupportedContent(QNetworkReply*)), |
|
|
|
this, SLOT(unsupportedContent(QNetworkReply*))); |
|
|
|
this, SLOT(unsupportedContent(QNetworkReply*))); |
|
|
@ -1577,16 +1579,15 @@ class Download: public Command { |
|
|
|
_filesuccess = filesuccess; |
|
|
|
_filesuccess = filesuccess; |
|
|
|
} |
|
|
|
} |
|
|
|
void unsupportedContent(QNetworkReply* reply) { |
|
|
|
void unsupportedContent(QNetworkReply* reply) { |
|
|
|
_realfilename = reply->url().toString().split('/').last(); |
|
|
|
if (!_realfilename.size()) { |
|
|
|
if (_filename.size()) |
|
|
|
_realfilename = reply->url().toString().split('/').last(); |
|
|
|
_realfilename = _filename; |
|
|
|
if (reply->header(QNetworkRequest::ContentDispositionHeader).isValid()) { |
|
|
|
else if (reply->header(QNetworkRequest::ContentDispositionHeader) |
|
|
|
QString part(reply->header(QNetworkRequest::ContentDispositionHeader) |
|
|
|
.isValid()) { |
|
|
|
.toString()); |
|
|
|
QString part(reply->header(QNetworkRequest::ContentDispositionHeader) |
|
|
|
if (part.contains(QRegularExpression("attachment; *filename="))) { |
|
|
|
.toString()); |
|
|
|
part.replace(QRegularExpression(".*attachment; *filename="), ""); |
|
|
|
if (part.contains(QRegularExpression("attachment; *filename="))) { |
|
|
|
if (part.size()) _realfilename = part; |
|
|
|
part.replace(QRegularExpression(".*attachment; *filename="), ""); |
|
|
|
} |
|
|
|
if (part.size()) _realfilename = part; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
connect(new RunDownload(reply, _realfilename), |
|
|
|
connect(new RunDownload(reply, _realfilename), |
|
|
|