[Uml-devel] branches/KDE/4.9/kdesdk/umbrello/umbrello/codeimpwizard

Ralf Habacker ralf.habacker at gmail.com
Tue Jul 10 20:38:39 UTC 2012


SVN commit 1305127 by habacker:

Merged 1303763 from trunk.

Refactored code import wizard to be able to show import errors.

 M  +14 -10    codeimpstatuspage.cpp  
 M  +1 -1      codeimpstatuspage.h  
 M  +3 -3      codeimpthread.cpp  
 M  +2 -1      codeimpthread.h  


--- branches/KDE/4.9/kdesdk/umbrello/umbrello/codeimpwizard/codeimpstatuspage.cpp #1305126:1305127
@@ -131,26 +131,30 @@
 #ifdef ENABLE_IMPORT_THREAD
     m_thread = new QThread;
     //connect(thread, SIGNAL(started()), this, SLOT(importCodeFile()));
-    connect(m_thread, SIGNAL(finished()), this, SLOT(importCodeFile()));
+    connect(m_thread, SIGNAL(finished(bool)), this, SLOT(importCodeFile(bool)));
     connect(m_thread, SIGNAL(terminated()), this, SLOT(importCodeStop()));
 #endif
     importCodeFile();
 }
 
-void CodeImpStatusPage::importCodeFile()
+void CodeImpStatusPage::importCodeFile(bool noError)
 {
+    if (m_index > 0) {
+        if (noError) {
+            messageToLog(m_file.fileName(), i18n("importing file ... DONE<br>"));
+            updateStatus(m_file.fileName(), i18n("Import Done"));
+        }
+        else {
+            messageToLog(m_file.fileName(), i18n("importing file ... FAILED<br>"));
+            updateStatus(m_file.fileName(), i18n("Import Failed"));
+        }
+    }
+
     // all files done
     if (m_index >= m_files.size()) {
-        messageToLog(m_file.fileName(), i18n("importing file ... DONE<br>"));
-        updateStatus(m_file.fileName(), i18n("Import Done"));
         importCodeFinish();
         return;
     }
-    // at least one file done
-    else if (m_index > 0) {
-        messageToLog(m_file.fileName(), i18n("importing file ... DONE<br>"));
-        updateStatus(m_file.fileName(), i18n("Import Done"));
-    }
 
     m_file = m_files.at(m_index++);
     messageToLog(m_file.fileName(), i18n("importing file ..."));
@@ -159,7 +163,7 @@
     connect(worker, SIGNAL(messageToLog(QString,QString)), this, SLOT(messageToLog(QString,QString)));
     connect(worker, SIGNAL(messageToApp(QString)), this, SLOT(messageToApp(QString)));
 #ifndef ENABLE_IMPORT_THREAD
-    connect(worker, SIGNAL(finished()), this, SLOT(importCodeFile()));
+    connect(worker, SIGNAL(finished(bool)), this, SLOT(importCodeFile(bool)));
     connect(worker, SIGNAL(aborted()), this, SLOT(importCodeStop()));
     worker->run();
     worker->deleteLater();
--- branches/KDE/4.9/kdesdk/umbrello/umbrello/codeimpwizard/codeimpstatuspage.h #1305126:1305127
@@ -61,7 +61,7 @@
 
 protected slots:
     void importCode(); ///< start importing
-    void importCodeFile(); ///< import single file
+    void importCodeFile(bool noError=true); ///< import single file
     void importCodeFinish(); ///< finish importing
     void importCodeStop(); ///< cancel importing
     void updateStatus(const QString& file, const QString& text);
--- branches/KDE/4.9/kdesdk/umbrello/umbrello/codeimpwizard/codeimpthread.cpp #1305126:1305127
@@ -61,15 +61,15 @@
 
         if (!classImporter->importFile(fileName)) {
             emit messageToApp(i18nc("show failed on status bar", "Failed."));
-            emit messageToWiz(m_file.fileName(), "failed");
+            emit messageToWiz(m_file.fileName(), "");
             emit messageToLog(m_file.fileName(), "...import failed");
-            emit aborted();
+            emit finished(false);
         }
         else {
             emit messageToApp(i18nc("show Ready on status bar", "Ready."));
             emit messageToWiz(m_file.fileName(), "finished");
             emit messageToLog(m_file.fileName(), "...import finished");
-            emit finished();
+            emit finished(true);
         }
         delete classImporter;
     }
--- branches/KDE/4.9/kdesdk/umbrello/umbrello/codeimpwizard/codeimpthread.h #1305126:1305127
@@ -50,8 +50,9 @@
     void messageToWiz(const QString& file, const QString& text);
     void messageToLog(const QString& file, const QString& text);
     void messageToApp(const QString& text);
-    void finished();
     void aborted();
+    void failed();
+    void finished(bool noError);
 
 private slots:
     void questionAsked(const QString& question, int& answer);




More information about the umbrello-devel mailing list