Skip to content
Skip to link menu
Trinity API Reference
Trinity API Reference
tdecore
tdecore
tdecore
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 "tdeglobal.h"
35
#include "kstandarddirs.h"
36
#include "tdeconfigbackend.h"
37
38
#include "ksimpleconfig.h"
39
40
KSimpleConfig::KSimpleConfig
(
const
TQString &fileName,
bool
bReadOnly)
41
:
TDEConfig
(TQString::fromLatin1(
""
), bReadOnly, false)
42
{
43
// the difference between TDEConfig and KSimpleConfig is just that
44
// for KSimpleConfig an absolute filename is guaranteed
45
if
(!fileName.isNull() && TQDir::isRelativePath(fileName)) {
46
backEnd
->
changeFileName
(
TDEGlobal::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
(
TDEConfigBackEnd
*backEnd,
bool
bReadOnly)
56
:
TDEConfig
(backEnd, bReadOnly)
57
{}
58
59
KSimpleConfig::~KSimpleConfig
()
60
{
61
// we need to call the KSimpleConfig version of sync. Relying on the
62
// regular TDEConfig sync is bad, because the KSimpleConfig sync has
63
// different behavior. Syncing here will insure that the sync() call
64
// in the TDEConfig 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
{ TDEConfig::virtual_hook(
id
, data ); }
80
81
#include "ksimpleconfig.moc"
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
tdecore
tdeabc
tdecmshell
tdecore
tdefx
tdehtml
tdeinit
tdeio
bookmarks
httpfilter
kpasswdserver
kssl
tdeioslave
http
tdefile
tdeio
tdeioexec
tdemdi
tdemdi
tdenewstuff
tdeparts
tdeprint
tderandr
tderesources
tdespell2
tdesu
tdeui
tdeunittest
tdeutils
tdewallet