src/hbwidgets/devicedialogs/hbdevicemessagebox.cpp
changeset 28 b7da29130b0e
parent 21 4633027730f5
child 30 80e4d18b72f5
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
   405 
   405 
   406 /*!
   406 /*!
   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 all 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 is a modal
   413     with text, icon or animation and optional accept and reject buttons. The message box is
   413     dialog and displayed on top all applications by a device-dialog service.
   414     displayed by a device-dialog service which HbDeviceMessageBox is a client of.
   414     HbDeviceMessageBox is a client of the service.
   415 
   415 
   416     Device dialogs are shown on top of any running applications and are always modal by nature.
   416     For content it provides text, icon or animation and optional accept and reject buttons.
   417 
   417 
   418     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()
   419     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
   420     exec() function which launches a message box and waits for it close. exec() is not compatible
   420     exec() function which launches a message box and waits for it close. exec() is not compatible
   421     with gestures and cannot be used from applications that have an user interface.
   421     with gestures and cannot be used from applications that have an user interface.
   437 
   437 
   438     Static convenience functions are provided for launching message boxes. They launch message boxes
   438     Static convenience functions are provided for launching message boxes. They launch message boxes
   439     containing default properties appropriate for the message box type and their contents cannot
   439     containing default properties appropriate for the message box type and their contents cannot
   440     be updated. Information and warning convenience methods return immediately. Question waits for
   440     be updated. Information and warning convenience methods return immediately. Question waits for
   441     a message box to close and is not compatible with gestures.
   441     a message box to close and is not compatible with gestures.
       
   442 
       
   443     If none of HbDeviceMessageBox signals have been connected to, the object can be deleted after
       
   444     show() has been called and device-dialog service takes care showing the message box. If any
       
   445     signals are connected, message box is closed when HbDeviceMessageBox object goes out of scope.  
   442 
   446 
   443     Four types of message boxes are predefined. The type determines a set of default properties that
   447     Four types of message boxes are predefined. The type determines a set of default properties that
   444     are set on construction. Below is a table listing types and their default properties.
   448     are set on construction. Below is a table listing types and their default properties.
   445 
   449 
   446     <table border="1">
   450     <table border="1">
   450         <tr><td>Information</td><td>Info icon</td><td>"Ok" button</td><td>Standard timeout</td><td>Tap anywhere</td><td>Info sound</td></tr>
   454         <tr><td>Information</td><td>Info icon</td><td>"Ok" button</td><td>Standard timeout</td><td>Tap anywhere</td><td>Info sound</td></tr>
   451         <tr><td>Warning</td><td>Warning icon</td><td>"Ok" button</td><td>Standard timeout</td><td>Tap anywhere</td><td>Warn sound</td></tr>
   455         <tr><td>Warning</td><td>Warning icon</td><td>"Ok" button</td><td>Standard timeout</td><td>Tap anywhere</td><td>Warn sound</td></tr>
   452         <tr><td>Question</td><td>Question icon</td><td>"Yes" and "No" buttons</td><td>No timeout</td><td>Button press</td><td>Question sound</td></tr>
   456         <tr><td>Question</td><td>Question icon</td><td>"Yes" and "No" buttons</td><td>No timeout</td><td>Button press</td><td>Question sound</td></tr>
   453     </table>
   457     </table>
   454 
   458 
   455     In place of an icon, message box may conatain an animation. Supported icon animation formats are:
   459     In place of an icon, message box may contain an animation. Supported icon animation formats are:
   456     - GIF (.gif)
   460     - GIF (.gif)
   457     - MNG (.mng)
   461     - MNG (.mng)
   458     - Frame animations (.axml)
   462     - Frame animations (.axml)
   459 
   463 
   460     Sample code:
   464     \section _platform_spec Platform-specific implementation notes for HbDeviceNotificationDialog
       
   465 
       
   466     \subsection _nonsymbian Non-Symbian
       
   467     Device dialog service is implemented only for the Symbian platform. On other platforms device 
       
   468     message boxes are displayed on client's main window.
       
   469 
       
   470     \section _code_samples Sample code
   461 
   471 
   462     \code
   472     \code
   463     // Ask from user whether to continue operation or not.
   473     // Ask from user whether to continue operation or not.
   464     // Uses default accept/reject buttons (yes/no).
   474     // Uses default accept/reject buttons (yes/no).
   465 
   475 
   553     Reject button action.
   563     Reject button action.
   554 */
   564 */
   555 
   565 
   556 /*!
   566 /*!
   557     Constructor.
   567     Constructor.
       
   568 
   558     \param type Type of the message box.
   569     \param type Type of the message box.
   559     \param parent An optional parameter.
   570     \param parent An optional parameter.
   560 */
   571 */
   561 HbDeviceMessageBox::HbDeviceMessageBox(HbMessageBox::MessageBoxType type, QObject *parent) :
   572 HbDeviceMessageBox::HbDeviceMessageBox(HbMessageBox::MessageBoxType type, QObject *parent) :
   562     QObject(parent), d_ptr(new HbDeviceMessageBoxPrivate)
   573     QObject(parent), d_ptr(new HbDeviceMessageBoxPrivate)
   568     TRACE_EXIT
   579     TRACE_EXIT
   569 }
   580 }
   570 
   581 
   571 /*!
   582 /*!
   572     Constructor.
   583     Constructor.
       
   584 
   573     \param text Message box text.
   585     \param text Message box text.
   574     \param type Type of the message box.
   586     \param type Type of the message box.
   575     \param parent An optional parameter.
   587     \param parent An optional parameter.
   576 */
   588 */
   577 HbDeviceMessageBox::HbDeviceMessageBox(const QString &text, HbMessageBox::MessageBoxType type,
   589 HbDeviceMessageBox::HbDeviceMessageBox(const QString &text, HbMessageBox::MessageBoxType type,
   594     delete d_ptr;
   606     delete d_ptr;
   595     TRACE_EXIT
   607     TRACE_EXIT
   596 }
   608 }
   597 
   609 
   598 /*!
   610 /*!
   599     Shows a message box and returns immediately without waiting for it to close. Closing of the
   611     Shows a message box and returns immediately without waiting for it to close. A new message box
       
   612     is launched each time show() is called. Closing of the
   600     message box is indicated by aboutToClose() signal. Button presses are indicated by
   613     message box is indicated by aboutToClose() signal. Button presses are indicated by
   601     QAction::triggered() signals. The message box can be updated while showing by property
   614     QAction::triggered() signals. The message box can be updated while showing by property
   602     setters.
   615     setters.
   603 
   616 
   604     \sa update(), aboutToClose()
   617     \sa update(), aboutToClose()