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
00033 #include "kglobal.h"
00034 #include "kstandarddirs.h"
00035 #include "kconfigbackend.h"
00036
00037 #include "ksimpleconfig.h"
00038
00039 KSimpleConfig::KSimpleConfig(const QString &fileName, bool bReadOnly)
00040 : KConfig(QString::fromLatin1(""), bReadOnly, false)
00041 {
00042
00043
00044 if (!fileName.isNull() && fileName[0] != '/') {
00045 backEnd->changeFileName( KGlobal::dirs()->
00046 saveLocation("config", QString::null, !bReadOnly)+fileName, "config", false);
00047 } else {
00048 backEnd->changeFileName(fileName, "config", false);
00049 }
00050 setReadOnly( bReadOnly );
00051 reparseConfiguration();
00052 }
00053
00054 KSimpleConfig::~KSimpleConfig()
00055 {
00056
00057
00058
00059
00060 sync();
00061 }
00062
00063 void KSimpleConfig::sync()
00064 {
00065 if (isReadOnly())
00066 return;
00067 backEnd->sync(false);
00068
00069 if (isDirty())
00070 rollback();
00071 }
00072
00073 void KSimpleConfig::virtual_hook( int id, void* data )
00074 { KConfig::virtual_hook( id, data ); }
00075
00076 #include "ksimpleconfig.moc"
This file is part of the documentation for kdelibs Version 3.1.0.