[Bug 67993] file groups in file groups tab are not shown recursively in subdirectories

Jens Dagerbo jens.dagerbo at swipnet.se
Wed Dec 17 04:28:04 UTC 2003


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
     
http://bugs.kde.org/show_bug.cgi?id=67993     
jens.dagerbo at swipnet.se changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From jens.dagerbo at swipnet.se  2003-12-17 04:26 -------
Subject: kdevelop/parts/fileview

CVS commit by dagerbo: 

Make the filegroup "show non project files" setting work.

CCMAIL: 67993-done at bugs.kde.org


  M +37 -4     filegroupswidget.cpp   1.22
  M +1 -0      filegroupswidget.h   1.7


--- kdevelop/parts/fileview/filegroupswidget.cpp  #1.21:1.22
@@ -100,5 +100,5 @@ FileGroupsFileItem::FileGroupsFileItem(Q
     QFileInfo fi(fileName);
     setText(0, fi.fileName());
-    setText(1, fi.dirPath() + "/");
+    setText(1, "./" + fi.dirPath());
 }
 
@@ -199,4 +199,39 @@ void FileGroupsWidget::slotContextMenu(K
 }
 
+QStringList FileGroupsWidget::allFilesRecursively( QString const & dir )
+{
+        QStringList filelist;
+        QString reldir = dir.mid( m_part->project()->projectDirectory().length() +1 );
+
+        // recursively fetch all files in subdirectories
+        QStringList subdirs = QDir( dir ).entryList( QDir::Dirs );
+        QValueListIterator<QString> it = subdirs.begin();
+        while ( it != subdirs.end() )
+        {
+                if ( *it != "." && *it != ".." )
+                {
+                        filelist += allFilesRecursively( dir + "/"+ *it );
+                }
+                ++it;
+        }
+        
+        // append the project relative directory path to all files in the current directory
+        QStringList dirlist = QDir( dir ).entryList( QDir::Files );
+        QValueListIterator<QString> itt = dirlist.begin();
+        while ( itt != dirlist.end() )
+        {
+                if ( reldir.isEmpty() )
+                {
+                        filelist << *itt;
+                }
+                else
+                {
+                        filelist << reldir + "/" + *itt;
+                }
+                ++itt;
+        }
+        
+        return filelist;
+}
 
 void FileGroupsWidget::refresh()
@@ -222,7 +257,5 @@ void FileGroupsWidget::refresh()
     if (m_actionToggleShowNonProjectFiles->isChecked()) {
         // get all files in the project directory
-        QDir projectDir = m_part->project()->projectDirectory();
-        allFiles = projectDir.entryList(QDir::Files);
-        // @todo get all files in all subdirectories
+        allFiles = allFilesRecursively( m_part->project()->projectDirectory() );
     }
     else {

--- kdevelop/parts/fileview/filegroupswidget.h  #1.6:1.7
@@ -42,4 +42,5 @@ protected:
 
 private:
+    QStringList allFilesRecursively( QString const & );
     FileGroupsPart *m_part;




More information about the KDevelop-devel mailing list