[webkit-dev] Handling upload progresses

André Pedralho apedralho at gmail.com
Tue Nov 11 05:46:12 PST 2008


Hi all,

I'm just wondering if there is a way to get upload progresses the same
way we can do with download ones.

I mean, when a download starts it raises a download requested signal
(QWebPage), which can be used to get the related QNetworkRequest. With
this network request I'm able to get a network reply and connect the
download progress signal to it. See the code below that shows what I'm
trying to explain:

void MainWindow::downloadRequested(
        const QNetworkRequest &request)
{
(...)
  QNetworkAccessManager *networkManager =
    webView->page()->networkAccessManager();
  QNetworkReply *reply =
    networkManager->get(request);
  connect(
    reply, SIGNAL(downloadProgress(qint64, qint64)),
    this, SLOT(downloadProgress(qint64, qint64)));
  connect(reply, SIGNAL(finished()),
          this, SLOT(downloadIssueFinished()));
}

How can I do the same to uploads? Do we have an upload requested
signal in QWebPage? I'm using the chooseFile method to do some uploads
handling, is there a better way to do it? How can I get the
uploadProgress signal from the network reply using a structure similar
to the code above.

Thanks all,

--
André Pedralho


More information about the webkit-dev mailing list