From a5d21cb35088167a5a5b330000b663916bb21d0b Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 14 Apr 2023 19:13:49 +0300 Subject: [PATCH] There was added notifications count method --- notificationservice.cpp | 6 +++++- notificationservice.h | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/notificationservice.cpp b/notificationservice.cpp index d1bf6df..dd588a1 100644 --- a/notificationservice.cpp +++ b/notificationservice.cpp @@ -6,7 +6,7 @@ */ #include "notificationservice.h" -#include + namespace QmlNotificationService { NotificationService::NotificationService(QObject * ptr): QObject (ptr) { @@ -116,4 +116,8 @@ void NotificationService::showHistory() { emit sigShowHistory(); } +int NotificationService::notificationsCount() const { + return _history->rowCount({}); +} + } diff --git a/notificationservice.h b/notificationservice.h index af7320f..53de8a4 100644 --- a/notificationservice.h +++ b/notificationservice.h @@ -127,6 +127,12 @@ public: Q_INVOKABLE void showHistory(); + /** + * @brief notificationsCount - This method used for return count of history notifications. + * @return count of history notifications. + */ + Q_INVOKABLE int notificationsCount() const; + ~NotificationService(); signals: