From 29e27fa5d2e78d31e21b393774075d013b72a0ed Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 13 Nov 2018 18:09:43 +0100 Subject: [PATCH] Add the custom zim UrlSchemeHandler to the contentManager view. This way, the contentManager can get some information about a zim file using the zim scheme. We have to initialize the m_schemeHandler before the m_manager. --- src/contentmanagerview.cpp | 5 +++++ src/kiwixapp.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/contentmanagerview.cpp b/src/contentmanagerview.cpp index eee8634..5b40249 100644 --- a/src/contentmanagerview.cpp +++ b/src/contentmanagerview.cpp @@ -1,10 +1,15 @@ #include "contentmanagerview.h" #include +#include +#include "kiwixapp.h" ContentManagerView::ContentManagerView(QWidget *parent) : QWebEngineView(parent) { page()->setWebChannel(&m_webChannel); + auto profile = page()->profile(); + auto app = KiwixApp::instance(); + profile->installUrlSchemeHandler("zim", app->getSchemeHandler()); } diff --git a/src/kiwixapp.h b/src/kiwixapp.h index ea2459e..f5efa57 100644 --- a/src/kiwixapp.h +++ b/src/kiwixapp.h @@ -82,6 +82,7 @@ protected: private: QTranslator m_qtTranslator, m_appTranslator; + UrlSchemeHandler m_schemeHandler; Library m_library; kiwix::Downloader* mp_downloader; ContentManager m_manager; @@ -90,7 +91,6 @@ private: QWidget* mp_currentSideBar; QErrorMessage* mp_errorDialog; - UrlSchemeHandler m_schemeHandler; QAction* mpa_actions[MAX_ACTION]; };