[Uml-devel] branches/work/soc-umbrello

Gopala Krishna A krishna.ggk at gmail.com
Mon Apr 13 13:45:54 UTC 2009


SVN commit 953232 by gopala:

Merged revisions 952053,952058,952131 via svnmerge from 
svn+ssh://svn.kde.org/home/kde/trunk/KDE/kdesdk/umbrello

........
  r952053 | chehrlic | 2009-04-11 00:46:42 +0530 (Sat, 11 Apr 2009) | 2 lines
  
  remove some win32 hacks
  KUrl::path() -> KUrl::toLocalFile()/pathOrUrl()
........
  r952058 | chehrlic | 2009-04-11 01:17:49 +0530 (Sat, 11 Apr 2009) | 1 line
  
  KUrl::path() -> KUrl::toLocalFile()
........
  r952131 | fischer | 2009-04-11 08:18:38 +0530 (Sat, 11 Apr 2009) | 1 line
  
  Application closing after exporting with --export fixed.
........


 _M            . (directory)  
 M  +2 -2      umbrello/cmdlineexportallviewsevent.cpp  
 M  +1 -1      umbrello/dialogs/importprojectdlg.cpp  
 M  +12 -37    umbrello/uml.cpp  
 M  +21 -28    umbrello/umldoc.cpp  
 M  +1 -1      umbrello/umlviewimageexportermodel.cpp  


** branches/work/soc-umbrello #property svnmerge-integrated
   - /trunk/KDE/kdesdk/umbrello:1-854015,854687,854787,855207-866962,866965-870129,871091,872169-887978,889968-889981,890075-890805,896752-896872,901256-910119,911086,911706-911805,912902,913652,914852-917492,918579-919414,920540-921357,922431,922854-927155,928929-928936,931178-937536,937636,937969-941130,941971,942048-942637,943412,945536-946356,948572-948599,949430,951335-951484
   + /trunk/KDE/kdesdk/umbrello:1-854015,854687,854787,855207-866962,866965-870129,871091,872169-887978,889968-889981,890075-890805,896752-896872,901256-910119,911086,911706-911805,912902,913652,914852-917492,918579-919414,920540-921357,922431,922854-927155,928929-928936,931178-937536,937636,937969-941130,941971,942048-942637,943412,945536-946356,948572-948599,949430,951335-951484,952053-952131
--- branches/work/soc-umbrello/umbrello/cmdlineexportallviewsevent.cpp #953231:953232
@@ -60,7 +60,7 @@
 
 /**
  * Exports all the views using UMLViewImageExporterModel, prints the errors
- * occurred in the error output and sends a close event to the application to finish it.
+ * occurred in the error output and quits the application.
  * To export the views, it uses the attributes set when the event was created.
  */
 void CmdLineExportAllViewsEvent::exportAllViews()
@@ -73,5 +73,5 @@
         }
     }
 
-    kapp->sendEvent(UMLApp::app(), new QCloseEvent());
+    kapp->quit();
 }
--- branches/work/soc-umbrello/umbrello/dialogs/importprojectdlg.cpp #953231:953232
@@ -103,7 +103,7 @@
         KMessageBox::sorry(this, i18n("You have to choose a directory."));
         return;
     }
-    QDir dir(url.path());
+    QDir dir(url.toLocalFile());
     if (!dir.exists()){
         KMessageBox::sorry(this, i18n("This directory does not exist."));
         return;
--- branches/work/soc-umbrello/umbrello/uml.cpp #953231:953232
@@ -60,11 +60,7 @@
 #include <kconfig.h>
 #include <kcursor.h>
 #include <kdebug.h>
-#ifdef Q_WS_WIN
-#include <QtGui/QFileDialog>
-#else
 #include <kfiledialog.h>
-#endif
 #include <klocale.h>
 #include <kmenubar.h>
 #include <kmessagebox.h>
@@ -1019,22 +1015,12 @@
         // here saving wasn't successful
     }
     else {
-#ifdef Q_WS_WIN
-        KUrl url=QFileDialog::getOpenFileName(    //krazy:exclude=qclasses
-            this,
-            i18n("Open File"),
-            "",
-            i18n("All Supported Files (*.xmi *.mdl);;"
-                 "XMI Files (*.xmi);;"
-                 "Rose model files (*.mdl)"));
-#else
         KUrl url=KFileDialog::getOpenUrl(KUrl(),
             i18n("*.xmi *.xmi.tgz *.xmi.tar.bz2 *.mdl|All Supported Files (*.xmi, *.xmi.tgz, *.xmi.tar.bz2, *.mdl)\n"
                  "*.xmi|Uncompressed XMI Files (*.xmi)\n"
                  "*.xmi.tgz|Gzip Compressed XMI Files (*.xmi.tgz)\n"
                  "*.xmi.tar.bz2|Bzip2 Compressed XMI Files (*.xmi.tar.bz2)\n"
                  "*.mdl|Rose model files"), this, i18n("Open File"));
-#endif
         if (!url.isEmpty()) {
             if (m_doc->openDocument(url)) {
                 fileOpenRecent->addUrl( url );
@@ -1104,15 +1090,7 @@
     KUrl url;
     QString ext;
     while (cont) {
-#ifdef Q_WS_WIN
-        url=QFileDialog::getSaveFileName(    //krazy:exclude=qclasses
-            this,
-            i18n("Save As"),
-            "",
-            i18n("XMI File (*.xmi);;All Files (*.*"));
-#else
         url=KFileDialog::getSaveUrl(KUrl(), i18n("*.xmi|XMI File\n*.xmi.tgz|Gzip Compressed XMI File\n*.xmi.tar.bz2|Bzip2 Compressed XMI File\n*|All Files"), this, i18n("Save As"));
-#endif
         if (url.isEmpty()) {
             cont = false;
         }
@@ -1126,16 +1104,20 @@
             //    url.setFileName(url.fileName() + ".xmi");
             //    ext = "xmi";
             //}
-            QDir d = url.path( KUrl::RemoveTrailingSlash );
+            if (url.isLocalFile()) {
+                QString file = url.toLocalFile( KUrl::RemoveTrailingSlash );
 
-            if (QFile::exists(d.path())) {
-                int want_save = KMessageBox::warningContinueCancel(this, i18n("The file %1 exists.\nDo you wish to overwrite it?", url.path()),
-                                                                   i18n("Warning"), KGuiItem(i18n("Overwrite")));
-                if (want_save == KMessageBox::Continue) {
+                if (QFile::exists(file)) {
+                    int want_save = KMessageBox::warningContinueCancel(this, i18n("The file %1 exists.\nDo you wish to overwrite it?", url.toLocalFile()), 
+                                                                       i18n("Warning"), KGuiItem(i18n("Overwrite")));
+                    if (want_save == KMessageBox::Continue) {
+                        cont = false;
+                    }
+                }
+                else {
                     cont = false;
                 }
-            }
-            else {
+            } else {
                 cont = false;
             }
         }
@@ -1153,8 +1135,7 @@
         resetStatusMsg();
         return false;
     }
-}
-
+} 
 /**
  * Asks for saving if the file is modified, then closes the current
  * file and window.
@@ -2275,14 +2256,8 @@
         preselectedExtension = i18n("*.h *.hh *.hpp *.hxx *.H|Header Files (*.h *.hh *.hpp *.hxx *.H)");
     }
     preselectedExtension.append("\n*|" + i18n("All Files"));
-#ifdef Q_WS_WIN
-    QStringList extList = preselectedExtension.split('|');
-    QStringList fileList = QFileDialog::getOpenFileNames(this, i18n("Select Code to Import"),    //krazy:exclude=qclasses
-                                "", extList[1] );
-#else
     QStringList fileList = KFileDialog::getOpenFileNames(KUrl(), preselectedExtension,
                            this, i18n("Select Code to Import") );
-#endif
     importFiles(&fileList);
 }
 
--- branches/work/soc-umbrello/umbrello/umldoc.cpp #953231:953232
@@ -386,7 +386,6 @@
     }
 
     m_doc_url = url;
-    QDir d = url.path(KUrl::AddTrailingSlash);
     closeDocument();
     // IMPORTANT: set m_bLoading to true
     // _AFTER_ the call of UMLDoc::closeDocument()
@@ -399,7 +398,7 @@
                             );
     QFile file( tmpfile );
     if ( !file.exists() ) {
-        KMessageBox::error(0, i18n("The file %1 does not exist.", d.path()), i18n("Load Error"));
+        KMessageBox::error(0, i18n("The file %1 does not exist.", url.pathOrUrl()), i18n("Load Error"));
         m_doc_url.setFileName(i18n("Untitled"));
         m_bLoading = false;
         newDocument();
@@ -424,7 +423,7 @@
         KTar archive(tmpfile, mimetype);
         if (archive.open(QIODevice::ReadOnly) == false)
         {
-            KMessageBox::error(0, i18n("The file %1 seems to be corrupted.", d.path()), i18n("Load Error"));
+            KMessageBox::error(0, i18n("The file %1 seems to be corrupted.", url.pathOrUrl()), i18n("Load Error"));
             m_doc_url.setFileName(i18n("Untitled"));
             m_bLoading = false;
             newDocument();
@@ -466,7 +465,7 @@
             entry = const_cast<KArchiveEntry*>(rootDir->entry(*it));
             if (entry == 0)
             {
-                KMessageBox::error(0, i18n("There was no XMI file found in the compressed file %1.", d.path()),
+                KMessageBox::error(0, i18n("There was no XMI file found in the compressed file %1.", url.pathOrUrl()),
                                    i18n("Load Error"));
                 m_doc_url.setFileName(i18n("Untitled"));
                 m_bLoading = false;
@@ -479,7 +478,7 @@
             fileEntry = dynamic_cast<KArchiveFile*>(entry);
             if (fileEntry == 0)
             {
-                KMessageBox::error(0, i18n("There was no XMI file found in the compressed file %1.", d.path()),
+                KMessageBox::error(0, i18n("There was no XMI file found in the compressed file %1.", url.pathOrUrl()),
                                    i18n("Load Error"));
                 m_doc_url.setFileName(i18n("Untitled"));
                 m_bLoading = false;
@@ -494,7 +493,7 @@
             QFile xmi_file(tmp_dir.name() + *it);
             if( !xmi_file.open( QIODevice::ReadOnly ) )
             {
-                KMessageBox::error(0, i18n("There was a problem loading the extracted file: %1", d.path()),
+                KMessageBox::error(0, i18n("There was a problem loading the extracted file: %1", url.pathOrUrl()),
                                    i18n("Load Error"));
                 m_doc_url.setFileName(i18n("Untitled"));
                 m_bLoading = false;
@@ -506,7 +505,7 @@
             // close the extracted file and the temporary directory
             xmi_file.close();
         } else {
-            KMessageBox::error(0, i18n("There was no XMI file found in the compressed file %1.", d.path()),
+            KMessageBox::error(0, i18n("There was no XMI file found in the compressed file %1.", url.pathOrUrl()),
                                i18n("Load Error"));
             m_doc_url.setFileName(i18n("Untitled"));
             m_bLoading = false;
@@ -519,7 +518,7 @@
     {
         // no, it seems to be an ordinary file
         if( !file.open( QIODevice::ReadOnly ) ) {
-            KMessageBox::error(0, i18n("There was a problem loading file: %1", d.path()),
+            KMessageBox::error(0, i18n("There was a problem loading file: %1", url.pathOrUrl()),
                                i18n("Load Error"));
             m_doc_url.setFileName(i18n("Untitled"));
             m_bLoading = false;
@@ -536,7 +535,7 @@
     KIO::NetAccess::removeTempFile( tmpfile );
     if( !status )
     {
-        KMessageBox::error(0, i18n("There was a problem loading file: %1", d.path()),
+        KMessageBox::error(0, i18n("There was a problem loading file: %1", url.pathOrUrl()),
                            i18n("Load Error"));
         m_bLoading = false;
         newDocument();
@@ -565,7 +564,6 @@
 {
     Q_UNUSED(format);
     m_doc_url = url;
-    QDir d = m_doc_url.path(KUrl::AddTrailingSlash);
     bool uploaded = true;
 
     // first, we have to find out which format to use
@@ -598,9 +596,9 @@
         {
             if (fileFormat == "tgz") // check tgz or bzip2
             {
-                archive = new KTar(d.path(), "application/x-gzip");
+                archive = new KTar(url.toLocalFile(), "application/x-gzip");
             } else {
-                archive = new KTar(d.path(), "application/x-bzip");
+                archive = new KTar(url.toLocalFile(), "application/x-bzip");
             }
         } else {
             if (fileFormat == "tgz") // check tgz or bzip2
@@ -614,7 +612,7 @@
         // now check if we can write to the file
         if (archive->open(QIODevice::WriteOnly) == false)
         {
-            KMessageBox::error(0, i18n("There was a problem saving file: %1", d.path()), i18n("Save Error"));
+            KMessageBox::error(0, i18n("There was a problem saving file: %1", url.pathOrUrl()), i18n("Save Error"));
             delete archive;
             return false;
         }
@@ -624,7 +622,7 @@
         KTemporaryFile tmp_xmi_file;
         tmp_xmi_file.setAutoRemove(false);
         if ( !tmp_xmi_file.open() ) {
-            KMessageBox::error(0, i18n("There was a problem saving file: %1", d.path()), i18n("Save Error"));
+            KMessageBox::error(0, i18n("There was a problem saving file: %1", url.pathOrUrl()), i18n("Save Error"));
             delete archive;
             return false;
         }
@@ -641,7 +639,7 @@
         archive->addLocalFile(tmp_xmi_file.fileName(), tmpQString);
 
         if (!archive->close()) {
-            KMessageBox::error(0, i18n("There was a problem saving file: %1", d.path()), i18n("Save Error"));
+            KMessageBox::error(0, i18n("There was a problem saving file: %1", url.pathOrUrl()), i18n("Save Error"));
             delete archive;
             return false;
         }
@@ -675,7 +673,7 @@
 
         // lets open the file for writing
         if( !tmpfile.open() ) {
-            KMessageBox::error(0, i18n("There was a problem saving file: %1", d.path()), i18n("Save Error"));
+            KMessageBox::error(0, i18n("There was a problem saving file: %1", url.pathOrUrl()), i18n("Save Error"));
             return false;
         }
         saveToXMI(tmpfile); // save the xmi stuff to it
@@ -687,27 +685,22 @@
                                              );
         }
         else {
+            // now remove the original file
 #ifdef Q_WS_WIN
-            // use Qt way of file copying until broken KIO::file_move() is fixed
-            QFile::remove(url.toLocalFile());
-            if ( !QFile::copy(tmpfile.fileName(),url.toLocalFile()) ) {
-                KMessageBox::error(0, i18n("There was a problem saving file: %1", url.toLocalFile()), i18n("Save Error"));
-                m_doc_url.setFileName(i18n("Untitled"));
-                return false;
-            }
+            tmpfile.setAutoRemove(true);
+            KIO::FileCopyJob* fcj = KIO::file_copy( tmpfile.fileName(), url, -1, KIO::Overwrite );
 #else
-            // now remove the original file
-            KIO::FileCopyJob* fcj = KIO::file_move( tmpfile.fileName(), d.path(), -1, KIO::Overwrite );
+            KIO::FileCopyJob* fcj = KIO::file_move( tmpfile.fileName(), url, -1, KIO::Overwrite );
+#endif
             if ( KIO::NetAccess::synchronousRun( fcj, (QWidget*)UMLApp::app() ) == false ) {
-                KMessageBox::error(0, i18n("There was a problem saving file: %1", d.path()), i18n("Save Error"));
+                KMessageBox::error(0, i18n("There was a problem saving file: %1", url.pathOrUrl()), i18n("Save Error"));
                 m_doc_url.setFileName(i18n("Untitled"));
                 return false;
             }
-#endif
         }
     }
     if( !uploaded ) {
-        KMessageBox::error(0, i18n("There was a problem uploading file: %1", d.path()), i18n("Save Error"));
+        KMessageBox::error(0, i18n("There was a problem uploading file: %1", url.pathOrUrl()), i18n("Save Error"));
         m_doc_url.setFileName(i18n("Untitled"));
     }
     setModified(false);
--- branches/work/soc-umbrello/umbrello/umlviewimageexportermodel.cpp #953231:953232
@@ -211,7 +211,7 @@
     QString fileName;
     KTemporaryFile tmpFile;
     if (url.isLocalFile()) {
-        fileName = url.path();
+        fileName = url.toLocalFile();
     } else {
         tmpFile.open();
         fileName = tmpFile.fileName();




More information about the umbrello-devel mailing list