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

QCategoryManager Class Reference
[QtBaseModule]

The QCategoryManager class provides a set of functions to create, modify, and remove categories. More...

    #include <QCategoryManager>

Inherits QObject.

Public Functions

Signals

Static Public Members

Additional Inherited Members


Detailed Description

The QCategoryManager class provides a set of functions to create, modify, and remove categories.

See also Categories.


Member Function Documentation

QCategoryManager::QCategoryManager ( QObject * parent = 0 )

Constructs a QCategoryManager object with parent parent. It will only see categories in the global scope.

QCategoryManager::QCategoryManager ( const QString & scope, QObject * parent = 0 )

Constructs a QCategoryManager object with parent parent. If scope is null then only categories in the global scope will be seen. Otherwise both global categories and categories restricted to scope will be seen.

QCategoryManager::~QCategoryManager ()

Destroys a QCategoryManager object.

QString QCategoryManager::add ( const QString & trLabel, const QString & icon = QString(), bool forceGlobal = false )

Creates a new category with the user-supplied label trLabel and icon icon. The category is created in the scope of the QCategoryManager unless forceGlobal is true, when it will be created in the global scope.

Returns the id of the new category if the new category is successfully added. Otherwise returns the null string.

Note that this function is not suitable for applications wishing to create categories programmatically. Instead, a system category should be created, using the ensureSystemCategory() function.

See also User Categories and System Categories.

QString QCategoryManager::allLabel ()   [static]

Returns the translated label for the set of all categories.

void QCategoryManager::categoriesChanged ()   [signal]

This signal is emitted when any changes are made to categories.

QList<QString> QCategoryManager::categoryIds () const

Returns the set of category ids that QCategoryManager can see.

bool QCategoryManager::contains ( const QString & id ) const

Returns true if there is a category in the global scope or the scope of QCategoryManager with category id id. Otherwise returns false.

bool QCategoryManager::containsLabel ( const QString & label, bool forceGlobal = false ) const

Returns true if there is a category in the global scope or the scope of QCategoryManager with text label. Otherwise returns false. Set forceGlobal to true to limit the search to categories in the global scope.

Note that this searches on the text stored which may not match what is returned by label() for system categories.

bool QCategoryManager::ensureSystemCategory ( const QString & id, const QString & trLabel, const QString & icon = QString(), bool forceGlobal = false )

Creates a new system category with category id id, translatable label trLabel and icon icon in the scope of the QCategoryManager. If forceGlobal is true or the QCategoryManager has no scope the category will be created in the global scope.

Note that id must be unique. If the id already exists and the existing category does not match the arguments the existing category is removed and re-created using the arguments.

Returns true if the new category is successfully added or a matching system category already exists. Otherwise returns false.

Note that applications wishing to create categories on behalf of the user should use the add() function.

See also User Categories and System Categories.

bool QCategoryManager::exists ( const QString & id ) const

Returns true if there is a category in any scope with category id id.

QIcon QCategoryManager::icon ( const QString & id ) const

If there is a category id id in the scope of the QCategoryManager returns the icon for the category id. Otherwise returns a null icon.

See also setIcon().

QString QCategoryManager::iconFile ( const QString & id ) const

If there is a category id id in the scope of the QCategoryManager returns the icon filename for the category id. Otherwise returns an empty string.

QString QCategoryManager::idForLabel ( const QString & label ) const

Returns the category id for a category with text label in the global scope or the scope of QCategoryManager. Otherwise returns an empty string.

Note that this searches on the text stored which may not match what is returned by label() for system categories.

bool QCategoryManager::isGlobal ( const QString & id ) const

Returns true if the category id id is in the global scope.

bool QCategoryManager::isSystem ( const QString & id ) const

Returns true if the category identified by id is a system category. Otherwise returns false.

See also System Categories.

QString QCategoryManager::label ( const QString & id ) const

If there is a category id id in the scope of the QCategoryManager returns the display label for the category id. Otherwise returns a null string.

User categories have a display label set by the user. System categories have a string that is translated to obtain the display label.

See also setLabel(), User Categories, and System Categories.

QList<QString> QCategoryManager::labels ( const QList<QString> & l ) const

Returns a list containing the translated label for each category id in the list l that is in the scope of the QCategoryManager. The list returned will have a count smaller than the list if id's l if one or more of the ids in the list l are not in the scope of the QCategoryManager.

See also label().

QString QCategoryManager::multiLabel ()   [static]

Returns a translated label for a set containing two or more categories.

bool QCategoryManager::remove ( const QString & id )

Attempts to remove the category with category id id as long as the category is either global or in the scope of the QCategoryManager object. Returns true If the category is successfully removed. Otherwise returns false.

Note that this will always fail if id is a system category.

QString QCategoryManager::ringTone ( const QString & id ) const

If there is a category id id in the scope of the QCategoryManger returns the ringtone filename for the category id. Otherwise returns an empty string.

See also setRingTone().

bool QCategoryManager::setGlobal ( const QString & id, bool global )

Sets the category with category id id to the global scope if global is true or to the scope of QCategoryManager otherwise. Returns true on success. Returns false if the category does not exist, if global is false and QCategoryManager does not have a scope or if there is a database failure.

See also isGlobal().

bool QCategoryManager::setIcon ( const QString & id, const QString & icon )

Attempts to set the icon for the category with category id id to icon. Returns true If the category icon is changed successfully. Otherwise returns false.

Note that this will always fail if id is a system category.

See also icon().

bool QCategoryManager::setLabel ( const QString & id, const QString & trLabel )

Attempts to rename the category with category id id to have the translated label trLabel. Returns true If the category is successfully renamed. Otherwise returns false.

Note that this will always fail if id is a system category.

See also label().

bool QCategoryManager::setRingTone ( const QString & id, const QString & fileName )

Attempts to set the ringtone for the category with category id id to fileName. Returns true if the category ringtone is changed successfully. Otherwise return false.

See also ringTone().

QString QCategoryManager::unfiledLabel ()   [static]

Returns the translated label for the empty set of categories. Also known as unfiled due to the set not yet having any categories assigned.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3