kstandarddirs.h
/*
This file is part of the KDE libraries
Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef SSK_KSTDDIRS_H
#define SSK_KSTDDIRS_H
#include <qstring.h>
#include <qdict.h>
#include <qstringlist.h>
#include <kglobal.h>
class KConfig;
class KStandardDirsPrivate;
class KDECORE_EXPORT KStandardDirs
{
public:
KStandardDirs( );
virtual ~KStandardDirs();
void addPrefix( const QString& dir );
void addXdgConfigPrefix( const QString& dir );
void addXdgDataPrefix( const QString& dir );
bool addResourceType( const char *type,
const QString& relativename );
bool addResourceDir( const char *type,
const QString& absdir);
QString findResource( const char *type,
const QString& filename ) const;
bool isRestrictedResource( const char *type,
const QString& relPath=QString::null ) const;
Q_UINT32 calcResourceHash( const char *type,
const QString& filename, bool deep) const;
QStringList findDirs( const char *type,
const QString& reldir ) const;
QString findResourceDir( const char *type,
const QString& filename) const;
QStringList findAllResources( const char *type,
const QString& filter = QString::null,
bool recursive = false,
bool unique = false) const;
QStringList findAllResources( const char *type,
const QString& filter,
bool recursive,
bool unique,
QStringList &relPaths) const;
static QStringList systemPaths( const QString& pstr=QString::null );
static QString findExe( const QString& appname,
const QString& pathstr=QString::null,
bool ignoreExecBit=false );
static int findAllExe( QStringList& list, const QString& appname,
const QString& pathstr=QString::null,
bool ignoreExecBit=false );
void addKDEDefaults();
bool addCustomized(KConfig *config);
QStringList resourceDirs(const char *type) const;
QStringList allTypes() const;
QString saveLocation(const char *type,
const QString& suffix = QString::null,
bool create = true) const;
QString relativeLocation(const char *type, const QString &absPath);
static bool makeDir(const QString& dir, int mode = 0755);
static QString kde_default(const char *type);
QString kfsstnd_prefixes();
QString kfsstnd_xdg_conf_prefixes();
QString kfsstnd_xdg_data_prefixes();
QString localkdedir() const;
static QString kfsstnd_defaultprefix();
static QString kfsstnd_defaultbindir();
QString localxdgdatadir() const;
QString localxdgconfdir() const;
static bool exists(const QString &fullPath);
static QString realPath(const QString &dirname);
static QString realFilePath(const QString &filename);
private:
QStringList prefixes;
// Directory dictionaries
QDict<QStringList> absolutes;
QDict<QStringList> relatives;
mutable QDict<QStringList> dircache;
mutable QDict<QString> savelocations;
// Disallow assignment and copy-construction
KStandardDirs( const KStandardDirs& );
KStandardDirs& operator= ( const KStandardDirs& );
bool addedCustoms;
class KStandardDirsPrivate;
KStandardDirsPrivate *d;
void checkConfig() const;
void applyDataRestrictions(const QString &) const;
void createSpecialResource(const char*);
// Like their public counter parts but with an extra priority argument
// If priority is true, the directory is added directly after
// $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME
void addPrefix( const QString& dir, bool priority );
void addXdgConfigPrefix( const QString& dir, bool priority );
void addXdgDataPrefix( const QString& dir, bool priority );
// If priority is true, the directory is added before any other,
// otherwise after
bool addResourceType( const char *type,
const QString& relativename, bool priority );
bool addResourceDir( const char *type,
const QString& absdir, bool priority);
};
KDECORE_EXPORT QString locate( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() );
KDECORE_EXPORT QString locateLocal( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() );
KDECORE_EXPORT QString locateLocal( const char *type, const QString& filename, bool createDir, const KInstance* instance = KGlobal::instance() );
#endif // SSK_KSTDDIRS_H
KStandardDirs::locate
QString locate(const char *type, const QString &filename, const KInstance *instance=KGlobal::instance())
Definition: kstandarddirs.cpp:1657
KStandardDirs::locateLocal
QString locateLocal(const char *type, const QString &filename, const KInstance *instance=KGlobal::instance())
Definition: kstandarddirs.cpp:1663
KStandardDirs
Site-independent access to standard KDE directories.
Definition: kstandarddirs.h:125
KInstance
Access to KDE global objects for use in shared libraries.
Definition: kinstance.h:43
KGlobal::instance
static KInstance * instance()
Returns the global instance.
Definition: kglobal.cpp:82
KConfig
Access KDE Configuration entries.
Definition: kconfig.h:43

KDE Home | KDE Accessibility Home | Description of Access Keys