kdecore Library API Documentation

kstandarddirs.h

00001 /*
00002   This file is part of the KDE libraries
00003   Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
00004                      Stephan Kulow <coolo@kde.org>
00005              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 KStandardDirs
00126 {
00127 public:
00131     KStandardDirs( );
00132 
00136     virtual ~KStandardDirs();
00137 
00147     void addPrefix( const QString& dir );
00148 
00168     bool addResourceType( const char *type,
00169                   const QString& relativename );
00170 
00186     bool addResourceDir( const char *type,
00187                  const QString& absdir);
00188 
00207     QString findResource( const char *type,
00208                   const QString& filename ) const;
00209 
00225     bool isRestrictedResource( const char *type,
00226                   const QString& relPath=QString::null ) const;
00227 
00240     Q_UINT32 calcResourceHash( const char *type,
00241                   const QString& filename, bool deep) const;
00242 
00259     QStringList findDirs( const char *type,
00260                               const QString& reldir ) const;
00261 
00282     QString findResourceDir( const char *type,
00283                  const QString& filename) const;
00284 
00285 
00305     QStringList findAllResources( const char *type,
00306                        const QString& filter = QString::null,
00307                        bool recursive = false,
00308                        bool uniq = false) const;
00309 
00333     QStringList findAllResources( const char *type,
00334                        const QString& filter,
00335                        bool recursive,
00336                        bool uniq,
00337                        QStringList &relPaths) const;
00338 
00356     static QString findExe( const QString& appname,
00357                 const QString& pathstr=QString::null,
00358                 bool ignoreExecBit=false );
00359 
00378     static int findAllExe( QStringList& list, const QString& appname,
00379                    const QString& pathstr=QString::null,
00380                    bool ignoreExecBit=false );
00381 
00391     void addKDEDefaults();
00392 
00402     bool addCustomized(KConfig *config);
00403 
00415     QStringList resourceDirs(const char *type) const;
00416 
00423     QStringList allTypes() const;
00424 
00442      QString saveLocation(const char *type,
00443                   const QString& suffix = QString::null,
00444                   bool create = true) const;
00445 
00461          QString relativeLocation(const char *type, const QString &absPath);
00462 
00473     static bool makeDir(const QString& dir, int mode = 0755);
00474 
00502     static QString kde_default(const char *type);
00503 
00507     QString kfsstnd_prefixes();
00508 
00515     QString localkdedir() const;
00516 
00523     static bool exists(const QString &fullPath);
00524 
00533         static QString realPath(const QString &dirname);
00534  private:
00535 
00536     QStringList prefixes;
00537 
00538     // Directory dictionaries
00539     QDict<QStringList> absolutes;
00540     QDict<QStringList> relatives;
00541 
00542     mutable QDict<QStringList> dircache;
00543     mutable QDict<QString> savelocations;
00544 
00545     // Disallow assignment and copy-construction
00546     KStandardDirs( const KStandardDirs& );
00547     KStandardDirs& operator= ( const KStandardDirs& );
00548 
00549     bool addedCustoms;
00550 
00551         class KStandardDirsPrivate;
00552     KStandardDirsPrivate *d;
00553 
00554     void checkConfig() const;
00555     void applyDataRestrictions(const QString &) const;
00556 };
00557 
00614 QString locate( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() );
00615 
00625 QString locateLocal( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() );
00626 
00629 #endif // SSK_KSTDDIRS_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:20:42 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001