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.
This commit is contained in:
Matthieu Gautier 2018-11-13 18:09:43 +01:00
parent 5ca4d8903f
commit 29e27fa5d2
2 changed files with 6 additions and 1 deletions

View File

@ -1,10 +1,15 @@
#include "contentmanagerview.h"
#include <QFile>
#include <QWebEngineProfile>
#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());
}

View File

@ -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];
};