Bug 133704 - doctree is not sorted according to the .docrc config files (solution included!)
Summary: doctree is not sorted according to the .docrc config files (solution included!)
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-07 13:46 UTC by bernd koesling
Modified: 2006-09-08 14:49 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
the patched docfolder.cpp (3.55 KB, text/plain)
2006-09-07 13:50 UTC, bernd koesling
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bernd koesling 2006-09-07 13:46:52 UTC
Version:            (using KDE KDE 3.5.3)
Installed from:    Fedora RPMs
OS:                Linux

in docfolder.cpp the list is looped twice: one time for the non-folders and a second time for the folders. this results in a list where all folders are on top of the list and all non-folders follow. if a docrc-file has these types in mixed order, the resulting doctree doesn't fit the requested config.

the solution is simple enough:

please change the behaviour in docfolder.cpp to run only one loop:

/***************** this block appears twice in the file! **********/

  for ( list.last(); ( item = list.current() ) ; list.prev() ) {
    if ( item[0] != '#' ) {
      QString url = config->readEntry( item );
      DocItem *el = new DocItem( this, QString(item), basePath+url);
      el->setPixmap( 0, SmallIcon("info") );
    } else  { // current item is folder
      item++; // remove leading #
      QString l_url = config->readEntry( QString("folder_")+item, "" );
      DocFolder *el = new DocFolder(this, QString(item), config, basePath);
      if ( ! l_url.isEmpty() )
        el->url = basePath+l_url;
      el->setPixmap( 0, UserIcon("mini-book1") );
      el->setOpen( false );
    }
  }

/******************* end of quote *********************/

this solution works perfectly. so i hope, that you will 
integrate it soon in your source. 

thank you! koessi
Comment 1 bernd koesling 2006-09-07 13:50:00 UTC
Created attachment 17660 [details]
the patched docfolder.cpp

this is the changed file including the working solution.
Comment 2 András Manţia 2006-09-07 19:19:13 UTC
SVN commit 581836 by amantia:

Respect the order of items in the .docrc. Patch from the bugreport.

BUG: 133704


 M  +1 -0      ChangeLog  
 M  +2 -2      quanta.kdevelop  
 M  +1 -4      treeviews/docfolder.cpp  


--- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #581835:581836
@@ -24,6 +24,7 @@
       - default to a better place when saving a global toolbar to the local
         toolbar directory and improve the error message if a toolbar cannot be
         saved [#130236]
+      - respect the order of items in the .docrc [#133704]
 
 Version 3.5.3 (Release date: 23-05-2006; Started 18-03-2005):
  - bugfixes:
--- branches/KDE/3.5/kdewebdev/quanta/quanta.kdevelop #581835:581836
@@ -170,7 +170,7 @@
     </groups>
     <tree>
       <hidenonprojectfiles>false</hidenonprojectfiles>
-      <hidepatterns/>
+      <hidepatterns></hidepatterns>
       <showvcsfields>true</showvcsfields>
     </tree>
   </kdevfileview>
@@ -276,8 +276,8 @@
       <processFunctionArguments>false</processFunctionArguments>
     </codecompletion>
     <references>
+      <pcs>Qt3</pcs>
       <pcs>KDElibs3</pcs>
-      <pcs>Qt3</pcs>
     </references>
     <creategettersetter>
       <prefixGet/>
--- branches/KDE/3.5/kdewebdev/quanta/treeviews/docfolder.cpp #581835:581836
@@ -79,10 +79,7 @@
       QString url = config->readEntry( item );
       DocItem *el = new DocItem( this, QString(item), basePath+url);
       el->setPixmap( 0, SmallIcon("info") );
-    }
-  }
-
-  for ( list.last(); ( item = list.current() ) ; list.prev() ) {
+    } else
     if ( item[0] == '#' ) { // current item is folder
       item++; // remove leading #
       QString l_url = config->readEntry( QString("folder_")+item, "" );
Comment 3 bernd koesling 2006-09-08 09:19:03 UTC
thanks a lot for this incredibly fast response!
Comment 4 bernd koesling 2006-09-08 09:29:36 UTC
as i wrote in the bugreport: the loop-error occures twice. you should change the lines #50 to #55 in the same way as you did with the lines around #79.

the second function is for the first level of entries and the first one is called for nested folders. in both situations the loop should be done in one go.

thank you again. 
Comment 5 András Manţia 2006-09-08 14:49:56 UTC
SVN commit 582161 by amantia:

Complete the fix for #133704 as requested (plus some cleanup).

BUG: 133704


 M  +2 -2      quanta.kdevelop  
 M  +1 -3      src/quanta.cpp  
 M  +1 -4      treeviews/docfolder.cpp  


--- branches/KDE/3.5/kdewebdev/quanta/quanta.kdevelop #582160:582161
@@ -245,10 +245,10 @@
   </kdevcvs>
   <kdevfilecreate>
     <filetypes>
-      <type icon="" ext="h" name="C++ header" create="template" >
+      <type icon="" ext="h" create="template" name="C++ header" >
         <descr>Quanta speicfic header</descr>
       </type>
-      <type icon="source_cpp" ext="cpp" name="C++ source" create="template" >
+      <type icon="source_cpp" ext="cpp" create="template" name="C++ source" >
         <descr>A new empty C++ file.</descr>
       </type>
     </filetypes>
--- branches/KDE/3.5/kdewebdev/quanta/src/quanta.cpp #582160:582161
@@ -533,12 +533,10 @@
         }
         Project::ref()->insertFile(saveUrl, true);
       }
-      if(ViewManager::ref()->activeView() &&
-            ViewManager::ref()->activeView()->hadLastFocus() == QuantaView::VPLFocus)
+      if (view->hadLastFocus() == QuantaView::VPLFocus)
         w->docUndoRedo->reloadQuantaEditor();
 
       w->docUndoRedo->fileSaved();
-//      slotUpdateStatus(w); //FIXME:
       result = true;
     }
     if (oldURL.isLocalFile())
--- branches/KDE/3.5/kdewebdev/quanta/treeviews/docfolder.cpp #582160:582161
@@ -46,10 +46,7 @@
       QString url = config->readEntry( item );
       DocItem *el = new DocItem( this, QString(item), basePath+url);
       el->setPixmap( 0, SmallIcon("info") );
-    }
-  }
-
-  for ( list.last(); ( item = list.current() ) ; list.prev() ) {
+    } else
     if ( item[0] == '#' ) { // current item is folder
       item++; // remove leading #
       QString l_url = config->readEntry( QString("folder_")+item, "" );