![]() |
Home · All Namespaces · All Classes |
00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of systemui. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 00020 #ifndef NOTIFICATIONMANAGER_H_ 00021 #define NOTIFICATIONMANAGER_H_ 00022 00023 #include "notification.h" 00024 #include "notificationgroup.h" 00025 #include "notificationmanagerinterface.h" 00026 #include "eventtypestore.h" 00027 00028 #include <QObject> 00029 #include <QHash> 00030 #include <QSet> 00031 #include <QTimer> 00032 #include <QSharedPointer> 00033 #include <QBuffer> 00034 00035 class ApplicationContext; 00036 class DBusInterfaceNotificationSource; 00037 class DBusInterfaceNotificationSink; 00038 00043 class NotificationManager : public QObject, public NotificationManagerInterface 00044 { 00045 Q_OBJECT 00046 00047 public: 00060 NotificationManager(int relayInterval = 3000, uint maxWaitQueueSize = 100); 00061 00065 virtual ~NotificationManager(); 00066 00072 void initializeStore(); 00073 00079 void restoreData(); 00080 00082 QList<Notification> notifications() const; 00083 QList<NotificationGroup> groups() const; 00084 virtual QObject *qObject(); 00086 00087 public slots: 00089 uint addNotification(uint notificationUserId, const NotificationParameters ¶meters = NotificationParameters(), uint groupId = 0); 00090 bool updateNotification(uint notificationUserId, uint notificationId, const NotificationParameters ¶meters = NotificationParameters()); 00091 bool removeNotification(uint notificationUserId, uint notificationId); 00092 uint addGroup(uint notificationUserId, const NotificationParameters ¶meters = NotificationParameters()); 00093 bool updateGroup(uint notificationUserId, uint groupId, const NotificationParameters ¶meters = NotificationParameters()); 00094 bool removeGroup(uint notificationUserId, uint groupId); 00095 uint notificationUserId(); 00096 QList<uint> notificationIdList(uint notificationUserId); 00097 QList<Notification> notificationList(uint notificationUserId); 00098 QList<Notification> notificationListWithIdentifiers(uint notificationUserId); 00099 QList<NotificationGroup> notificationGroupList(uint notificationUserId); 00100 QList<NotificationGroup> notificationGroupListWithIdentifiers(uint notificationUserId); 00101 uint notificationCountInGroup(uint notificationUserId, uint groupId); 00103 00110 bool removeNotification(uint notificationId); 00111 00118 bool removeNotificationsInGroup(uint groupId); 00119 00124 void removeNotificationsAndGroupsWithEventType(const QString &eventType); 00125 00134 void updateNotificationsWithEventType(const QString &eventType); 00135 00136 signals: 00143 void notificationUpdated(const Notification ¬ification); 00144 00149 void notificationRemoved(uint notificationId); 00150 00157 void groupUpdated(uint groupId, const NotificationParameters ¶meters); 00158 00163 void groupRemoved(uint groupId); 00164 00170 void notificationRestored(const Notification ¬ification); 00171 00176 void queuedGroupRemove(uint groupId); 00177 00182 void queuedNotificationRemove(uint notificationId); 00183 00184 00185 protected slots: 00197 void relayNextNotification(); 00202 void removeUnseenFlags(bool ignore); 00203 00204 private slots: 00209 void doRemoveGroup(uint groupId); 00210 00211 private: 00218 Notification::NotificationType determineType(const NotificationParameters ¶meters); 00219 00225 void submitNotification(const Notification ¬ification); 00226 00235 NotificationParameters appendEventTypeParameters(const NotificationParameters ¶meters) const; 00236 00244 int findNotificationFromWaitQueue(uint notificationId); 00245 00251 uint nextAvailableNotificationID(); 00252 00258 uint nextAvailableGroupID(); 00259 00263 void initializeNotificationUserIdDataStore(); 00264 00268 void initializeEventTypeStore(); 00269 00275 bool ensurePersistentDataPath(); 00276 00280 void saveStateData(); 00281 00285 void saveNotifications(); 00286 00287 bool isSubsequentStart(); 00288 00289 void restoreState(); 00290 void restoreNotifications(); 00291 00298 bool isPersistent(const NotificationParameters ¶meters); 00299 00301 QHash<uint, Notification> notificationContainer; 00302 00304 QHash<uint, NotificationGroup> groupContainer; 00305 00307 QList<Notification> waitQueue; 00308 00310 const uint maxWaitQueueSize; 00311 00313 QTimer waitQueueTimer; 00314 00316 bool notificationInProgress; 00317 00319 uint notificationIdInProgress; 00320 00322 int relayInterval; 00323 00325 ApplicationContext *context; 00326 00328 DBusInterfaceNotificationSource *dBusSource; 00329 00331 DBusInterfaceNotificationSink *dBusSink; 00332 00334 QSharedPointer<EventTypeStore> notificationEventTypeStore; 00335 00337 quint32 lastUsedNotificationUserId; 00338 00340 bool persistentDataRestored; 00341 00343 bool subsequentStart; 00344 00345 #ifdef UNIT_TEST 00346 friend class Ut_NotificationManager; 00347 #endif 00348 }; 00349 00350 #endif /* NOTIFICATIONMANAGER_H_ */
Copyright © 2011 Nokia Corporation | Generated on Tue Aug 30 2011 16:38:12 Doxygen 1.7.1 |
MeeGo Touch |