Bug 67993 - file groups in file groups tab are not shown recursively in subdirectories
Summary: file groups in file groups tab are not shown recursively in subdirectories
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: file groups (show other bugs)
Version: 3.0.0b1
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-12 13:48 UTC by Holger Schröder
Modified: 2003-12-17 04:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Schröder 2003-11-12 13:48:49 UTC
Version:           3.0.0b1 (using KDE 3.1.92 (CVS >= 20031007), Gentoo)
Compiler:          gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r2, propolice)
OS:          Linux (i686) release 2.4.20-xfs-r2

Hi,

some time ago i created a new kde application project in gideon, and at that time when i clicked the file groups tab on the left side in ideal mode, i had all my source files under sources, the ui files under user interface and so on, but now only files that are directly in the same directory as the *.kdevelop file are shown in the groups.

for some reason the files in the subdirectories are not taken into account.

for me all sources and ui files are in the src/ subdir, as gideon wanted and wants it to do, so it should also be able to find these files in the subdirs.

thanks, Holger
Comment 1 Amilcar do Carmo Lucas 2003-11-12 14:21:51 UTC
Rigth click with the mouse one one of the group folders and deselect:
Show non project files.
And you'll get the correct behaviour.

This bug is only present when you select 
Show non project files
Comment 2 Holger Schröder 2003-11-12 16:37:47 UTC
thanks for the tip, now it works as expected.

perhaps the switch is named badly then.
perhaps call it "Show only non-project files"
or change the behaviour and always show the project files and only toggle if non-project files are shown too or not.

i'd vote for the second alternative.

thanks, Holger
Comment 3 Amilcar do Carmo Lucas 2003-11-12 16:53:29 UTC
No the idea is not to "Show only non-project files".

It doesn't show all files in "Show non-project files" mode because it doesn't
recurse in the file tree. That's the REAL (and only) bug.
Comment 4 Jens Dagerbo 2003-12-17 04:26:53 UTC
Subject: kdevelop/parts/fileview

CVS commit by dagerbo: 

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

CCMAIL: 67993-done@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;