• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdecore
 

kdecore

  • kdecore
kconfigbackend.h
1 /*
2  This file is part of the KDE libraries
3  Copyright (c) 1999 Preston Brown <pbrown@kde.org>
4  Portions copyright (c) 1997 Matthias Kalle Dalheimer <kalle@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef _KCONFIGBACKEND_H
23 #define _KCONFIGBACKEND_H
24 
25 #include "kconfigdata.h"
26 #include <kconfigbase.h>
27 #include <klockfile.h>
28 #include <klocale.h>
29 #include "kdelibs_export.h"
30 
31 class TQFile;
32 class KConfigBackEndPrivate;
33 
48 class KDECORE_EXPORT KConfigBackEnd
49 {
50  friend class KConfig;
51  friend class KSharedConfig;
52 public:
68  KConfigBackEnd(KConfigBase *_config, const TQString &_fileName,
69  const char * _resType, bool _useKDEGlobals);
70 
74  virtual ~KConfigBackEnd();
75 
82  virtual bool parseConfigFiles() = 0;
83 
93  virtual void sync(bool bMerge = true) = 0;
94 
105  void changeFileName(const TQString &_fileName, const char * _resType,
106  bool _useKDEGlobals);
107 
113  virtual KConfigBase::ConfigState getConfigState() const
114  { return mConfigState; }
115 
120  TQString fileName() const { return mfileName; }
121 
126  const char * resource() const { return resType; }
127 
133  void setLocaleString(const TQCString &_localeString) { localeString = _localeString; }
134 
139  void setFileWriteMode(int mode);
140 
147  bool checkConfigFilesWritable(bool warnUser);
148 
154  KLockFile::Ptr lockFile( bool bGlobal = false );
155 
156 #ifdef KDE_NO_COMPAT
157 private:
158 #endif
162  KDE_DEPRECATED TQString filename() const { return mfileName; }
163 
164 protected:
165  KConfigBase *pConfig;
166 
167  TQString mfileName;
168  TQCString resType;
169  bool useKDEGlobals : 1;
170  bool bFileImmutable : 1;
171  TQCString localeString;
172  TQString mLocalFileName;
173  TQString mGlobalFileName;
174  KConfigBase::ConfigState mConfigState;
175  int mFileMode;
176 
177 protected:
178  virtual void virtual_hook( int id, void* data );
179 protected:
180  class KConfigBackEndPrivate;
181  KConfigBackEndPrivate *d;
182 };
183 
184 
191 class KDECORE_EXPORT KConfigINIBackEnd : public KConfigBackEnd
192 {
193 
194 public:
210  KConfigINIBackEnd(KConfigBase *_config, const TQString &_fileName,
211  const char * _resType, bool _useKDEGlobals = true)
212  : KConfigBackEnd(_config, _fileName, _resType, _useKDEGlobals) {}
213 
217  virtual ~KConfigINIBackEnd() {}
218 
224  bool parseConfigFiles();
225 
233  virtual void sync(bool bMerge = true);
234 
235 protected:
251  void parseSingleConfigFile(TQFile& rFile, KEntryMap *pWriteBackMap = 0L,
252  bool bGlobal = false, bool bDefault = false);
253 
254  // Kubuntu patch, 2006-08-03
255  // looks up a key in with KLocale
256  // see https://launchpad.net/distros/ubuntu/+spec/langpacks-desktopfiles-kde
257  void translateKey(KLocale& locale, TQCString currentGroup, TQCString key);
258 
273  bool writeConfigFile(TQString filename, bool bGlobal = false, bool bMerge = true);
274 
287  bool getEntryMap(KEntryMap &map, bool bGlobal, TQFile *mergeFile);
288 
290  void writeEntries(FILE *pStream, const KEntryMap &aTempMap);
291 
292 protected:
293  virtual void virtual_hook( int id, void* data );
294 private:
295  class KConfigINIBackEndPrivate;
296  KConfigINIBackEndPrivate *not_d;
297 };
298 
299 #endif
KConfigBackEnd
Abstract base class for KDE configuration file loading/saving.
Definition: kconfigbackend.h:49
KConfigBackEnd::filename
KDE_DEPRECATED TQString filename() const
Definition: kconfigbackend.h:162
KConfigBackEnd::resource
const char * resource() const
Returns the resource type as passed to the constructor.
Definition: kconfigbackend.h:126
KConfigBackEnd::setLocaleString
void setLocaleString(const TQCString &_localeString)
Set the locale string that defines the current language.
Definition: kconfigbackend.h:133
KConfigBackEnd::parseConfigFiles
virtual bool parseConfigFiles()=0
Parses all configuration files for a configuration object.
KConfigBackEnd::sync
virtual void sync(bool bMerge=true)=0
Writes configuration data to file(s).
KConfigBackEnd::getConfigState
virtual KConfigBase::ConfigState getConfigState() const
Returns the state of the app-config object.
Definition: kconfigbackend.h:113
KConfigBackEnd::fileName
TQString fileName() const
Returns the filename as passed to the constructor.
Definition: kconfigbackend.h:120
KConfigBase
KDE Configuration Management abstract base class.
Definition: kconfigbase.h:71
KConfigBase::checkConfigFilesWritable
bool checkConfigFilesWritable(bool warnUser)
Check whether the config files are writable.
Definition: kconfigbase.cpp:1942
KConfigBase::ConfigState
ConfigState
Possible return values for getConfigState().
Definition: kconfigbase.h:1805
KConfigINIBackEnd
Class for KDE INI-style configuration file loading/saving.
Definition: kconfigbackend.h:192
KConfigINIBackEnd::KConfigINIBackEnd
KConfigINIBackEnd(KConfigBase *_config, const TQString &_fileName, const char *_resType, bool _useKDEGlobals=true)
Constructs an ini-style configuration back end.
Definition: kconfigbackend.h:210
KConfigINIBackEnd::~KConfigINIBackEnd
virtual ~KConfigINIBackEnd()
Destructs the configuration backend.
Definition: kconfigbackend.h:217
KConfig
Access KDE Configuration entries.
Definition: kconfig.h:44
KConfig::setFileWriteMode
void setFileWriteMode(int mode)
Set the file mode for newly created files.
Definition: kconfig.cpp:275
KConfig::lockFile
KLockFile::Ptr lockFile(bool bGlobal=false)
Returns a lock file object for the configuration file or 0 if the backend does not support locking.
Definition: kconfig.cpp:280
KLocale
KLocale provides support for country specific stuff like the national language.
Definition: klocale.h:125
KSharedConfig
KConfig variant using shared memory.
Definition: kconfig.h:274
KSharedPtr< KLockFile >
klocale.h

kdecore

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

kdecore

Skip menu "kdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |