Results 1 to 5 of 5

Thread: problem with handling of QWebView::handleUnsupportedContent

  1. #1

    Default problem with handling of QWebView::handleUnsupportedContent

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: problem with handling of QWebView::handleUnsupportedContent

    Please show us the code you use to handle this signal.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3

    Default Re: problem with handling of QWebView::handleUnsupportedContent

    The code is sth like this:

    Qt Code:
    1. void WebPage::handleFileDownload(QNetworkReply *reply)
    2. {
    3. PromptDownloadDialog dlg;
    4. QUrl url=reply->url();
    5. QFileInfo path=url.path();
    6. dlg.m_fileName=path.fileName();
    7. dlg.m_url=url.toString();
    8. dlg.m_saveFolder=g_pApp->m_downloadDirectory;
    9. if (dlg.exec()==QDialog::Accepted)
    10. {
    11. downloadFile(reply,dlg.m_fileName,dlg.m_url,dlg.m_saveFolder);
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 

    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.
    Last edited by wysota; 20th January 2011 at 02:20. Reason: missing [code] tags

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: problem with handling of QWebView::handleUnsupportedContent

    What do reply->isOpen(), reply->isReadable() and reply->bytesAvailable() return before and after the call to exec()?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5

    Default Re: problem with handling of QWebView::handleUnsupportedContent

    This has been confirmed as a regression bug here: https://bugs.webkit.org/show_bug.cgi?id=49650 .

Similar Threads

  1. Problem With QWebView
    By traxtopel in forum Qt Programming
    Replies: 2
    Last Post: 25th February 2010, 19:01
  2. Subclassed qlistwidget event handling problem
    By Annihilator in forum Qt Programming
    Replies: 9
    Last Post: 13th February 2010, 19:55
  3. Problem With QWebView
    By ivi2501 in forum Qt Programming
    Replies: 8
    Last Post: 2nd August 2009, 20:37
  4. Replies: 3
    Last Post: 4th December 2007, 11:04
  5. Event handling problem
    By Mel Seyle in forum Qt Programming
    Replies: 2
    Last Post: 23rd August 2007, 05:15

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.