Home · All Classes · Main Classes · Deprecated
Public Member Functions | Static Public Member Functions | Static Public Attributes | Properties

MNotification Class Reference

A class that represents a notification. More...

Inherits QObject.

Inherited by MNotificationGroup.

List of all members.

Public Member Functions

 MNotification (const QString &eventType, const QString &summary=QString(), const QString &body=QString())
virtual ~MNotification ()
void setGroup (const MNotificationGroup &group)
QString eventType () const
void setSummary (const QString &summary)
QString summary () const
void setBody (const QString &body)
QString body () const
void setImage (const QString &image)
QString image () const
void setAction (const MRemoteAction &action)
void setCount (uint count)
uint count () const
void setIdentifier (const QString &identifier)
QString identifier () const
virtual bool publish ()
virtual bool remove ()
bool isPublished () const

Static Public Member Functions

static QList< MNotification * > notifications ()

Static Public Attributes

static const QString DeviceEvent = "device"
static const QString DeviceAddedEvent = "device.added"
static const QString DeviceErrorEvent = "device.error"
static const QString DeviceRemovedEvent = "device.removed"
static const QString EmailEvent = "email"
static const QString EmailArrivedEvent = "email.arrived"
static const QString EmailBouncedEvent = "email.bounced"
static const QString ImEvent = "im"
static const QString ImErrorEvent = "im.error"
static const QString ImReceivedEvent = "im.received"
static const QString NetworkEvent = "network"
static const QString NetworkConnectedEvent = "network.connected"
static const QString NetworkDisconnectedEvent = "network.disconnected"
static const QString NetworkErrorEvent = "network.error"
static const QString PresenceEvent = "presence"
static const QString PresenceOfflineEvent = "presence.offline"
static const QString PresenceOnlineEvent = "presence.online"
static const QString TransferEvent = "transfer"
static const QString TransferCompleteEvent = "transfer.complete"
static const QString TransferErrorEvent = "transfer.error"
static const QString MessageEvent = "x-nokia.message"
static const QString MessageArrivedEvent = "x-nokia.message.arrived"

Properties

QString summary
QString body
QString image
uint count
QString identifier

Detailed Description

A class that represents a notification.

Overview

Notifications provide means to communicate system information and status updates to the user, without blocking the UI or requiring the user to switch to another view. Notifications can be done through visual, audio or haptic means.

Dialogs and notifications are related to each other, but separate components. All Dialogs are modal, i.e. elements that do not go away from the screen without requiring user interactions, whereas all notifications are temporal elements (i.e. modeless) that do not require interactions from the user (although they can sometimes also provide them).

Certain notifications are related to the communication activities (like SMS, email, feed updates etc.), and notifications relating to application and system behaviour (like connection lost, battery low etc.). Communication activities display incoming event notifications.

A notification is not created or updated until the publish() function is called.

A list of notifications already created can be requested. A QCoreApplication must be created before doing the request.

See also:
Notification system

Interactions

Notifications can be non-interactive (for information only) or interactive: the interactive notifications provide information, but they also provide a way for interacting with the notification, for example to fix a connectivity problem. Notifications are always modeless components - modal "notifications" are specified with Dialogs. Images on this page are for illustrational purposes only. In case that images and text conflict each other, the text should be followed.

Usage guidelines

Persistence

Notifications created as persistent are stored by the notification system and are returned by the MNotification::notifications() even after a reboot. It should be noted that currently all properties of such notifications need to be set before publishing changes to the notification. Otherwise the properties of the notification will be lost.

Note:
A QCoreApplication instance must be created before creating any persistent notifications.

Constructor & Destructor Documentation

MNotification::MNotification ( const QString eventType,
const QString summary = QString(),
const QString body = QString() 
) [explicit]

Creates a new representation of a notification. The notification will not be published until publish() is called. Only the event type needs to be defined. If no summary or body text is defined the notification will not have a visual representation.

Parameters:
eventType the event type of the notification. Types are in the format defined in Desktop Notifications Specification. Known constants (such as EmailArrivedEvent) are provided by the MNotification class but custom strings can also be used.
summary the summary text to be used in the notification. Can be omitted (defaults to no summary text).
body the body text to be used in the notification. Can be omitted (defaults to no body text).
MNotification::~MNotification (  )  [virtual]

Destroys the class that represents a notification.


Member Function Documentation

QString MNotification::body (  )  const

Gets the body text to be used in the notification.

Returns:
the body text to be used in the notification.
uint MNotification::count (  )  const

Gets the number of items represented by this notification (cardinality).

Returns:
the number of items represented by this notification
QString MNotification::eventType (  )  const

Gets the event type of the notification.

Returns:
the event type of the notification.
QString MNotification::identifier (  )  const

Gets the identifier of the notification.

Returns:
the identifier.
QString MNotification::image (  )  const

Gets the name of the image to be used in the notification.

Returns:
the name of the image to be used in the notification.
bool MNotification::isPublished (  )  const

Returns whether the notification is published

Returns:
true if the notification is published, false otherwise
QList< MNotification * > MNotification::notifications (  )  [static]

Returns a list of notifications created by this application but which have not been dismissed by the user yet. Caller of this function gets the ownership of the notifications, and is responsible for freeing them.

Returns:
list of notifications
bool MNotification::publish (  )  [virtual]

Publishes the notification. If the notification has not yet been published a notification is created into the given notification group (if any) and is given an ID by the notification manager. Otherwise the existing notification is updated.

Returns:
true if the publishing succeeded, false otherwise
bool MNotification::remove (  )  [virtual]

Removes a notification.

Returns:
true if the removal succeeded, false otherwise
void MNotification::setAction ( const MRemoteAction action  ) 

Sets the action to be executed when the notification is activated.

Parameters:
action the action to be executed when the notification is activated.
void MNotification::setBody ( const QString body  ) 

Sets the body text to be used in the notification.

Parameters:
body the body text to be used in the notification.
void MNotification::setCount ( uint  count  ) 

Sets the number of items represented by this notification (cardinality). For example a single notification may represent 5 new e-mails, in which case the count of the notification should be 5.

Parameters:
count the number of items represented by this notification
void MNotification::setGroup ( const MNotificationGroup group  ) 

Sets the notification group the notification belongs to. The notification group must be published before this function is called.

Parameters:
group the notification group the notification belongs to.
void MNotification::setIdentifier ( const QString identifier  ) 

Sets an identifier for the notification. Can be any string the application needs to identify this particular notification.

Parameters:
id the identifier
void MNotification::setImage ( const QString image  ) 

Sets the name of the image to be used in the notification. If the name is an absolute path (begins with a /) an image located in that path is used. Otherwise the image name is interpreted to be an icon ID.

Parameters:
image the name of the image to be used in the notification.
void MNotification::setSummary ( const QString summary  ) 

Sets the summary text to be used in the notification.

Parameters:
summary the summary text to be used in the notification.
QString MNotification::summary (  )  const

Gets the summary text to be used in the notification.

Returns:
the summary text to be used in the notification.

Member Data Documentation

const QString MNotification::DeviceAddedEvent = "device.added" [static]

A device, such as a USB device, was added to the system.

const QString MNotification::DeviceErrorEvent = "device.error" [static]

A device had some kind of error.

const QString MNotification::DeviceEvent = "device" [static]

A generic device-related notification that doesn't fit into any other category.

Predefined event types. These are just the known types; applications may use other types as well if the event type string is known.

const QString MNotification::DeviceRemovedEvent = "device.removed" [static]

A device, such as a USB device, was removed from the system.

const QString MNotification::EmailArrivedEvent = "email.arrived" [static]

A new e-mail notification.

const QString MNotification::EmailBouncedEvent = "email.bounced" [static]

A notification stating that an e-mail has bounced.

const QString MNotification::EmailEvent = "email" [static]

A generic e-mail-related notification that doesn't fit into any other category.

const QString MNotification::ImErrorEvent = "im.error" [static]

An instant message error notification.

const QString MNotification::ImEvent = "im" [static]

A generic instant message-related notification that doesn't fit into any other category.

const QString MNotification::ImReceivedEvent = "im.received" [static]

A received instant message notification.

const QString MNotification::MessageArrivedEvent = "x-nokia.message.arrived" [static]

A new SMS/MMS notification.

const QString MNotification::MessageEvent = "x-nokia.message" [static]

A generic SMS/MMS-related notification that doesn't fit into any other category.

const QString MNotification::NetworkConnectedEvent = "network.connected" [static]

A network connection notification, such as successful sign-on to a network service. This should not be confused with device.added for new network devices.

const QString MNotification::NetworkDisconnectedEvent = "network.disconnected" [static]

A network disconnected notification. This should not be confused with device.removed for disconnected network devices.

const QString MNotification::NetworkErrorEvent = "network.error" [static]

A network-related or connection-related error.

const QString MNotification::NetworkEvent = "network" [static]

A generic network notification that doesn't fit into any other category.

const QString MNotification::PresenceEvent = "presence" [static]

A generic presence change notification that doesn't fit into any other category, such as going away or idle.

const QString MNotification::PresenceOfflineEvent = "presence.offline" [static]

An offline presence change notification.

const QString MNotification::PresenceOnlineEvent = "presence.online" [static]

An online presence change notification.

const QString MNotification::TransferCompleteEvent = "transfer.complete" [static]

A file transfer or download complete notification.

const QString MNotification::TransferErrorEvent = "transfer.error" [static]

A file transfer or download error.

const QString MNotification::TransferEvent = "transfer" [static]

A generic file transfer or download notification that doesn't fit into any other category.


Property Documentation

MNotification::body [read, write]

The body text to be used in the notification.

MNotification::count [read, write]

The number of items represented by this notification.

MNotification::identifier [read, write]

The identifier string of the notification. The identifier is empty by default.

MNotification::image [read, write]

The name of the image to be used in the notification.

MNotification::summary [read, write]

The summary text to be used in the notification.


Copyright © 2010 Nokia Corporation
MeeGo Touch