PDA

View Full Version : problem with handling of QWebView::handleUnsupportedContent



sfcheng77
19th January 2011, 21:30
I am implementing my own download manager to download the file passed over from QWebView. I'd like to present the user a confirmation dialog before proceeding with the file download.

The handleUnsupported signal takes the following parameter:

unsupportedContent(QNetworkReply*reply)

If I directly use the reply to download the file without confirmation, everything works fine. If I popup a dialog or message box to confirm it, the reply object is no longer usable. Before the dialog is shown, reply->isFinished() return false. After the dialog is shown, I found reply->isFinished() return true. I can no longer use the reply object to continue downloading the file.

My best guess is that while the dialog is shown, the application's event loop starts running and somehow recycles the reply object.

Any tip on how to solve this problem would be greatly appreciated.

wysota
19th January 2011, 22:05
Please show us the code you use to handle this signal.

sfcheng77
19th January 2011, 22:37
The code is sth like this:


void WebPage::handleFileDownload(QNetworkReply *reply)
{
PromptDownloadDialog dlg;
QUrl url=reply->url();
QFileInfo path=url.path();
dlg.m_fileName=path.fileName();
dlg.m_url=url.toString();
dlg.m_saveFolder=g_pApp->m_downloadDirectory;
if (dlg.exec()==QDialog::Accepted)
{
downloadFile(reply,dlg.m_fileName,dlg.m_url,dlg.m_ saveFolder);
}
}

The code inside the actual download manager is too much to post here and I believe that is irrelevant either.

The point is that if I remove the prompting dialog, the download is completed just fine.

wysota
20th January 2011, 01:22
What do reply->isOpen(), reply->isReadable() and reply->bytesAvailable() return before and after the call to exec()?

sfcheng77
23rd January 2011, 03:56
This has been confirmed as a regression bug here: https://bugs.webkit.org/show_bug.cgi?id=49650 .