diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2019-03-20 18:04:50 +0100 |
---|---|---|
committer | Kirill Burtsev <kirill.burtsev@qt.io> | 2019-04-05 08:20:49 +0000 |
commit | d2fa5fd0f5b1972bd372510cc14509e85b972b23 (patch) | |
tree | 0f36120b208394729aff28de483369591f38ad4b /src/core/api/qwebenginenotification.cpp | |
parent | 320c7316b75be22112cb4802187c3873c9934eab (diff) |
Notification API cleanup
Task-number: QTBUG-74543
Change-Id: Ice5a0dbfc3485c8b7e6fa900ef427a9aed871d42
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/api/qwebenginenotification.cpp')
-rw-r--r-- | src/core/api/qwebenginenotification.cpp | 54 |
1 files changed, 12 insertions, 42 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,14 +86,6 @@ public: QWebEngineNotification *q; }; - -/*! - Creates a null QWebEngineNotification. - - \sa isNull() -*/ -QWebEngineNotification::QWebEngineNotification() { } - /*! \internal */ QWebEngineNotification::QWebEngineNotification(const QSharedPointer<UserNotificationController> &controller) @@ -102,25 +94,10 @@ QWebEngineNotification::QWebEngineNotification(const QSharedPointer<UserNotifica /*! \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(); } /*! @@ -224,14 +202,6 @@ Qt::LayoutDirection QWebEngineNotification::direction() const } /*! - 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. Should be called by the notification platform when the notification has been shown to user. |