kdecore Library: kstandarddirs.h Source File (kdecore Library)

| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kstandarddirs.h

    00001 /*
    00002   This file is part of the KDE libraries
    00003   Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
    00004   Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
    00005   Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
    00006
    00007   This library is free software; you can redistribute it and/or
    00008   modify it under the terms of the GNU Library General Public
    00009   License as published by the Free Software Foundation; either
    00010   version 2 of the License, or (at your option) any later version.
    00011
    00012   This library is distributed in the hope that it will be useful,
    00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015   Library General Public License for more details.
    00016
    00017   You should have received a copy of the GNU Library General Public License
    00018   along with this library; see the file COPYING.LIB.  If not, write to
    00019   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00020   Boston, MA 02111-1307, USA.
    00021 */
    00022
    00023 #ifndef SSK_KSTDDIRS_H
    00024 #define SSK_KSTDDIRS_H
    00025
    00026 #include <qstring.h>
    00027 #include <qdict.h>
    00028 #include <qstringlist.h>
    00029 #include <kglobal.h>
    00030
    00031 class KConfig;
    00032 class KStandardDirsPrivate;
    00033
    00125 class KDECORE_EXPORT KStandardDirs
    00126 {
    00127 public:
    00131     KStandardDirs( );
    00132
    00136     virtual ~KStandardDirs();
    00137
    00147     void addPrefix( const QString& dir );
    00148
    00156     void addXdgConfigPrefix( const QString& dir );
    00157
    00165     void addXdgDataPrefix( const QString& dir );
    00166
    00186     bool addResourceType( const char *type,
    00187                   const QString& relativename );
    00188
    00204     bool addResourceDir( const char *type,
    00205                  const QString& absdir);
    00206
    00225     QString findResource( const char *type,
    00226                   const QString& filename ) const;
    00227
    00243     bool isRestrictedResource( const char *type,
    00244                   const QString& relPath=QString::null ) const;
    00245
    00258     Q_UINT32 calcResourceHash( const char *type,
    00259                   const QString& filename, bool deep) const;
    00260
    00277     QStringList findDirs( const char *type,
    00278                               const QString& reldir ) const;
    00279
    00300     QString findResourceDir( const char *type,
    00301                  const QString& filename) const;
    00302
    00303
    00323     QStringList findAllResources( const char *type,
    00324                        const QString& filter = QString::null,
    00325                        bool recursive = false,
    00326                        bool unique = false) const;
    00327
    00350     QStringList findAllResources( const char *type,
    00351                        const QString& filter,
    00352                        bool recursive,
    00353                        bool unique,
    00354                        QStringList &relPaths) const;
    00355
    00365     static QStringList systemPaths( const QString& pstr=QString::null );
    00366
    00384     static QString findExe( const QString& appname,
    00385                 const QString& pathstr=QString::null,
    00386                 bool ignoreExecBit=false );
    00387
    00406     static int findAllExe( QStringList& list, const QString& appname,
    00407                    const QString& pathstr=QString::null,
    00408                    bool ignoreExecBit=false );
    00409
    00419     void addKDEDefaults();
    00420
    00430     bool addCustomized(KConfig *config);
    00431
    00443     QStringList resourceDirs(const char *type) const;
    00444
    00451     QStringList allTypes() const;
    00452
    00470      QString saveLocation(const char *type,
    00471                   const QString& suffix = QString::null,
    00472                   bool create = true) const;
    00473
    00489          QString relativeLocation(const char *type, const QString &absPath);
    00490
    00501     static bool makeDir(const QString& dir, int mode = 0755);
    00502
    00530     static QString kde_default(const char *type);
    00531
    00535     QString kfsstnd_prefixes();
    00536
    00540     QString kfsstnd_xdg_conf_prefixes();
    00541
    00545     QString kfsstnd_xdg_data_prefixes();
    00546
    00553     QString localkdedir() const;
    00554
    00559     static QString kfsstnd_defaultprefix();
    00560
    00565     static QString kfsstnd_defaultbindir();
    00566
    00571     QString localxdgdatadir() const;
    00572
    00577     QString localxdgconfdir() const;
    00578
    00586     static bool exists(const QString &fullPath);
    00587
    00596     static QString realPath(const QString &dirname);
    00597
    00606     static QString realFilePath(const QString &filename);
    00607
    00608  private:
    00609
    00610     QStringList prefixes;
    00611
    00612     // Directory dictionaries
    00613     QDict<QStringList> absolutes;
    00614     QDict<QStringList> relatives;
    00615
    00616     mutable QDict<QStringList> dircache;
    00617     mutable QDict<QString> savelocations;
    00618
    00619     // Disallow assignment and copy-construction
    00620     KStandardDirs( const KStandardDirs& );
    00621     KStandardDirs& operator= ( const KStandardDirs& );
    00622
    00623     bool addedCustoms;
    00624
    00625     class KStandardDirsPrivate;
    00626     KStandardDirsPrivate *d;
    00627
    00628     void checkConfig() const;
    00629     void applyDataRestrictions(const QString &) const;
    00630     void createSpecialResource(const char*);
    00631
    00632         // Like their public counter parts but with an extra priority argument
    00633         // If priority is true, the directory is added directly after
    00634         // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME
    00635     void addPrefix( const QString& dir, bool priority );
    00636     void addXdgConfigPrefix( const QString& dir, bool priority );
    00637     void addXdgDataPrefix( const QString& dir, bool priority );
    00638
    00639     // If priority is true, the directory is added before any other,
    00640     // otherwise after
    00641     bool addResourceType( const char *type,
    00642                   const QString& relativename, bool priority );
    00643     bool addResourceDir( const char *type,
    00644                  const QString& absdir, bool priority);
    00645 };
    00646
    00703 KDECORE_EXPORT QString locate( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() );
    00704
    00714 KDECORE_EXPORT QString locateLocal( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() );
    00715
    00725 KDECORE_EXPORT QString locateLocal( const char *type, const QString& filename, bool createDir, const KInstance* instance = KGlobal::instance() );
    00726
    00729 #endif // SSK_KSTDDIRS_H

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:11 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003