Home · All Classes · Main Classes · Deprecated

Developing applet installation sources

Applet installation sources are specific application extensions that can add plug-ins to an applet library for applet installation. For more information on application extensions, see Developing application extensions.

Development environment

To develop applet installation sources, you need:

Developing applet installation sources

An applet installation source is implemented as a Qt plug-in. The interface class used as the base class of all applet installation sources is MAppletInstallationSourceInterface. This class inherits from the base class MApplicationExtensionInterface. MAppletInstallationSourceInterface inherits the following methods from MApplicationExtensionInterface and must be implemented by the source:

 bool MApplicationExtensionInterface::initialize(const QString &interface)
 MWidget *widget() 

These methods are described in Developing application extensions and applications that use them section.

DuiAppletInstallationSourceInterface also contains a method which enables the source to access the applet inventory interface. The following method must be implemented by the source:

 void setMAppletInventoryInterface(MAppletInventoryInterface &installationSource) 

As a parameter it takes a reference to the MAppletInventoryInterface. Applet installation sources can use this interface for instantiating applets from an installation source package using the method:

 void instantiateAppletsInPackage(const QString &packageName) 

It takes the applet package name to be instantiated as a parameter.

Applet installation source developers need to implement DuiAppletInstallationSourceInterface interface in a plug-in library and export their implementation from the library. The applet inventory creates an instance of application extension area and instantiates the available installation sources when needed.

Example of demo applet installation source:

// demoappletsource.h
#ifndef DEMOAPPLETSOURCE_H
#define DEMOAPPLETSOURCE_H

#include <mappletinstallationsourceinterface.h>

class DemoAppletInstallationSource : public QObject, public MAppletInstallationSourceInterface
{
    Q_OBJECT
    Q_INTERFACES(MAppletInstallationSourceInterface MApplicationExtensionInterface)

public:
    DemoAppletInstallationSource();
    virtual ~DemoAppletInstallationSource();
    // methods derived from MAppletInstallationSourceInterface
    virtual bool initialize(const QString &);
    virtual MWidget *widget();
    virtual void setMAppletInventoryInterface(MAppletInventoryInterface &installationSource);

    MAppletInventoryInterface *appletInventoryInterface() const;

private:
    MAppletInventoryInterface *appletInventory;
    MWidget *sourceWidget;
};

#endif

Note: The Q_INTERFACES list must include both MAppletInstallationSourceInterface and its base interface MApplicationExtensionInterface.

// demoappletsource.cpp
#include "demoappletsource.h"
#include <MLibrary>

DemoAppletInstallationSource::DemoAppletInstallationSource() : appletInventory(NULL)
{
}

DemoAppletInstallationSource::~DemoAppletInstallationSource()
{
    delete sourceWidget;
}

MWidget *DemoAppletInstallationSource::widget()
{
    return sourceWidget;
}

bool DemoAppletInstallationSource::initialize(const QString &)
{
    sourceWidget = new MWidget;
    return true;
}

void DemoAppletInstallationSource::setMAppletInventoryInterface(MAppletInventoryInterface &installationSource)
{
    appletInventory = &installationSource;
}

MAppletInventoryInterface *DemoAppletInstallationSource::appletInventoryInterface() const
{
    return appletInventory;
}

Applet installation source desktop file

The following example illustrates an applet installation source desktop file:

[Desktop Entry]
Type=MApplicationExtension
Name=DemoAppletInstallationSource

[X-DUI]
MApplicationExtension-Interface=com.nokia.dui.core.AppletInstallationSourceInterface/1.0
MApplicationExtension-Extension=libappletinventory-demoinstallationsource.so

Copyright © 2010 Nokia Corporation
MeeGo Touch