• Skip to content
  • Skip to link menu
KDE 4.4 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 
00384     QStringList findDirs( const char *type,
00385                           const QString& reldir ) const;
00386 
00407     QString findResourceDir( const char *type,
00408                              const QString& filename) const;
00409 
00410 
00431     QStringList findAllResources( const char *type,
00432                                   const QString& filter = QString(),
00433                                   SearchOptions options = NoSearchOptions ) const;
00434 
00459     QStringList findAllResources( const char *type,
00460                                   const QString& filter,
00461                                   SearchOptions options,
00462                                   QStringList &relPaths) const;
00463 
00473     static QStringList systemPaths( const QString& pstr=QString() );
00474 
00495     static QString findExe( const QString& appname,
00496                             const QString& pathstr = QString(),
00497                             SearchOptions options = NoSearchOptions );
00498 
00517     static int findAllExe( QStringList& list, const QString& appname,
00518                            const QString& pathstr=QString(),
00519                            SearchOptions options = NoSearchOptions );
00520 
00530     bool addCustomized(KConfig *config);
00531 
00543     QStringList resourceDirs(const char *type) const;
00544 
00551     QStringList allTypes() const;
00552 
00570     QString saveLocation(const char *type,
00571                          const QString& suffix = QString(),
00572                          bool create = true) const;
00573 
00589     QString relativeLocation(const char *type, const QString &absPath);
00590 
00601     static bool makeDir(const QString& dir, int mode = 0755);
00602 
00641     static KDE_DEPRECATED QString kde_default(const char *type);
00642 
00646     QString kfsstnd_prefixes();
00647 
00651     QString kfsstnd_xdg_conf_prefixes();
00652 
00656     QString kfsstnd_xdg_data_prefixes();
00657 
00664     QString localkdedir() const;
00665 
00670     QString localxdgdatadir() const;
00671 
00676     QString localxdgconfdir() const;
00677 
00682     static QString installPath(const char *type);
00683 
00691     static bool exists(const QString &fullPath);
00692 
00700     static QString realPath(const QString &dirname);
00701 
00709     static QString realFilePath(const QString &filename);
00710 
00722     static QString locate( const char *type, const QString& filename, const KComponentData &cData = KGlobal::mainComponent() );
00723 
00738     static QString locateLocal( const char *type, const QString& filename, const KComponentData &cData = KGlobal::mainComponent() );
00739 
00756     static QString locateLocal( const char *type, const QString& filename, bool createDir, const KComponentData &cData = KGlobal::mainComponent() );
00757 
00774     static bool checkAccess(const QString& pathname, int mode);
00775 
00776 private:
00777     // Disallow assignment and copy-construction
00778     KStandardDirs( const KStandardDirs& );
00779     KStandardDirs& operator= ( const KStandardDirs& );
00780 
00781     class KStandardDirsPrivate;
00782     KStandardDirsPrivate* const d;
00783 
00784     // Like their public counter parts but with an extra priority argument
00785     // If priority is true, the directory is added directly after
00786     // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME
00787     void addPrefix( const QString& dir, bool priority );
00788     void addXdgConfigPrefix( const QString& dir, bool priority );
00789     void addXdgDataPrefix( const QString& dir, bool priority );
00790     void addKDEDefaults();
00791 
00792     void addResourcesFrom_krcdirs();
00793 };
00794 
00795 Q_DECLARE_OPERATORS_FOR_FLAGS(KStandardDirs::SearchOptions)
00796 
00797 #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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  •     Sodep
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.9-20090814
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