src/hbwidgets/devicedialogs/hbdevicemessagebox.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 28 b7da29130b0e
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
   363 
   363 
   364     static const struct { HbPopup::DefaultTimeout timeout; int value; } timeoutValues[] = {
   364     static const struct { HbPopup::DefaultTimeout timeout; int value; } timeoutValues[] = {
   365         {HbPopup::NoTimeout,0},
   365         {HbPopup::NoTimeout,0},
   366         {HbPopup::ConfirmationNoteTimeout,1500},
   366         {HbPopup::ConfirmationNoteTimeout,1500},
   367         {HbPopup::StandardTimeout,3000},
   367         {HbPopup::StandardTimeout,3000},
   368         {HbPopup::ContextMenuTimeout,6000},
   368         {HbPopup::ContextMenuTimeout,6000}
   369     };
   369     };
   370     int count = sizeof(timeoutValues) / sizeof(timeoutValues[0]);
   370     int count = sizeof(timeoutValues) / sizeof(timeoutValues[0]);
   371     if (timeout < 0 || timeout >= count) {
   371     if (timeout < 0 || timeout >= count) {
   372         TRACE_EXIT
   372         TRACE_EXIT
   373         return timeoutValues[HbPopup::NoTimeout].value;
   373         return timeoutValues[HbPopup::NoTimeout].value;
   407     @stable
   407     @stable
   408     @hbwidgets
   408     @hbwidgets
   409     \class HbDeviceMessageBox
   409     \class HbDeviceMessageBox
   410     \brief HbDeviceMessageBox displays a message box on top of any running applications.
   410     \brief HbDeviceMessageBox displays a message box on top of any running applications.
   411 
   411 
   412     HbDeviceMessageBox is a device dialog version of HbMessageBox. It displays a message box
   412     HbDeviceMessageBox is a device-dialog version of HbMessageBox. It displays a message box
   413     with text, icon or animation and optional accept and reject buttons. It is not a widget.
   413     with text, icon or animation and optional accept and reject buttons. The message box is
   414     The message box is displayed by a device dialog service which HbDeviceMessageBox is a
   414     displayed by a device-dialog service which HbDeviceMessageBox is a client of.
   415     client of.
       
   416 
   415 
   417     Device dialogs are shown on top of any running applications and are always modal by nature.
   416     Device dialogs are shown on top of any running applications and are always modal by nature.
   418 
   417 
   419     A device message box is lauched by a show(). A new message box is lauched every time show()
   418     A device message box is lauched by a show(). A new message box is lauched every time show()
   420     is called. aboutToClose() signal is emitted when the box has closed. There is also syncronous
   419     is called. aboutToClose() signal is emitted when the box has closed. There is also syncronous
   700     Type of a showing message box cannot be changed on the fly. show() must be called to launch
   699     Type of a showing message box cannot be changed on the fly. show() must be called to launch
   701     a new message box after setMessageBoxType() has been called.
   700     a new message box after setMessageBoxType() has been called.
   702 
   701 
   703     \param type Message box type.
   702     \param type Message box type.
   704 
   703 
   705     \sa setMessageBoxType()
   704     \sa messageBoxType(), show()
   706 */
   705 */
   707 void HbDeviceMessageBox::setMessageBoxType(HbMessageBox::MessageBoxType type)
   706 void HbDeviceMessageBox::setMessageBoxType(HbMessageBox::MessageBoxType type)
   708 {
   707 {
   709     TRACE_ENTRY
   708     TRACE_ENTRY
   710     // After setType(), a new message is launched by a show()
   709     // After setType(), a new message is launched by a show()
   731 
   730 
   732     \param buttons Message box buttons. A combination of flags,
   731     \param buttons Message box buttons. A combination of flags,
   733     eg. HbMessageBox::Yes | HbMessageBox::No. Button flags are scanned starting from lsb.
   732     eg. HbMessageBox::Yes | HbMessageBox::No. Button flags are scanned starting from lsb.
   734     First button found goes to accept position and so forth.
   733     First button found goes to accept position and so forth.
   735 
   734 
   736     \sa standardButtons()
   735     \sa standardButtons(), show(), update()
   737 */
   736 */
   738 void HbDeviceMessageBox::setStandardButtons(HbMessageBox::StandardButtons buttons)
   737 void HbDeviceMessageBox::setStandardButtons(HbMessageBox::StandardButtons buttons)
   739 {
   738 {
   740     TRACE_ENTRY
   739     TRACE_ENTRY
   741     d_ptr->setStandardButtons(buttons);
   740     d_ptr->setStandardButtons(buttons);
   885     Default actions are owned and deleted by the message box.
   884     Default actions are owned and deleted by the message box.
   886 
   885 
   887     \param action Action or null. Ownership does not transfer.
   886     \param action Action or null. Ownership does not transfer.
   888     \param role Selects an action.
   887     \param role Selects an action.
   889 
   888 
   890     \sa action()
   889     \sa action(), show(), update()
   891 */
   890 */
   892 void HbDeviceMessageBox::setAction(QAction *action, ActionRole role)
   891 void HbDeviceMessageBox::setAction(QAction *action, ActionRole role)
   893 {
   892 {
   894     TRACE_ENTRY
   893     TRACE_ENTRY
   895     HbDeviceMessageBoxPrivate::ActionSelector  actionSelector =
   894     HbDeviceMessageBoxPrivate::ActionSelector  actionSelector =
   904 /*!
   903 /*!
   905     Sets message box text. Supported text formats are the same as HbMessageBox::setText().
   904     Sets message box text. Supported text formats are the same as HbMessageBox::setText().
   906 
   905 
   907     \param text Message box text.
   906     \param text Message box text.
   908 
   907 
   909     \sa text(), HbMessageBox::setText()
   908     \sa text(), show(), update(), HbMessageBox::setText()
   910 */
   909 */
   911 void HbDeviceMessageBox::setText(const QString &text)
   910 void HbDeviceMessageBox::setText(const QString &text)
   912 {
   911 {
   913     TRACE_ENTRY
   912     TRACE_ENTRY
   914     d_ptr->setProperty(HbDeviceMessageBoxPrivate::Text, text);
   913     d_ptr->setProperty(HbDeviceMessageBoxPrivate::Text, text);
   929     Sets message box icon name or animation logical name.
   928     Sets message box icon name or animation logical name.
   930 
   929 
   931     \param aIconName Icon name. Icon can be from Hb resources or themes. Or can be a file in
   930     \param aIconName Icon name. Icon can be from Hb resources or themes. Or can be a file in
   932     a file system.
   931     a file system.
   933 
   932 
   934     \sa IconName()
   933     \sa IconName(), show(), update()
   935 */
   934 */
   936 void HbDeviceMessageBox::setIconName(const QString &iconName)
   935 void HbDeviceMessageBox::setIconName(const QString &iconName)
   937 {
   936 {
   938     TRACE_ENTRY
   937     TRACE_ENTRY
   939     d_ptr->setProperty(HbDeviceMessageBoxPrivate::IconName, iconName);
   938     d_ptr->setProperty(HbDeviceMessageBoxPrivate::IconName, iconName);
   953 /*!
   952 /*!
   954     Enables/disables icon visibility.
   953     Enables/disables icon visibility.
   955 
   954 
   956     \param visible Enables icon visibility.
   955     \param visible Enables icon visibility.
   957 
   956 
   958     \sa iconVisible()
   957     \sa iconVisible(), show(), update()
   959 */
   958 */
   960 void HbDeviceMessageBox::setIconVisible(bool visible)
   959 void HbDeviceMessageBox::setIconVisible(bool visible)
   961 {
   960 {
   962     TRACE_ENTRY
   961     TRACE_ENTRY
   963     d_ptr->setProperty(HbDeviceMessageBoxPrivate::IconVisible, visible);
   962     d_ptr->setProperty(HbDeviceMessageBoxPrivate::IconVisible, visible);
   977 /*!
   976 /*!
   978     Sets message box timeout.
   977     Sets message box timeout.
   979 
   978 
   980     \param timeout Timeout in milliseconds. 0 denotes no timeout (infinite).
   979     \param timeout Timeout in milliseconds. 0 denotes no timeout (infinite).
   981 
   980 
   982     \sa timeout() setTimeout(HbPopup::DefaultTimeout)
   981     \sa timeout(), setTimeout(HbPopup::DefaultTimeout), show(), update()
   983 */
   982 */
   984 void HbDeviceMessageBox::setTimeout(int timeout)
   983 void HbDeviceMessageBox::setTimeout(int timeout)
   985 {
   984 {
   986     TRACE_ENTRY
   985     TRACE_ENTRY
   987     d_ptr->setProperty(HbDeviceMessageBoxPrivate::Timeout, timeout);
   986     d_ptr->setProperty(HbDeviceMessageBoxPrivate::Timeout, timeout);
   992     Sets timeout to one of HbPopup::DefaultTimeout values. Helps achieving
   991     Sets timeout to one of HbPopup::DefaultTimeout values. Helps achieving
   993     common look and feel of message boxes.
   992     common look and feel of message boxes.
   994 
   993 
   995     \param timeout Timeout as an enumerated constant.
   994     \param timeout Timeout as an enumerated constant.
   996 
   995 
   997     \sa enum HbPopup::DefaultTimeout timeout() setTimeout(int)
   996     \sa enum HbPopup::DefaultTimeout, timeout(), setTimeout(int), show(), update()
   998 */
   997 */
   999 void HbDeviceMessageBox::setTimeout(HbPopup::DefaultTimeout timeout)
   998 void HbDeviceMessageBox::setTimeout(HbPopup::DefaultTimeout timeout)
  1000 {
   999 {
  1001     TRACE_ENTRY
  1000     TRACE_ENTRY
  1002     setTimeout(HbDeviceMessageBoxPrivate::timeoutValue(timeout));
  1001     setTimeout(HbDeviceMessageBoxPrivate::timeoutValue(timeout));
  1018 /*!
  1017 /*!
  1019     Sets message box dismiss policy.
  1018     Sets message box dismiss policy.
  1020 
  1019 
  1021     \param dismissPolicy Dismiss policy.
  1020     \param dismissPolicy Dismiss policy.
  1022 
  1021 
  1023     \sa dismissPolicy()
  1022     \sa dismissPolicy(), show(), update()
  1024 */
  1023 */
  1025 void HbDeviceMessageBox::setDismissPolicy(HbPopup::DismissPolicy dismissPolicy)
  1024 void HbDeviceMessageBox::setDismissPolicy(HbPopup::DismissPolicy dismissPolicy)
  1026 {
  1025 {
  1027     TRACE_ENTRY
  1026     TRACE_ENTRY
  1028     d_ptr->setProperty(HbDeviceMessageBoxPrivate::DismissPolicy, dismissPolicy);
  1027     d_ptr->setProperty(HbDeviceMessageBoxPrivate::DismissPolicy, dismissPolicy);
  1051     - MNG (.mng)
  1050     - MNG (.mng)
  1052         - Frame animations
  1051         - Frame animations
  1053 
  1052 
  1054     \param animationDefinition Path and name of the animation definition file.
  1053     \param animationDefinition Path and name of the animation definition file.
  1055 
  1054 
  1056     \sa setIcon(), animationDefinition(), HbIconAnimationManager::addDefinitionFile()
  1055     \sa setIcon(), animationDefinition(), HbIconAnimationManager::addDefinitionFile(), show(), update()
  1057 */
  1056 */
  1058 void HbDeviceMessageBox::setAnimationDefinition(QString &animationDefinition)
  1057 void HbDeviceMessageBox::setAnimationDefinition(QString &animationDefinition)
  1059 {
  1058 {
  1060     TRACE_ENTRY
  1059     TRACE_ENTRY
  1061     d_ptr->setProperty(HbDeviceMessageBoxPrivate::AnimationDefinition, animationDefinition);
  1060     d_ptr->setProperty(HbDeviceMessageBoxPrivate::AnimationDefinition, animationDefinition);