summaryrefslogtreecommitdiff
path: root/src/webtab
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-12-16 18:17:39 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-12-16 18:17:39 +0100
commit5dc6dffb6668e529b5687276e87469ae17900fe0 (patch)
tree70d533a6934bfa2504e2401bb942a61da32c76f7 /src/webtab
parent"Workaround" cookie management in private browsing mode (diff)
downloadrekonq-5dc6dffb6668e529b5687276e87469ae17900fe0.tar.xz
Fix double opening with local files && kparts opening in webapp mode
Diffstat (limited to 'src/webtab')
-rw-r--r--src/webtab/webpage.cpp62
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;