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 <QUrlQuery>
|
||||
#include <QtWebEngineWidgetsVersion>
|
||||
|
||||
QString Scripts::setupWebChannel()
|
||||
{
|
||||
|
@ -146,9 +147,11 @@ QString Scripts::setupWindowObject()
|
|||
" return false;"
|
||||
"};"
|
||||
"window.external = external;"
|
||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
"window.print = function() {"
|
||||
" window.location = 'falkon:PrintPage';"
|
||||
"};"
|
||||
#endif
|
||||
"})()");
|
||||
|
||||
return source;
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include <QAuthenticator>
|
||||
#include <QPushButton>
|
||||
#include <QUrlQuery>
|
||||
#include <QtWebEngineWidgetsVersion>
|
||||
|
||||
QString WebPage::s_lastUploadLocation = QDir::homePath();
|
||||
QUrl WebPage::s_lastUnsupportedUrl;
|
||||
|
@ -109,6 +110,10 @@ WebPage::WebPage(QObject* parent)
|
|||
emit loadFinished(true);
|
||||
}
|
||||
});
|
||||
|
||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
||||
connect(this, &QWebEnginePage::printRequested, this, &WebPage::printRequested);
|
||||
#endif
|
||||
}
|
||||
|
||||
WebPage::~WebPage()
|
||||
|
@ -421,9 +426,11 @@ bool WebPage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::Navigatio
|
|||
QUrlQuery query(url);
|
||||
mApp->searchEnginesManager()->addEngine(QUrl(query.queryItemValue(QSL("url"))));
|
||||
return false;
|
||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
} else if (url.path() == QL1S("PrintPage")) {
|
||||
emit printRequested();
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user