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

kdecore

  • kdecore
ksimpleconfig.cpp
1 /* This file is part of the KDE libraries
2  Copyright (c) 1999 Preston Brown <pbrown@kde.org>
3  Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 // $Id$
21 
22 #include <config.h>
23 
24 #ifdef HAVE_SYS_STAT_H
25 #include <sys/stat.h>
26 #endif
27 
28 #include <stdlib.h>
29 #include <unistd.h>
30 
31 #include <tqfileinfo.h>
32 #include <tqdir.h>
33 
34 #include "kglobal.h"
35 #include "kstandarddirs.h"
36 #include "kconfigbackend.h"
37 
38 #include "ksimpleconfig.h"
39 
40 KSimpleConfig::KSimpleConfig(const TQString &fileName, bool bReadOnly)
41  : KConfig(TQString::fromLatin1(""), bReadOnly, false)
42 {
43  // the difference between KConfig and KSimpleConfig is just that
44  // for KSimpleConfig an absolute filename is guaranteed
45  if (!fileName.isNull() && TQDir::isRelativePath(fileName)) {
46  backEnd->changeFileName( KGlobal::dirs()->
47  saveLocation("config", TQString::null, !bReadOnly)+fileName, "config", false);
48  } else {
49  backEnd->changeFileName(fileName, "config", false);
50  }
51  setReadOnly( bReadOnly );
52  reparseConfiguration();
53 }
54 
55 KSimpleConfig::KSimpleConfig(KConfigBackEnd *backEnd, bool bReadOnly)
56  : KConfig(backEnd, bReadOnly)
57 {}
58 
59 KSimpleConfig::~KSimpleConfig()
60 {
61  // we need to call the KSimpleConfig version of sync. Relying on the
62  // regular KConfig sync is bad, because the KSimpleConfig sync has
63  // different behavior. Syncing here will insure that the sync() call
64  // in the KConfig destructor doesn't actually do anything.
65  sync();
66 }
67 
68 void KSimpleConfig::sync()
69 {
70  if (isReadOnly())
71  return;
72  backEnd->sync(false);
73 
74  if (isDirty())
75  rollback();
76 }
77 
78 void KSimpleConfig::virtual_hook( int id, void* data )
79 { KConfig::virtual_hook( id, data ); }
80 
81 #include "ksimpleconfig.moc"

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.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |