diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-10-01 11:44:30 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-10-01 11:44:30 +0200 |
commit | a6f6dac926250a2982704b30198b2690749a22c9 (patch) | |
tree | 65652153e65242fa0709b659a8c7293e11e49bbd /src | |
parent | Faster Application::icon (diff) | |
download | rekonq-a6f6dac926250a2982704b30198b2690749a22c9.tar.xz |
Setting session and request metadata about ssl navigation
Diffstat (limited to 'src')
-rw-r--r-- | src/webpage.cpp | 29 | ||||
-rw-r--r-- | src/webpage.h | 5 |
2 files changed, 33 insertions, 1 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; +} diff --git a/src/webpage.h b/src/webpage.h index 7137da3d..6934e77c 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -79,7 +79,10 @@ protected: protected Q_SLOTS: virtual void slotHandleUnsupportedContent(QNetworkReply *reply); virtual void slotDownloadRequested(const QNetworkRequest &request); - + + void setSessionMetaData(const QString& key, const QString& value); + void setRequestMetaData(const QString& key, const QString& value); + private: friend class WebView; QString errorPage(QNetworkReply *); |