src/hbcore/indicatorplugins/hbindicatorplugininterface.cpp
changeset 28 b7da29130b0e
parent 2 06ff229162e9
child 30 80e4d18b72f5
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
    25 
    25 
    26 #include <hbindicatorplugininterface.h>
    26 #include <hbindicatorplugininterface.h>
    27 
    27 
    28 /*!
    28 /*!
    29     \class HbIndicatorPluginInterface
    29     \class HbIndicatorPluginInterface
    30     \brief HbIndicatorPluginInterface is an abstract base class for indicator plugins.
    30     \brief HbIndicatorPluginInterface is an abstract interface class for indicator plugins.
    31 
    31 
    32     Indicators are displayed in the status indicator area and/or in universal indicator popup.
    32     Indicators are activated, deactivated and updated using HbIndicator class. Indicator
    33     Applications can create own indicators by implementing this plugin interface and creating
    33     framework takes care of displaying indicators in satus bar and/or indicator menu.
    34     at least one class inherited from HbIndicatorInterface.
       
    35 
    34 
    36     One plugin can implement one or more indicators. Indicators are identified by a type string.
    35     Indicator plugins contain implentation of indicators. Single pluging can implement
    37     The indicator types the plugin implements must be returned from the function
    36     one or several indicators. HbIndicatorInterface defines functionality required from an
    38     indicatorTypes(). The indicator is created, when requested by the client,
    37     indicator implementation.
    39     using createIndicator().
       
    40 
    38 
    41     Indicator plugin may limit access to an indicator. Before activating or deactivating an
    39     Indicators are identified by a string. By convention the string should follow
    42     indicator, the framework calls accessAllowed() allowing the plugin to inspect client's security
    40     inverted domain name format. For example com.nokia.hb.indicator.xxx/1.0.
    43     credentials. By returning false, the plugin denies client access.
    41     Function indicatorTypes() returns a list of indicators the plugin implements.
    44 
    42 
    45     Plugins are loaded by a Device Dialog server. For information on installing plugins, refer to
    43     Appending version number into indicator type string enables versioning.
    46     HbDeviceDialogPlugin documentation.
    44     A plugin should handle versioning by returning indicator type string for all versions it
       
    45     implements in indicatorTypes() and then in createIndicator() create an indicator
       
    46     instance compatible with the version requested. This could always be the latest version if it
       
    47     is backwards compatible with older versions. Indicator framework is unaware of version
       
    48     numbers in type strings. It performs string comparison of the whole string when searching
       
    49     for a plugin.
    47 
    50 
    48     here's an example of how to create a simple indicator plugin.
    51     Plugins are responsible for maintaining system security for their own part. If plugin
    49     If plugin implements only one indicator, the pluginInterface class can also inherit from
    52     performs operations that may compromise security or want's to limit access to specific
       
    53     clients, it should check client security credentials in accessAllowed() function.
       
    54     Indicator framework calls this function before activating/deactivating indicators.
       
    55 
       
    56     \section _platform_hbindicatorplugin Platform-specific implementation notes for HbIndicatorPluginInterface
       
    57 
       
    58     \subsection _nonsymbian Non-Symbian
       
    59 
       
    60     Indicator plugins are loaded into client process. Plugin executables are searched from
       
    61     application's current directory and HB_PLUGINS_DIR/indicators directory.
       
    62 
       
    63     \subsection _symbian Symbian
       
    64 
       
    65     Plugins are run by a server with platform security capabilities ProtServ, SwEvent,
       
    66     TrustedUI and ReadDeviceData. If a plugin doesn't have required platform security
       
    67     capabilities it will not load.
       
    68 
       
    69     Device dialog plugin stubs (.qtplugin) are searched from /resource/plugins/indicators directory
       
    70     and executables in /sys/bin directory in each drive.
       
    71 
       
    72     \section _example_code Example code
       
    73 
       
    74     Below is an example of how to create a simple indicator plugin.
       
    75 
       
    76     If plugin implements only one indicator, plugin can also inherit from
    50     HbIndicatorInterface. Example header-file:
    77     HbIndicatorInterface. Example header-file:
    51 
    78 
    52     \snippet{unit\unittest_hbindicator\codesnippetplugin\hbcodesnippetplugin.h,1}
    79     \snippet{tsrc\unit\unittest_hbindicator\codesnippetplugin\hbcodesnippetplugin.h,1}
    53 
    80 
    54     Example source-file:
    81     Example source-file:
    55     \snippet{unit\unittest_hbindicator\codesnippetplugin\hbcodesnippetplugin.cpp,1}
    82     \snippet{tsrc\unit\unittest_hbindicator\codesnippetplugin\hbcodesnippetplugin.cpp,1}
    56 
    83 
    57     If more than one indicators are implemented inside a plugin, createIndicator should create new object
    84     If more than one indicators are implemented inside a plugin, plugin inherits from HbIndicatorPluginInterface.
    58     based on HbIndicatorInterface.
       
    59     \snippet{unit\unittest_hbindicator\codesnippetplugin\hbcodesnippetplugin.cpp,2}
       
    60 
    85 
    61     \sa HbIndicator, HbIndicatorInterface, HbDeviceDialogPlugin
    86     \snippet{tsrc\unit\unittest_hbindicator\codesnippetplugin\hbcodesnippetplugin.h,2}
       
    87 
       
    88     And createIndicator should create new object based on indicator type.
       
    89 
       
    90     \snippet{tsrc\unit\unittest_hbindicator\codesnippetplugin\hbcodesnippetplugin.cpp,2}
       
    91 
       
    92     \sa HbIndicator, HbIndicatorInterface
    62 
    93 
    63     \stable
    94     \stable
    64     \hbcore
    95     \hbcore
    65 */
    96 */
    66 
    97 
    67 /*!
    98 /*!
    68     \fn virtual QStringList HbIndicatorPluginInterface::indicatorTypes() const = 0
    99     \fn virtual QStringList HbIndicatorPluginInterface::indicatorTypes() const = 0
    69 
   100 
    70     Should return the indicator types this plugin implements.
   101     Should return the indicator types the plugin implements.
    71 */
   102 */
    72 
   103 
    73 /*!
   104 /*!
    74     \fn virtual bool HbIndicatorPluginInterface::accessAllowed(
   105     \fn virtual bool HbIndicatorPluginInterface::accessAllowed(
    75         const QString &indicatorType, const QVariantMap &securityInfo) const
   106         const QString &indicatorType, const QVariantMap &securityInfo) const
    86     \sa HbDeviceDialogPlugin::accessAllowed()
   117     \sa HbDeviceDialogPlugin::accessAllowed()
    87 */
   118 */
    88 
   119 
    89 /*!
   120 /*!
    90     \fn virtual  HbIndicatorInterface *HbIndicatorPluginInterface::createIndicator(const QString &indicatorType) = 0
   121     \fn virtual  HbIndicatorInterface *HbIndicatorPluginInterface::createIndicator(const QString &indicatorType) = 0
    91     creates an indicator of type \a indicatorType. Ownership is passed to the caller.
   122 
       
   123     Creates an indicator of type \a indicatorType. Ownership is passed to the caller.
       
   124 
    92     \sa HbIndicatorPluginInterface::indicatorTypes()
   125     \sa HbIndicatorPluginInterface::indicatorTypes()
    93 */
   126 */
    94 
   127 
    95 /*!
   128 /*!
    96     \fn virtual int HbIndicatorPluginInterface::error() const = 0
   129     \fn virtual int HbIndicatorPluginInterface::error() const = 0
       
   130 
    97     Returns the last error code. The code is cleared when any other API function than error() is
   131     Returns the last error code. The code is cleared when any other API function than error() is
    98     called.
   132     called.
    99 */
   133 */
   100 
   134