QtMobility Reference Documentation

File Manager Plugin Example


This example shows how to write a service plugin for the Service Framework.

Registering the Service

The service can be registered by using the function addService() which takes a path to the XML file that describes the service, filemanagerservice.xml.

Writing the Plug-In

A Service plug-in is made by deriving a new plugin class from the QServicePluginInterface class then implementing the function QServicePluginInterface::createInstance().

The FileManager plugin example has a simple createInstance(). It only needs to create the appropriate object based on the interface name and return a pointer to it.

     if (descriptor.interfaceName() == "com.nokia.qt.examples.FileStorage")
         return new FileManagerStorage(this);
     else if (descriptor.interfaceName() == "com.nokia.qt.examples.FileTransfer")
         return new FileManagerTransfer(this);
         return 0;

The functionality of the FileManager and the FileTransfer classes are in the separate classes FileManagerStorage and FileManagerTransfer respectively. The existing functions are merely test stubs to demonstrate the concept.


Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.