summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kconfig.cpp44
1 files changed, 41 insertions, 3 deletions
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp
index 3f23ed2..b882adb 100644
--- a/microkde/kconfig.cpp
+++ b/microkde/kconfig.cpp
@@ -325,60 +325,98 @@ void KConfig::sync()
325 * 325 *
326 * If the group is not empty and bDeep is false, nothing gets 326 * If the group is not empty and bDeep is false, nothing gets
327 * deleted and false is returned. 327 * deleted and false is returned.
328 * If this group is the current group and it is deleted, the 328 * If this group is the current group and it is deleted, the
329 * current group is undefined and should be set with setGroup() 329 * current group is undefined and should be set with setGroup()
330 * before the next operation on the configuration object. 330 * before the next operation on the configuration object.
331 * 331 *
332 * @param group The name of the group 332 * @param group The name of the group
333 * returns true if we deleted at least one entry. 333 * returns true if we deleted at least one entry.
334 */ 334 */
335bool KConfig::deleteGroup( const QString& group) 335bool KConfig::deleteGroup( const QString& group)
336{ 336{
337 bool dirty = false; 337 bool dirty = false;
338 int pos; 338 int pos;
339 339
340 QMap<QString,bool>::Iterator itBool; 340 QMap<QString,bool>::Iterator itBool;
341 QMap<QString,bool>::Iterator delBool;
342 while ( itBool != mBoolMap.end() ) {
343 pos = itBool.key().find( group );
344 if (pos == 0) {
345 delBool = itBool;
346 ++itBool;
347 mBoolMap.remove(delBool);
348 dirty = true;
349 }
350
351 }
352 /*
341 for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) 353 for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool )
342 { 354 {
343 pos = itBool.key().find( group ); 355 pos = itBool.key().find( group );
344 if (pos == 0) { 356 if (pos == 0) {
345 mBoolMap.remove(itBool); 357 mBoolMap.remove(itBool);
346 dirty = true; 358 dirty = true;
347 } 359 }
348 } 360 }
361 */
362 QMap<QString,QString>::Iterator itString = mStringMap.begin();
363 QMap<QString,QString>::Iterator delString ;
364 while( itString != mStringMap.end() ) {
365 pos = itString.key().find( group );
366 if (pos == 0) {
367 delString = itString;
368 ++itString;
369 mStringMap.remove(delString);
370 //qDebug("delte++++++++++++++++++ ");
371 dirty = true;
372 }
349 373
350 QMap<QString,QString>::Iterator itString; 374 }
375 /* this leads to a memory access violation
351 for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) 376 for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString )
352 { 377 {
353 pos = itString.key().find( group ); 378 pos = itString.key().find( group );
354 if (pos == 0) { 379 if (pos == 0) {
355 mStringMap.remove(itString); 380 mStringMap.remove(itString);
356 dirty = true; 381 dirty = true;
357 } 382 }
358 } 383 }
359 384 */
360 QMap<QString,QDateTime>::Iterator itDateTime; 385 QMap<QString,QDateTime>::Iterator itDateTime= mDateTimeMap.begin();
386 QMap<QString,QDateTime>::Iterator delDateTime;
387 while ( itDateTime != mDateTimeMap.end() ) {
388 pos = itDateTime.key().find( group );
389 if (pos == 0) {
390 delDateTime = itDateTime;
391 ++itDateTime;
392 mDateTimeMap.remove(delDateTime);
393 dirty = true;
394 }
395
396 }
397 /*
361 for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) 398 for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime )
362 { 399 {
363 pos = itDateTime.key().find( group ); 400 pos = itDateTime.key().find( group );
364 if (pos == 0) { 401 if (pos == 0) {
365 mDateTimeMap.remove(itDateTime); 402 mDateTimeMap.remove(itDateTime);
366 dirty = true; 403 dirty = true;
367 } 404 }
368 } 405 }
406 */
369 407
370 if (dirty) 408 if (dirty)
371 mDirty = true; 409 mDirty = true;
372 410
373 return dirty; 411 return dirty;
374 412
375} 413}
376 414
377//US I took the following hasGroup method from a newer version from KDE. 415//US I took the following hasGroup method from a newer version from KDE.
378 /** 416 /**
379 * Returns true if the specified group is known about. 417 * Returns true if the specified group is known about.
380 * 418 *
381 * @param group The group to search for. 419 * @param group The group to search for.
382 * @return Whether the group exists. 420 * @return Whether the group exists.
383 */ 421 */
384bool KConfig::hasGroup(const QString &group) const 422bool KConfig::hasGroup(const QString &group) const