26 #ifdef HAVE_SYS_STAT_H
33 #include <tqfileinfo.h>
35 #include <kapplication.h>
36 #include "kconfigbackend.h"
40 #include "kstandarddirs.h"
41 #include "kstaticdeleter.h"
45 bool bReadOnly,
bool bUseKderc,
const char *resType )
46 :
KConfigBase(), bGroupImmutable(false), bFileImmutable(false),
79 : bGroupImmutable(false), bFileImmutable(false),
102 for (KEntryMapIterator aIt =
aEntryMap.begin();
104 (*aIt).bDirty =
false;
109 TQStringList retList;
111 KEntryMapConstIterator aIt =
aEntryMap.begin();
112 KEntryMapConstIterator aEnd =
aEntryMap.end();
113 for (; aIt != aEnd; ++aIt)
115 while(aIt.key().mKey.isEmpty())
117 TQCString
group = aIt.key().mGroup;
124 if (aIt.key().mKey.isEmpty())
127 if (!aIt.key().bDefault && !(*aIt).bDeleted)
129 if (group !=
"$Version")
130 retList.append(TQString::fromUtf8(group));
143 TQCString pGroup_utf = pGroup.utf8();
145 TQMap<TQString, TQString> tmpMap;
147 KEntryMapConstIterator aIt =
aEntryMap.find(groupKey);
151 for (; aIt.key().mGroup == pGroup_utf && aIt !=
aEntryMap.end(); ++aIt)
154 if (!aIt.key().bDefault && !(*aIt).bDeleted)
155 tmpMap.insert(TQString::fromUtf8(aIt.key().mKey), TQString::fromUtf8((*aIt).mValue.data(), (*aIt).mValue.length()));
173 bFileImmutable =
false;
175 bFileImmutable = bReadOnly;
180 TQCString pGroup_utf = pGroup.utf8();
182 KEntryMapConstIterator aIt;
184 KEntryMap tmpEntryMap;
194 for (; aIt.key().mGroup == pGroup_utf && aIt !=
aEntryMap.end(); ++aIt)
196 tmpEntryMap.insert(aIt.key(), *aIt);
204 if (bFileImmutable && !_key.
bDefault)
215 if (bGroupImmutable && !_key.
bDefault)
240 KEntryMapConstIterator aIt =
aEntryMap.find(_key);
243 const KEntry &entry = *aIt;
258 KEntryMapConstIterator aIt =
aEntryMap.find(groupKey);
259 KEntryMapConstIterator aEnd =
aEntryMap.end();
264 for(; (aIt != aEnd); ++aIt)
266 if (aIt.key().mKey.isEmpty())
269 if (!aIt.key().bDefault && !(*aIt).bDeleted)
283 if (!aBackEnd)
return 0;
289 TQString oldGroup =
group();
291 TQString cfg_id = updateFile+
":"+id;
293 if (!ids.contains(cfg_id))
296 args <<
"--check" << updateFile;
306 config =
new KConfig(TQString::null,
false,
false);
309 config->bFileImmutable =
false;
310 config->
backEnd->mConfigState = ReadWrite;
313 for(TQStringList::ConstIterator it = groups.begin();
314 it != groups.end(); ++it)
316 TQMap<TQString, TQString> map =
entryMap(*it);
318 for (TQMap<TQString,TQString>::Iterator it2 = map.begin();
319 it2 != map.end(); ++it2)
328 void KConfig::virtual_hook(
int id,
void* data )
329 { KConfigBase::virtual_hook(
id, data ); }
332 TQValueList<KSharedConfig*> *KSharedConfig::s_list = 0;
338 for(TQValueList<KSharedConfig*>::ConstIterator it = s_list->begin();
339 it != s_list->end(); ++it)
341 if ((*it)->backEnd->fileName() == fileName &&
342 (*it)->bReadOnly == readOnly &&
343 (*it)->backEnd->useKDEGlobals == useKDEGlobals )
350 KSharedConfig::KSharedConfig(
const TQString& fileName,
bool readonly,
bool usekdeglobals)
351 :
KConfig(fileName, readonly, usekdeglobals)
355 sd.
setObject(s_list,
new TQValueList<KSharedConfig*>);
358 s_list->append(
this);
361 KSharedConfig::~KSharedConfig()
364 s_list->remove(
this);
367 #include "kconfig.moc"