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

QDrmContentPlugin Class Reference
[QtBaseModule]

The QDrmContentPlugin class is the primary interface between DRM agents and the Qt Extended document system. More...

    #include <QDrmContentPlugin>

Inherits QObject and QAbstractFileEngineHandler.

Public Functions

Static Public Members

Protected Slots

Additional Inherited Members


Detailed Description

The QDrmContentPlugin class is the primary interface between DRM agents and the Qt Extended document system.

QDrmContentPlugin allows the document system to present the license state and meta-info of DRM protected files, provide activation options and provide metered access to the plain-text content of those files.

DRM Content Recognition and Installation

When the document system discovers new content on a device it will attempt to determine if it is DRM protected by calling installContent() for each DRM content plugin installed. If a plugin recognizes the content as DRM protected it should populate the passed QContent with meta-data from the files and return true which will mark the content as being DRM protected.

Once a QContent has been identified as being DRM protected the document system will identify the plugin by looking up the file extension in the list returned by keys(). If a file passed to installContent() is DRM protected but does not have a correct extension it should be renamed by the plugin when it is installed. Likewise if a DRM format has separate transport and storage formats the plugin should convert from the transport format to the storage format when it is installed.

DRM File Access

The document system requires applications to request a license through QDrmContent before they can access the plain-text content of a DRM protected file. When a license is requested the document system first checks the current permissions of the file, if permission the license is requested for is not valid the document system will attempt to acquire rights for the file by calling activate(). If the file permissions were already valid or the activation was successful the document system will then attempt to acquire an instance of QDrmContentLicense by calling requestContentLicense() which will be used to update the files license constraints. Content licenses can be registered by calling registerLicense() and once a license has been registered it can be retrieved using license(), deleted licenses are automatically unregistered. QDrmContentPlugin inherits from QAbstractFileEngine and its implementation of create() constructs a file engine which will allow application to open a DRM protected file in read-only mode if a content license for that file has been registered with the plugin, the file will be opened using a QIODevice created by createDecoder() with the permission the license was requested for. When a license is released the document system will call reactivate() irregardless of the current permissions of the file, if rights have expired or will expire in the near future a plugin may prompt the user to acquire new rights.

See also QDrmContent.


Member Function Documentation

QDrmContentPlugin::QDrmContentPlugin ( QObject * parent )

Constructs a new drm content plug-in with the given parent.

QDrmContentPlugin::~QDrmContentPlugin ()   [virtual]

Destroys a QDrmContentPlugin object.

bool QDrmContentPlugin::activate ( const QContent & content, QDrmRights::Permission permission, QWidget * focus )   [pure virtual]

Checks if there are valid rights to render the DRM protected content content with the given permission. If there are currently no valid rights an attempt to acquire new rights is initiated, which may be done by downloading the rights directly or by prompting the user to visit a web site.

If the content had valid rights when this method was called or new rights could be acquired directly this will return true. Otherwise if the rights are invalid and new rights can not be obtained or the rights acquisition process requires external action such as visiting a web page this will return false.

Any dialogs displayed will be parented off the given focus widget.

This method will block until the rights activation process has been completed which may take significant time.

void QDrmContentPlugin::activate ( const QContent & content, QWidget * focus )   [pure virtual]

This is an overloaded member function, provided for convenience.

Initiates an attempt to acquire rights for the given DRM protected content in response to the user selecting an activation menu option or similar action.

Any dialogs displayed will be parented off the given focus widget.

See also canActivate().

bool QDrmContentPlugin::canActivate ( const QString & fileName )   [pure virtual]

Indicates whether the user should be given a menu option to activate the DRM protected content with the file name fileName.

Returns true if the content with the file name fileName can be activated.

See also activate().

QIODevice * QDrmContentPlugin::createDecoder ( const QString & fileName, QDrmRights::Permission permission )   [virtual]

Returns a new QIODevice which provides access to the decrypted content of the DRM file with the file name fileName. If the file cannot be opened for rendering with the given permission a null pointer will be returned instead.

The returned QIODevice will not update any license constraints. In order to update the constraints with the correct usage a content license should be requested using requestContentLicense() and explicitly updated with the usage.

See also requestContentLicense().

bool QDrmContentPlugin::deleteFile ( const QString & fileName )   [pure virtual]

Deletes the DRM protected file with the file name fileName.

Returns true if the file was sucessfully deleted.

QDrmRights QDrmContentPlugin::getRights ( const QString & fileName, QDrmRights::Permission permission )   [pure virtual]

Returns the rights associated with the drm protected file with the file name fileName for the given permission.

QList<QPair<QString, QString> > QDrmContentPlugin::httpHeaders () const   [virtual]

Returns a list of HTTP header key/value pairs DRM enabled web applications should advertise to indicate support for the DRM content handled by the plugin.

void QDrmContentPlugin::initialize ()   [static]

Ensures all DRM plugins have been instantiated. This should be called before scanning directories for content to ensure the file engines for drm content are loaded and content contained within multipart files can be found.

bool QDrmContentPlugin::installContent ( const QString & fileName, QContent * content )   [pure virtual]

Populates a newly created QContent content with meta-data from the file with the file name fileName.

This at a minimum sets the name and type of the QContent, but may also set other attributes such as an icon or any number of property values. In some cases the file may be converted to an localized format and renamed, one such instance is OMA DRM message (application/vnd.oma.drm.message) files which are converted to the content format (application/vnd.oma.drm.content) when installed.

Returns true if the file is a valid DRM file.

See also QContent.

bool QDrmContentPlugin::isProtected ( const QString & fileName ) const   [pure virtual]

Returns true if the file with the file name fileName is DRM protected.

QStringList QDrmContentPlugin::keys () const   [pure virtual]

Returns the file extensions of all DRM file formats supported. This is used to identify the DRM plugin that should handle a file type.

QDrmContentLicense * QDrmContentPlugin::license ( const QString & fileName ) const

Checks if a license for the content with the file name fileName is registered with the plugin. A pointer to a registered license is returned if found otherwise a null pointer is returned.

See also registerLicense() and requestContentLicense().

QDrmRights::Permissions QDrmContentPlugin::permissions ( const QString & fileName )   [pure virtual]

Returns the current valid permissions of the DRM protected content with the file name fileName.

void QDrmContentPlugin::reactivate ( const QContent & content, QDrmRights::Permission permission, QWidget * focus )   [pure virtual]

Checks if the rights to render content with the given permission have expired or will expire in the near future. If either condition is true and there is a valid activation mechanism for the content the user is informed and prompted to reactivate the content.

Any dialogs displayed will be parented off the given focus widget.

void QDrmContentPlugin::registerLicense ( QDrmContentLicense * license )   [protected slot]

Registers a new content license with the plugin.

See also license() and requestContentLicense().

QDrmContentLicense * QDrmContentPlugin::requestContentLicense ( const QContent & content, QDrmRights::Permission permission, QDrmContent::LicenseOptions options )   [virtual]

Requests a content license for rendering content with the given permission. If the content has valid and current rights a pointer to a new content license is returned otherwise a null pointer is returned. The initial state of the content license is determined by the license options.

Implementing classes should register new content licenses with the plugin using registerLicense(), the content licenses are unregistered automatically when destroyed. Once a license has been granted and registered with the plugin access to the unencrypted content of the DRM protected file will become available through the Qt file API for the duration of the license's lifetime.

QPixmap QDrmContentPlugin::thumbnail ( const QString & fileName, const QSize & size, Qt::AspectRatioMode mode = Qt::KeepAspectRatio )   [virtual]

Creates a preview thumbnail image of the content with the file name fileName scaled to the given size. Aspect ratio is maintained according to mode.

QStringList QDrmContentPlugin::types () const   [pure virtual]

Returns the mime types of all DRM file formats supported by the plugin. These types are set in the accept headers of DRM enabled web applications.

qint64 QDrmContentPlugin::unencryptedSize ( const QString & fileName )   [pure virtual]

Returns the size in bytes of the plaintext content of a DRM protected file with the file name fileName.

bool QDrmContentPlugin::updateContent ( QContent * content )   [virtual]

Refreshes the content data of content following a change to the file it references.

Returns true if the content data was out of date, false otherwise.


Copyright © 2009 Nokia Trademarks
Qt Extended 4.4.3