Bug 109157 - Recursively scan source files (c++, hpp) when reverse engineering
Summary: Recursively scan source files (c++, hpp) when reverse engineering
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.3.2
Platform: Debian testing Linux
: NOR wishlist
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
: 142208 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-07-16 10:44 UTC by Christoph Conrad
Modified: 2013-11-06 17:35 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.0.0


Attachments
patch for #109157 (23.77 KB, patch)
2007-03-03 16:41 UTC, Antoine Dopffer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Conrad 2005-07-16 10:44:26 UTC
Version:           1.3.2 (using KDE KDE 3.3.0)
Installed from:    Debian testing/unstable Packages
OS:                Linux

it is only possible to import single files, not to scan a whole tree for source files. this is a lot of effort with big projects.
Comment 1 Oliver Kellogg 2005-07-27 07:56:11 UTC
> it is only possible to import single files, [...]

Well, you can select multiple files within the same directory
(but I agree that selecting files across directories would be useful)
Comment 2 Christoph Conrad 2005-07-27 08:02:38 UTC
> but I agree that selecting files across directories would be useful

I would like to have the possibility to select a directory, and all files matching several extensions below that directory hierarchy are imported.
Comment 3 Oliver Kellogg 2007-02-26 07:31:53 UTC
*** Bug 142208 has been marked as a duplicate of this bug. ***
Comment 4 Antoine Dopffer 2007-02-26 17:42:34 UTC
As I said for duplicate 142208, it should be only an option. 
You don't always want to go recursively 
 
Comment 5 Antoine Dopffer 2007-03-03 16:41:31 UTC
Created attachment 19873 [details]
patch for #109157

This patch creates a new dialog for collecting the "Import project" params
(directory and programming language) and searching the files that match the
params.
New files created:
- importprojectdlgbase.ui
- importprojectdlg.cpp
- importprojectdlg.h

I have updated the CMake files, but you should double check it, cause I am not
an expert with cmake.

This patch works for me but :
1) It uses features that exists only in QT4

2) the patch is affected with bug #142459 . I think either this bug will be
resolved or  this bug is my plain fault.

3) For testing, I have used (in file uml.cpp):
setupGUI(KMainWindow::Default,
"/home/kde-devel/kdesdk/umbrello/umbrello/umbrelloui.rc");  instead of
setupGUI();
Because I guess setupGUI() with no params uses umbrelloui.rc of umbrello 1.5.6
of my distro. 
But in the patch, I have let the instruction setupGui()
Comment 6 Oliver Kellogg 2007-03-07 18:30:14 UTC
SVN commit 640337 by okellogg:

Apply attachment 19873 [details] from Antoine Dopffer:
> This patch creates a new dialog for collecting the "Import project" params
> (directory and programming language) and searching the files that match the 
> params. 
> This patch works for me but: It uses features that exists only in QT4


I.e. this feature will be available in the KDE4 based Umbrello 2.0 release.

FEATURE:109157


 M  +1 -0      ChangeLog.2  
 M  +4 -2      umbrello/CMakeLists.txt  
 A             umbrello/dialogs/importprojectdlg.cpp   [License: no copyright GPL (v2+)]
 A             umbrello/dialogs/importprojectdlg.h   [License: no copyright GPL (v2+)]
 A             umbrello/dialogs/importprojectdlgbase.ui  
 M  +5 -0      umbrello/listpopupmenu.cpp  
 M  +1 -0      umbrello/listpopupmenu.h  
 M  +1 -0      umbrello/umbrelloui.rc  
 M  +32 -10    umbrello/uml.cpp  
 M  +11 -0     umbrello/uml.h  
 M  +4 -0      umbrello/umllistview.cpp  


--- trunk/KDE/kdesdk/umbrello/ChangeLog.2 #640336:640337
@@ -2,4 +2,5 @@
 
 * Bugs/wishes from http://bugs.kde.org:
 * Turn off header/footer and page numbers when printing (69113)
+* Recursively scan source files when reverse engineering (109157)
 
--- trunk/KDE/kdesdk/umbrello/umbrello/CMakeLists.txt #640336:640337
@@ -125,7 +125,8 @@
 	dialogs/codevieweroptionspage.cpp 
 	dialogs/defaultcodegenpolicypage.cpp 
 	dialogs/diagramprintpage.cpp 
-    dialogs/exportallviewsdialog.cpp
+	dialogs/exportallviewsdialog.cpp
+	dialogs/importprojectdlg.cpp
 	dialogs/notedialog.cpp 
 	dialogs/overwritedialogue.cpp 
 	dialogs/pkgcontentspage.cpp 
@@ -148,7 +149,8 @@
 	${CMAKE_CURRENT_SOURCE_DIR}/dialogs/codegenerationwizardbase.ui 
 	${CMAKE_CURRENT_SOURCE_DIR}/dialogs/codeviewerdialogbase.ui 
 	${CMAKE_CURRENT_SOURCE_DIR}/dialogs/codevieweroptionsbase.ui 
-    ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/exportallviewsdialogbase.ui 
+	${CMAKE_CURRENT_SOURCE_DIR}/dialogs/exportallviewsdialogbase.ui 
+	${CMAKE_CURRENT_SOURCE_DIR}/dialogs/importprojectdlgbase.ui 
 )
 
 kde4_add_ui_files(  libdialogs_SRCS 
--- trunk/KDE/kdesdk/umbrello/umbrello/listpopupmenu.cpp #640336:640337
@@ -506,6 +506,9 @@
     case mt_Import_Classes:
         insertItem(BarIcon("source_cpp"), i18n("Import Classes..."), mt_Import_Classes);
         break;
+    case mt_Import_Project:
+        insertItem(BarIcon("source_cpp"), i18n("Import Project..."), mt_Import_Project);
+        break;
     case mt_Package:
         m_pInsert->insertItem(m_pixmap[pm_Package], i18n("Package"), mt_Package);
     case mt_Subsystem:
@@ -852,6 +855,7 @@
         insertStdItem(mt_Paste);
         insertSeparator();
         insertStdItem(mt_Import_Classes);
+        insertStdItem(mt_Import_Project);
         insertSeparator();
         insertStdItem(mt_Expand_All);
         insertStdItem(mt_Collapse_All);
@@ -919,6 +923,7 @@
         insertContainerItems(true);
         insertStdItems();
         insertStdItem(mt_Import_Classes);
+        insertStdItem(mt_Import_Project);
         insertSubmodelAction();
         insertSeparator();
         insertStdItem(mt_Expand_All);
--- trunk/KDE/kdesdk/umbrello/umbrello/listpopupmenu.h #640336:640337
@@ -122,6 +122,7 @@
         mt_Delete,
         mt_Export_Image,
         mt_Import_Classes,
+        mt_Import_Project,
         mt_Sequence_Number,
         mt_Cut,
         mt_Copy,
--- trunk/KDE/kdesdk/umbrello/umbrello/umbrelloui.rc #640336:640337
@@ -41,6 +41,7 @@
 
   <Menu name="code"><text>&amp;Code</text>
     <Action name="import_class"/>
+    <Action name="import_project"/>
     <Action name="generation_wizard"/>
     <Action name="generate_all"/>
     <Menu name="active_lang_menu"><text>Active &amp;Language</text>
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #640336:640337
@@ -70,6 +70,7 @@
 #include "dialogs/codegenerationwizard.h"
 #include "dialogs/codeviewerdialog.h"
 #include "dialogs/diagramprintpage.h"
+#include "dialogs/importprojectdlg.h"
 
 #include "refactoring/refactoringassistant.h"
 #include "codegenerators/simplecodegenerator.h"
@@ -218,6 +219,11 @@
     importClasses->setText(i18n("&Import Classes..."));
     connect(importClasses, SIGNAL( triggered( bool ) ), this, SLOT( slotImportClasses() ));
 
+    importProject = actionCollection()->addAction("import_project");
+    importProject->setIcon(KIcon("source_cpp"));
+    importProject->setText(i18n("Import &Project..."));
+    connect(importProject, SIGNAL( triggered( bool ) ), this, SLOT( slotImportProject() ));
+
     genWizard = actionCollection()->addAction("generation_wizard");
     genWizard->setText(i18n("&Code Generation Wizard..."));
     connect(genWizard, SIGNAL( triggered( bool ) ), this, SLOT( generationWizard() ));
@@ -1541,6 +1547,22 @@
     }
 }
 
+
+void UMLApp::importFiles(QStringList* fileList) {
+    if (! fileList->isEmpty()) {
+        const QString& firstFile = fileList->first();
+        ClassImport *classImporter = ClassImport::createImporterByFileExt(firstFile);
+        classImporter->importFiles(*fileList);
+        delete classImporter;
+        m_doc->setLoading(false);
+        //Modification is set after the import is made, because the file was modified when adding the classes
+        //Allowing undo of the whole class importing. I think it eats a lot of memory
+        //m_doc->setModified(true);
+        //Setting the modification, but without allowing undo
+        m_doc->setModified(true, false);
+    }
+}
+
 void UMLApp::slotImportClasses() {
     m_doc->setLoading(true);
     // File selection is separated from invocation of ClassImport::import()
@@ -1564,18 +1586,18 @@
     preselectedExtension.append("\n*|" + i18n("All Files"));
     QStringList fileList = KFileDialog::getOpenFileNames(KUrl(), preselectedExtension,
                            this, i18n("Select Code to Import") );
-    const QString& firstFile = fileList.first();
-    ClassImport *classImporter = ClassImport::createImporterByFileExt(firstFile);
-    classImporter->importFiles(fileList);
-    delete classImporter;
-    m_doc->setLoading(false);
-    //Modification is set after the import is made, because the file was modified when adding the classes
-    //Allowing undo of the whole class importing. I think it eats a lot of memory
-    //m_doc->setModified(true);
-    //Setting the modification, but without allowing undo
-    m_doc->setModified(true, false);
+    importFiles(&fileList);
 }
 
+void UMLApp::slotImportProject() {
+    QStringList listFile;
+
+    QDialog::DialogCode code = ImportProjectDlg::getFilesToImport(&listFile,m_codegen->getLanguage(), this);
+    if (code == QDialog::Accepted) {
+        importFiles(&listFile);
+    }
+}
+
 void UMLApp::slotClassWizard() {
     ClassWizard dlg( m_doc );
     dlg.exec();
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.h #640336:640337
@@ -705,6 +705,11 @@
     void slotImportClasses();
 
     /**
+     * Import project menu selection.
+     */
+    void slotImportProject();
+
+    /**
      * Class wizard menu selection.
      */
     void slotClassWizard();
@@ -880,6 +885,11 @@
     void initSavedCodeGenerators();
 
     /**
+    * import the source files that are in fileList
+    */
+    void importFiles(QStringList* fileList);
+
+     /**
      * The configuration object of the application.
      */
     KSharedConfigPtr m_config;
@@ -971,6 +981,7 @@
     QAction* genAll;
     QAction* genWizard;
     QAction* importClasses;
+    QAction* importProject;
     QAction* classWizard;
     QAction* m_langAct[Uml::pl_Reserved];
     QAction* deleteSelectedWidget;
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #640336:640337
@@ -323,6 +323,10 @@
         UMLApp::app()->slotImportClasses();
         break;
 
+    case ListPopupMenu::mt_Import_Project:
+        UMLApp::app()->slotImportProject();
+        break;
+
     case ListPopupMenu::mt_Expand_All:
         expandAll(temp);
         break;
Comment 7 Ralf Habacker 2013-11-06 17:35:25 UTC
set version-fixed-in from 4.0.0 changelog