author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdecore/kstandarddirs.h | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kdecore/kstandarddirs.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdecore/kstandarddirs.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/microkde/kdecore/kstandarddirs.h b/microkde/kdecore/kstandarddirs.h index 901384e..f0e28fc 100644 --- a/microkde/kdecore/kstandarddirs.h +++ b/microkde/kdecore/kstandarddirs.h @@ -1,123 +1,123 @@ /* This file is part of the KDE libraries Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org> Stephan Kulow <coolo@kde.org> 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef SSK_KSTDDIRS_H #define SSK_KSTDDIRS_H #include <qstring.h> -#include <qdict.h> +#include <q3dict.h> #include <qstringlist.h> #include <kglobal.h> class KConfig; class KStandardDirsPrivate; /** * @short Site-independent access to standard KDE directories. * @author Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org> * @version $Id$ * * This is one of the most central classes in kdelibs as * it provides a basic service: It knows where the files * reside on the user's hard disk. And it's meant to be the * only one that knows -- to make the real location as * transparent as possible to both the user and the applications. * * To this end it insulates the application from all information * and applications always refer to a file with a resource type * (e.g. icon) and a filename (e.g. khexdit.xpm). In an ideal world * the application would make no assumption where this file is and * leave it up to @ref KStandardDirs::findResource("apps", "Home.desktop") * to apply this knowledge to return /opt/kde/share/applnk/Home.desktop * or ::locate("data", "kgame/background.jpg") to return * /opt/kde/share/apps/kgame/background.jpg * * The main idea behind KStandardDirs is that there are several * toplevel prefixes below which the files lie. One of these prefixes is * the one where the user installed kdelibs, one is where the * application was installed, and one is $HOME/.kde, but there * may be even more. Under these prefixes there are several well * defined suffixes where specific resource types are to be found. * For example, for the resource type "html" the suffixes could be * share/doc/HTML and share/doc/kde/HTML. * So the search algorithm basicly appends to each prefix each registered * suffix and tries to locate the file there. * To make the thing even more complex, it's also possible to register * absolute paths that KStandardDirs looks up after not finding anything * in the former steps. They can be useful if the user wants to provide * specific directories that aren't in his $HOME/.kde directory for, * for example, icons. * * @sect Standard resources that kdelibs allocates are: * * @li apps - Applications menu (.desktop files). * @li cache - Cached information (e.g. favicons, web-pages) * @li cgi - CGIs to run from kdehelp. * @li config - Configuration files. * @li data - Where applications store data. * @li exe - Executables in $prefix/bin. @ref findExe() for a function that takes $PATH into account. * @li html - HTML documentation. * @li icon - Icons, see @ref KIconLoader. * @li lib - Libraries. * @li locale - Translation files for @ref KLocale. * @li mime - Mime types. * @li module - Module (dynamically loaded library). * @li qtplugins - Qt plugins (dynamically loaded objects for Qt) * @li services - Services. * @li servicetypes - Service types. * @li scripts - Application scripting additions. * @li sound - Application sounds. * @li templates - Templates * @li wallpaper - Wallpapers. * @li tmp - Temporary files (specfic for both current host and current user) * @li socket - UNIX Sockets (specific for both current host and current user) * * A type that is added by the class @ref KApplication if you use it, is * appdata. This one makes the use of the type data a bit easier as it * appends the name of the application. * So while you had to ::locate("data", "appname/filename") so you can * also write ::locate("appdata", "filename") if your KApplication instance * is called "appname" (as set via KApplication's constructor or KAboutData, if * you use the global KStandardDirs object @ref KGlobal::dirs()). * Please note though that you cannot use the "appdata" * type if you intend to use it in an applet for Kicker because 'appname' would * be "Kicker" instead of the applet's name. Therefore, for applets, you've got * to work around this by using ::locate("data", "appletname/filename"). * * @sect KStandardDirs supports the following environment variables: * * @li KDEDIRS: This may set an additional number of directory prefixes to * search for resources. The directories should be seperated * by ':'. The directories are searched in the order they are * specified. * @li KDEDIR: Used for backwards compatibility. As KDEDIRS but only a single * directory may be specified. If KDEDIRS is set KDEDIR is * ignored. * @li KDEHOME: The directory where changes are saved to. This directory is * used to search for resources first. If KDEHOME is not * specified it defaults to "$HOME/.kde" * @li KDEROOTHOME: Like KDEHOME, but used for the root user. * If KDEROOTHOME is not set it defaults to the .kde directory in the * home directory of root, usually "/root/.kde". * Note that the setting of $HOME is ignored in this case. * @@ -481,197 +481,197 @@ public: * will be returned unchanged. */ QString relativeLocation(const char *type, const QString &absPath); /** * Recursively creates still-missing directories in the given path. * * The resulting permissions will depend on the current umask setting. * permission = mode & ~umask. * * @param dir Absolute path of the directory to be made. * @param mode Directory permissions. * @return true if successful, false otherwise */ static bool makeDir(const QString& dir, int mode = 0755); /** * This returns a default relative path for the standard KDE * resource types. Below is a list of them so you get an idea * of what this is all about. * * @li data - share/apps * @li html - share/doc/HTML * @li icon - share/icon * @li config - share/config * @li pixmap - share/pixmaps * @li apps - share/applnk * @li sound - share/sounds * @li locale - share/locale * @li services - share/services * @li servicetypes - share/servicetypes * @li mime - share/mimelnk * @li wallpaper - share/wallpapers * @li templates - share/templates * @li exe - bin * @li lib - lib * * @returns Static default for the specified resource. You * should probably be using locate() or locateLocal() * instead. * @see locate() * @see locateLocal() */ static QString kde_default(const char *type); /** * @internal (for use by sycoca only) */ QString kfsstnd_prefixes(); /** * Returns the toplevel directory in which KStandardDirs * will store things. Most likely $HOME/.kde * Don't use this function if you can use locateLocal * @return the toplevel directory */ QString localkdedir() const; /** * @return $XDG_DATA_HOME * See also http://www.freedesktop.org/standards/basedir/draft/basedir-spec/basedir-spec.html */ QString localxdgdatadir() const; /** * @return $XDG_CONFIG_HOME * See also http://www.freedesktop.org/standards/basedir/draft/basedir-spec/basedir-spec.html */ QString localxdgconfdir() const; /** * Checks for existence and accessability. * Faster than creating a QFileInfo first. * @param fullPath the path to check * @return true if the directory exists */ static bool exists(const QString &fullPath); /** * Expands all symbolic links and resolves references to * '/./', '/../' and extra '/' characters in @p dirname * and returns the canonicalized absolute pathname. * The resulting path will have no symbolic link, '/./' * or '/../' components. * @since 3.1 */ static QString realPath(const QString &dirname); static void setAppDir( const QString & ); static QString appDir(); private: QStringList prefixes; // Directory dictionaries - QDict<QStringList> absolutes; - QDict<QStringList> relatives; + Q3Dict<QStringList> absolutes; + Q3Dict<QStringList> relatives; - mutable QDict<QStringList> dircache; - mutable QDict<QString> savelocations; + mutable Q3Dict<QStringList> dircache; + mutable Q3Dict<QString> savelocations; // Disallow assignment and copy-construction KStandardDirs( const KStandardDirs& ); KStandardDirs& operator= ( const KStandardDirs& ); bool addedCustoms; class KStandardDirsPrivate; KStandardDirsPrivate *d; //US static QString mAppDir; void checkConfig() const; void applyDataRestrictions(const QString &) const; //US void createSpecialResource(const char*); }; /** * \addtogroup locates Locate Functions * @{ * On The Usage Of 'locate' and 'locateLocal' * * Typical KDE applications use resource files in one out of * three ways: * * 1) A resource file is read but is never written. A system * default is supplied but the user can override this * default in his local .kde directory: * * \code * // Code example * myFile = locate("appdata", "groups.lst"); * myData = myReadGroups(myFile); // myFile may be null * \endcode * * 2) A resource file is read and written. If the user has no * local version of the file the system default is used. * The resource file is always written to the users local * .kde directory. * * \code * // Code example * myFile = locate("appdata", "groups.lst") * myData = myReadGroups(myFile); * ... * doSomething(myData); * ... * myFile = locateLocal("appdata", "groups.lst"); * myWriteGroups(myFile, myData); * \endcode * * 3) A resource file is read and written. No system default * is used if the user has no local version of the file. * The resource file is always written to the users local * .kde directory. * * \code * // Code example * myFile = locateLocal("appdata", "groups.lst"); * myData = myReadGroups(myFile); * ... * doSomething(myData); * ... * myFile = locateLocal("appdata", "groups.lst"); * myWriteGroups(myFile, myData); * \endcode **/ /*! * \relates KStandardDirs * This function is just for convenience. It simply calls *instance->dirs()->\link KStandardDirs::findResource() findResource\endlink(type, filename). **/ QString locate( const char *type, const QString& filename /*US , const KInstance* instance = KGlobal::instance()*/ ); /*! * \relates KStandardDirs * This function is much like locate. However it returns a * filename suitable for writing to. No check is made if the * specified filename actually exists. Missing directories * are created. If filename is only a directory, without a * specific file, filename must have a trailing slash. * **/ QString locateLocal( const char *type, const QString& filename /*US , const KInstance* instance = KGlobal::instance() */ ); /*! * \relates KStandardDirs * This function is much like locate. No check is made if the * specified filename actually exists. Missing directories * are created if @p createDir is true. If filename is only * a directory, without a specific file, * filename must have a trailing slash. * **/ |