• Skip to content
  • Skip to link menu
KDE 4.1 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 KStandardDirsPrivate;
00031 class KConfig;
00032 
00175 class KDECORE_EXPORT KStandardDirs
00176 {
00177 public:
00181     KStandardDirs();
00182 
00183     enum SearchOption { NoSearchOptions = 0,
00184                         Recursive = 1,
00185                         NoDuplicates = 2,
00186                         IgnoreExecBit = 4 };
00187     Q_DECLARE_FLAGS( SearchOptions, SearchOption )
00188 
00189     
00192     virtual ~KStandardDirs();
00193 
00203     void addPrefix( const QString& dir );
00204 
00212     void addXdgConfigPrefix( const QString& dir );
00213 
00221     void addXdgDataPrefix( const QString& dir );
00222 
00246     KDE_DEPRECATED bool addResourceType( const char *type,
00247                                          const QString& relativename, bool priority = true );
00248 
00270     bool addResourceType( const char *type, const char *basetype,
00271                           const QString& relativename, bool priority = true );
00272 
00274     bool addResourceType( const char *type, const char *basetype,
00275                           const char* relativename, bool priority = true )
00276     {
00277         return addResourceType(type, basetype, QLatin1String(relativename), priority);
00278     }
00279 
00297     bool addResourceDir( const char *type,
00298                          const QString& absdir, bool priority = true );
00299 
00318     QString findResource( const char *type,
00319                           const QString& filename ) const;
00320 
00335     bool isRestrictedResource( const char *type,
00336                                const QString& relPath=QString() ) const;
00337 
00351     quint32 calcResourceHash( const char *type,
00352                               const QString& filename,
00353                               SearchOptions options = NoSearchOptions) const;
00354 
00371     QStringList findDirs( const char *type,
00372                           const QString& reldir ) const;
00373 
00394     QString findResourceDir( const char *type,
00395                              const QString& filename) const;
00396 
00397 
00416     QStringList findAllResources( const char *type,
00417                                   const QString& filter = QString(),
00418                                   SearchOptions options = NoSearchOptions ) const;
00419 
00442     QStringList findAllResources( const char *type,
00443                                   const QString& filter,
00444                                   SearchOptions options,
00445                                   QStringList &relPaths) const;
00446 
00456     static QStringList systemPaths( const QString& pstr=QString() );
00457 
00478     static QString findExe( const QString& appname,
00479                             const QString& pathstr = QString(),
00480                             SearchOptions options = NoSearchOptions );
00481 
00500     static int findAllExe( QStringList& list, const QString& appname,
00501                            const QString& pathstr=QString(),
00502                            SearchOptions options = NoSearchOptions );
00503 
00513     bool addCustomized(KConfig *config);
00514 
00526     QStringList resourceDirs(const char *type) const;
00527 
00534     QStringList allTypes() const;
00535 
00553     QString saveLocation(const char *type,
00554                          const QString& suffix = QString(),
00555                          bool create = true) const;
00556 
00572     QString relativeLocation(const char *type, const QString &absPath);
00573 
00584     static bool makeDir(const QString& dir, int mode = 0755);
00585 
00624     static KDE_DEPRECATED QString kde_default(const char *type);
00625 
00629     QString kfsstnd_prefixes();
00630 
00634     QString kfsstnd_xdg_conf_prefixes();
00635 
00639     QString kfsstnd_xdg_data_prefixes();
00640 
00647     QString localkdedir() const;
00648 
00653     QString localxdgdatadir() const;
00654 
00659     QString localxdgconfdir() const;
00660 
00665     static QString installPath(const char *type);
00666 
00674     static bool exists(const QString &fullPath);
00675 
00683     static QString realPath(const QString &dirname);
00684 
00692     static QString realFilePath(const QString &filename);
00693 
00705     static QString locate( const char *type, const QString& filename, const KComponentData &cData = KGlobal::mainComponent() );
00706 
00721     static QString locateLocal( const char *type, const QString& filename, const KComponentData &cData = KGlobal::mainComponent() );
00722 
00739     static QString locateLocal( const char *type, const QString& filename, bool createDir, const KComponentData &cData = KGlobal::mainComponent() );
00740 
00757     static bool checkAccess(const QString& pathname, int mode);
00758 
00759 private:
00760     // Disallow assignment and copy-construction
00761     KStandardDirs( const KStandardDirs& );
00762     KStandardDirs& operator= ( const KStandardDirs& );
00763 
00764     class KStandardDirsPrivate;
00765     KStandardDirsPrivate* const d;
00766 
00767     void applyDataRestrictions(const QString &) const;
00768     void createSpecialResource(const char*);
00769 
00770     // Like their public counter parts but with an extra priority argument
00771     // If priority is true, the directory is added directly after
00772     // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME
00773     void addPrefix( const QString& dir, bool priority );
00774     void addXdgConfigPrefix( const QString& dir, bool priority );
00775     void addXdgDataPrefix( const QString& dir, bool priority );
00776     void addKDEDefaults();
00777 
00778     void addResourcesFrom_krcdirs();
00779 };
00780 
00781 Q_DECLARE_OPERATORS_FOR_FLAGS(KStandardDirs::SearchOptions)
00782 
00783 #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
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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