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

tdecore

  • tdecore
tdeconfigbackend.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 _TDECONFIGBACKEND_H
23 #define _TDECONFIGBACKEND_H
24 
25 #include "tdeconfigdata.h"
26 #include <tdeconfigbase.h>
27 #include <klockfile.h>
28 #include <tdelocale.h>
29 #include "tdelibs_export.h"
30 
31 class TQFile;
32 class TDEConfigBackEndPrivate;
33 
48 class TDECORE_EXPORT TDEConfigBackEnd
49 {
50  friend class TDEConfig;
51  friend class TDESharedConfig;
52 public:
68  TDEConfigBackEnd(TDEConfigBase *_config, const TQString &_fileName,
69  const char * _resType, bool _useKDEGlobals);
70 
74  virtual ~TDEConfigBackEnd();
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 TDEConfigBase::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  TDELockFile::Ptr lockFile( bool bGlobal = false );
155 
156 #ifdef KDE_NO_COMPAT
157 private:
158 #endif
162  TDE_DEPRECATED TQString filename() const { return mfileName; }
163 
164 protected:
165  TDEConfigBase *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  TDEConfigBase::ConfigState mConfigState;
175  int mFileMode;
176 
177 protected:
178  virtual void virtual_hook( int id, void* data );
179 protected:
180  class TDEConfigBackEndPrivate;
181  TDEConfigBackEndPrivate *d;
182 };
183 
184 
191 class TDECORE_EXPORT TDEConfigINIBackEnd : public TDEConfigBackEnd
192 {
193 
194 public:
210  TDEConfigINIBackEnd(TDEConfigBase *_config, const TQString &_fileName,
211  const char * _resType, bool _useKDEGlobals = true)
212  : TDEConfigBackEnd(_config, _fileName, _resType, _useKDEGlobals) {}
213 
217  virtual ~TDEConfigINIBackEnd() {}
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 TDELocale
256  // see https://launchpad.net/distros/ubuntu/+spec/langpacks-desktopfiles-kde
257  void translateKey(TDELocale& 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 TDEConfigINIBackEndPrivate;
296  TDEConfigINIBackEndPrivate *not_d;
297 };
298 
299 #endif
TDEConfigBackEnd
Abstract base class for KDE configuration file loading/saving.
Definition: tdeconfigbackend.h:49
TDEConfigBackEnd::parseConfigFiles
virtual bool parseConfigFiles()=0
Parses all configuration files for a configuration object.
TDEConfigBackEnd::setLocaleString
void setLocaleString(const TQCString &_localeString)
Set the locale string that defines the current language.
Definition: tdeconfigbackend.h:133
TDEConfigBackEnd::filename
TDE_DEPRECATED TQString filename() const
Definition: tdeconfigbackend.h:162
TDEConfigBackEnd::fileName
TQString fileName() const
Returns the filename as passed to the constructor.
Definition: tdeconfigbackend.h:120
TDEConfigBackEnd::resource
const char * resource() const
Returns the resource type as passed to the constructor.
Definition: tdeconfigbackend.h:126
TDEConfigBackEnd::sync
virtual void sync(bool bMerge=true)=0
Writes configuration data to file(s).
TDEConfigBackEnd::getConfigState
virtual TDEConfigBase::ConfigState getConfigState() const
Returns the state of the app-config object.
Definition: tdeconfigbackend.h:113
TDEConfigBase
KDE Configuration Management abstract base class.
Definition: tdeconfigbase.h:71
TDEConfigBase::ConfigState
ConfigState
Possible return values for getConfigState().
Definition: tdeconfigbase.h:1828
TDEConfigBase::checkConfigFilesWritable
bool checkConfigFilesWritable(bool warnUser)
Check whether the config files are writable.
Definition: tdeconfigbase.cpp:1904
TDEConfigINIBackEnd
Class for KDE INI-style configuration file loading/saving.
Definition: tdeconfigbackend.h:192
TDEConfigINIBackEnd::TDEConfigINIBackEnd
TDEConfigINIBackEnd(TDEConfigBase *_config, const TQString &_fileName, const char *_resType, bool _useKDEGlobals=true)
Constructs an ini-style configuration back end.
Definition: tdeconfigbackend.h:210
TDEConfigINIBackEnd::~TDEConfigINIBackEnd
virtual ~TDEConfigINIBackEnd()
Destructs the configuration backend.
Definition: tdeconfigbackend.h:217
TDEConfig
Access KDE Configuration entries.
Definition: tdeconfig.h:44
TDEConfig::lockFile
TDELockFile::Ptr lockFile(bool bGlobal=false)
Returns a lock file object for the configuration file or 0 if the backend does not support locking.
Definition: tdeconfig.cpp:280
TDEConfig::setFileWriteMode
void setFileWriteMode(int mode)
Set the file mode for newly created files.
Definition: tdeconfig.cpp:275
TDELocale
TDELocale provides support for country specific stuff like the national language.
Definition: tdelocale.h:124
TDESharedConfig
TDEConfig variant using shared memory.
Definition: tdeconfig.h:274
TDESharedPtr< TDELockFile >
tdelocale.h

tdecore

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

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.