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

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • kernel
kstandarddirs.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE libraries
3  Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
4  Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
5  Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef KSTANDARDDIRS_H
24 #define KSTANDARDDIRS_H
25 
26 #include <QtCore/QStringList>
27 #include <kglobal.h>
28 #include <QtCore/QMap>
29 
30 class KConfig;
31 
171 class KDECORE_EXPORT KStandardDirs
172 {
173 public:
188  KStandardDirs();
189 
190  enum SearchOption { NoSearchOptions = 0,
191  Recursive = 1,
192  NoDuplicates = 2,
193  IgnoreExecBit = 4 };
194  Q_DECLARE_FLAGS( SearchOptions, SearchOption )
195 
196 
199  virtual ~KStandardDirs();
200 
210  void addPrefix( const QString& dir );
211 
219  void addXdgConfigPrefix( const QString& dir );
220 
228  void addXdgDataPrefix( const QString& dir );
229 
253 #ifndef KDE_NO_DEPRECATED
254  KDE_DEPRECATED bool addResourceType( const char *type,
255  const QString& relativename, bool priority = true );
256 #endif
257 
279  bool addResourceType( const char *type, const char *basetype,
280  const QString& relativename, bool priority = true );
281 
283  bool addResourceType( const char *type, const char *basetype,
284  const char* relativename, bool priority = true )
285  {
286  return addResourceType(type, basetype, QLatin1String(relativename), priority);
287  }
288 
306  bool addResourceDir( const char *type,
307  const QString& absdir, bool priority = true );
308 
336  QString findResource( const char *type,
337  const QString& filename ) const;
338 
353  bool isRestrictedResource( const char *type,
354  const QString& relPath=QString() ) const;
355 
369  quint32 calcResourceHash( const char *type,
370  const QString& filename,
371  SearchOptions options = NoSearchOptions) const;
372 
391  QStringList findDirs( const char *type,
392  const QString& reldir ) const;
393 
414  QString findResourceDir( const char *type,
415  const QString& filename) const;
416 
417 
438  QStringList findAllResources( const char *type,
439  const QString& filter = QString(),
440  SearchOptions options = NoSearchOptions ) const;
441 
470  QStringList findAllResources( const char *type,
471  const QString& filter,
472  SearchOptions options,
473  QStringList &relPaths) const;
474 
484  static QStringList systemPaths( const QString& pstr=QString() );
485 
506  static QString findExe( const QString& appname,
507  const QString& pathstr = QString(),
508  SearchOptions options = NoSearchOptions );
509 
528  static int findAllExe( QStringList& list, const QString& appname,
529  const QString& pathstr=QString(),
530  SearchOptions options = NoSearchOptions );
531 
541  bool addCustomized(KConfig *config);
542 
554  QStringList resourceDirs(const char *type) const;
555 
562  QStringList allTypes() const;
563 
581  QString saveLocation(const char *type,
582  const QString& suffix = QString(),
583  bool create = true) const;
584 
600  QString relativeLocation(const char *type, const QString &absPath);
601 
612  static bool makeDir(const QString& dir, int mode = 0755);
613 
652 #ifndef KDE_NO_DEPRECATED
653  static KDE_DEPRECATED QString kde_default(const char *type);
654 #endif
655 
659  QString kfsstnd_prefixes();
660 
664  QString kfsstnd_xdg_conf_prefixes();
665 
669  QString kfsstnd_xdg_data_prefixes();
670 
677  QString localkdedir() const;
678 
683  QString localxdgdatadir() const;
684 
689  QString localxdgconfdir() const;
690 
695  static QString installPath(const char *type);
696 
704  static bool exists(const QString &fullPath);
705 
713  static QString realPath(const QString &dirname);
714 
722  static QString realFilePath(const QString &filename);
723 
735  static QString locate( const char *type, const QString& filename, const KComponentData &cData = KGlobal::mainComponent() );
736 
751  static QString locateLocal( const char *type, const QString& filename, const KComponentData &cData = KGlobal::mainComponent() );
752 
769  static QString locateLocal( const char *type, const QString& filename, bool createDir, const KComponentData &cData = KGlobal::mainComponent() );
770 
787  static bool checkAccess(const QString& pathname, int mode);
788 
789 private:
790  // Disallow assignment and copy-construction
791  KStandardDirs( const KStandardDirs& );
792  KStandardDirs& operator= ( const KStandardDirs& );
793 
794  class KStandardDirsPrivate;
795  KStandardDirsPrivate* const d;
796 
797  // Like their public counter parts but with an extra priority argument
798  // If priority is true, the directory is added directly after
799  // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME
800  void addPrefix( const QString& dir, bool priority );
801  void addXdgConfigPrefix( const QString& dir, bool priority );
802  void addXdgDataPrefix( const QString& dir, bool priority );
803  void addKDEDefaults();
804 
805  void addResourcesFrom_krcdirs();
806 };
807 
808 Q_DECLARE_OPERATORS_FOR_FLAGS(KStandardDirs::SearchOptions)
809 
810 #endif // KSTANDARDDIRS_H
quint32
KStandardDirs::addResourceType
bool addResourceType(const char *type, const char *basetype, const char *relativename, bool priority=true)
Definition: kstandarddirs.h:283
KGlobal::config
KSharedConfigPtr config()
Returns the general config object.
Definition: kglobal.cpp:139
kglobal.h
KStandardDirs
Site-independent access to standard KDE directories.
Definition: kstandarddirs.h:171
QString
QStringList
KConfig
The central class of the KDE configuration data system.
Definition: kconfig.h:70
QLatin1String
KGlobal::mainComponent
const KComponentData & mainComponent()
Returns the global component data.
Definition: kglobal.cpp:145
KComponentData
Per component data.
Definition: kcomponentdata.h:46
KStandardDirs::SearchOption
SearchOption
Definition: kstandarddirs.h:190
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal