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 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 00543 QString localkdedir() const; 00544 00549 QString localxdgdatadir() const; 00550 00555 QString localxdgconfdir() const; 00556 00563 static bool exists(const QString &fullPath); 00564 00573 static QString realPath(const QString &dirname); 00574 private: 00575 00576 QStringList prefixes; 00577 00578 // Directory dictionaries 00579 QDict<QStringList> absolutes; 00580 QDict<QStringList> relatives; 00581 00582 mutable QDict<QStringList> dircache; 00583 mutable QDict<QString> savelocations; 00584 00585 // Disallow assignment and copy-construction 00586 KStandardDirs( const KStandardDirs& ); 00587 KStandardDirs& operator= ( const KStandardDirs& ); 00588 00589 bool addedCustoms; 00590 00591 class KStandardDirsPrivate; 00592 KStandardDirsPrivate *d; 00593 00594 void checkConfig() const; 00595 void applyDataRestrictions(const QString &) const; 00596 void createSpecialResource(const char*); 00597 00598 // Like their publi counter parts but with an extra priority argument 00599 // If priority is true, the directory is added directly after 00600 // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME 00601 void addPrefix( const QString& dir, bool priority ); 00602 void addXdgConfigPrefix( const QString& dir, bool priority ); 00603 void addXdgDataPrefix( const QString& dir, bool priority ); 00604 00605 // If priority is true, the directory is added before any other, 00606 // otherwise after 00607 bool addResourceType( const char *type, 00608 const QString& relativename, bool priority ); 00609 bool addResourceDir( const char *type, 00610 const QString& absdir, bool priority); 00611 }; 00612 00669 QString locate( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() ); 00670 00680 QString locateLocal( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() ); 00681 00691 QString locateLocal( const char *type, const QString& filename, bool createDir, const KInstance* instance = KGlobal::instance() ); 00692 00695 #endif // SSK_KSTDDIRS_H
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:43:11 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003