mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Use QWebEnginePage::printRequested with QtWebEngine 5.12
This commit is contained in:
parent
f19f443c1c
commit
5fd9cb92ee
|
@ -21,6 +21,7 @@
|
||||||
#include "webpage.h"
|
#include "webpage.h"
|
||||||
|
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
|
#include <QtWebEngineWidgetsVersion>
|
||||||
|
|
||||||
QString Scripts::setupWebChannel()
|
QString Scripts::setupWebChannel()
|
||||||
{
|
{
|
||||||
|
@ -146,9 +147,11 @@ QString Scripts::setupWindowObject()
|
||||||
" return false;"
|
" return false;"
|
||||||
"};"
|
"};"
|
||||||
"window.external = external;"
|
"window.external = external;"
|
||||||
|
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||||
"window.print = function() {"
|
"window.print = function() {"
|
||||||
" window.location = 'falkon:PrintPage';"
|
" window.location = 'falkon:PrintPage';"
|
||||||
"};"
|
"};"
|
||||||
|
#endif
|
||||||
"})()");
|
"})()");
|
||||||
|
|
||||||
return source;
|
return source;
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include <QAuthenticator>
|
#include <QAuthenticator>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
|
#include <QtWebEngineWidgetsVersion>
|
||||||
|
|
||||||
QString WebPage::s_lastUploadLocation = QDir::homePath();
|
QString WebPage::s_lastUploadLocation = QDir::homePath();
|
||||||
QUrl WebPage::s_lastUnsupportedUrl;
|
QUrl WebPage::s_lastUnsupportedUrl;
|
||||||
|
@ -109,6 +110,10 @@ WebPage::WebPage(QObject* parent)
|
||||||
emit loadFinished(true);
|
emit loadFinished(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
||||||
|
connect(this, &QWebEnginePage::printRequested, this, &WebPage::printRequested);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
WebPage::~WebPage()
|
WebPage::~WebPage()
|
||||||
|
@ -421,9 +426,11 @@ bool WebPage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::Navigatio
|
||||||
QUrlQuery query(url);
|
QUrlQuery query(url);
|
||||||
mApp->searchEnginesManager()->addEngine(QUrl(query.queryItemValue(QSL("url"))));
|
mApp->searchEnginesManager()->addEngine(QUrl(query.queryItemValue(QSL("url"))));
|
||||||
return false;
|
return false;
|
||||||
|
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||||
} else if (url.path() == QL1S("PrintPage")) {
|
} else if (url.path() == QL1S("PrintPage")) {
|
||||||
emit printRequested();
|
emit printRequested();
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user