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 00126 class KStandardDirs 00127 { 00128 public: 00132 KStandardDirs( ); 00133 00137 virtual ~KStandardDirs(); 00138 00148 void addPrefix( const QString& dir ); 00149 00157 void addXdgConfigPrefix( const QString& dir ); 00158 00166 void addXdgDataPrefix( const QString& dir ); 00167 00187 bool addResourceType( const char *type, 00188 const QString& relativename ); 00189 00205 bool addResourceDir( const char *type, 00206 const QString& absdir); 00207 00226 QString findResource( const char *type, 00227 const QString& filename ) const; 00228 00244 bool isRestrictedResource( const char *type, 00245 const QString& relPath=QString::null ) const; 00246 00259 Q_UINT32 calcResourceHash( const char *type, 00260 const QString& filename, bool deep) const; 00261 00278 QStringList findDirs( const char *type, 00279 const QString& reldir ) const; 00280 00301 QString findResourceDir( const char *type, 00302 const QString& filename) const; 00303 00304 00324 QStringList findAllResources( const char *type, 00325 const QString& filter = QString::null, 00326 bool recursive = false, 00327 bool unique = false) const; 00328 00351 QStringList findAllResources( const char *type, 00352 const QString& filter, 00353 bool recursive, 00354 bool unique, 00355 QStringList &relPaths) const; 00356 00366 static QStringList systemPaths( const QString& pstr=QString::null ); 00367 00385 static QString findExe( const QString& appname, 00386 const QString& pathstr=QString::null, 00387 bool ignoreExecBit=false ); 00388 00407 static int findAllExe( QStringList& list, const QString& appname, 00408 const QString& pathstr=QString::null, 00409 bool ignoreExecBit=false ); 00410 00420 void addKDEDefaults(); 00421 00431 bool addCustomized(KConfig *config); 00432 00444 QStringList resourceDirs(const char *type) const; 00445 00452 QStringList allTypes() const; 00453 00471 QString saveLocation(const char *type, 00472 const QString& suffix = QString::null, 00473 bool create = true) const; 00474 00490 QString relativeLocation(const char *type, const QString &absPath); 00491 00502 static bool makeDir(const QString& dir, int mode = 0755); 00503 00531 static QString kde_default(const char *type); 00532 00536 QString kfsstnd_prefixes(); 00537 00544 QString localkdedir() const; 00545 00550 QString localxdgdatadir() const; 00551 00556 QString localxdgconfdir() const; 00557 00564 static bool exists(const QString &fullPath); 00565 00574 static QString realPath(const QString &dirname); 00575 private: 00576 00577 QStringList prefixes; 00578 00579 // Directory dictionaries 00580 QDict<QStringList> absolutes; 00581 QDict<QStringList> relatives; 00582 00583 mutable QDict<QStringList> dircache; 00584 mutable QDict<QString> savelocations; 00585 00586 // Disallow assignment and copy-construction 00587 KStandardDirs( const KStandardDirs& ); 00588 KStandardDirs& operator= ( const KStandardDirs& ); 00589 00590 bool addedCustoms; 00591 00592 class KStandardDirsPrivate; 00593 KStandardDirsPrivate *d; 00594 00595 void checkConfig() const; 00596 void applyDataRestrictions(const QString &) const; 00597 void createSpecialResource(const char*); 00598 00599 // Like their publi counter parts but with an extra priority argument 00600 // If priority is true, the directory is added directly after 00601 // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME 00602 void addPrefix( const QString& dir, bool priority ); 00603 void addXdgConfigPrefix( const QString& dir, bool priority ); 00604 void addXdgDataPrefix( const QString& dir, bool priority ); 00605 00606 // If priority is true, the directory is added before any other, 00607 // otherwise after 00608 bool addResourceType( const char *type, 00609 const QString& relativename, bool priority ); 00610 bool addResourceDir( const char *type, 00611 const QString& absdir, bool priority); 00612 }; 00613 00670 QString locate( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() ); 00671 00681 QString locateLocal( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() ); 00682 00692 QString locateLocal( const char *type, const QString& filename, bool createDir, const KInstance* instance = KGlobal::instance() ); 00693 00696 #endif // SSK_KSTDDIRS_H
KDE Logo
This file is part of the documentation for kdecore Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 20 09:48:27 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003