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) {
|
||||
if (m_currentHost != url.host() ) {
|
||||
m_currentHost = url.host();
|
||||
emit zimIdChanged(m_currentHost);
|
||||
auto app = KiwixApp::instance();
|
||||
auto reader = app->getLibrary()->getReader(m_currentHost);
|
||||
std::string favicon, _mimetype;
|
||||
|
@ -10,6 +10,7 @@ class WebView : public QWebEngineView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(const QIcon icon READ icon NOTIFY iconChanged);
|
||||
Q_PROPERTY(QString zimId READ zimId NOTIFY zimIdChanged)
|
||||
|
||||
public:
|
||||
WebView(QWidget *parent = Q_NULLPTR);
|
||||
@ -17,12 +18,14 @@ public:
|
||||
|
||||
bool isWebActionEnabled(QWebEnginePage::WebAction webAction) const;
|
||||
const QIcon &icon() { return m_icon; }
|
||||
const QString &zimId() { return m_currentHost; }
|
||||
|
||||
public slots:
|
||||
void onUrlChanged(const QUrl& url);
|
||||
|
||||
signals:
|
||||
void iconChanged(const QIcon& icon);
|
||||
void zimIdChanged(const QString& zimId);
|
||||
|
||||
protected:
|
||||
virtual QWebEngineView* createWindow(QWebEnginePage::WebWindowType type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user