| Home · All Classes · Grouped Classes · Annotated · Functions |
The QContent class represents a content carrying entity in the Qtopia system, where content includes resources which an end-user may view or manage. More...
#include <QContent>
The QContent class represents a content carrying entity in the Qtopia system, where content includes resources which an end-user may view or manage.
By creating content with a Role of Data using the setRole() method, resources not intended to be directly consumed by the end-user may also be managed.
An instance of a QContent may, for example, represent any one of the following types of content:
The QContent class is responsible for providing access to metadata about the content contained in a file or stream.
As a system-wide invariant, the backing store is authoritative for information about content available on the device. For example content stored in a DRM file or a stream may not have a logical file on the file-system.
In general applications should use the QContent and QContentSet interface to manage, and search for resources, instead of calling through to the file-system.
The backing store is typically an SQL database, although it could be some other kind of persistent storage.
The static methods install() and uninstall() are used to update 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 QContentSet::changed() signal.
See also QContentSet and QContentFilter.
This enum specifies the type of change made to a QContent.
| Constant | Value | Description |
|---|---|---|
| QContent::Added | 0 | the QContent has been added. |
| QContent::Removed | 1 | the QContent has been deleted. |
| QContent::Updated | 2 | the QContent has been modified. |
See also QContentSet::changed().
This enum specifies the DRM State of this QContent object.
| Constant | Value | Description |
|---|---|---|
| QContent::Unprotected | 0 | plain text "legacy" file, not subject to drm |
| QContent::Protected | 1 | file subject to drm. |
Convenience enum provides some of the more common content properties.
| Constant | Value | Description |
|---|---|---|
| QContent::Album | 0 | The name of the album which the content is part of. |
| QContent::Artist | 1 | The name of the artist who produced the content. |
| QContent::Author | 2 | The author of the content. |
| QContent::Composer | 3 | The composer of the content. |
| QContent::ContentUrl | 4 | A URL from which a copy of the content can be downloaded. Typically associated with OMA DRM content. |
| QContent::Copyright | 5 | A copyright notice for the content. |
| QContent::CopyrightUrl | 6 | A URL with copyright/legal information. |
| QContent::Description | 7 | A description of the content. |
| QContent::Genre | 8 | The genre the content belongs to. |
| QContent::InformationUrl | 9 | A URL where additional information about the content can be obtained. Typically associated with OMA DRM content. |
| QContent::PublisherUrl | 10 | The URL for the content publisher's website. |
| QContent::RightsIssuerUrl | 11 | A URL where rights for DRM protected content may be obtained. Typically associated with OMA DRM content. |
| QContent::Track | 12 | The content's position on an album. |
| QContent::Version | 13 | The content's version number. |
This enum specifies the type of document this QContent object appears to be.
| Constant | Value | Description |
|---|---|---|
| QContent::UnknownUsage | 0 | unknown mode (default) |
| QContent::Document | 1 | a user-visible document file suitable for "open" |
| QContent::Data | 2 | a data or config file not suitable for "open" |
| QContent::Application | 3 | an application (possibly Java, possibly DRM controlled) |
This typedef is deprecated.
UsageMode has been deprecated, use Role instead.
See also QContent::Role.
Constructs an empty invalid content object.
Create a QContent object by fetching the metadata from the backing store specified by id. This method will be fast if the object has already been referenced by QContent and QContentSet classes loaded in the current process, since internally the results of calls to the backing store are cached.
Create a QContent based on the content contained in the file represented by fileName.
Passing store specifies whether this content object is stored into the backing store database, or only used as a local object.
Create a QContent based on the content contained in the file represented by fi.
Passing store specifies whether this content object is stored into the backing store, or only used as a local object.
Create a QContent by copying the other content object.
Destroys the content object.
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().
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.
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
See also setComment().
Writes the changes to the QContent object to the backing store. Returns true if successfull
This is an overloaded member function, provided for convenience.
Writes the changes to the QContent to the backing store. Returns true if successfull and sets change to the type of change committed.
Copy the contents of from to this QContent.
Returns true is successful, otherwise false.
Copy the contents of the file and the metainfo from this QContent to newPath.
Returns true is successful, otherwise false.
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.
Return true if this QContent object is in an error state. Call the errorString() method to return a text description of the error.
Given an application binary name bin, return QContentId pointing to the QContent item representing an application with that binary.
A path name may be supplied for bin (eg bin may contain "/" characters).
Note that binary names are unique across qtopia.
Returns the executable name property. This is the name of the executable program associated with the QContent target.
See also setExecutableName() and execute().
Executes the application associated with this QContent, with args as arguments.
See also executableName() and setExecutableName().
This is an overloaded member function, provided for convenience.
Executes the application associated with this QContent.
See also executableName() and setExecutableName().
Returns the file associated with the QContent.
See also setFile(), executableName(), and name().
Return true if the file associated with this QContent object is already known. If false, calling file() will generate a file name.
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 does not have current rights for the default application the icon is shown greyed out (using the QIcon dynamic routines).
See also setIcon().
This is an overloaded member function, provided for convenience.
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 does not have current rights for permission the icon is shown greyed out (using the QIcon dynamic routines).
Return the path to the icon for this file.
See also icon().
Returns the Id of this QContent. If this QContent is not present in the backing store its value will be QContent::InvalidId.
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().
Installs a set of files in a batch, committing to the database only once. This achieves a significant performance boost over multiple calls to install.
See also install().
Convenience function to test if this QContent is a Document or an Application. Returns true if this QContent is a Document or an Application; otherwise returns false.
See also usageMode().
Queries the launcher configuration settings and returns true if this object is in the systems PreloadApps list; otherwise returns false.
Content 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. Returns true if content is valid; otherwise returns false.
Note: this method can be expensive.
Return the value of the last time underlying file was updated.
Deprecated functionality: Return the path of the .desktop link file this metainfo ContentLink was generated from if available.
See also setLinkFile().
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().
Loads the content into data.
Returns true if successful; otherwise false.
Returns the root path of the media the content is stored on.
See also setMedia().
Returns the MimeTypeIcons property of the QContent.
Returns MimeTypePermissions property of the QContent.
Returns the MimeTypes property. This is the list of MIME types that the application can view or edit.
See also setMimeTypes().
Move the contents of the file and the metainfo from this QContent to newPath.
Returns true if the contents is successfully moved, otherwise false.
Note: The id() of the original file will be invalid and should not be used.
Return the user-visible name for this content object
See also setName().
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.
This is an overloaded member function, provided for convenience.
Opens a read only QIODevice.
Returns the QIODevice if successful, otherwise returns 0. It is the caller's responsibility to delete the return value.
Returns all the DRM permissions the content currently has rights for. A true value of force will cause the rights to be requeried otherwise a cached value may be returned.
Return a property associated with this content with key key and group group. If group is not specifed the default group will be used.
See also setProperty().
This is an overloaded member function, provided for convenience.
Return a property associated with this content with key key.
See also setProperty().
Returns the string key for a given property.
Uninstall this object from the database, and remove it from the filesystem.
This function is deprecated.
Uninstall the .desktop/link file for this object from the database, and remove it from the filesystem.
Return a QDrmRights representation of any rights for this object for the given permission. If the drmStatus() returns Unprotected, then this method returns a QDrmRights object with valid rights for all permissions. Use drmStatus() != Unprotected to test for unprotected content and permissions() & [permission] to test for a specific permission.
Return the document status of the object as per the Role 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.
See also setRole().
Saves the data data.
Returns true is successful; otherwise false.
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().
Sets a string comment for this object.
See also comment().
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().
Set the file that this content references to filename
See also file().
Sets the icons associated with this content to iconpath. The property will not be written to the backing store until commit() is called.
This function is deprecated.
Set the link/.desktop file that this content references to filename.
See also linkFile().
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. Returns true if successful; otherwise false.
See also media().
Sets the MimeTypes property tp mimeTypes. This is the list of MIME types that the application can view or edit.
See also mimeTypes().
Sets the Name property to docname. The property will not be written to the backing store until commit() is called.
See also name().
Set a property associated with the content with key key and value value. If group is specified then the property will be stored in the specified group, otherwise it will be stored in the default group. The property will not be written to the backing store until commit() is called.
See also property() and commit().
This is an overloaded member function, provided for convenience.
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().
Set the document status of the object to role as per the Role enum.
See also role().
Sets the Type property to doctype. The property will not be written to the backing store until commit() is called.
Return the plaintext size of the content in bytes
Return the RFC2045 mime-type for the content
See also setType().
Remove the Content with id from the backing store
Uninstalls a set of files in a batch, committing to the database only once. This achieves a significant performance boost over multiple calls to uninstall().
See also uninstall().
This function is deprecated.
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.
See also role().
Assignment operator. Sets data on this to be what is set on other.
Equality operator. Return true if this Content object is the same as the other; otherwise returns false. Is true if both have the same Id number, or if both are empty.
This variable holds a constant representing an invalid QContent identifier.
A QContentId is a globally unique identifier for a QContent record. Synonym for QPair<QtopiaDatabaseId, quint64>.
Synonym for QList<QContentId>.
A QtopiaDatabaseId is a globally unique identifier for a QContent backing store. Synonym for quint32.
| Copyright © 2007 Trolltech | Trademarks | Qtopia 4.2.5 |