Home · All Namespaces · All Classes · Main Classes

Declarative applets

Description

A declarative applet has all of its content declared in user readable file formats. It has a .desktop file, like all applets, and an .xml file which describes its main widgets content using MeeGo Touch declarative language.

This is the easiest way of creating an applet, but it is less flexible (currently):

<settings>
  <group>
      <text key="/apps/ControlPanel/Example/Text1" title="Please specify a text:" >
          something
      </text>
      <text key="/apps/ControlPanel/Example/Text2" title="Please specify a text:" >
          something
      </text>
    <selection key="/apps/ControlPanel/Example/Enum1">
        <option title="first value" >1</option>
        <option title="second value" >2</option>
        <option title="third value" >3</option>
        <option title="fourth value" >4</option>
    </selection>
  </group>
  <group>
    <boolean key="/apps/ControlPanel/Example/Bool1" title="Please switch me">
    </boolean>
    <integer key="/apps/ControlPanel/Example/Integer1"
        title="Select a number" min="30" max="60">
    </integer>
  </group>
</settings>

example1.xml describing a declarative applet

Requirements

The .desktop file

The plugin should have a .desktop file like any other plugin, see Desktop file format for details.

Only difference is that you have to specify the followings:

DUI / X-DUIApplet-Applet
This must be "libdeclarative.so" for a declarative applet.
DCP / Part
For declarative plugins this value contains the name of the xml file, which describes the content of their main widget.
[Desktop Entry]
Type=ControlPanelApplet
Name=Declarative Example 1
X-logical-id=decl_exampl_1
X-translation-catalog=examplecatalog
Icon=

# This has to be specified in order that the .desktop file can also be
# used as an action (for example for search to know how to
# open the applet)
X-Maemo-Service=com.nokia.DuiControlPanel
X-Maemo-Method=com.nokia.DuiControlPanelIf.appletPage
X-Maemo-Object-Path=/
# this has to be the same as Name
X-Maemo-Fixed-Args=Declarative Example 1

[DUI]
X-DUIApplet-Applet=libdeclarative.so

[DCP]
Category=Applications
Order=100
Part=example1.xml

.destktop file for example1.xml

The .xml description of the main widget

The .xml file which describes the main widget should be located under "/usr/share/duicontrolpanel/uidescriptions".

For details about how you can create input widgets, check libmeegotouch-doc about Declarative Settings Language.

All keys of the input widgets are considered as GConf paths, where the value of the user feedback gets stored.

For an example, check duicontrolpanel-skeletonapplet package, or the directory examples/binaryapplet/itemlike in control panel repository.

Localization

In the ui describtion .xml file translation ids can also be used instead of text like at "title" key to support multiple languages. These translation ids can be translated as usual through Qt translation catalogs. The applet should specify its catalog(s) through its .desktop file with the key:

X-translation-catalog=catalog1,catalog2

You can find an example about how to do this under examples/declarativeapplets/localized in controlpanel source.


Copyright © 2009 Nokia Corporation Generated on Tue Jul 5 2011 15:01:31
Doxygen 1.7.1
Meego control panel