File indexing completed on 2024-12-08 10:25:50

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "notificationhistorymanager.h"
0008 #include "model/notificationhistorymodel.h"
0009 
0010 NotificationHistoryManager::NotificationHistoryManager(QObject *parent)
0011     : QObject{parent}
0012     , mNotificationHistoryModel(new NotificationHistoryModel(this))
0013 {
0014 }
0015 
0016 NotificationHistoryManager::~NotificationHistoryManager() = default;
0017 
0018 NotificationHistoryManager *NotificationHistoryManager::self()
0019 {
0020     static NotificationHistoryManager s_self;
0021     return &s_self;
0022 }
0023 
0024 NotificationHistoryModel *NotificationHistoryManager::notificationHistoryModel() const
0025 {
0026     return mNotificationHistoryModel;
0027 }
0028 
0029 void NotificationHistoryManager::addNotification(const NotificationInfo &info)
0030 {
0031     // qDebug() << " info " << info;
0032     mNotificationHistoryModel->addNotification(info);
0033     Q_EMIT newNotification();
0034 }
0035 
0036 #include "moc_notificationhistorymanager.cpp"