Home · All Classes · Grouped Classes · Annotated · Functions

QContentSet Class Reference

The QContentSet class represents a set of QContent objects. More...

    #include <QContentSet>

Inherits QObject.

Public Types

Public Functions

Signals

Static Public Members

Related Non-Members

Additional Inherited Members


Detailed Description

The QContentSet class represents a set of QContent objects.

When building GUI elements representing a collection of QContent objects perform the following:

Example:

    QContentSet set(QContentFilter::Role, "Document");
    QContentSetModel model(&set);

As the model is automatically kept up-to-date, this is preferable method of accessing a list of QContent objects

The set is synchronized so that the data is as up-to-date as possible when new storage media (such as CF or SD cards) are inserted or removed, or when other applications change content files.

The mechanism for this synchronization is as follows:


Member Type Documentation

enum QContentSet::Priority

This enum specifies the priority to use when scanning a directory.

ConstantValueDescription
QContentSet::LowPriority0use low priority
QContentSet::NormalPriority1use normal priority
QContentSet::HighPriority2use low priority - directory will be scanned before lower priority jobs.


Member Function Documentation

QContentSet::QContentSet ( QObject * parent = 0 )

Constructs a new unfiltered QContentSet with the specified parent.

QContentSet::QContentSet ( const QContentFilter & catFilters, QObject * parent = 0 )

Constructs a new QContentSet with the specified parent, containing all records from the backing store which match the filters listed in catFilters.

QContentSet::QContentSet ( const QContentFilter & catFilters, const QStringList & sortOrder, QObject * parent = 0 )

Constructs a new QContentSet with the specified parent, containing all records from the backing store which match the filters listed in catFilters sorted by sortOrder.

QContentSet::QContentSet ( QContentFilter::FilterType tag, const QString & filter, QObject * parent = 0 )

Constructs a new QContentSet with the specified parent, containing all records from the backing store which match the filtering criteria specified by tag and filter.

QContentSet::QContentSet ( QContentFilter::FilterType tag, const QString & filter, const QStringList & sortOrder, QObject * parent = 0 )

Constructs a new QContentSet with the specified parent, containing all records from the backing store which match the filtering criteria specified by tag and filter and sorted by sortOrder.

QContentSet::QContentSet ( const QContentSet & original, QObject * parent = 0 )

Constructs a new QContentSet with the specified parent, containing all records from original.

QContentSet::~QContentSet ()   [virtual]

Destroys the QContentSet.

void QContentSet::aboutToSort ()   [signal]

This signal is emitted when this QContentSet is about to be sorted.

void QContentSet::add ( const QContent & content )

Explicitly add the QContent object content to this set but not to the backing store. contains() is called first to test if the content already exists in the set, and does not add it if it is already present.

If using this method and remove(), a filter expression is not used for these items. This is useful for building up a set of QContent objects to display or to perform bulk operations upon, such as moving to a new location.

If a filter expression is used and the object added matches it, this method is effectively a null operation - although it will update the internal cache.

See also remove(), contains(), and clear().

void QContentSet::addCriteria ( QContentFilter::FilterType kind, const QString & filter, QContentFilter::Operand operand )

Joins a filtering criteria of filter type kind and value filter to the current filter set using the given operand.

void QContentSet::addCriteria ( const QContentFilter & filters, QContentFilter::Operand operand )

This is an overloaded member function, provided for convenience.

Joins a group of filtering criteria filters to the current filter set using the given operand.

void QContentSet::appendFrom ( QContentSet & other )

Appends the contents of other to this QContentSet. Currently it appends them as explicit items to the current QContenSet, in the future, it will concatenate the two filter sets to create a new aggregate filter set.

void QContentSet::changed ( const QContentIdList & idList, QContent::ChangeType type )   [signal]

This signal is emitted when QContent included in the filter expression for this QContentSet are changed by another application, or by removable media being inserted or removed.

idList contains a list of the Ids of QContent items that have changed.

type specifies the type of change that is being signalled.

void QContentSet::changed ()   [signal]

This is an overloaded member function, provided for convenience.

This signal is emitted when a large number of QContent objects included in the filter expression for this QContentSet are changed by another application or by removable media being inserted or removed.

void QContentSet::clear ()

Remove all filters and explicitly added QContent objects from this set.

See also add(), remove(), and contains().

void QContentSet::clearFilter ()

Clears the current filter expression on the set

bool QContentSet::contains ( const QContent & content ) const

Return true if the set contains the object content, that is:

See also add(), remove(), and clear().

void QContentSet::contentAboutToBeInserted ( int start, int end )   [signal]

This signal is emitted when content items are about to be inserted between the start and end indexes.

void QContentSet::contentAboutToBeRemoved ( int start, int end )   [signal]

This signal is emitted when content items between the start and end indexes are about to be removed.

void QContentSet::contentChanged ( int start, int end )   [signal]

This signal is emitted when content items between the start and end indexes have changed.

void QContentSet::contentInserted ()   [signal]

This signal is emitted when the content insertion indicated by contentAboutToBeInserted() has been completed.

void QContentSet::contentRemoved ()   [signal]

This signal is emitted when the content removal indicated by contentAboutToBeRemoved() has been completed.

int QContentSet::count () const

Return the number of QContent objects in this set.

int QContentSet::count ( const QContentFilter & filter )   [static]

This is an overloaded member function, provided for convenience.

Returns the number of content items in the database that match the content filter filter.

QContentFilter QContentSet::filter () const

Returns a copy of the current filter set for this QContentSet.

void QContentSet::findDocuments ( QContentSet * folder, const QString & mimefilter = QString() )   [static]

Finds all documents in the system's document directories which match the filter mimefilter, and appends the resulting QContent objects to folder.

QContent QContentSet::findExecutable ( const QString & exec ) const

Find a QContent object for the executable exec in the current QContentSet. Returns an empty/invalid QContent if unsuccessful.

See also QContent::InvalidId.

QContent QContentSet::findFileName ( const QString & filename ) const

Find a QContent object for the filename in the current QContentSet. Returns an empty/invalid QContent if unsuccessful.

Paths are not acceptable in filename, ie the filename must not contain any "/" characters.

Note that if more than one item with the filename exists in the QContentSet no guarantee is provided as to which one is returned.

This method is typically used with filters such that only one filename item exists in the filtered set.

See also QContent::InvalidId.

void QContentSet::installContent ()

Store the meta information objects into the backing store, and create a file on the file system if the content type is appropriate.

See also uninstallContent().

bool QContentSet::isEmpty () const

Returns true if this set is empty.

QContentIdList QContentSet::itemIds () const

Return a QContentIdList of content Ids in this set.

This is a relatively expensive operation, and generally should not be used unless it is known that only a few items will be returned.

It is also a snapshot of the currently known items in the list, which has a possibility of going out of date immediately after it is obtained.

When considering use of this method first examine the process of retrieving a pointer to the internal model and using a Model/View solution.

See also QContentSetModel and items().

QContentList QContentSet::items () const

Return a QContentList of items in this set.

This is a relatively expensive operation, and generally should not be used unless it is known that only a few items will be returned.

It is also a snapshot of the currently known items in the list, which has a possibility of going out of date immediately after it is obtained.

When considering use of this method first examine the process of retrieving a pointer to the internal model and using a Model/View solution.

See also QContentSetModel and itemIds().

void QContentSet::remove ( const QContent & cl )

Remove the QContent object cl from this set. This does not remove the object from the backing store. This is useful for trimming down a set of QContent objects to display to the user, or perform bulk operations on such as moving to a new location.

The method cannot remove an object that matches the filter expression, if one is set.

See also add(), contains(), and clear().

void QContentSet::scan ( const QString & path, Priority priority = NormalPriority )   [static]

Scan for added/removed content in path with the specified priority. Directories will be scanned recusively in a background thread located in the server process.

void QContentSet::setCriteria ( QContentFilter::FilterType kind, const QString & filter )

Sets a filtering criteria of FilterType kind and value filter to the current filter set. This operation will replace all previously specified filters.

void QContentSet::setCriteria ( const QContentFilter & filters )

This is an overloaded member function, provided for convenience.

Sets a group of filtering criteria filters to the current filter set. This operation will replace all previously specified filters.

void QContentSet::setSortOrder ( const QStringList & sortOrder )

Sets the attribute(s) that content in this QContentSet is ordered by to sortOrder.

See also sortOrder().

QStringList QContentSet::sortOrder () const

Returns the attribute(s) the content in this QContentSet is ordered by.

See also setSortOrder().

void QContentSet::sorted ()   [signal]

This signal is emitted when this QContentSet has been sorted.

QStringList QContentSet::types () const

Returns the list of mime-types contained in this set.

For applications, games and settings the type is application/x-executable.

For documents the type is the document's MIME type, or application/octet-stream if the file type is unknown.

void QContentSet::uninstallContent ()

Remove the meta information objects in this set from the backing store, and remove any files from the file system if the content type is appropriate. In the case of DRM controlled files this will also remove any rights objects.

See also installContent().

QContentSet & QContentSet::operator= ( const QContentSet & contentset )

Assigns the given contentset to this QContentSet and returns a reference to this QContentSet.


Related Non-Members

typedef QContentList

Synonym for QList<QContent>.


Copyright © 2007 Trolltech Trademarks
Qtopia 4.2.5