mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-24 04:32:15 -04:00
Add a property zimId in the WebView.
This commit is contained in:
parent
5e80464128
commit
b3fbeccfbc
@ -37,6 +37,7 @@ QWebEngineView* WebView::createWindow(QWebEnginePage::WebWindowType type)
|
|||||||
void WebView::onUrlChanged(const QUrl& url) {
|
void WebView::onUrlChanged(const QUrl& url) {
|
||||||
if (m_currentHost != url.host() ) {
|
if (m_currentHost != url.host() ) {
|
||||||
m_currentHost = url.host();
|
m_currentHost = url.host();
|
||||||
|
emit zimIdChanged(m_currentHost);
|
||||||
auto app = KiwixApp::instance();
|
auto app = KiwixApp::instance();
|
||||||
auto reader = app->getLibrary()->getReader(m_currentHost);
|
auto reader = app->getLibrary()->getReader(m_currentHost);
|
||||||
std::string favicon, _mimetype;
|
std::string favicon, _mimetype;
|
||||||
|
@ -10,6 +10,7 @@ class WebView : public QWebEngineView
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(const QIcon icon READ icon NOTIFY iconChanged);
|
Q_PROPERTY(const QIcon icon READ icon NOTIFY iconChanged);
|
||||||
|
Q_PROPERTY(QString zimId READ zimId NOTIFY zimIdChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WebView(QWidget *parent = Q_NULLPTR);
|
WebView(QWidget *parent = Q_NULLPTR);
|
||||||
@ -17,12 +18,14 @@ public:
|
|||||||
|
|
||||||
bool isWebActionEnabled(QWebEnginePage::WebAction webAction) const;
|
bool isWebActionEnabled(QWebEnginePage::WebAction webAction) const;
|
||||||
const QIcon &icon() { return m_icon; }
|
const QIcon &icon() { return m_icon; }
|
||||||
|
const QString &zimId() { return m_currentHost; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onUrlChanged(const QUrl& url);
|
void onUrlChanged(const QUrl& url);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void iconChanged(const QIcon& icon);
|
void iconChanged(const QIcon& icon);
|
||||||
|
void zimIdChanged(const QString& zimId);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QWebEngineView* createWindow(QWebEnginePage::WebWindowType type);
|
virtual QWebEngineView* createWindow(QWebEnginePage::WebWindowType type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user