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 00576 enum distroVersionType { DOWNLOAD = 0, POWERPACK, DISCOVERY, POWERPACKPLUS }; 00577 00578 static QString menu_type_by_version(); 00579 static QString default_menu_type_by_version(); 00580 static distroVersionType mandrake_distro_version(); 00581 00582 private: 00583 00584 QStringList prefixes; 00585 00586 // Directory dictionaries 00587 QDict<QStringList> absolutes; 00588 QDict<QStringList> relatives; 00589 00590 mutable QDict<QStringList> dircache; 00591 mutable QDict<QString> savelocations; 00592 00593 // Disallow assignment and copy-construction 00594 KStandardDirs( const KStandardDirs& ); 00595 KStandardDirs& operator= ( const KStandardDirs& ); 00596 00597 bool addedCustoms; 00598 00599 class KStandardDirsPrivate; 00600 KStandardDirsPrivate *d; 00601 00602 void checkConfig() const; 00603 void applyDataRestrictions(const QString &) const; 00604 void createSpecialResource(const char*); 00605 00606 // Like their publi counter parts but with an extra priority argument 00607 // If priority is true, the directory is added directly after 00608 // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME 00609 void addPrefix( const QString& dir, bool priority ); 00610 void addXdgConfigPrefix( const QString& dir, bool priority ); 00611 void addXdgDataPrefix( const QString& dir, bool priority ); 00612 00613 // If priority is true, the directory is added before any other, 00614 // otherwise after 00615 bool addResourceType( const char *type, 00616 const QString& relativename, bool priority ); 00617 bool addResourceDir( const char *type, 00618 const QString& absdir, bool priority); 00619 }; 00620 00677 QString locate( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() ); 00678 00688 QString locateLocal( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() ); 00689 00699 QString locateLocal( const char *type, const QString& filename, bool createDir, const KInstance* instance = KGlobal::instance() ); 00700 00703 #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 Oct 8 11:14:02 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003