summaryrefslogtreecommitdiff
path: root/src/webpage.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-10-01 11:44:30 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-10-01 11:44:30 +0200
commita6f6dac926250a2982704b30198b2690749a22c9 (patch)
tree65652153e65242fa0709b659a8c7293e11e49bbd /src/webpage.cpp
parentFaster Application::icon (diff)
downloadrekonq-a6f6dac926250a2982704b30198b2690749a22c9.tar.xz
Setting session and request metadata about ssl navigation
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r--src/webpage.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/webpage.cpp b/src/webpage.cpp
index b1fc0da2..34a1e1b6 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -81,6 +81,8 @@ WebPage::WebPage(QObject *parent)
setNetworkAccessManager(Application::networkAccessManager());
connect(networkAccessManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(manageNetworkErrors(QNetworkReply*)));
+ setSessionMetaData("ssl_activate_warnings", "TRUE");
+
connect(this, SIGNAL(downloadRequested(const QNetworkRequest &)), this, SLOT(slotDownloadRequested(const QNetworkRequest &)));
connect(this, SIGNAL(unsupportedContent(QNetworkReply *)), this, SLOT(slotHandleUnsupportedContent(QNetworkReply *)));
}
@@ -93,6 +95,21 @@ WebPage::~WebPage()
bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
{
+ // FIXME CHECK this
+ if (frame)
+ {
+ // TODO: Check if we need to flag navigation from javascript as well.
+ // Currently QtWebKit provides no way to distinguish such requests and
+ // lumps them under QWebPage::NavigationTypeOther.
+ if (type == QWebPage::NavigationTypeLinkClicked)
+ {
+ QString scheme = request.url().scheme();
+ if (scheme == "https" || scheme == "webdavs")
+ setRequestMetaData("ssl_was_in_use", "TRUE");
+ }
+ }
+ setRequestMetaData("main_frame_request", (frame->parentFrame() ? "FALSE" : "TRUE"));
+
if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
{
Application::instance()->loadUrl(request.url(), Rekonq::SettingOpenTab);
@@ -301,3 +318,15 @@ void WebPage::slotDownloadRequested(const QNetworkRequest &request)
job->addMetaData("cache", "cache"); // Use entry from cache if available.
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
}
+
+
+void WebPage::setSessionMetaData(const QString& key, const QString& value)
+{
+ qobject_cast<NetworkAccessManager*>(networkAccessManager())->sessionMetaData()[key] = value;
+}
+
+
+void WebPage::setRequestMetaData(const QString& key, const QString& value)
+{
+ qobject_cast<NetworkAccessManager*>(networkAccessManager())->requestMetaData()[key] = value;
+}