Home · All Classes · Grouped Classes · Annotated · Functions

SXE - Web Browser Integration Implementation

The Web Browser integration allows the user to install a package directly from a web page viewed within a web browser. When a user clicks a link to a Qtopia package descriptor file, the PackageManager service is notified. It then invokes the PackageManager enabling the user to install the package referenced by the descriptor. The browser notifies the PackageManager service when it recognizes a file of a pre-defined mime type. The service then passes the descriptor file contents to the PackageManager, which manages the execution of the standard package installation functionality.

PackageManager Definition

The PackageManager definition contains:

The web browser requires modification to provide the previously described functionality, details are provided in the following sections.

The services/PackageManager.service file

This file defines the PackageManager service as a standard Qtopia service. The definition is simple with only one specified action; installPackage() corresponding to a method with the same name in the PackageManagerService class.

The etc/qds/Packagemanager file

This file defines the PackageManager service as a QDS service allowing it to be found when searching for the QDS services available for a particular mime type. For example, the mime type for the PackageManager is application/qtopia-package. The file also specifies the service attribute install allowing QDSServices to find a service corresponding to this mime type and attribute, with the returned service being the PackageManager service.

The PackageManagerService Class

The PackageManagerService class is derived from QtopiaAbstractService with core implementation similar to other services. Additionally, it contains the method installPackage() which accepts a single parameter of type QDSRequest and contains the request data, that is, the contents of the Qtopia package descriptor file. This method is called when a service action of the same name is invoked and then executes the standard PackageManager dialog, which prompts the user to install the package or cancel the installation.

Web Browser Modification

When a browser recognizes a particular mime type, an instance of QDSServices for the mime type and attribute must be created. This instance is, in turn, used to find an instance of the PackageManager service which is then used as a parameter to construct a QDSAction object. The invocation of the QDSAction exec() method causes the method PackageManagerService.installPackage() to be called. The exec() method requires an instance of QDSData whose constructor accepts a file (the Qtopia package descriptor) and mime type as parameters.

There are two ways to add this functionality to a web browser:

  1. integrate it into the web browser code (this may not always be possible due to licensing issues or if the web browser application is in binary format)
  2. create an application invoked by the browser on recognition of a particular mime type.

    Contemporary browsers such as Firefox or Opera can be configured in this way. After the Qtopia package descriptor file is downloaded it is passed as a parameter to this application, which implements the functionality of finding and invoking the PackageManager service.


Copyright © 2008 Trolltech Trademarks
Qtopia 4.3.1