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

Andi Fischer andi.fischer at hispeed.ch
Sun Feb 5 17:23:37 UTC 2012


SVN commit 1278208 by fischer:

Logger export implemented. Writing to logger text field improved.

 M  +17 -7     codeimpstatuspage.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/codeimpwizard/codeimpstatuspage.cpp #1278207:1278208
@@ -33,7 +33,9 @@
 #include "umldoc.h"
 
 //kde includes
+#include <kfiledialog.h>
 #include <klocale.h>
+#include <kmessagebox.h>
 
 //qt includes
 #include <QtGui/QListWidget>
@@ -238,16 +240,12 @@
  */
 void CodeImpStatusPage::messageToLog(const QString& file, const QString& text)
 {
-    QString oldText = ui_textEditLogger->toHtml();
-    QString newText('\n');
     if (file.isEmpty()) {
-        newText.append("    " + text);
+        ui_textEditLogger->insertHtml("\n    " + text + "<br>");
     }
     else {
-        newText.append("<b>" + file + ":</b> " + text);
+        ui_textEditLogger->insertHtml("\n<b>" + file + ":</b> " + text + "<br>");
     }
-    oldText.append(newText);
-    ui_textEditLogger->setHtml(oldText);
 }
 
 /**
@@ -297,7 +295,19 @@
  */
 void CodeImpStatusPage::loggerExport()
 {
-    uDebug() << "TODO: Not yet implemented!";
+    const QString caption = i18n("Umbrello Code Import - Logger Export");
+    QString fileName = KFileDialog::getSaveFileName(KUrl(), QString(), 0, caption);
+    if (!fileName.isEmpty()) {
+        QFile file(fileName);
+        if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
+            QTextStream out(&file);
+            out << ui_textEditLogger->toHtml();
+            file.close();
 }
+        else {
+            KMessageBox::error(this, i18n("Cannot open file!"), caption);
+        }
+    }
+}
 
 #include "codeimpstatuspage.moc"




More information about the umbrello-devel mailing list