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 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 00598 enum distroVersionType { DOWNLOAD = 0, POWERPACK, DISCOVERY, POWERPACKPLUS }; 00599 00600 static QString menu_type_by_version(); 00601 static QString default_menu_type_by_version(); 00602 static distroVersionType mandrake_distro_version(); 00603 00612 static QString realFilePath(const QString &filename); 00613 static QString mandrake_merge_directory(); 00614 00615 private: 00616 00617 QStringList prefixes; 00618 00619 // Directory dictionaries 00620 QDict<QStringList> absolutes; 00621 QDict<QStringList> relatives; 00622 00623 mutable QDict<QStringList> dircache; 00624 mutable QDict<QString> savelocations; 00625 00626 // Disallow assignment and copy-construction 00627 KStandardDirs( const KStandardDirs& ); 00628 KStandardDirs& operator= ( const KStandardDirs& ); 00629 00630 bool addedCustoms; 00631 00632 class KStandardDirsPrivate; 00633 KStandardDirsPrivate *d; 00634 00635 void checkConfig() const; 00636 void applyDataRestrictions(const QString &) const; 00637 void createSpecialResource(const char*); 00638 00639 // Like their public counter parts but with an extra priority argument 00640 // If priority is true, the directory is added directly after 00641 // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME 00642 void addPrefix( const QString& dir, bool priority ); 00643 void addXdgConfigPrefix( const QString& dir, bool priority ); 00644 void addXdgDataPrefix( const QString& dir, bool priority ); 00645 00646 // If priority is true, the directory is added before any other, 00647 // otherwise after 00648 bool addResourceType( const char *type, 00649 const QString& relativename, bool priority ); 00650 bool addResourceDir( const char *type, 00651 const QString& absdir, bool priority); 00652 }; 00653 00710 KDECORE_EXPORT QString locate( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() ); 00711 00721 KDECORE_EXPORT QString locateLocal( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() ); 00722 00732 KDECORE_EXPORT QString locateLocal( const char *type, const QString& filename, bool createDir, const KInstance* instance = KGlobal::instance() ); 00733 00736 #endif // SSK_KSTDDIRS_H
KDE Logo
This file is part of the documentation for kdecore Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:03:33 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003