Warning, file /pim/akregator/src/notificationmanager.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     This file is part of Akregator.
0003 
0004     SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0007 */
0008 
0009 #pragma once
0010 
0011 #include <QList>
0012 #include <QObject>
0013 
0014 #include "akregator_export.h"
0015 #include "article.h"
0016 
0017 namespace Akregator
0018 {
0019 /** this class collects notification requests (new articles etc.) and processes them using KNotify.  */
0020 class AKREGATOR_EXPORT NotificationManager : public QObject
0021 {
0022     Q_OBJECT
0023 public:
0024     /** singleton instance of notification manager */
0025     static NotificationManager *self();
0026 
0027     ~NotificationManager() override;
0028 
0029     /** the widget used for notification, normally either the mainwindow or the tray icon */
0030     void setWidget(QWidget *widget, const QString &componentName = QString());
0031 
0032 public Q_SLOTS:
0033 
0034     /** notifies an article. Note that articles are not notified separately, but
0035     "collected" and notified all together */
0036     void slotNotifyArticle(const Akregator::Article &article);
0037 
0038     /** notifies the addition of feeds (used when added via DCOP or command line) */
0039     void slotNotifyFeeds(const QStringList &feeds);
0040 
0041 protected:
0042     void doNotify();
0043 
0044 protected Q_SLOTS:
0045 
0046     void slotIntervalCheck();
0047 
0048 private:
0049     explicit NotificationManager(QObject *parent = nullptr);
0050     NotificationManager(const NotificationManager &)
0051         : QObject()
0052     {
0053     }
0054 
0055     int m_checkInterval = 0;
0056     int m_intervalsLapsed = 2000;
0057     int m_maxIntervals = 10;
0058     int m_maxArticles = 20;
0059     bool m_running = false;
0060     bool m_addedInLastInterval = false;
0061     QWidget *m_widget = nullptr;
0062     QString m_componantName;
0063 
0064     QList<Article> m_articles;
0065 
0066     static NotificationManager *m_self;
0067 };
0068 } // namespace Akregator