• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDECore

kstandarddirs.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00020   Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #ifndef KSTANDARDDIRS_H
00024 #define KSTANDARDDIRS_H
00025 
00026 #include <QtCore/QStringList>
00027 #include <kglobal.h>
00028 #include <QtCore/QMap>
00029 
00030 class KConfig;
00031 
00175 class KDECORE_EXPORT KStandardDirs
00176 {
00177 public:
00192     KStandardDirs();
00193 
00194     enum SearchOption { NoSearchOptions = 0,
00195                         Recursive = 1,
00196                         NoDuplicates = 2,
00197                         IgnoreExecBit = 4 };
00198     Q_DECLARE_FLAGS( SearchOptions, SearchOption )
00199 
00200     
00203     virtual ~KStandardDirs();
00204 
00214     void addPrefix( const QString& dir );
00215 
00223     void addXdgConfigPrefix( const QString& dir );
00224 
00232     void addXdgDataPrefix( const QString& dir );
00233 
00257     KDE_DEPRECATED bool addResourceType( const char *type,
00258                                          const QString& relativename, bool priority = true );
00259 
00281     bool addResourceType( const char *type, const char *basetype,
00282                           const QString& relativename, bool priority = true );
00283 
00285     bool addResourceType( const char *type, const char *basetype,
00286                           const char* relativename, bool priority = true )
00287     {
00288         return addResourceType(type, basetype, QLatin1String(relativename), priority);
00289     }
00290 
00308     bool addResourceDir( const char *type,
00309                          const QString& absdir, bool priority = true );
00310 
00329     QString findResource( const char *type,
00330                           const QString& filename ) const;
00331 
00346     bool isRestrictedResource( const char *type,
00347                                const QString& relPath=QString() ) const;
00348 
00362     quint32 calcResourceHash( const char *type,
00363                               const QString& filename,
00364                               SearchOptions options = NoSearchOptions) const;
00365 
00382     QStringList findDirs( const char *type,
00383                           const QString& reldir ) const;
00384 
00405     QString findResourceDir( const char *type,
00406                              const QString& filename) const;
00407 
00408 
00429     QStringList findAllResources( const char *type,
00430                                   const QString& filter = QString(),
00431                                   SearchOptions options = NoSearchOptions ) const;
00432 
00457     QStringList findAllResources( const char *type,
00458                                   const QString& filter,
00459                                   SearchOptions options,
00460                                   QStringList &relPaths) const;
00461 
00471     static QStringList systemPaths( const QString& pstr=QString() );
00472 
00493     static QString findExe( const QString& appname,
00494                             const QString& pathstr = QString(),
00495                             SearchOptions options = NoSearchOptions );
00496 
00515     static int findAllExe( QStringList& list, const QString& appname,
00516                            const QString& pathstr=QString(),
00517                            SearchOptions options = NoSearchOptions );
00518 
00528     bool addCustomized(KConfig *config);
00529 
00541     QStringList resourceDirs(const char *type) const;
00542 
00549     QStringList allTypes() const;
00550 
00568     QString saveLocation(const char *type,
00569                          const QString& suffix = QString(),
00570                          bool create = true) const;
00571 
00587     QString relativeLocation(const char *type, const QString &absPath);
00588 
00599     static bool makeDir(const QString& dir, int mode = 0755);
00600 
00639     static KDE_DEPRECATED QString kde_default(const char *type);
00640 
00644     QString kfsstnd_prefixes();
00645 
00649     QString kfsstnd_xdg_conf_prefixes();
00650 
00654     QString kfsstnd_xdg_data_prefixes();
00655 
00662     QString localkdedir() const;
00663 
00668     QString localxdgdatadir() const;
00669 
00674     QString localxdgconfdir() const;
00675 
00680     static QString installPath(const char *type);
00681 
00689     static bool exists(const QString &fullPath);
00690 
00698     static QString realPath(const QString &dirname);
00699 
00707     static QString realFilePath(const QString &filename);
00708 
00720     static QString locate( const char *type, const QString& filename, const KComponentData &cData = KGlobal::mainComponent() );
00721 
00736     static QString locateLocal( const char *type, const QString& filename, const KComponentData &cData = KGlobal::mainComponent() );
00737 
00754     static QString locateLocal( const char *type, const QString& filename, bool createDir, const KComponentData &cData = KGlobal::mainComponent() );
00755 
00772     static bool checkAccess(const QString& pathname, int mode);
00773 
00774 private:
00775     // Disallow assignment and copy-construction
00776     KStandardDirs( const KStandardDirs& );
00777     KStandardDirs& operator= ( const KStandardDirs& );
00778 
00779     class KStandardDirsPrivate;
00780     KStandardDirsPrivate* const d;
00781 
00782     // Like their public counter parts but with an extra priority argument
00783     // If priority is true, the directory is added directly after
00784     // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME
00785     void addPrefix( const QString& dir, bool priority );
00786     void addXdgConfigPrefix( const QString& dir, bool priority );
00787     void addXdgDataPrefix( const QString& dir, bool priority );
00788     void addKDEDefaults();
00789 
00790     void addResourcesFrom_krcdirs();
00791 };
00792 
00793 Q_DECLARE_OPERATORS_FOR_FLAGS(KStandardDirs::SearchOptions)
00794 
00795 #endif // KSTANDARDDIRS_H

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal