NotificationDialog
#include <bb/platform/NotificationDialog>
To link against this class, add the following line to your .pro file: LIBS += -lbbplatform
A notification that will be shown to the user using a dialog box.
The notification also triggers effects such as vibration, LED flashing, sound playing, and so on. The effects are dependent on the notification settings of the application. Settings like Universal Inbox integration and badges will not be applied.
BlackBerry 10.0.0
Properties Index
| QString | title |
| QString | body |
| bool | repeat |
| QUrl | soundUrl |
| QDeclarativeListProperty< bb::system::SystemUiButton > | buttons [read-only] |
| bb::platform::NotificationResult::Type | result [read-only] |
| bb::platform::NotificationError::Type | error [read-only] |
Public Functions Index
| NotificationDialog (QObject *parent=0) | |
| virtual | ~NotificationDialog () |
| QString | title () const |
| QString | body () const |
| bool | repeat () const |
| QUrl | soundUrl () const |
| void | setTitle (const QString &title) |
| void | setBody (const QString &body) |
| void | setRepeat (bool repeat) |
| void | setSoundUrl (const QUrl &newSoundUrl) |
| void | appendButton (bb::system::SystemUiButton *button) |
| int | buttonCount () const |
| bb::system::SystemUiButton * | buttonAt (int index) const |
| void | clearButtons () |
| void | resetTitle () |
| void | resetBody () |
| void | resetRepeat () |
| void | resetSoundUrl () |
| bb::platform::NotificationResult::Type | result () const |
| bb::platform::NotificationError::Type | error () const |
| Q_INVOKABLE bb::system::SystemUiButton * | buttonSelection () const |
Public Slots Index
| void | show () |
| bb::platform::NotificationResult::Type | exec () |
| void | cancel () |
Signals Index
| void | finished (bb::platform::NotificationResult::Type value) |
| void | titleChanged (const QString &value) |
| void | bodyChanged (const QString &value) |
| void | repeatChanged (bool value) |
| void | soundUrlChanged (const QUrl &newSoundUrl) |
Properties
QString
Represents the title of the notification.
The notification settings determine whether and where the title is shown.
BlackBerry 10.0.0
QString
Represents the main text of the notification.
The notification settings determine whether and where the body is shown.
BlackBerry 10.0.0
bool
Represents whether the triggered effects of the notification should repeat.
Repeating effects include playing a sound.
BlackBerry 10.0.0
QUrl
Represents the location of the sound to be used when the notification is posted.
When the notification setting allows for sounds to be played, this property overrides the user preference for which sound to play. You must specify the soundUrl as a file URI to a public asset or a shared asset on the device. You can set a local asset to be a public asset in the Assets tab of the bar-descriptor.xml file of your project.
You must set the access_shared permission for your app to access shared files.
BlackBerry 10.0.0
QDeclarativeListProperty< bb::system::SystemUiButton >
Represents any buttons to include in the dialog box.
When the user selects one of these buttons, the finished() signal will be emitted with a parameter value of bb::platform::NotificationResult::ButtonSelection. If no buttons are supplied, show() requests will fail.
BlackBerry 10.0.0
bb::platform::NotificationResult::Type
Represents the result of the last completed request.
BlackBerry 10.0.0
bb::platform::NotificationError::Type
Represents the last error encountered.
This property is only valid when result() is bb::platform::NotificationResult::Error.
BlackBerry 10.0.0
Public Functions
The default property is buttons.
| Parameters | |
|---|---|
| parent |
If not 0, the supplied parent will be responsible for deleting this instance. |
BlackBerry 10.0.0
virtual
Destructor.
BlackBerry 10.0.0
QString
Retrieves the title associated with this notification.
The title of the notification.
BlackBerry 10.0.0
QString
Retrieves the text associated with this notification.
The text of the notification.
BlackBerry 10.0.0
bool
Retrieves the setting of whether or not to repeat notification settings such as vibration, LED, and so on.
true if the notification settings should be repeated.
BlackBerry 10.0.0
QUrl
Retrieves the sound associated with this notification.
The sound URL of the notification.
BlackBerry 10.0.0
void
Sets the title of the notification.
| Parameters | |
|---|---|
| title |
The title for the notification. |
BlackBerry 10.0.0
void
Sets the text of the notification.
| Parameters | |
|---|---|
| body |
The body for the notification. |
BlackBerry 10.0.0
void
Sets whether or not the notification settings like vibration, LED, etc should be repeated.
| Parameters | |
|---|---|
| repeat |
The preference for repeating notification settings. |
BlackBerry 10.0.0
void
Sets the sound of the notification.
You must specify the soundUrl as a file URI to a public asset or a shared asset on the device. You can set a local asset to be a public asset in the Assets tab of the bar-descriptor.xml file of your project.
You must set the access_shared permission for your app to access shared files.
| Parameters | |
|---|---|
| newSoundUrl |
The soundUrl for the notification. |
BlackBerry 10.0.0
void
Appends button to the list of buttons for this notification dialog box.
| Parameters | |
|---|---|
| button |
The button to append. |
BlackBerry 10.0.0
int
Retrieves the number of buttons added to the notification.
The number of buttons.
BlackBerry 10.0.0
bb::system::SystemUiButton *
Retrieves the button at index.
| Parameters | |
|---|---|
| index |
An index into the list of buttons. |
The button at index or null if an invalid index is provided.
BlackBerry 10.0.0
void
Clears the list of buttons for this notification.
The button instances will be deleted.
BlackBerry 10.0.0
void
Resets the title for the notification.
This resets the title property to its context-specific default value. The default is QString::null.
BlackBerry 10.0.0
void
Resets the body for the notification.
This resets the body property to its context-specific default value. The default is QString::null.
BlackBerry 10.0.0
void
Resets whether effects triggered by the notification should be repeated to not repeat.
BlackBerry 10.0.0
void
Resets the sound for the notification.
When reset, the user setting will be used.
BlackBerry 10.0.0
bb::platform::NotificationResult::Type
Retrieves the result of the last completed request.
The result of the last completed request.
BlackBerry 10.0.0
bb::platform::NotificationError::Type
Retrieves the error that occurred during the request.
The error that occurred.
BlackBerry 10.0.0
Q_INVOKABLE bb::system::SystemUiButton *
Returns the button selected when a button selection is made.
If no button has been selected, a null pointer will be returned.
This function will return the result of the button selection of show() and exec().
The return value will be reset when a new request is made.
The button selected.
BlackBerry 10.0.0
Public Slots
void
Displays or updates the dialog box based on current property values.
The dialog result can be retrieved with buttonSelection().
Control is returned to the caller immediately. For a blocking request, use exec().
BlackBerry 10.0.0
bb::platform::NotificationResult::Type
Displays the dialog box based on current property values.
The button selection can be retrieved with buttonSelection().
The result of the request.
BlackBerry 10.0.0
void
Cancels the dialog box if it is still displayed.
BlackBerry 10.0.0
Signals
void
Emitted when a request is completed.
| Parameters | |
|---|---|
| value |
The result of the request. |
BlackBerry 10.0.0
void
Emitted when the title property is changed programmatically.
| Parameters | |
|---|---|
| value |
The new value of the title property. |
BlackBerry 10.0.0
void
Emitted when the body property is changed programmatically.
| Parameters | |
|---|---|
| value |
The new value of the body property. |
BlackBerry 10.0.0
void
Emitted when the repeat property is changed programmatically.
| Parameters | |
|---|---|
| value |
The new value for the repeat property. |
BlackBerry 10.0.0
void
Emitted when the soundUrl property changes.
| Parameters | |
|---|---|
| newSoundUrl |
The new value for the soundUrl property. |
BlackBerry 10.0.0