ksimpleconfig.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#include <config.h>
00023
00024
#ifdef HAVE_SYS_STAT_H
00025
#include <sys/stat.h>
00026
#endif
00027
00028
#include <stdlib.h>
00029
#include <unistd.h>
00030
00031
#include <qfileinfo.h>
00032
#include <qdir.h>
00033
00034
#include "kglobal.h"
00035
#include "kstandarddirs.h"
00036
#include "kconfigbackend.h"
00037
00038
#include "ksimpleconfig.h"
00039
00040 KSimpleConfig::KSimpleConfig(
const QString &fileName,
bool bReadOnly)
00041 :
KConfig(
QString::fromLatin1(""), bReadOnly, false)
00042 {
00043
00044
00045
if (!fileName.
isNull() && QDir::isRelativePath(fileName)) {
00046 backEnd->
changeFileName( KGlobal::dirs()->
00047 saveLocation(
"config", QString::null, !bReadOnly)+fileName,
"config",
false);
00048 }
else {
00049 backEnd->
changeFileName(fileName,
"config",
false);
00050 }
00051 setReadOnly( bReadOnly );
00052
reparseConfiguration();
00053 }
00054
00055 KSimpleConfig::KSimpleConfig(
KConfigBackEnd *backEnd,
bool bReadOnly)
00056 :
KConfig(backEnd, bReadOnly)
00057 {}
00058
00059 KSimpleConfig::~KSimpleConfig()
00060 {
00061
00062
00063
00064
00065
sync();
00066 }
00067
00068 void KSimpleConfig::sync()
00069 {
00070
if (
isReadOnly())
00071
return;
00072 backEnd->
sync(
false);
00073
00074
if (
isDirty())
00075 rollback();
00076 }
00077
00078
void KSimpleConfig::virtual_hook(
int id,
void* data )
00079 { KConfig::virtual_hook(
id, data ); }
00080
00081
#include "ksimpleconfig.moc"
This file is part of the documentation for kdecore Library Version 3.4.0.