[Uml-devel] KDE/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Mar 7 17:30:09 UTC 2007


SVN commit 640337 by okellogg:

Apply attachment 19873 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>&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 &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;




More information about the umbrello-devel mailing list