summaryrefslogtreecommitdiff
path: root/library/backend/categories.h
Side-by-side diff
Diffstat (limited to 'library/backend/categories.h') (more/less context) (show whitespace changes)
-rw-r--r--library/backend/categories.h12
1 files changed, 3 insertions, 9 deletions
diff --git a/library/backend/categories.h b/library/backend/categories.h
index 82d765b..ba65ee3 100644
--- a/library/backend/categories.h
+++ b/library/backend/categories.h
@@ -62,26 +62,25 @@ public:
bool contains(int id) const;
bool contains(const QString &label) const;
/** Returns label associated with the uid or QString::null if
* not found
*/
const QString &label(int id) const;
/** Returns the uid associated with label or 0 if not found */
int id(const QString &label) const;
/** Returns a sorted list of labels */
QStringList labels() const;
- QArray<int> ids( const QStringList &cats ) const;
- QArray<int> ids() const;
+
QStringList labels( const QArray<int> &catids ) const;
const QMap<int, QString> &idMap() const { return mIdLabelMap; }
private:
void insert( int uid, const QString &label );
QMap<int, QString> mIdLabelMap;
QMap<QString, int> mLabelIdMap;
static Qtopia::UidGen &uidGen() { return sUidGen; }
static Qtopia::UidGen sUidGen;
};
@@ -121,51 +120,46 @@ public:
* already exist globally. Return UID if added, 0 if conflicts.
*/
int addGlobalCategory( const QString &catname, int uid );
/** Removes the category from the application; if it is not found
* in the application, then it removes it from the global list
*/
bool removeCategory( const QString &appName, const QString &catName,
bool checkGlobal = TRUE);
bool removeCategory( const QString &appName, int uid );
bool removeGlobalCategory( const QString &catName );
bool removeGlobalCategory( int uid );
- QArray<int> ids( const QString &app ) const;
- QArray<int> ids( const QString &app,
- const QStringList &cats ) const;
+ QArray<int> ids( const QString &app, const QStringList &labels) const;
+
/** Returns the id associated with the app */
int id( const QString &app, const QString &cat ) const;
/** Returns the label associated with the id */
QString label( const QString &app, int id ) const;
enum ExtraLabels { NoExtra, AllUnfiled, AllLabel, UnfiledLabel };
/** Returns the sorted list of all categories that are
* associated with the app.
* If includeGlobal parameter is TRUE then the returned
* categories will include the global category items.
* If extra = NoExtra, then
* If extra = AllUnfiled, then All and Unfiled will be prepended to
* the list
* If extra = AllLabel, then All is prepended
* If extra = UnfiledLabel, then Unfiled is prepended
*/
QStringList labels( const QString &app,
bool includeGlobal = TRUE,
ExtraLabels extra = NoExtra ) const;
- /** Returns the labels of the categories associated with the uids */
- QStringList labels( const QString & app,
- const QArray<int> &catids ) const;
-
enum DisplaySingle { ShowMulti, ShowAll, ShowFirst };
/** Returns a single string associated with the cat ids for display in
* a combobox or any area that requires one string. If catids are empty
* then "Unfiled" will be returned. If multiple categories are assigned
* then the behavior depends on the DisplaySingle type.
* If /a display is set to ShowMulti then " (multi)" appended to the
* first string. If /a display is set to ShowAll, then a space seperated
* string is returned with all categories. If ShowFirst is returned,
* the just the first string is returned.
*/
QString displaySingle( const QString &app,