KDELibs4Support

kstandarddirs.h
1 /*
2  This file is part of the KDE libraries
3  Copyright (C) 1999 Sirtaj Singh Kang <[email protected]>
4  Copyright (C) 1999 Stephan Kulow <[email protected]>
5  Copyright (C) 1999 Waldo Bastian <[email protected]>
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 <kdelibs4support_export.h>
27 
28 #ifdef KDELIBS4SUPPORT_NO_DEPRECATED_NOISE
29 #warning "This file is deprecated."
30 #endif
31 
32 #include <QStringList>
33 #include <QMap>
34 
35 class KConfig;
36 
177 class KDELIBS4SUPPORT_DEPRECATED_EXPORT_NOISE KStandardDirs
178 {
179 public:
194  KStandardDirs();
195 
196  enum SearchOption { NoSearchOptions = 0,
197  Recursive = 1,
198  NoDuplicates = 2,
199  IgnoreExecBit = 4
200  };
201  Q_DECLARE_FLAGS(SearchOptions, SearchOption)
202 
203 
206  virtual ~KStandardDirs();
207 
219  void addPrefix(const QString &dir);
220 
228  void addXdgConfigPrefix(const QString &dir);
229 
236  void addXdgDataPrefix(const QString &dir);
237 
261 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
262  KDELIBS4SUPPORT_DEPRECATED bool addResourceType(const char *type,
263  const QString &relativename, bool priority = true);
264 #endif
265 
287  bool addResourceType(const char *type, const char *basetype,
288  const QString &relativename, bool priority = true);
289 
291  bool addResourceType(const char *type, const char *basetype,
292  const char *relativename, bool priority = true)
293  {
294  return addResourceType(type, basetype, QLatin1String(relativename), priority);
295  }
296 
314  bool addResourceDir(const char *type,
315  const QString &absdir, bool priority = true);
316 
344  QString findResource(const char *type,
345  const QString &filename) const;
346 
361  bool isRestrictedResource(const char *type,
362  const QString &relPath = QString()) const;
363 
379 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
380  KDELIBS4SUPPORT_DEPRECATED quint32 calcResourceHash(const char *type,
381  const QString &filename,
382  SearchOptions options = NoSearchOptions) const;
383 #endif
384 
403  QStringList findDirs(const char *type,
404  const QString &reldir) const;
405 
426  QString findResourceDir(const char *type,
427  const QString &filename) const;
428 
449  QStringList findAllResources(const char *type,
450  const QString &filter = QString(),
451  SearchOptions options = NoSearchOptions) const;
452 
481  QStringList findAllResources(const char *type,
482  const QString &filter,
483  SearchOptions options,
484  QStringList &relPaths) const;
485 
495  static QStringList systemPaths(const QString &pstr = QString());
496 
517  static QString findExe(const QString &appname,
518  const QString &pathstr = QString(),
519  SearchOptions options = NoSearchOptions);
520 
539  static int findAllExe(QStringList &list, const QString &appname,
540  const QString &pathstr = QString(),
541  SearchOptions options = NoSearchOptions);
542 
552  bool addCustomized(KConfig *config);
553 
565  QStringList resourceDirs(const char *type) const;
566 
573  QStringList allTypes() const;
574 
592  QString saveLocation(const char *type,
593  const QString &suffix = QString(),
594  bool create = true) const;
595 
625 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
626  KDELIBS4SUPPORT_DEPRECATED QString relativeLocation(const char *type, const QString &absPath) const;
627 #endif
628 
640 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
641  KDELIBS4SUPPORT_DEPRECATED static bool makeDir(const QString &dir, int mode = 0755);
642 #endif
643 
682 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
683  static KDELIBS4SUPPORT_DEPRECATED QString kde_default(const char *type);
684 #endif
685 
691 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
692  KDELIBS4SUPPORT_DEPRECATED QString kfsstnd_prefixes();
693 #endif
694 
704 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
705  KDELIBS4SUPPORT_DEPRECATED QString localkdedir() const;
706 #endif
707 
713 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
714  KDELIBS4SUPPORT_DEPRECATED QString localxdgdatadir() const;
715 #endif
716 
722 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
723  KDELIBS4SUPPORT_DEPRECATED QString localxdgconfdir() const;
724 #endif
725 
731  static QString installPath(const char *type);
732 
741 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
742  KDELIBS4SUPPORT_DEPRECATED static bool exists(const QString &fullPath);
743 #endif
744 
754  static QString realPath(const QString &dirname);
755 
765  static QString realFilePath(const QString &filename);
766 
777  static QString locate(const char *type, const QString &filename);
778 
792  static QString locateLocal(const char *type, const QString &filename);
793 
809  static QString locateLocal(const char *type, const QString &filename, bool createDir);
810 
827  static bool checkAccess(const QString &pathname, int mode);
828 
829 private:
830  // Disallow assignment and copy-construction
831  KStandardDirs(const KStandardDirs &);
832  KStandardDirs &operator= (const KStandardDirs &);
833 
834  class KStandardDirsPrivate;
835  KStandardDirsPrivate *const d;
836 
837  // Like their public counter parts but with an extra priority argument
838  // If priority is true, the directory is added directly after
839  // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME
840  void addPrefix(const QString &dir, bool priority);
841  void addXdgConfigPrefix(const QString &dir, bool priority);
842  void addXdgDataPrefix(const QString &dir, bool priority);
843  void addKDEDefaults();
844 
845  void addResourcesFrom_krcdirs();
846 };
847 
848 Q_DECLARE_OPERATORS_FOR_FLAGS(KStandardDirs::SearchOptions)
849 
850 #endif // KSTANDARDDIRS_H
bool addResourceType(const char *type, const char *basetype, const char *relativename, bool priority=true)
Site-independent access to standard KDE directories.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jul 5 2020 22:58:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.