diff --git a/kiwix-desktop.pro b/kiwix-desktop.pro index ad23ff6..d6862bc 100644 --- a/kiwix-desktop.pro +++ b/kiwix-desktop.pro @@ -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 \ diff --git a/src/kiwixapp.h b/src/kiwixapp.h index 789b2e0..ea2459e 100644 --- a/src/kiwixapp.h +++ b/src/kiwixapp.h @@ -8,7 +8,6 @@ #include "tabbar.h" #include "tocsidebar.h" #include "urlschemehandler.h" -#include "requestinterceptor.h" #include #include @@ -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]; }; diff --git a/src/requestinterceptor.cpp b/src/requestinterceptor.cpp deleted file mode 100644 index 34d2aaa..0000000 --- a/src/requestinterceptor.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "requestinterceptor.h" - -#include -#include -#include - -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)); -} - diff --git a/src/requestinterceptor.h b/src/requestinterceptor.h deleted file mode 100644 index 8c60244..0000000 --- a/src/requestinterceptor.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef REQUESTINTERCEPTOR_H -#define REQUESTINTERCEPTOR_H - -#include - - -class RequestInterceptor : public QWebEngineUrlRequestInterceptor -{ -public: - RequestInterceptor(); - virtual void interceptRequest(QWebEngineUrlRequestInfo &info); -}; - -#endif // REQUESTINTERCEPTOR_H diff --git a/src/webview.cpp b/src/webview.cpp index 658da89..bb643b3 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -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); }