Akonadi

notificationmanager.h
1 /*
2  Copyright (c) 2006 - 2007 Volker Krause <[email protected]>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #ifndef AKONADI_NOTIFICATIONMANAGER_H
21 #define AKONADI_NOTIFICATIONMANAGER_H
22 
23 #include "akthread.h"
24 
25 #include <private/protocol_p.h>
26 
27 #include <QTimer>
28 #include <QPointer>
29 
30 class NotificationManagerTest;
31 class QThreadPool;
32 
33 namespace Akonadi
34 {
35 namespace Server
36 {
37 
38 class NotificationCollector;
39 class NotificationSubscriber;
40 class AggregatedCollectionFetchScope;
41 class AggregatedItemFetchScope;
42 class AggregatedTagFetchScope;
43 
44 class NotificationManager : public AkThread
45 {
46  Q_OBJECT
47 
48 public:
49  explicit NotificationManager(StartMode startMode = AutoStart);
50  ~NotificationManager() override;
51 
52  void forgetSubscriber(NotificationSubscriber *subscriber);
53 
54  AggregatedCollectionFetchScope *collectionFetchScope() const { return mCollectionFetchScope; }
55  AggregatedItemFetchScope *itemFetchScope() const { return mItemFetchScope; }
56  AggregatedTagFetchScope *tagFetchScope() const { return mTagFetchScope; }
57 
58 public Q_SLOTS:
59  void registerConnection(quintptr socketDescriptor);
60 
61  void emitPendingNotifications();
62 
63  void slotNotify(const Akonadi::Protocol::ChangeNotificationList &msgs);
64 
65 protected:
66  void init() override;
67  void quit() override;
68 
69  void emitDebugNotification(const Protocol::ChangeNotificationPtr &ntf,
70  const QVector<QByteArray> &listeners);
71 
72 private:
73  Protocol::ChangeNotificationList mNotifications;
74  QTimer *mTimer = nullptr;
75 
76  QThreadPool *mNotifyThreadPool = nullptr;
78  int mDebugNotifications;
79  AggregatedCollectionFetchScope *mCollectionFetchScope = nullptr;
80  AggregatedItemFetchScope *mItemFetchScope = nullptr;
81  AggregatedTagFetchScope *mTagFetchScope = nullptr;
82 
83  bool mWaiting = false;
84  bool mQuitting = false;
85 
86  friend class NotificationSubscriber;
87  friend class ::NotificationManagerTest;
88 };
89 
90 } // namespace Server
91 } // namespace Akonadi
92 
93 #endif
Q_OBJECTQ_OBJECT
QCA_EXPORT void init()
KDEGAMES_EXPORT QAction * quit(const QObject *recvr, const char *slot, QObject *parent)
Helper integration between Akonadi and Qt.
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 23:08:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.