diff options
Diffstat (limited to 'src/webtab')
-rw-r--r-- | src/webtab/webpage.cpp | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/src/webtab/webpage.cpp b/src/webtab/webpage.cpp index 1a12f8dc..cd1f41e8 100644 --- a/src/webtab/webpage.cpp +++ b/src/webtab/webpage.cpp @@ -406,43 +406,43 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); return; } - + if (isLocal) { // Load outside local files KRun::run(*appService, replyUrl, 0, false, _suggestedFileName); + return; } - else - { - KParts::BrowserOpenOrSaveQuestion dlg(view(), replyUrl, _mimeType); - if (!_suggestedFileName.isEmpty()) - dlg.setSuggestedFileName(_suggestedFileName); + // else + KParts::BrowserOpenOrSaveQuestion dlg(view(), replyUrl, _mimeType); - // read askEmbedOrSave preferences. If we don't have to show dialog and rekonq settings are - // to automatically choose download dir, we won't show local dir choose dialog - KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("filetypesrc", KConfig::NoGlobals), QL1S("Notification Messages")); - bool hideDialog = cg.readEntry(QL1S("askEmbedOrSave") + _mimeType, false); + if (!_suggestedFileName.isEmpty()) + dlg.setSuggestedFileName(_suggestedFileName); - kDebug() << "Hide dialog for " << _mimeType << "? " << hideDialog; + // read askEmbedOrSave preferences. If we don't have to show dialog and rekonq settings are + // to automatically choose download dir, we won't show local dir choose dialog + KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("filetypesrc", KConfig::NoGlobals), QL1S("Notification Messages")); + bool hideDialog = cg.readEntry(QL1S("askEmbedOrSave") + _mimeType, false); - switch (dlg.askEmbedOrSave()) - { - case KParts::BrowserOpenOrSaveQuestion::Save: - DownloadManager::self()->downloadResource(reply->url(), - KIO::MetaData(), - view(), - !hideDialog, - _suggestedFileName, - !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); - return; + kDebug() << "Hide dialog for " << _mimeType << "? " << hideDialog; - case KParts::BrowserOpenOrSaveQuestion::Cancel: - return; + switch (dlg.askEmbedOrSave()) + { + case KParts::BrowserOpenOrSaveQuestion::Save: + DownloadManager::self()->downloadResource(reply->url(), + KIO::MetaData(), + view(), + !hideDialog, + _suggestedFileName, + !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); + return; - default: // Can happen when "Open with.." is set and "don't ask again" is checked - break; - } + case KParts::BrowserOpenOrSaveQuestion::Cancel: + return; + + default: // Can happen when "Open with.." is set and "don't ask again" is checked + break; } // Handle Post operations that return content... @@ -462,9 +462,17 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) return; } + bool webAppMode; + WebView *v = qobject_cast<WebView *>(view()); + WebWindow *webwin = v->parentTab()->webWindow(); + if (webwin) + webAppMode = false; + else + webAppMode = true; + // case KParts::BrowserRun::Embed KParts::ReadOnlyPart *pa = KMimeTypeTrader::createPartInstanceFromQuery<KParts::ReadOnlyPart>(_mimeType, view(), this, QString()); - if (pa) + if (pa && !webAppMode) { _isOnRekonqPage = true; |