Home · All Namespaces · All Classes · Main Classes
Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends

DcpAppletDb Class Reference

This singleton class keeps track of all installed applets of Conrol Panel. More...

#include <dcpappletdb.h>

List of all members.

Signals

void appletLoaded (DcpAppletObject *applet)

Public Member Functions

bool addPath (const QString &pathName)
 adds files at a specified path pathName to the db
bool addFiles (const QString &path, const QString &filter)
virtual ~DcpAppletDb ()
 Database destructor.
DcpAppletMetadataList list () const
 List all applets.
DcpAppletMetadataList listByCategory (const QString &category)
 Queries the db for a specified applet category.
DcpAppletMetadataList listByCategory (const char **category, int n_categories, checkCategory checkFunction=0)
DcpAppletMetadataList listByCategory (const QStringList &categories, checkCategory checkFunction=0)
DcpAppletMetadataList listMostUsed ()
 List the four most used applets.
DcpAppletObjectapplet (const QString &name)
 Returns the applet found in the database by its name.
DcpAppletMetadatametadata (const QString &name)
bool addFile (const QString &filename)
 add one file to the db
void eraseEntry (DcpAppletMetadata *metadata)
 erase metadata from the db
QStringList appletNames () const
 returns all applet names of the db
bool containsFile (const QString &fileName)
 checks if fileName has already added to the db
bool containsName (const QString &name)
 checks if an applet with given name is already in the db
bool isAppletLoaded (const QString &name)
 checks if the applet with this name is loaded already
QList< DcpAppletObject * > loadedApplets () const
 Lists the loaded applets.
void destroyData (void)
 destroys all the contents (metadata) of the db

Static Public Member Functions

static DcpAppletDbinstance (const QString &pathName=DcpApplet::DefaultPath, const QString &nameFilter="*.desktop")
 Gives back the db instance.
static void initEmptyDb ()
 Initializes an empty db.
static void destroy (void)

Protected Member Functions

 DcpAppletDb (const QString &pathName, const QString &nameFilter)
 protected constructor for singleton
 DcpAppletDb ()
 Creates an empty db.

Friends

class Ut_DcpAppletDb

Detailed Description

This singleton class keeps track of all installed applets of Conrol Panel.

Applet database can be filled with desktop files and then can be queried by category, usage, by applet name.


Constructor & Destructor Documentation

DcpAppletDb::~DcpAppletDb (  )  [virtual]

Database destructor.

DcpAppletDb::DcpAppletDb ( const QString &  pathName,
const QString &  nameFilter 
) [protected]

protected constructor for singleton

DcpAppletDb::DcpAppletDb (  )  [protected]

Creates an empty db.


Member Function Documentation

bool DcpAppletDb::addFile ( const QString &  filename  ) 

add one file to the db

bool DcpAppletDb::addFiles ( const QString &  path,
const QString &  filter 
)
bool DcpAppletDb::addPath ( const QString &  pathName  ) 

adds files at a specified path pathName to the db

DcpAppletObject * DcpAppletDb::applet ( const QString &  name  ) 

Returns the applet found in the database by its name.

Returns:
the object of an applet by name
void DcpAppletDb::appletLoaded ( DcpAppletObject applet  )  [signal]
QStringList DcpAppletDb::appletNames (  )  const

returns all applet names of the db

bool DcpAppletDb::containsFile ( const QString &  fileName  ) 

checks if fileName has already added to the db

bool DcpAppletDb::containsName ( const QString &  name  ) 

checks if an applet with given name is already in the db

void DcpAppletDb::destroy ( void   )  [static]
void DcpAppletDb::destroyData ( void   ) 

destroys all the contents (metadata) of the db

void DcpAppletDb::eraseEntry ( DcpAppletMetadata metadata  ) 

erase metadata from the db

void DcpAppletDb::initEmptyDb (  )  [static]

Initializes an empty db.

It can be used to avoid parsing the .desktop files on the instance call. If db is already initialized, it just outputs a warning.

DcpAppletDb * DcpAppletDb::instance ( const QString &  pathName = DcpApplet::DefaultPath,
const QString &  nameFilter = "*.desktop" 
) [static]

Gives back the db instance.

This function has two optional arguments, so the path and the filter can be initialized as the very first step. Pathname can also be a list of paths separated by ':'.

Use this function to get the instance of the DcpAppletDb singleton, by re-using the existing one and initializing it.

bool DcpAppletDb::isAppletLoaded ( const QString &  name  ) 

checks if the applet with this name is loaded already

DcpAppletMetadataList DcpAppletDb::list (  )  const

List all applets.

Returns:
the metadata list of the applets
DcpAppletMetadataList DcpAppletDb::listByCategory ( const QStringList &  categories,
checkCategory  checkFunction = 0 
)
DcpAppletMetadataList DcpAppletDb::listByCategory ( const char **  category,
int  n_categories,
checkCategory  checkFunction = 0 
)
Parameters:
category An array of string pointers with the category names. All categories with these names will be added.
n_categories The size of the name array.
checkFunction If not NULL the function will be called with the category name of the metadata items and those that are getting false return value are going to be added too. Used to handle the uncategorized applets.
DcpAppletMetadataList DcpAppletDb::listByCategory ( const QString &  category  ) 

Queries the db for a specified applet category.

Parameters:
category the name of the category
Returns:
the metadata list of the matching applets
DcpAppletMetadataList DcpAppletDb::listMostUsed (  ) 

List the four most used applets.

The first element will be the applet used last time, the next three will be the most frequently used ones.

Returns an empty list in case nost used item handling is disabled.

QList< DcpAppletObject * > DcpAppletDb::loadedApplets (  )  const

Lists the loaded applets.

DcpAppletMetadata * DcpAppletDb::metadata ( const QString &  name  ) 
Returns:
the metadata of an applet by name

Friends And Related Function Documentation

friend class Ut_DcpAppletDb [friend]

The documentation for this class was generated from the following files:

Copyright © 2009 Nokia Corporation Generated on Tue Jul 5 2011 15:01:31
Doxygen 1.7.1
Meego control panel