Home · All Classes · Annotated · Functions

QContent Class Reference

The QContent class represents a content carrying entity in the Qtopia system. More...

#include <QContent>

Inherited by QDrmContent.

Public Types

Public Functions

Static Public Members


Detailed Description

The QContent class represents a content carrying entity in the Qtopia system.

Each entity may include:

The QContent class is responsible for providing access to metadata about the content contained in a file or stream.

A server process calls install(...) and iuninstall(...) to update the records of metadata in the backing store in response to hardware and software events such as:

To be notified of these events, create a QContentSet object and connect to its changed(QContentId) signal.


Member Type Documentation

enum QContent::ChangeType

This enum specifies the type of change made to a QContent.

ConstantValueDescription
QContent::Added0the QContent has been added.
QContent::Removed1the QContent has been deleted.
QContent::Updated2the QContent has been modified.

enum QContent::DRMState

This enum specifies the DRM State of this QContent object.

ConstantValueDescription
QContent::Unprotected0x00plain text "legacy" file, not subject to drm
QContent::Protected0x01file subject to drm
QContent::InvalidRights0x02current rights do not allow any access to content.
QContent::Redistributable0x04rights to content may be aquired seperate to initial delivery.

enum QContent::UsageMode

This enum specifies the type of document this QContent object appears to be.

ConstantValueDescription
QContent::UnknownUsage0unknown mode (default)
QContent::Document1a user-visible document file suitable for "open"
QContent::Data2a data or config file not suitable for "open"
QContent::Application3an application (possibly Java, possibly DRM controlled)


Member Function Documentation

QContent::QContent ()

Constructs an empty invalid content object.

QContent::QContent ( QContentId id )

Create a QContent object by fetching the metadata from the backing store of the passed id. This uses in-process caching with statics in the inner private class to save on SQL/calls to the backing store. This method will be fast if the object has already been referenced as the QContent and QContentSet classes are loaded in the current process.

QContent::QContent ( const QString & fileName, bool store = true )

Create an application or document content link based on the fileName. Passing store specifies whether this content object is stored into the backing store database, or only used as a local object.

QContent::QContent ( const QContent & other )

Create a content link by copying the other content object.

QContent::~QContent ()   [virtual]

Destroys the content object.

QStringList QContent::categories () const

Return a list of strings representing the categories on this object. Usually it will make more sense to create a QContentSet and set category filters on it.

See also setCategories().

void QContent::clearErrors ()   [static]

Clear all error flags and errors strings on all QContent objects. Note: this method clears the global error cache for all QContent objects in this process.

QString QContent::comment () const

Return the comment for this object, typically used on ToolTips For DRM controlled objects this will include a summary of the rights and DRM status

bool QContent::commit () const

Writes the changes to the QContent to the backing store.

bool QContent::copyContent ( const QContent & from )

Copy the contents of from to this QContent.

Returns true is successful, otherwise false.

bool QContent::copyTo ( const QString & newPath )

Copy the contents of the file and the metainfo from this QContent to newPath.

Returns true is successful, otherwise false.

QFlags<DRMState> QContent::drmState () const

Return the DRM status of this object, as per the DRMState enum. This value is a cache of the real value available from the DRM agent. When an object expires an event should be fired to update the database but be aware that stale information may be displayed.

bool QContent::error () const

Return true if this QContent object is in an error state. Call the errorString() method to return a text description of the error.

QString QContent::executableName () const

Returns the executable name property. This is the name of the executable program associated with the QContent target.

See also setExecutableName() and execute().

void QContent::execute ( const QStringList & args ) const

Executes the application associated with this QContent, with args as arguments.

See also executableName() and setExecutableName().

void QContent::execute () const

This is an overloaded member function, provided for convenience.

Executes the application associated with this QContent.

See also executableName() and setExecutableName().

QString QContent::file () const

Returns the file associated with the QContent.

See also setFile(), executableName(), and name().

bool QContent::fileKnown () const

Return true if the file associated with this QContent object is already known. If false, calling file() will generate a file name.

QIcon QContent::icon () const

Return the icon for this object. If the object is an application, then it will be the application icon, otherwise it will be a generic icon for the mime-type of the object.

If the object is a DRM controlled, a key emblem is super-imposed on the icon. If the content is DRM_unrenderable the icon is shown greyed out (using the QIcon dynamic routines).

See also setIcon().

QString QContent::iconName () const

Return the path to the icon for this file.

See also icon().

QContentId QContent::id () const

Returns the Id of this QContent. If this QContent is not present in the backing store its value will be QContent::InvalidId.

QContentId QContent::install ( const QFileInfo & fi )   [static]

Takes a QFileInfo reference fi to a content object, and installs the metadata for it in the backing store/database. The path must be an absolute path and the file must exist. If the file is a .desktop file referring to an application or a document a QContent record is created.

If mimetype data is not available, it is determined by file extension, or failing that, the magic number.

If the object is a DRM-controlled file (is a .dcf file, or is otherwise shown as drm controlled) the DRM subsystem is queried for the DRM status.

See also QContentSet::scan().

bool QContent::isDocument () const

Convenience function to test if this QContent is a Document or an Application.

See also usageMode().

bool QContent::isPreloaded () const

Queries the launcher configuration settings to check if this object is in the systems PreloadApps list.

bool QContent::isValid ( bool force = false ) const

Content link is invalid if the backing file is unavailable, either due to removal of media or deletion of the file. If force is true, the content will be revalidated even if this value has been previously cached.

QDateTime QContent::lastUpdated () const

Return the value of the last time underlying file was updated.

QString QContent::linkFile () const

Deprecated functionality: Return the path of the .desktop link file this metainfo ContentLink was generated from if available.

See also setLinkFile().

bool QContent::linkFileKnown () const

Return true if the file associated with this QContent object is already known. If false, calling file() will generate a file name.

See also QContent::fileKnown(), QContent::linkFile(), and QContent::file().

bool QContent::load ( QByteArray & data ) const

Loads the content into data.

Returns true if successful; otherwise false.

QString QContent::location () const

Return the location hint of the package that owns this QContent.

QString QContent::media () const

Returns the root path of the media the content is stored on.

See also setMedia().

QStringList QContent::mimeTypeIcons () const

Returns the MimeTypeIcons property of the QContent.

QStringList QContent::mimeTypePermissions () const

Returns MimeTypePermissions property of the QContent.

QStringList QContent::mimeTypes () const

Returns the MimeTypes property. This is the list of MIME types that the application can view or edit.

bool QContent::moveTo ( const QString & newPath )

Move the contents of the file and the metainfo from this QContent to newPath.

Returns true is successful, otherwise false.

Note: The id() of the original file will be invalid and should not be used.

QString QContent::name () const

Return the user-visible name for this content object

See also setName().

QIODevice * QContent::open ( QIODevice::OpenMode mode ) const

Opens a QIODevice using mode mode.

Returns the QIODevice if successful, otherwise returns 0. It is the caller's responsibility to delete the return value.

QString QContent::property ( const QString & key ) const

Return a property associated with this content with key key.

See also setProperty().

void QContent::removeFiles ()

Uninstall this object from the database, and remove it from the filesystem.

void QContent::removeLinkFile ()

Uninstall the .desktop/link file for this object from the database, and remove it from the filesystem.

QString QContent::rights () const

Return a brief string representation of any rights for this object. If the drmStatus() returns Unprotected, then this method returns an empty string. Use drmStatus() != Unprotected instead of checking for an empty string.

bool QContent::save ( const QByteArray & data )

Saves the data data.

Returns true is successful; otherwise false.

void QContent::setCategories ( const QStringList & categoryList )

Set the categories associated with this content to categoryList. The categores will not be written to the backing store until commit() is called.

See also categories() and commit().

void QContent::setExecutableName ( const QString & exec )

Sets the executable name property to exec. The property will not be written to the backing store until commit() is called.

See also executableName() and execute().

void QContent::setFile ( const QString & filename )

Set the file that this content references to filename

See also file().

void QContent::setIcon ( const QString & iconpath )

Sets the icons associated with this content to iconpath. The property will not be written to the backing store until commit() is called.

See also icon() and commit().

void QContent::setLinkFile ( const QString & filename )

Set the link/.desktop file that this content references to filename

See also linkFile().

bool QContent::setMedia ( const QString & media )

Sets the root path of the media the file is stored on. Once a QContent has been commited to the database the media cannot be changed.

See also media().

void QContent::setName ( const QString & docname )

Sets the Name property to docname. The property will not be written to the backing store until commit() is called.

See also name().

void QContent::setProperty ( const QString & key, const QString & value )

Set a property associated with the content with key key and value value. The property will not be written to the backing store until commit() is called.

See also property() and commit().

void QContent::setType ( const QString & doctype )

Sets the Type property to doctype. The property will not be written to the backing store until commit() is called.

See also type() and name().

qint64 QContent::size () const

Return the plaintext size of the content in bytes

QString QContent::type () const

Return the RFC2045 mime-type for the content If this is an application, instead return "Application" (the underlying QContent's type)

See also setType().

void QContent::uninstall ( QContentId id )   [static]

Remove the Content with id from the backing store

UsageMode QContent::usageMode () const

Return the document status of the object as per the UsageMode enum. This value does not usually change. The status is used to determine what to display to the user. Data objects make no sense to display to the user, as they cannot be launched or categorized. These files are only of use to the applications which operate on them.

QContent & QContent::operator= ( const QContent & other )

Assignment operator. Sets data on this to be what is set on other.

bool QContent::operator== ( const QContent & other ) const

Equality operator. Return true if this Content object is the same as the other. Is true if both have the same Id number, or if both are empty.


Copyright © 2006 Trolltech Trademarks
Qtopia 4.1.7