src/hbcore/devicedialogbase/hbdevicedialogplugin.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 5 627c4a0fd0e7
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    29 
    29 
    30     Device dialogs are widgets which are shown on top of all applications by a device dialog
    30     Device dialogs are widgets which are shown on top of all applications by a device dialog
    31     service. The service queues and displays device dialogs according to client requests and
    31     service. The service queues and displays device dialogs according to client requests and
    32     system state. The service displays widgets in it's window (HbApplication window).
    32     system state. The service displays widgets in it's window (HbApplication window).
    33 
    33 
       
    34     <b>Platform dependent.</b> Currently server is implemented only for Symbian platform. On other platforms,
       
    35     device dialog are displayed on client's mainwindow.
       
    36 
    34     Device dialog widgets are created by plugins. The service loads a plugin to create and display
    37     Device dialog widgets are created by plugins. The service loads a plugin to create and display
    35     a device dialog. A single plugin may implement several different dialogs or just one.
    38     a device dialog. A single plugin may implement several different dialogs or just one.
    36     Dialogs are identified by a string. By convention the string should follow
    39     Dialogs are identified by a string. By convention the string should follow
    37     inverted domain name format. For example com.nokia.hb.devicedialog.note/1.0.
    40     inverted domain name format. For example com.nokia.hb.devicedialog.note/1.0.
    38     Function deviceDialogTypes() returns a list of dialog types the plugin implements.
    41     Function deviceDialogTypes() returns a list of dialog types the plugin implements.
    43     instance compatible with the version requested. This could always be the latest version if it
    46     instance compatible with the version requested. This could always be the latest version if it
    44     is backwards compatible with older versions. Device dialog framework is unaware of version
    47     is backwards compatible with older versions. Device dialog framework is unaware of version
    45     numbers in type strings. It performs string comparison of the whole string when searching
    48     numbers in type strings. It performs string comparison of the whole string when searching
    46     for a plugin.
    49     for a plugin.
    47 
    50 
    48     Device dialogs are divided into three groups: generic device dialog, device notification dialog
    51     Device dialogs are divided into five groups: generic, notification, indicator-menu, security
    49     and indicator groups. The group dictates how and when a dialog is shown. Each dialog
    52     and critical groups. The group dictates how and when a dialog is shown. Generic and
    50     indicates which group it belongs to. The group need not be fixed. It may change depending on
    53     notification dialogs are intended for application use. Indicator, security and critical dialogs are
    51     create parameters.
    54     for platform. Each dialog indicates which group it belongs to. The group need not be fixed.
       
    55     It may change depending on create parameters.
    52 
    56 
    53     Device dialog groups may prioritize (queueing) device dialogs in respect to other groups.
    57     Device dialog groups may prioritize (queueing) device dialogs in respect to other groups.
    54     In addition each device dialog has an individual queueing priority that may affect how it is
    58     In addition each device dialog has an individual queueing priority that may affect how it is
    55     shown inside a group. Currently there is no queueing implemented for device dialogs. All
    59     shown inside a group. Currently there is no queueing implemented for device dialogs. All
    56     dialogs are displayed in order requests are received. Z-order of dialogs on display is
    60     dialogs are displayed in order requests are received. Z-order of dialogs on display is
    57     determined by popup framework. Last dialog created is on top. Z-order may be changed by
    61     determined by popup framework. Last dialog created is on top. Device dialog framework
    58     dialog widget changing it's popup priority.
    62     manipulates Z-order of dialogs. Device dialogs themselves should not change the popup Z-order.
    59 
    63 
    60     Device dialog widgets have to be derived from HbPopup either directly or by ancestry.
    64     Device dialog widgets have to be derived from HbPopup either directly or by ancestry.
    61 
    65 
    62     <div style="color:gray">
    66     <div style="color:gray">
    63     <b>For future needs. Not implemented.</b>
    67     <b>For future needs. Not implemented.</b>
    68     "hb.devicedialog.note/1.0%#1". If a device dialog instance exists, a client is attached into it
    72     "hb.devicedialog.note/1.0%#1". If a device dialog instance exists, a client is attached into it
    69     instead of creating a new one. To allow sharing, plugin must set
    73     instead of creating a new one. To allow sharing, plugin must set
    70     HbDeviceDialogPlugin::SharedDeviceDialog.
    74     HbDeviceDialogPlugin::SharedDeviceDialog.
    71     </div>
    75     </div>
    72 
    76 
    73     On S60, platform and third party plugins are run by separate servers with different
    77     <b>Symbian.</b>Plugins are run by a server with platform security capabilities ProtServ, SwEvent,
    74     platform security capabilities. The capabilities are following.
    78     TrustedUI and ReadDeviceData.
    75     - Platform plugins
       
    76         - ProtServ, SwEvent, TrustedUI
       
    77     - Third party plugins
       
    78        - ProtServ, TrustedUI
       
    79 
    79 
    80     Plugins are responsible for maintaining system security for their own part. If plugin
    80     Plugins are responsible for maintaining system security for their own part. If plugin
    81     performs operations that may compromise security or want's to limit access to specific
    81     performs operations that may compromise security or want's to limit access to specific
    82     clients, it should check client security credentials in accessAllowed() function.
    82     clients, it should check client security credentials in accessAllowed() function.
    83     Device dialog framework calls this function before creating or attaching client to a
    83     Device dialog framework calls this function before creating or attaching client to a
    84     plugin if HbDeviceDialogPlugin::SecurityCheck is set. Access is denied if the
    84     plugin if HbDeviceDialogPlugin::SecurityCheck is set. Access is denied if the
    85     function returns false. In addition, HbDeviceDialogPlugin constructor has a check which
    85     function returns false. In addition, HbDeviceDialogPlugin constructor has a check which
    86     allows only device dialog service to load plugins derived from it.
    86     allows only device dialog service to load plugins derived from it.
    87 
    87 
    88     Device dialog plugins can be installed into a device by users. Tbd. This needs to be clarified.
    88     <b>Symbian.</b>Device dialog plugins can be installed into a device. If a plugin doesn't have
    89 
    89     required platform security capabilities it will not load. Plugins are searched from device's
    90     Plugin location differs depending on platform. On Symbian, device dialog plugin stubs are
    90     local drives. The search order is rom-drives, non-removable drives and removable drives. Once
    91     located in /resource/plugins/devicedialogs directory and executables in /sys/bin directory.
    91     a pluging is found the search stops. This implies that plugins on rom drives cannot be
    92     On Windows/Linux plugin executables are searched from application's current directory and
    92     overriden by plugins on other drives.
    93     HB_PLUGINS_DIR/devicedialogs directory.
    93 
       
    94     <b>Platform dependent.</b>Plugin location differs depending on platform. On Symbian, device dialog
       
    95     plugin stubs (.qtplugin) are located in /resource/plugins/devicedialogs directory and executables
       
    96     in /sys/bin directory. On other platforms plugin executables are searched from application's
       
    97     current directory and HB_PLUGINS_DIR/devicedialogs directory.
       
    98 
       
    99     Well behaving dialog widget should observe following rules:
       
   100     - Should not create and show other dialogs
       
   101     - No calls to show(), hide() or setVisible()
       
   102     - Not setting popup Z-order
       
   103     - No time consuming operations performed
    94 
   104 
    95     Creating a device dialog plugin and widget involves following steps.
   105     Creating a device dialog plugin and widget involves following steps.
    96     - Set in .pro file TEMPLATE = lib and CONFIG += hb plugin
   106     - Set in .pro file TEMPLATE = lib and CONFIG += hb plugin
    97     - Derive a class from HbPopup or derivatives and HbDeviceDialogInterface
   107     - Derive a class from HbPopup or derivatives and HbDeviceDialogInterface
    98     \code
   108     \code
    99     class HbSampleMessageBoxWidget : public HbMessageBox, public HbDeviceDialogInterface
   109     class HbSampleMessageBoxWidget : public HbMessageBox, public HbDeviceDialogInterface
   100     {
   110     {
   101         Q_OBJECT
   111         Q_OBJECT
   102     \endcode
   112     \endcode
   103     - Implement device dialog widget and HbDeviceDialogInterface interface. Declare and emit
   113     - Implement device dialog widget and HbDeviceDialogInterface interface. Declare and emit
   104       deviceDialogClosed and optionally deviceDialogData signals.
   114       deviceDialogClosed and optionally deviceDialogData signals. Do not call show(), hide() or
       
   115       setVisible() in the plugin. Device dialog framework calls show() to display the widget.
   105     \code
   116     \code
   106     public:
   117     public:
   107         bool setDeviceDialogParameters(const QVariantMap &parameters);
   118         bool setDeviceDialogParameters(const QVariantMap &parameters);
   108         int deviceDialogError() const;
   119         int deviceDialogError() const;
   109         void closeDeviceDialog(bool byClient);
   120         void closeDeviceDialog(bool byClient);
   176 
   187 
   177     Sample plugin implementations can be found in src/hbplugins/devicedialogs directory.
   188     Sample plugin implementations can be found in src/hbplugins/devicedialogs directory.
   178 
   189 
   179     \sa HbDeviceDialogPluginInterface HbDeviceDialogInterface HbDeviceDialog HbPopup
   190     \sa HbDeviceDialogPluginInterface HbDeviceDialogInterface HbDeviceDialog HbPopup
   180 
   191 
   181     \alpha
   192     \stable
   182     \hbcore
   193     \hbcore
   183 */
   194 */
   184 
   195 
   185 /*!
   196 /*!
   186     \enum HbDeviceDialogPlugin::PluginFlag
   197     \enum HbDeviceDialogPlugin::PluginFlag
   251     \var HbDeviceDialogPlugin::DeviceDialogFlag HbDeviceDialogPlugin::SecurityCheck
   262     \var HbDeviceDialogPlugin::DeviceDialogFlag HbDeviceDialogPlugin::SecurityCheck
   252     If the flag is set, device dialog service calls accessAllowed() before creating or
   263     If the flag is set, device dialog service calls accessAllowed() before creating or
   253     attaching to a device dialog widget.
   264     attaching to a device dialog widget.
   254 */
   265 */
   255 
   266 
   256 /*!
   267 
   257     \var HbDeviceDialogPlugin::DeviceDialogFlag HbDeviceDialogPlugin::NoLocalisableData
       
   258     If the flag is set, device dialog service does not try to find and localise strings
       
   259     from the property set. If not set localisable strings are localised by the device
       
   260     dialog service.
       
   261 
       
   262     \deprecated HbDeviceDialogPlugin::NoLocalisableData
       
   263         is deprecated. Will be removed as localization is always done by application.
       
   264 */
       
   265 
   268 
   266 /*!
   269 /*!
   267     \var HbDeviceDialogPlugin::DefaultPriority
   270     \var HbDeviceDialogPlugin::DefaultPriority
   268     Default priority value to return in DeviceDialogInfo.
   271     Default priority value to return in DeviceDialogInfo.
   269 */
   272 */
   412     and meaning of the data is a contract between the widget and a client.
   415     and meaning of the data is a contract between the widget and a client.
   413     \endcode
   416     \endcode
   414 
   417 
   415     \sa HbDeviceDialogPlugin HbDeviceDialog
   418     \sa HbDeviceDialogPlugin HbDeviceDialog
   416 
   419 
   417     \alpha
   420     \stable
   418     \hbcore
   421     \hbcore
   419 */
   422 */
   420 
   423 
   421 /*!
   424 /*!
   422     \fn virtual bool HbDeviceDialogInterface::setDeviceDialogParameters(
   425     \fn virtual bool HbDeviceDialogInterface::setDeviceDialogParameters(
   480 
   483 
   481     This class is not intended for direct derivation. Instead a device dialog plugin should be derived
   484     This class is not intended for direct derivation. Instead a device dialog plugin should be derived
   482     from HbDeviceDialogPlugin. This class declares createDeviceDialog() function which the plugin must
   485     from HbDeviceDialogPlugin. This class declares createDeviceDialog() function which the plugin must
   483     implement.
   486     implement.
   484 
   487 
   485     \alpha
   488     \stable
   486     \hbcore
   489     \hbcore
   487 */
   490 */
   488 
   491 
   489 /*!
   492 /*!
   490     \fn virtual HbDeviceDialogPluginInterface *HbDeviceDialogPluginInterface::createDeviceDialog(
   493     \fn virtual HbDeviceDialogPluginInterface *HbDeviceDialogPluginInterface::createDeviceDialog(