mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Handle web push notifications with Falkon notification system
Summary: Add basic support for web notifications with icon, title and body text. FEATURE: 409045 Test Plan: Fire some notifications from webpage Reviewers: #falkon Subscribers: falkon Tags: #falkon Differential Revision: https://phabricator.kde.org/D26452
This commit is contained in:
parent
91612fcb55
commit
2a0f092436
@ -67,6 +67,11 @@
|
||||
#include <QWebEngineScriptCollection>
|
||||
#include <QRegularExpression>
|
||||
#include <QtWebEngineWidgetsVersion>
|
||||
#include <QtWebEngineCoreVersion>
|
||||
|
||||
#if QTWEBENGINECORE_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||
#include <QWebEngineNotification>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <QtWin>
|
||||
@ -287,6 +292,15 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
m_webProfile = isPrivate() ? new QWebEngineProfile() : QWebEngineProfile::defaultProfile();
|
||||
connect(m_webProfile, &QWebEngineProfile::downloadRequested, this, &MainApplication::downloadRequested);
|
||||
|
||||
#if QTWEBENGINECORE_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||
m_webProfile->setNotificationPresenter([&] (std::unique_ptr<QWebEngineNotification> notification) {
|
||||
auto notifications = desktopNotifications();
|
||||
notifications->showNotification(
|
||||
QPixmap::fromImage(notification->icon()), notification->title(), notification->message()
|
||||
);
|
||||
});
|
||||
#endif
|
||||
|
||||
m_networkManager = new NetworkManager(this);
|
||||
|
||||
setupUserScripts();
|
||||
|
Loading…
Reference in New Issue
Block a user