src/hbcore/devicedialogbase/hbdevicedialog.cpp
changeset 28 b7da29130b0e
parent 5 627c4a0fd0e7
child 30 80e4d18b72f5
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
    43     HbDeviceDialog is not a widget but is the interface to a framework that handles the dialogs.
    43     HbDeviceDialog is not a widget but is the interface to a framework that handles the dialogs.
    44     
    44     
    45     \section _framework Device Dialog Framework
    45     \section _framework Device Dialog Framework
    46     
    46     
    47     Any application is able to generate device dialogs. However, in
    47     Any application is able to generate device dialogs. However, in
    48     order to display the dialogs on top of all applications, the device dialog framework 
    48     order to display the dialogs on top of all applications, the device dialog framework
    49     uses a server. To display a dialog an application uses the HbDeviceDialog client interface to send requests for
    49     uses a server. To display a dialog an application uses the HbDeviceDialog client interface
    50     dialogs to the server. The HbDeviceDialog class can also be used or extended as part of a set of specialization classes
    50     to send requests for dialogs to the server. The HbDeviceDialog class can also be used or
    51     to create different device dialog types. 
    51     extended as part of a set of specialization classes to create different device dialog types. 
    52     
    52     
    53     Device dialog widgets are implemented in plugins loaded by the server.
    53     Device dialog widgets are implemented in plugins loaded by the server.
    54 
    54 
    55     Shown below is a runtime view of the device dialog framework.
    55     Shown below is a runtime view of the device dialog framework.
    56 
    56 
   123         deviceDialogManager -> deviceDialog1 [label = "data"];
   123         deviceDialogManager -> deviceDialog1 [label = "data"];
   124         deviceDialogManager -> deviceDialog2 [label = "data"];
   124         deviceDialogManager -> deviceDialog2 [label = "data"];
   125     }
   125     }
   126     \enddot
   126     \enddot
   127 
   127 
   128     <b>Platform dependent.</b> Currently server is implemented only for Symbian platform. On other platforms,
   128     HbDeviceDialog has no dependencies to other parts of the framework. Only to Qt.
   129     device dialog are displayed on client's mainwindow.
   129     Thus it can be used also from engine components that have no user interface.
   130 
       
   131     HbDeviceDialog has no dependencies to other parts of the framework. Only to Qt. Thus it can be used
       
   132     also from engine components that have no user interface.
       
   133 
   130 
   134     \section _types Types of device dialogs
   131     \section _types Types of device dialogs
   135 
   132 
   136     There are three classes of device dialogs:
   133     There are two classes of device dialogs intended for application use:
   137      -# Generic device dialogs are displayed on top
   134      -# Generic device dialogs are displayed on top
   138     of all applications, except in the case of an incoming call. Examples of these are a "Low memory"
   135     of all applications, except in the case of an incoming call. Examples of these are a "Low memory"
   139     message box and a "Receive message via bluetooth?" query. 
   136     message box and a "Receive message via bluetooth?" query. 
   140      -# Device notification dialogs are
   137      -# Device notification dialogs are
   141     notifications displayed in the top left corner of the display. Examples are "New message" and
   138     notifications displayed in the top left corner of the display. Examples are "New message" and
   142     "Low battery" notifications. 
   139     "Low battery" notifications.
   143      -# The Universal indicator menu shows enhanced status indicator
   140 
   144     information.
   141     Generic device dialogs interrupt the current foreground application.
   145 
       
   146     Generic device dialogs and the indicator menu interrupt the current foreground application.
       
   147     The user cannot interact with the application with a touch or keyboard until the dialog
   142     The user cannot interact with the application with a touch or keyboard until the dialog
   148     is dismissed. Device notification dialogs behave differently allowing interaction with the
   143     is dismissed. Device notification dialogs behave differently allowing interaction with the
   149     current foreground application.
   144     current foreground application. Another difference is that notification dialogs are shown
       
   145     serially instead of on top of each other.
       
   146 
       
   147     In addition, there are two device dialogs classes intended for platform use: Indicator menu and security.
       
   148 
       
   149     \section _operation Operation of device dialogs
       
   150 
       
   151     \subsection _construction Construction and identification
   150 
   152 
   151     Device dialog widgets are constructed dynamically by the device dialog service. Construction
   153     Device dialog widgets are constructed dynamically by the device dialog service. Construction
   152     takes two parameters: a type and a set of parameters appropriate to the dialog type.
   154     takes two parameters: a type and a set of parameters appropriate to the dialog type.
   153     The device dialog type is a unique string identifying the
   155     The device dialog type is a unique string identifying the dialog. A search is made to find a
   154     dialog. A search is made to find a plugin that can instantiate the requested
   156     plugin that can instantiate the requested dialog. The service loads the plugin and creates an
   155     dialog. The service loads the plugin and creates an instance of the widget.
   157     instance of the widget.
   156 
   158 
   157     The parameter set is encapsulated in QMap<QString, QVariant>. Each device dialog implementation has
   159     The parameter set is encapsulated in QMap<QString, QVariant>. Each device dialog implementation
   158     a default value for all parameters. Only parameters that differ from the default need to be
   160     has a default value for all parameters. Only parameters that differ from the default need to be
   159     given. Parameters are <name, value> pairs. How the parameters are used depends on
   161     given. Parameters are <name, value> pairs. How the parameters are used depends on
   160     the plugin implementing the dialog. Suggested usage is <name, value> used as property
   162     the plugin implementing the dialog. Suggested usage is <name, value> used as property
   161     name and value pairs of the dialog implementation. This makes it easy to set properties using
   163     name and value pairs of the dialog implementation. This makes it easy to set properties using
   162     QObject::setProperty(const char*, const QVariant&). If data types supported by QVariant are
   164     QObject::setProperty(const char*, const QVariant&). If data types supported by QVariant are
   163     not suitable for a specific device dialog, Q_DECLARE_METATYPE can be used to add data types.
   165     not suitable for a specific device dialog, Q_DECLARE_METATYPE can be used to add data types.
   164 
   166 
   165     %Data can be sent to a device dialog after it has been launched using the update() function. %Data
   167     \subsection _updating Updating and receiving data
   166     sent by the dialog is received by the dataReceived signal. A copy of the last data received
   168 
   167     is held by the class and can be fetched by a call to the receivedData() function. This allows data to be received
   169     %Data can be sent to a device dialog after it has been launched using the update() function.
   168     without having to connect to a signal by waiting for a dialog to close and then
   170     %Data sent by the dialog is received by the dataReceived signal. A copy of the last data
   169     getting the received data.
   171     received is held by the class and can be fetched by a call to the receivedData() function.
       
   172     This allows data to be received without having to connect to a signal by waiting for a dialog
       
   173     to close and then getting the received data.
       
   174 
       
   175     \subsection _showing Showing device dialogs
   170 
   176 
   171     It is possible to launch multiple device dialogs from a single HbDeviceDialog object.
   177     It is possible to launch multiple device dialogs from a single HbDeviceDialog object.
   172     However if there is a need to update a dialog or receive data from it, only the last dialog
   178     However if there is a need to update a dialog or receive data from it, only the last dialog
   173     launched supports this. In this case instantiate the HbDeviceDialog class for each device dialog
   179     launched supports this. In this case instantiate the HbDeviceDialog class for each device
   174     that needs communication (update or data receive) after a launch.
   180     dialog that needs communication (update or data receive) after a launch.
   175 
   181 
   176     HbDeviceDialog::show() method returns after the device dialog service has accepted the dialog.
   182     HbDeviceDialog::show() method returns after the device dialog service has accepted the dialog.
   177     The service decides when the dialog is actually displayed. If there is no need to receive
   183     The service decides when the dialog is actually displayed. No assumption should be made
   178     data from the dialog widget, the HbDeviceDialog object can be destroyed after the show() method returns
   184     about the timing when the dialog will display. It may get delayed depending on system state.
   179     (can be allocated in a stack). A function is provided to wait for the device dialog to be dismissed,
   185     If there is no need to receive data from the dialog widget, the HbDeviceDialog object can be
   180     making the dialog display synchronous.
   186     destroyed after the show() method returns (can be allocated in a stack). In this case,
       
   187     it is assumed that the dialog widget closes itself by a timeout. System will close dialog
       
   188     widgets left running this way without a corresponding HbDialog instance, after 10 seconds.
   181 
   189 
   182     If any signals of HbDeviceDialog are connected, then the instance needs to exist until the
   190     If any signals of HbDeviceDialog are connected, then the instance needs to exist until the
   183     dialog is dismissed. In this case the device dialog service will close all dialogs
   191     dialog widget is dismissed. In this case the device dialog service will close all dialogs
   184     launched by the instance when it is deleted making it inappropriate to allocate HbDeviceDialog
   192     launched by the HbDeviceDialog instance when it is deleted making it inappropriate to allocate
   185     into a stack.
   193     it into a stack.
   186 
   194 
   187     Several clients can share the same device dialog widget by agreeing on an unique tag. See
   195     A function is provided to wait for the device dialog to be dismissed, making the dialog
   188     HbDeviceDialogWidgetPlugin for more information.
   196     display synchronous.
       
   197 
       
   198     \subsection _misc Miscellaneous notes
   189 
   199 
   190     When the HbDeviceDialog object is created, it can reserve a communication channel to the device dialog
   200     When the HbDeviceDialog object is created, it can reserve a communication channel to the device dialog
   191     service or the channel creation may be delayed until show(). This is controlled by a constructor
   201     service or the channel creation may be delayed until show(). This is controlled by a constructor
   192     flag. The default is the delayed resource reservation.
   202     flag. The default is the delayed resource reservation.
   193 
   203 
   194     The HbDeviceDialog class is not thread safe. If cancel() needs to called across threads, a queued
   204     The HbDeviceDialog class is not thread safe. If cancel() needs to called across threads, a queued
   195     signal slot connection can be used.
   205     signal slot connection can be used.
   196     
   206 
       
   207     \section _platform_hbdevicedialog Platform-specific implementation notes for HbDeviceDialog
       
   208 
       
   209     \subsection _nonsymbian_hbdevicedialog Non-Symbian
       
   210     The server is implemented only for the Symbian platform. On other platforms device dialogs are
       
   211     displayed on client's main window.
       
   212 
   197     \section _usecases Using the HbDeviceDialog class
   213     \section _usecases Using the HbDeviceDialog class
   198     
   214     
   199     The code below launches a device dialog and continues execution
   215     The code below launches a device dialog and continues execution
   200     \code
   216     \code
   201     // Launch a device dialog and continue execution.
   217     // Launch a device dialog and continue execution. Assumes that the dialog widget closes
       
   218     // itself by a timeout.
   202 
   219 
   203     HbDeviceDialog deviceDialog;
   220     HbDeviceDialog deviceDialog;
   204     QVariantMap parameters;
   221     QVariantMap parameters;
   205     parameters.insertMulti(QString("text"), QVariant(QString("Warning text")));
   222     parameters.insertMulti(QString("text"), QVariant(QString("Warning text")));
   206     const char *deviceDialogType = "hb.devdlg.examplemessagebox/1.0";
   223     const char *deviceDialogType = "hb.devdlg.examplemessagebox/1.0";
   272     A device dialog widget is a single instance and already exists (has been launched).
   289     A device dialog widget is a single instance and already exists (has been launched).
   273     See HbDeviceDialogPlugin::SingleInstance.
   290     See HbDeviceDialogPlugin::SingleInstance.
   274 */
   291 */
   275 
   292 
   276 /*!
   293 /*!
       
   294     \enum HbDeviceDialog::DeviceDialogFlag
       
   295     Defines construct flags.
       
   296 */
       
   297 
       
   298 /*!
   277     \var HbDeviceDialog::DeviceDialogFlags HbDeviceDialog::NoFlags
   299     \var HbDeviceDialog::DeviceDialogFlags HbDeviceDialog::NoFlags
   278     No flags specified.
   300     No flags specified.
   279 */
       
   280 
       
   281 /*!
       
   282     \enum HbDeviceDialog::DeviceDialogFlag
       
   283     Defines construct flags.
       
   284         
       
   285     The DeviceDialogFlags type is a typedef for QFlags<DeviceDialogFlag>. It stores an OR combination of the DeviceDialogFlag values.
       
   286 */
   301 */
   287 
   302 
   288 /*!
   303 /*!
   289     \var HbDeviceDialog::DeviceDialogFlags HbDeviceDialog::ImmediateResourceReservationFlag
   304     \var HbDeviceDialog::DeviceDialogFlags HbDeviceDialog::ImmediateResourceReservationFlag
   290     Reserves resources immediately instead of delaying until show() is called.
   305     Reserves resources immediately instead of delaying until show() is called.
   370 }
   385 }
   371 
   386 
   372 /*!
   387 /*!
   373     Shows a device dialog using the device dialog service.
   388     Shows a device dialog using the device dialog service.
   374     
   389     
   375     The function returns immediately after the
   390     The function returns immediately after the service has accepted the dialog.
   376     service has accepted the dialog. Returns \c true if the dialog was accepted, \c false if an error occurred.
   391     Returns \c true if the dialog was accepted, \c false if an error occurred.
   377     The service decides when the dialog is actually displayed.
   392     The service decides when the dialog is actually displayed. Displaying may be delayed
       
   393     depending on system state.
   378 
   394 
   379     \param deviceDialogType Identifies a device dialog to be displayed by a name.
   395     \param deviceDialogType Identifies a device dialog to be displayed by a name.
   380     \param parameters Defines properties of the dialog.
   396     \param parameters Defines properties of the dialog.
   381 
   397 
   382     \sa update(), waitForClosed(), cancel()
   398     \sa update(), waitForClosed(), cancel()