Remove the requestInterceptor.

This is useless. It was use to rewrite http request to zim request and
have the custumUrlShemeHandler handle the request.

However, we now want to open http request in a external browser.
And it is already the case, the http requests are never intercepted.
This commit is contained in:
Matthieu Gautier 2018-11-13 18:07:40 +01:00
parent a12e641667
commit 5ca4d8903f
5 changed files with 0 additions and 42 deletions

View File

@ -47,7 +47,6 @@ SOURCES += \
src/blobbuffer.cpp \
src/library.cpp \
src/topwidget.cpp \
src/requestinterceptor.cpp \
src/urlschemehandler.cpp \
src/webview.cpp \
src/searchbar.cpp \
@ -67,7 +66,6 @@ HEADERS += \
src/library.h \
src/topwidget.h \
src/kconstants.h \
src/requestinterceptor.h \
src/urlschemehandler.h \
src/webview.h \
src/searchbar.h \

View File

@ -8,7 +8,6 @@
#include "tabbar.h"
#include "tocsidebar.h"
#include "urlschemehandler.h"
#include "requestinterceptor.h"
#include <QApplication>
#include <QErrorMessage>
@ -64,7 +63,6 @@ public:
void showMessage(const QString& message);
UrlSchemeHandler* getSchemeHandler() { return &m_schemeHandler; }
RequestInterceptor* getRequestInterceptor() { return &m_requestInterceptor; }
Library* getLibrary() { return &m_library; }
MainWindow* getMainWindow() { return mp_mainWindow; }
kiwix::Downloader* getDownloader() { return mp_downloader; }
@ -93,7 +91,6 @@ private:
QErrorMessage* mp_errorDialog;
UrlSchemeHandler m_schemeHandler;
RequestInterceptor m_requestInterceptor;
QAction* mpa_actions[MAX_ACTION];
};

View File

@ -1,22 +0,0 @@
#include "requestinterceptor.h"
#include <QWebEngineUrlRequestInfo>
#include <QDebug>
#include <iostream>
RequestInterceptor::RequestInterceptor()
{
}
void RequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
auto url = info.requestUrl();
auto urlString = url.toString();
if (urlString.startsWith("http://")) {
urlString.replace(0, 7, "zim://");
}
info.redirect(QUrl(urlString));
}

View File

@ -1,14 +0,0 @@
#ifndef REQUESTINTERCEPTOR_H
#define REQUESTINTERCEPTOR_H
#include <QWebEngineUrlRequestInterceptor>
class RequestInterceptor : public QWebEngineUrlRequestInterceptor
{
public:
RequestInterceptor();
virtual void interceptRequest(QWebEngineUrlRequestInfo &info);
};
#endif // REQUESTINTERCEPTOR_H

View File

@ -13,7 +13,6 @@ WebView::WebView(QWidget *parent)
auto profile = page()->profile();
auto app = KiwixApp::instance();
profile->installUrlSchemeHandler("zim", app->getSchemeHandler());
profile->setRequestInterceptor(app->getRequestInterceptor());
QObject::connect(this, &QWebEngineView::urlChanged, this, &WebView::onUrlChanged);
}