0000952: Download manager

This commit is contained in:
wmayer
2013-05-29 17:57:25 +02:00
parent 09e2f6bee6
commit 66d03fa4aa
4 changed files with 33 additions and 16 deletions

View File

@@ -143,17 +143,7 @@ void BrowserView::onLinkClicked (const QUrl & url)
//QString fragment = url. fragment();
if (scheme==QString::fromLatin1("http")) {
bool ok = false;
if (ok) {
//Dialog::DownloadDialog dlg (url,this/*QString::fromLatin1("c:/temp/test.fcstd")*/);
//int result = dlg.exec();
//if(ext ==QString::fromLatin1("fcstd") )
// Gui::Command::doCommand(Gui::Command::Gui,"Gui.open('c:/temp/test.fcstd')");
}
else {
load(url);
}
//OpenURLInBrowser(url.toString().toLatin1());
load(url);
}
// run scripts if not from somewhere else!
if ((scheme.size() < 2 || scheme==QString::fromLatin1("file"))&& host.isEmpty()) {
@@ -189,7 +179,13 @@ void BrowserView::onDownloadRequested(const QNetworkRequest & request)
void BrowserView::onUnsupportedContent(QNetworkReply* reply)
{
Gui::Dialog::DownloadManager::getInstance()->handleUnsupportedContent(reply);
// Do not call handleUnsupportedContent() directly otherwise we won't get
// the metaDataChanged() signal of the reply.
Gui::Dialog::DownloadManager::getInstance()->download(reply->url());
// Due to setting the policy QWebPage::DelegateAllLinks the onLinkClicked()
// slot is called even when clicking on a downloadable file but the page
// then fails to load. Thus, we reload the previous url.
view->reload();
}
void BrowserView::load(const char* URL)

View File

@@ -35,6 +35,7 @@
class QWebView;
class QUrl;
class QNetworkRequest;
class QNetworkReply;
namespace WebGui {