[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kde3support/kdeui
From:       Christoph Feck <christoph () maxiom ! de>
Date:       2010-08-26 17:41:58
Message-ID: 20100826174158.2D34DAC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1168457 by cfeck:

Fix K3DockWidget config loading

* the result of the config entry "NameList" was silently discarded
* the ObjectList iterator was incorrectly expected to return 0 at
  the end of the list
* additionally fix some formatting

Thanks to Gilles Allard for the analysis and patch!
BUG: 241515


 M  +18 -15    k3dockwidget.cpp  


--- trunk/KDE/kdelibs/kde3support/kdeui/k3dockwidget.cpp #1168456:1168457
@@ -1367,7 +1367,7 @@
 
 void K3DockWidget::undock()
 {
-//  kDebug(282)<<"K3DockWidget::undock()";
+  //  kDebug(282) << "K3DockWidget::undock : undocking " << name();
 
   manager->d->dragRect = QRect ();
   manager->drawDragRectangle ();
@@ -2437,7 +2437,8 @@
 
     QObjectList::iterator it = childDock->begin();
     K3DockWidget *obj1;
-    while ( (obj1=(K3DockWidget*)(*it)) ) {
+    while ( it != childDock->end() ) {
+	obj1=(K3DockWidget*)(*it);
         if ( !obj1->isGroup && !obj1->isTabGroup ) {
             if ( obj1->parent() )
                 obj1->undock();
@@ -2789,11 +2790,11 @@
   if (!c) {
       c = KGlobal::config().data();
   }
-  QString group = group.isEmpty() ? "dock_setting_default" : _group;
+  QString group = _group.isEmpty() ? "dock_setting_default" : _group;
 
   KConfigGroup cg(c, group );
   QStringList nameList;
-  cg.readEntry( "NameList", nameList );
+  nameList = cg.readEntry( "NameList", QStringList() );
   QString ver = cg.readEntry( "Version", "0.0.1" );
   if ( nameList.isEmpty() || ver != DOCK_CONFIG_VERSION ){
     activate();
@@ -2810,10 +2811,10 @@
   QObjectList::iterator it = childDock->begin();
   K3DockWidget * obj;
 
-  while ( (obj=(K3DockWidget*)(*it)) ){
+  while ( it != childDock->end() ){
+    obj = (K3DockWidget*)(*it);
     ++it;
-    if ( !obj->isGroup && !obj->isTabGroup )
-    {
+    if ( !obj->isGroup && !obj->isTabGroup ) {
       if ( obj->parent() ) obj->undock(); else obj->hide();
     }
   }
@@ -2974,7 +2975,8 @@
 void K3DockManager::dumpDockWidgets() {
   QObjectList::iterator it = childDock->begin();
   K3DockWidget * obj;
-  while ( (obj=(K3DockWidget*)(*it)) ) {
+  while ( it != childDock->end() ) {
+    obj = (K3DockWidget*)(*it);
     ++it;
     kDebug(282)<<"K3DockManager::dumpDockWidgets:"<<obj->name();
   }
@@ -2985,7 +2987,8 @@
 {
   QObjectList::iterator it = childDock->begin();
   K3DockWidget * obj;
-  while ( (obj=(K3DockWidget*)(*it)) ) {
+  while ( it != childDock->end() ) {
+    obj=(K3DockWidget*)(*it);
     ++it;
     if ( obj->objectName() == dockName ) return obj;
   }
@@ -3035,16 +3038,15 @@
 
   QObjectList::iterator it = childDock->begin();
   K3DockWidget * obj;
-  while ( (obj=(K3DockWidget*)(*it)) ) {
+  while ( it != childDock->end() ) {
+    obj=(K3DockWidget*)(*it);
     ++it;
-    if ( obj->mayBeHide() )
-    {
+    if ( obj->mayBeHide() ) {
       menu->insertItem( i18n("Hide %1", obj->windowTitle()));
       menuData->append( new MenuDockData( obj, true ) );
     }
 
-    if ( obj->mayBeShow() )
-    {
+    if ( obj->mayBeShow() ) {
       menu->insertItem( i18n("Show %1", obj->windowTitle()));
       menuData->append( new MenuDockData( obj, false ) );
     }
@@ -3063,7 +3065,8 @@
   K3DockWidget * dock;
   K3DockWidget * found = 0L;
 
-  while ( (dock=(K3DockWidget*)(*it)) ) {
+  while (it != childDock->end()  ) {
+    dock=(K3DockWidget*)(*it);
     ++it;
     if ( dock->widget == w ){ found  = dock; break; }
   }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic