Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

PackageManager - Browser Integration

This document describes why and how to integrate a browser with PackageManager and how to make Qt Extended packages available via a web-page.

Use Case

The basic sequence for a user wanting to install a package is:

  1. Invoke the PackageManager.
  2. Use PackageManager to connect to a web server and display the list of packages offered.
  3. The user selects the required package and installs it

While this approach is functional, there is little the content provider can do to advertise and differentiate their packages. The browser integration enables the user to visit any web site and install packages from there.

The process is now becomes:

  1. A web page offers a list of links to Qt Extended package file descriptors which are text files containing information about a package as well as an exact URL indicating the download location.
  2. The user clicks the required link and the descriptor is downloaded and passed to the PackageManager.
  3. The user reads the package requirements.
  4. The user clicks the install button and the package is downloaded and installed.

This package behaves like any other package, that is, it can be un-installed and is subject to SXE security.

Web-Browser Modification

Upon downloading a descriptor file of mime type, application/qtopia-package, the browser needs to:

  1. Create an instance of QDSServices with the requestDataType, application/qtopia-package and attribute, install. (The responseDataType should be "*").
  2. The QDSServices object should contain a QDSServiceInfo object corresponding to PackageManager, use that to create a QDSAction object.
  3. Create a QDSData object with the downloaded qpd file and application/qtopia-package mime type.
  4. Invoke the exec() function of the QDSAction object with the QDSData object as a parameter. Via the services framework, this will invoke PackageManager to begin the installation process and prompt the user to confirm installation.

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 Qt Extended package descriptor file is downloaded it is passed as a parameter to this application, which implements the above functionality of finding and invoking the PackageManager service.

How to Make a Qt Extended Package Available via a Web Page

To make a Qt Extended packages available via a web page:

Qt Extended Package Descriptor and Web Page

For every package offered for download a Qt Extended package descriptor file must be provided. These files contain meta-data about the package which includes a URL indicating the package download location. The mkPackages script is used to generate descriptor file, further details can be found here.

The link on the web page points to the descriptor file and is processed by the PackageManager which extracts the URL and, upon confirmation by the user, downloads and installs the package.

Web Server Configuration

For the browser to detect the Qt Extended package descriptor the web server must set the appropriate mime type (application/qtopia-package) in the HTTP header for that file. This means that on the web server a new mime type mapping must be configured for the extension of the Qt Extended package descriptor, which is *.qpd.

The following table describes the mime type mapping for two common browsers:

BrowserMapping Instructions
Apache 2Edit the mime.types file, usually found under /etc/apache2 Append a line containing:
    application/qtopia-package qpd
  • Add mime entries to the following registry location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InetInfo\Parameters\MimeMap by opening the MimeMap key and choosing Edit Value or Add Value.
  • The mime information must be placed in the Value Name box.
  • The data type for the entry must be set to REG_SZ and the string field is left blank.

Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3