Home · All Namespaces · All Classes

EventTypeStore Class Reference

#include <eventtypestore.h>

Inheritance diagram for EventTypeStore:
Inheritance graph
[legend]
Collaboration diagram for EventTypeStore:
Collaboration graph
[legend]

List of all members.

Signals

void eventTypeModified (const QString &eventType)
void eventTypeUninstalled (const QString &eventType)

Public Member Functions

 EventTypeStore (const QString &eventTypesPath, uint maxStoredEventTypes=100)
bool eventTypeExists (const QString &eventType) const
QList< QString > allKeys (const QString &eventType) const
bool contains (const QString &eventType, const QString &key) const
QString value (const QString &eventType, const QString &key) const

Detailed Description

A class that represents a notification event type store. The event type store will store all the event types stored in the given path.

The event type store will limit the number of configuration files it will read. The rationale is to constrain memory usage and startup time in case a huge number of event types are defined by a misbehaving package.

Definition at line 42 of file eventtypestore.h.


Constructor & Destructor Documentation

EventTypeStore::EventTypeStore ( const QString &  eventTypesPath,
uint  maxStoredEventTypes = 100 
) [explicit]

Creates a notification event types store to store the notifications event types.

Parameters:
eventTypesPath The path where the different event types are defined
maxStoredEventTypes The maximum number of event types to keep in memory

Definition at line 27 of file eventtypestore.cpp.

00027                                                                                       :
00028     eventTypesPath(eventTypesPath),
00029     maxStoredEventTypes(maxStoredEventTypes)
00030 {
00031     if (!this->eventTypesPath.endsWith('/')) {
00032         this->eventTypesPath.append('/');
00033     }
00034 
00035     // Watch for changes in event type files
00036     eventTypePathWatcher.addPath(this->eventTypesPath);
00037     connect(&eventTypePathWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(updateEventTypeFileList()));
00038     connect(&eventTypePathWatcher, SIGNAL(fileChanged(QString)), this, SLOT(updateEventTypeFile(QString)));
00039     updateEventTypeFileList();
00040 }


Member Function Documentation

QList< QString > EventTypeStore::allKeys ( const QString &  eventType  )  const

Returns all parameter keys for a given event type. If the event type doesn't exist, an empty list is returned.

Parameters:
eventType the event type.
See also:
eventTypeExists, contains, value

Definition at line 99 of file eventtypestore.cpp.

00100 {
00101     if (eventTypeExists(eventType)) {
00102         return eventTypesMap.value(eventType)->allKeys();
00103     }
00104 
00105     return QList<QString>();
00106 }

Here is the call graph for this function:

bool EventTypeStore::contains ( const QString &  eventType,
const QString &  key 
) const

Check if a given parameter key exists in the the configuration for eventType. If the key does exist in the eventType, this method returns true. If the key does not exist or the eventType does not exist at all, this method returns false.

Parameters:
eventType the event type.
key the parameter key.
Returns:
true if the key exists in the event type, false otherwise.
See also:
eventTypeExists, allKeys, value

Definition at line 108 of file eventtypestore.cpp.

00109 {
00110     if (eventTypeExists(eventType)) {
00111         return eventTypesMap.value(eventType)->contains(key);
00112     }
00113 
00114     return false;
00115 }

Here is the call graph for this function:

bool EventTypeStore::eventTypeExists ( const QString &  eventType  )  const

Tests if the eventType exists in the system.

Parameters:
eventType the event type to check.
Returns:
true if the event type exists, false otherwise.

Definition at line 82 of file eventtypestore.cpp.

00083 {
00084     bool eventTypeFound = false;
00085 
00086     if (!eventTypesMap.contains(eventType)) {
00087         // If the event type has not been loaded yet load it
00088         const_cast<EventTypeStore *>(this)->loadSettings(eventType);
00089     }
00090 
00091     if (eventTypesMap.contains(eventType)) {
00092         const_cast<EventTypeStore*>(this)->eventTypeAccessed(eventType);
00093         eventTypeFound = true;
00094     }
00095 
00096     return eventTypeFound;
00097 }

void EventTypeStore::eventTypeModified ( const QString &  eventType  )  [signal]

A signal sent whenever an event type has been modified

Parameters:
eventType the event type that was modified
void EventTypeStore::eventTypeUninstalled ( const QString &  eventType  )  [signal]

A signal sent whenever an event type has been uninstalled

Parameters:
eventType the event type that was removed
QString EventTypeStore::value ( const QString &  eventType,
const QString &  key 
) const

Returns the value for the given parameter key in the configuration for eventType. If the key does not exist in the eventType or the eventType does not exist at all, this method returns an empty string.

Parameters:
eventType the event type.
key the parameter key.
Returns:
the value for the key in the event type.
See also:
eventTypeExists, allKeys, contains

Definition at line 117 of file eventtypestore.cpp.

00118 {
00119     if (contains(eventType, key)) {
00120         return eventTypesMap.value(eventType)->value(key).toString();
00121     }
00122 
00123     return QString();
00124 }

Here is the call graph for this function:


The documentation for this class was generated from the following files:

Copyright © 2010 Nokia Corporation Generated on Wed Nov 10 16:05:05 2010
Doxygen 1.6.1
MeeGo Touch