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