From d2fa5fd0f5b1972bd372510cc14509e85b972b23 Mon Sep 17 00:00:00 2001 From: Kirill Burtsev <kirill.burtsev@qt.io> Date: Wed, 20 Mar 2019 18:04:50 +0100 Subject: [PATCH] Notification API cleanup Task-number: QTBUG-74543 Change-Id: Ice5a0dbfc3485c8b7e6fa900ef427a9aed871d42 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> --- src/core/api/qwebenginenotification.cpp | 54 +++++-------------- src/core/api/qwebenginenotification.h | 16 ++---- src/core/user_notification_controller.cpp | 11 ++-- src/core/user_notification_controller.h | 2 +- src/webengine/api/qquickwebengineprofile.cpp | 6 +-- src/webengine/api/qquickwebengineprofile.h | 2 +- src/webengine/plugin/plugins.qmltypes | 2 +- .../api/qwebenginenotificationpresenter.cpp | 38 +++++++------ .../api/qwebenginenotificationpresenter_p.h | 10 ++-- .../api/qwebengineprofile.cpp | 10 ++-- src/webenginewidgets/api/qwebengineprofile.h | 3 +- .../api/qwebengineprofile_p.h | 2 +- tests/auto/quick/publicapi/tst_publicapi.cpp | 3 +- .../quick/qmltests/data/tst_notification.qml | 2 +- .../qwebenginepage/tst_qwebenginepage.cpp | 34 +++++++----- tests/quicktestbrowser/ApplicationRoot.qml | 2 +- tests/quicktestbrowser/BrowserWindow.qml | 2 +- 17 files changed, 88 insertions(+), 111 deletions(-) diff --git a/src/core/api/qwebenginenotification.cpp b/src/core/api/qwebenginenotification.cpp index ba9739b35..0b1d48ce9 100644 --- a/src/core/api/qwebenginenotification.cpp +++ b/src/core/api/qwebenginenotification.cpp @@ -58,8 +58,8 @@ using QtWebEngineCore::UserNotificationController; Web engine notifications are passed to the user in the \l QWebEngineProfile::setNotificationPresenter() and - \l QQuickWebEngineProfile::userNotification() calls and the - \l WebEngineProfile::userNotification() signal. + \l QQuickWebEngineProfile::presentNotification() calls and the + \l WebEngineProfile::presentNotification() signal. */ class QWebEngineNotificationPrivate : public UserNotificationController::Client { @@ -86,41 +86,18 @@ public: QWebEngineNotification *q; }; - -/*! - Creates a null QWebEngineNotification. - - \sa isNull() -*/ -QWebEngineNotification::QWebEngineNotification() { } - /*! \internal */ QWebEngineNotification::QWebEngineNotification(const QSharedPointer<UserNotificationController> &controller) : d_ptr(new QWebEngineNotificationPrivate(this, controller)) { } -/*! \internal -*/ -QWebEngineNotification::QWebEngineNotification(const QWebEngineNotification &other) - : QObject() - , d_ptr(new QWebEngineNotificationPrivate(this, other.d_ptr->controller)) -{ } - /*! \internal */ QWebEngineNotification::~QWebEngineNotification() { } -/*! \internal -*/ -const QWebEngineNotification &QWebEngineNotification::operator=(const QWebEngineNotification &other) -{ - d_ptr.reset(new QWebEngineNotificationPrivate(this, other.d_ptr->controller)); - return *this; -} - /*! Returns \c true if the two notifications belong to the same message chain. That is, if their tag() and origin() are the same. This means one is @@ -128,13 +105,15 @@ const QWebEngineNotification &QWebEngineNotification::operator=(const QWebEngine \sa tag(), origin() */ -bool QWebEngineNotification::matches(const QWebEngineNotification &other) const +bool QWebEngineNotification::matches(const QWebEngineNotification *other) const { + if (!other) + return false; if (!d_ptr) - return !other.d_ptr; - if (!other.d_ptr) + return !other->d_ptr; + if (!other->d_ptr) return false; - return tag() == other.tag() && origin() == other.origin(); + return tag() == other->tag() && origin() == other->origin(); } /*! @@ -187,15 +166,14 @@ QUrl QWebEngineNotification::origin() const } /*! - \property QWebEngineNotification::icon - \brief The icon to be shown with the notification. + Returns the icon to be shown with the notification. - If no icon is set by the sender, an null QIcon is returned. + If no icon is set by the sender, a null QImage is returned. */ -QIcon QWebEngineNotification::icon() const +QImage QWebEngineNotification::icon() const { Q_D(const QWebEngineNotification); - return d ? d->controller->icon() : QIcon(); + return d ? d->controller->icon() : QImage(); } /*! @@ -223,14 +201,6 @@ Qt::LayoutDirection QWebEngineNotification::direction() const return d ? d->controller->direction() : Qt::LayoutDirectionAuto; } -/*! - Returns \c true if the notification is not a default constructed null notification. -*/ -bool QWebEngineNotification::isValid() const -{ - return !d_ptr.isNull(); -} - /*! Creates and dispatches a JavaScript \e {show event} on notification. diff --git a/src/core/api/qwebenginenotification.h b/src/core/api/qwebenginenotification.h index 6c9a8f891..08fd629be 100644 --- a/src/core/api/qwebenginenotification.h +++ b/src/core/api/qwebenginenotification.h @@ -46,7 +46,6 @@ #include <QtCore/QScopedPointer> #include <QtCore/QSharedPointer> #include <QtCore/QUrl> -#include <QtGui/QIcon> namespace QtWebEngineCore { class UserNotificationController; @@ -59,7 +58,6 @@ class QWebEngineNotificationPrivate; class Q_WEBENGINECORE_EXPORT QWebEngineNotification : public QObject { Q_OBJECT Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL) - Q_PROPERTY(QIcon icon READ icon CONSTANT FINAL) Q_PROPERTY(QString title READ title CONSTANT FINAL) Q_PROPERTY(QString message READ message CONSTANT FINAL) Q_PROPERTY(QString tag READ tag CONSTANT FINAL) @@ -67,23 +65,18 @@ class Q_WEBENGINECORE_EXPORT QWebEngineNotification : public QObject { Q_PROPERTY(Qt::LayoutDirection direction READ direction CONSTANT FINAL) public: - QWebEngineNotification(); - QWebEngineNotification(const QWebEngineNotification &other); - virtual ~QWebEngineNotification(); - const QWebEngineNotification &operator=(const QWebEngineNotification &other); + virtual ~QWebEngineNotification() override; - bool matches(const QWebEngineNotification &other) const; + bool matches(const QWebEngineNotification *other) const; QUrl origin() const; - QIcon icon() const; + QImage icon() const; QString title() const; QString message() const; QString tag() const; QString language() const; Qt::LayoutDirection direction() const; - bool isValid() const; - public Q_SLOTS: void show() const; void click() const; @@ -93,8 +86,9 @@ Q_SIGNALS: void closed(); private: - QWebEngineNotification(const QSharedPointer<QtWebEngineCore::UserNotificationController> &controller); + Q_DISABLE_COPY(QWebEngineNotification) Q_DECLARE_PRIVATE(QWebEngineNotification) + QWebEngineNotification(const QSharedPointer<QtWebEngineCore::UserNotificationController> &controller); QScopedPointer<QWebEngineNotificationPrivate> d_ptr; friend class QQuickWebEngineProfilePrivate; friend class QWebEngineProfilePrivate; diff --git a/src/core/user_notification_controller.cpp b/src/core/user_notification_controller.cpp index 82cb57e51..d169bf854 100644 --- a/src/core/user_notification_controller.cpp +++ b/src/core/user_notification_controller.cpp @@ -86,7 +86,7 @@ public: std::unique_ptr<UserNotificationController::Delegate> m_delegate; blink::NotificationResources m_resources; UserNotificationController::Client *m_client; - QIcon m_icon; + QImage m_icon; QImage m_image; QImage m_badge; bool m_iconGenerated; @@ -155,15 +155,12 @@ QUrl UserNotificationController::origin() const return toQt(d->m_origin); } -QIcon UserNotificationController::icon() const +QImage UserNotificationController::icon() const { if (!d->m_iconGenerated) { d->m_iconGenerated = true; - if (!d->m_resources.notification_icon.isNull()) { - QImage image = toQImage(d->m_resources.notification_icon); - if (!image.isNull()) - d->m_icon = QIcon(QPixmap::fromImage(std::move(image), Qt::NoFormatConversion)); - } + if (!d->m_resources.notification_icon.isNull()) + d->m_icon = toQImage(d->m_resources.notification_icon); } return d->m_icon; } diff --git a/src/core/user_notification_controller.h b/src/core/user_notification_controller.h index 213629334..bab85c7ec 100644 --- a/src/core/user_notification_controller.h +++ b/src/core/user_notification_controller.h @@ -86,7 +86,7 @@ public: void closeNotification(); QUrl origin() const; - QIcon icon() const; + QImage icon() const; QImage image() const; QImage badge() const; QString title() const; diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index ac75b5356..4832ba303 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -152,7 +152,7 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineC */ /*! - \fn QQuickWebEngineProfile::userNotification(QWebEngineNotification *notification) + \fn QQuickWebEngineProfile::presentNotification(QWebEngineNotification *notification) This signal is emitted whenever there is a newly created user notification. The \a notification argument holds the notification instance to query data and interact with. @@ -304,7 +304,7 @@ void QQuickWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineC Q_Q(QQuickWebEngineProfile); auto notification = new QWebEngineNotification(controller); QQmlEngine::setObjectOwnership(notification, QQmlEngine::JavaScriptOwnership); - Q_EMIT q->userNotification(notification); + Q_EMIT q->presentNotification(notification); } void QQuickWebEngineProfilePrivate::userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script) @@ -387,7 +387,7 @@ void QQuickWebEngineProfilePrivate::userScripts_clear(QQmlListProperty<QQuickWeb */ /*! - \qmlsignal WebEngineProfile::userNotification(WebEngineNotification notification) + \qmlsignal WebEngineProfile::presentNotification(WebEngineNotification notification) \since QtWebEngine 1.9 This signal is emitted whenever there is a newly created user notification. diff --git a/src/webengine/api/qquickwebengineprofile.h b/src/webengine/api/qquickwebengineprofile.h index e6f9fb73d..e5f7ff713 100644 --- a/src/webengine/api/qquickwebengineprofile.h +++ b/src/webengine/api/qquickwebengineprofile.h @@ -176,7 +176,7 @@ Q_SIGNALS: void downloadRequested(QQuickWebEngineDownloadItem *download); void downloadFinished(QQuickWebEngineDownloadItem *download); - Q_REVISION(5) void userNotification(QWebEngineNotification *notification); + Q_REVISION(5) void presentNotification(QWebEngineNotification *notification); private: Q_DECLARE_PRIVATE(QQuickWebEngineProfile) diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes index cc2ed502d..0037861e5 100644 --- a/src/webengine/plugin/plugins.qmltypes +++ b/src/webengine/plugin/plugins.qmltypes @@ -531,7 +531,7 @@ Module { Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true } } Signal { - name: "userNotification" + name: "presentNotification" revision: 5 Parameter { name: "notification"; type: "QWebEngineNotification"; isPointer: true } } diff --git a/src/webenginewidgets/api/qwebenginenotificationpresenter.cpp b/src/webenginewidgets/api/qwebenginenotificationpresenter.cpp index da97c4662..667605c37 100644 --- a/src/webenginewidgets/api/qwebenginenotificationpresenter.cpp +++ b/src/webenginewidgets/api/qwebenginenotificationpresenter.cpp @@ -39,6 +39,7 @@ #include "qwebenginenotificationpresenter_p.h" +#include <QApplication> #include <QSystemTrayIcon> QT_BEGIN_NAMESPACE @@ -55,50 +56,53 @@ DefaultNotificationPresenter::~DefaultNotificationPresenter() { } -void DefaultNotificationPresenter::show(const QWebEngineNotification ¬ification) +void DefaultNotificationPresenter::show(std::unique_ptr<QWebEngineNotification> notification) { - if (m_activeNotification.isValid()) { - m_activeNotification.close(); - m_activeNotification.disconnect(this); + Q_ASSERT(notification); + if (m_activeNotification) { + m_activeNotification->close(); + m_activeNotification->disconnect(this); } - m_activeNotification = notification; + m_activeNotification = std::move(notification); #ifndef QT_NO_SYSTEMTRAYICON - if (m_activeNotification.isValid() && m_systemTrayIcon) { + if (m_activeNotification && m_systemTrayIcon) { + m_systemTrayIcon->setIcon(qApp->windowIcon()); m_systemTrayIcon->show(); - QIcon icon = notification.icon(); - if (!icon.isNull()) - m_systemTrayIcon->showMessage(notification.title(), notification.message(), icon); + QImage notificationIconImage = m_activeNotification->icon(); + m_notificationIcon = QIcon(QPixmap::fromImage(std::move(notificationIconImage), Qt::NoFormatConversion)); + if (!m_notificationIcon.isNull()) + m_systemTrayIcon->showMessage(m_activeNotification->title(), m_activeNotification->message(), m_notificationIcon); else - m_systemTrayIcon->showMessage(notification.title(), notification.message()); - notification.show(); - connect(&m_activeNotification, &QWebEngineNotification::closed, this, &DefaultNotificationPresenter::closeNotification); + m_systemTrayIcon->showMessage(m_activeNotification->title(), m_activeNotification->message()); + m_activeNotification->show(); + connect(m_activeNotification.get(), &QWebEngineNotification::closed, this, &DefaultNotificationPresenter::closeNotification); } #endif } void DefaultNotificationPresenter::messageClicked() { - if (m_activeNotification.isValid()) - m_activeNotification.click(); + if (m_activeNotification) + m_activeNotification->click(); } void DefaultNotificationPresenter::closeNotification() { #ifndef QT_NO_SYSTEMTRAYICON const QWebEngineNotification *canceled = static_cast<const QWebEngineNotification *>(QObject::sender()); - if (m_systemTrayIcon && canceled->matches(m_activeNotification)) + if (m_systemTrayIcon && canceled->matches(m_activeNotification.get())) m_systemTrayIcon->hide(); #endif } -void defaultNotificationPresenter(const QWebEngineNotification ¬ification) +void defaultNotificationPresenter(std::unique_ptr<QWebEngineNotification> notification) { static DefaultNotificationPresenter *presenter = nullptr; if (!presenter) presenter = new DefaultNotificationPresenter(); - presenter->show(notification); + presenter->show(std::move(notification)); } diff --git a/src/webenginewidgets/api/qwebenginenotificationpresenter_p.h b/src/webenginewidgets/api/qwebenginenotificationpresenter_p.h index a66dbc1b2..49d774806 100644 --- a/src/webenginewidgets/api/qwebenginenotificationpresenter_p.h +++ b/src/webenginewidgets/api/qwebenginenotificationpresenter_p.h @@ -54,6 +54,9 @@ #include <QtWebEngineCore/QWebEngineNotification> #include <QtCore/QObject> +#include <QtGui/QIcon> + +#include <memory> QT_BEGIN_NAMESPACE @@ -65,7 +68,7 @@ public: DefaultNotificationPresenter(QObject *parent = nullptr); virtual ~DefaultNotificationPresenter(); - void show(const QWebEngineNotification ¬ification); + void show(std::unique_ptr<QWebEngineNotification> notification); private Q_SLOTS: void messageClicked(); @@ -73,10 +76,11 @@ private Q_SLOTS: private: QSystemTrayIcon *m_systemTrayIcon; - QWebEngineNotification m_activeNotification; + QIcon m_notificationIcon; + std::unique_ptr<QWebEngineNotification> m_activeNotification; }; -void defaultNotificationPresenter(const QWebEngineNotification ¬ification); +void defaultNotificationPresenter(std::unique_ptr<QWebEngineNotification> notification); QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index d69ddb343..47b3f4363 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -141,10 +141,12 @@ using QtWebEngineCore::ProfileAdapter; Both session and persistent cookies are saved to and restored from disk. */ -void QWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineCore::UserNotificationController> ¬ification) +void QWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineCore::UserNotificationController> &controller) { - if (m_notificationPresenter) - m_notificationPresenter(QWebEngineNotification(notification)); + if (m_notificationPresenter) { + std::unique_ptr<QWebEngineNotification> notification(new QWebEngineNotification(controller)); + m_notificationPresenter(std::move(notification)); + } } /*! @@ -668,7 +670,7 @@ QWebEngineScriptCollection *QWebEngineProfile::scripts() const \since 5.13 \sa QWebEngineNotification */ -void QWebEngineProfile::setNotificationPresenter(std::function<void(const QWebEngineNotification &)> notificationPresenter) +void QWebEngineProfile::setNotificationPresenter(std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter) { Q_D(QWebEngineProfile); d->m_notificationPresenter = std::move(notificationPresenter); diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h index e3ddb594a..794ba6279 100644 --- a/src/webenginewidgets/api/qwebengineprofile.h +++ b/src/webenginewidgets/api/qwebengineprofile.h @@ -47,6 +47,7 @@ #include <QtCore/qstring.h> #include <functional> +#include <memory> QT_BEGIN_NAMESPACE @@ -141,7 +142,7 @@ public: QString downloadPath() const; void setDownloadPath(const QString &path); - void setNotificationPresenter(std::function<void(const QWebEngineNotification &)> notificationPresenter); + void setNotificationPresenter(std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter); QWebEngineClientCertificateStore *clientCertificateStore(); diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h index 91c43cf0a..64e9500b0 100644 --- a/src/webenginewidgets/api/qwebengineprofile_p.h +++ b/src/webenginewidgets/api/qwebengineprofile_p.h @@ -100,7 +100,7 @@ private: QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter; QScopedPointer<QWebEngineScriptCollection> m_scriptCollection; QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads; - std::function<void(const QWebEngineNotification &)> m_notificationPresenter; + std::function<void(std::unique_ptr<QWebEngineNotification>)> m_notificationPresenter; }; QT_END_NAMESPACE diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 0012249c8..90b768ac7 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -324,7 +324,7 @@ static const QStringList expectedAPI = QStringList() << "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void" << "QQuickWebEngineProfile.downloadPath --> QString" << "QQuickWebEngineProfile.downloadPathChanged() --> void" - << "QQuickWebEngineProfile.userNotification(QWebEngineNotification*) --> void" + << "QQuickWebEngineProfile.presentNotification(QWebEngineNotification*) --> void" << "QQuickWebEngineProfile.httpAcceptLanguage --> QString" << "QQuickWebEngineProfile.httpAcceptLanguageChanged() --> void" << "QQuickWebEngineProfile.httpCacheMaximumSize --> int" @@ -756,7 +756,6 @@ static const QStringList expectedAPI = QStringList() << "QWebEngineRegisterProtocolHandlerRequest.reject() --> void" << "QWebEngineRegisterProtocolHandlerRequest.scheme --> QString" << "QWebEngineNotification.origin --> QUrl" - << "QWebEngineNotification.icon --> QIcon" << "QWebEngineNotification.title --> QString" << "QWebEngineNotification.message --> QString" << "QWebEngineNotification.tag --> QString" diff --git a/tests/auto/quick/qmltests/data/tst_notification.qml b/tests/auto/quick/qmltests/data/tst_notification.qml index af4aebafc..773bf4a8e 100644 --- a/tests/auto/quick/qmltests/data/tst_notification.qml +++ b/tests/auto/quick/qmltests/data/tst_notification.qml @@ -107,7 +107,7 @@ TestWebEngineView { verify(permissionRequested) let title = 'Title', message = 'Message', notification = null - view.profile.userNotification.connect(function (n) { notification = n }) + view.profile.presentNotification.connect(function (n) { notification = n }) view.runJavaScript('sendNotification("' + title + '", "' + message + '")') tryVerify(function () { return notification !== null }) diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index f73469d83..9ba242e68 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -3327,27 +3327,33 @@ void tst_QWebEnginePage::sendNotification() QVERIFY(page.spyRequest.wasCalled()); QCOMPARE(page.getPermission(), "granted"); - CallbackSpy<QWebEngineNotification> presenter; - page.profile()->setNotificationPresenter([callback = presenter.ref()] (const QWebEngineNotification ¬ification) mutable { callback(notification); }); + std::unique_ptr<QWebEngineNotification> activeNotification; + CallbackSpy<bool> presenter; + page.profile()->setNotificationPresenter( + [&] (std::unique_ptr<QWebEngineNotification> notification) + { + activeNotification = std::move(notification); + presenter(true); + }); QString title("Title"), message("Message"); page.sendNotification(title, message); - auto notification = presenter.waitForResult(); + presenter.waitForResult(); QVERIFY(presenter.wasCalled()); - QVERIFY(notification.isValid()); - QCOMPARE(notification.title(), title); - QCOMPARE(notification.message(), message); - QCOMPARE(notification.origin(), origin); - QCOMPARE(notification.direction(), Qt::RightToLeft); - QCOMPARE(notification.language(), "de"); - QCOMPARE(notification.tag(), "tst"); - - notification.show(); + QVERIFY(activeNotification); + QCOMPARE(activeNotification->title(), title); + QCOMPARE(activeNotification->message(), message); + QCOMPARE(activeNotification->origin(), origin); + QCOMPARE(activeNotification->direction(), Qt::RightToLeft); + QCOMPARE(activeNotification->language(), "de"); + QCOMPARE(activeNotification->tag(), "tst"); + + activeNotification->show(); QTRY_VERIFY2(page.messages.contains("onshow"), page.messages.join("\n").toLatin1().constData()); - notification.click(); + activeNotification->click(); QTRY_VERIFY2(page.messages.contains("onclick"), page.messages.join("\n").toLatin1().constData()); - notification.close(); + activeNotification->close(); QTRY_VERIFY2(page.messages.contains("onclose"), page.messages.join("\n").toLatin1().constData()); } diff --git a/tests/quicktestbrowser/ApplicationRoot.qml b/tests/quicktestbrowser/ApplicationRoot.qml index e2248e350..a2e83e1e6 100644 --- a/tests/quicktestbrowser/ApplicationRoot.qml +++ b/tests/quicktestbrowser/ApplicationRoot.qml @@ -53,7 +53,7 @@ QtObject { var newWindow = browserWindowComponent.createObject(root) newWindow.currentWebView.profile = profile profile.downloadRequested.connect(newWindow.onDownloadRequested) - profile.userNotification.connect(newWindow.onUserNotification) + profile.presentNotification.connect(newWindow.onPresentNotification) return newWindow } function createDialog(profile) { diff --git a/tests/quicktestbrowser/BrowserWindow.qml b/tests/quicktestbrowser/BrowserWindow.qml index 381e9c142..6c3c160ac 100644 --- a/tests/quicktestbrowser/BrowserWindow.qml +++ b/tests/quicktestbrowser/BrowserWindow.qml @@ -511,7 +511,7 @@ ApplicationWindow { standardButtons: StandardButton.Ok } - function onUserNotification(notification) { + function onPresentNotification(notification) { notificationDialog.title = notification.title notificationDialog.text = notification.origin.toString() + '\n' + notification.message notificationDialog.open() -- GitLab