diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-10-02 15:55:07 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-10-02 15:55:07 +0200 |
commit | a67b0137ad0a8a4399de23238aa3cafdfdd3522f (patch) | |
tree | 920805afeb088400ff073d1581cf282ec0713fa3 | |
parent | Merge branch 'DEVS' (diff) | |
download | rekonq-a67b0137ad0a8a4399de23238aa3cafdfdd3522f.tar.xz |
Simpler KIO management (no more metadata)
-rw-r--r-- | src/networkaccessmanager.cpp | 60 | ||||
-rw-r--r-- | src/networkaccessmanager.h | 14 | ||||
-rw-r--r-- | src/webpage.cpp | 29 | ||||
-rw-r--r-- | src/webpage.h | 3 |
4 files changed, 26 insertions, 80 deletions
diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index f95fa456..c21d54df 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -191,39 +191,27 @@ void NetworkAccessManager::slotSSLErrors(QNetworkReply *reply, const QList<QSslE #endif -KIO::MetaData& NetworkAccessManager::sessionMetaData() -{ - return m_sessionMetaData; -} - - -KIO::MetaData& NetworkAccessManager::requestMetaData() -{ - return m_requestMetaData; -} - - -QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData) -{ - // TODO implement Ad-Block here (refuse connections..) - - QNetworkRequest request(req); - KIO::MetaData metaData = m_sessionMetaData; - metaData += m_requestMetaData; - - QVariant attr = req.attribute(QNetworkRequest::User); - if (attr.isValid() && attr.type() == QVariant::Map) - { - metaData += attr.toMap(); - } - - if (!metaData.isEmpty()) - { - attr = metaData.toVariant(); - request.setAttribute(QNetworkRequest::User, attr); - } - - // Clear the per request meta data... - m_requestMetaData.clear(); - return AccessManager::createRequest(op, request, outgoingData); -} +// QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData) +// { +// // TODO implement Ad-Block here (refuse connections..) +// +// QNetworkRequest request(req); +// KIO::MetaData metaData = m_sessionMetaData; +// metaData += m_requestMetaData; +// +// QVariant attr = req.attribute(QNetworkRequest::User); +// if (attr.isValid() && attr.type() == QVariant::Map) +// { +// metaData += attr.toMap(); +// } +// +// if (!metaData.isEmpty()) +// { +// attr = metaData.toVariant(); +// request.setAttribute(QNetworkRequest::User, attr); +// } +// +// // Clear the per request meta data... +// m_requestMetaData.clear(); +// return AccessManager::createRequest(op, request, outgoingData); +// } diff --git a/src/networkaccessmanager.h b/src/networkaccessmanager.h index 44f2ef3e..9e23a96e 100644 --- a/src/networkaccessmanager.h +++ b/src/networkaccessmanager.h @@ -41,17 +41,13 @@ class NetworkAccessManager : public AccessManager public: NetworkAccessManager(QObject *parent = 0); - - KIO::MetaData& sessionMetaData(); - KIO::MetaData& requestMetaData(); - void resetDiskCache(); public slots: void loadSettings(); -protected: - virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0); +// protected: +// virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0); private slots: void authenticationRequired(QNetworkReply *reply, QAuthenticator *auth); @@ -60,12 +56,6 @@ private slots: #ifndef QT_NO_OPENSSL void slotSSLErrors(QNetworkReply *reply, const QList<QSslError> &error); #endif - -private: - KIO::MetaData m_sessionMetaData; - KIO::MetaData m_requestMetaData; - - }; #endif // NETWORKACCESSMANAGER_H diff --git a/src/webpage.cpp b/src/webpage.cpp index 34a1e1b6..3f5e6244 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -80,8 +80,6 @@ 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 *))); @@ -95,21 +93,6 @@ 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); @@ -318,15 +301,3 @@ 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 6934e77c..86024a9d 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -80,9 +80,6 @@ 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 *); |