Logo Search packages:      
Sourcecode: akonadi version File versions  Download package

Akonadi::XdgBaseDirs Class Reference

#include <xdgbasedirs_p.h>

List of all members.


Detailed Description

Resource type based handling of standard directories.

Developers of several Free Software desktop projects have created a specification for handling so-called "base directories", i.e. lists of system wide directories and directories within each user's home directory for installing and later finding certain files.

This class handles the respective behaviour, i.e. environment variables and their defaults, for the following type of resources:

Example: getting the Akonadi server config file "akonadiserverrc", assuming that Akonadi stores its config in an additional subdirectoy called "akonadi"

 QString relativeFileName = QLatin1String( "akonadi/akonadiserverrc" );

 // look for the file "akonadiserverrc" with additional subdirectory "akonadi"
 // in any directory associated with resource type "config"
 QString configFile = XdgBaseDirs::findResourceFile( "config", relativeFileName );

 if ( configFile.isEmpty() ) {
  // No config file yet, get the suitable user specific directory for storing
  // a new one
  configFile  = XdgBaseDirs::saveDir( "config", QLatin1String( "akonadi" ) );
  configFile += QLatin1String( "akonadiserverrc" );
 }

 QSettings serverConfig( configFile );

Author:
Kevin Krammer, <kevin.krammer@gmx.at>
See also:
http://www.freedesktop.org/wiki/Specifications/basedir-spec

Definition at line 72 of file xdgbasedirs_p.h.


Public Types

enum  FileAccessFlag { ReadOnly = 0x1, WriteOnly = 0x2, ReadWrite = ReadOnly | WriteOnly }
 Open mode flags for resource files. More...
typedef QFlags< FileAccessFlagFileAccessMode

Public Member Functions

 XdgBaseDirs ()
 Creates the instance.
 ~XdgBaseDirs ()
 Destroys the instance.

Static Public Member Functions

static QString akonadiConnectionConfigFile (FileAccessMode openMode=ReadOnly)
 Returns the path of the Akonadi data connection config file.
static QString akonadiServerConfigFile (FileAccessMode openMode=ReadOnly)
 Returns the path of the Akonadi server config file.
static QStringList findAllResourceDirs (const char *resource, const QString &relPath)
 Searches the resource specific directories for a given subdirectory.
static QString findExecutableFile (const QString &relPath)
 Searches the executable specific directories for a given file.
static QString findResourceDir (const char *resource, const QString &relPath)
 Searches the resource specific directories for a given subdirectory.
static QString findResourceFile (const char *resource, const QString &relPath)
 Searches the resource specific directories for a given file.
static QString homePath (const char *resource)
 Returns the user specific directory for the given resource type.
static QString saveDir (const char *resource, const QString &relPath)
 Finds or creates the "save to" directory for a given resource.
static QStringList systemPathList (const char *resource)
 Returns the list of system wide directories for a given resource type.

Private Member Functions

XdgBaseDirsoperator= (const XdgBaseDirs &)
 XdgBaseDirs (const XdgBaseDirs &)

Static Private Member Functions

static QString akonadiConfigFile (const QString &file, FileAccessMode openMode)

Private Attributes

XdgBaseDirsPrivate *const d

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

Generated by  Doxygen 1.6.0   Back to index