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

Ralf Habacker Ralf.Habacker at freenet.de
Fri Nov 2 21:53:01 UTC 2007


SVN commit 732137 by habacker:

fixed local file saving under win32

 M  +11 -3     umldoc.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.cpp #732136:732137
@@ -613,15 +613,22 @@
             return false;
         }
         saveToXMI(tmpfile); // save the xmi stuff to it
-#ifdef Q_WS_WIN
-        tmpfile.close();        
-#endif
+
         // if it is a remote file, we have to upload the tmp file
         if ( !url.isLocalFile() ) {
             uploaded = KIO::NetAccess::upload( tmpfile.fileName(), m_doc_url
                                                , UMLApp::app()
                                              );
         } else {
+#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;
+            }
+#else 
             // now remove the original file
             KIO::FileCopyJob* fcj = KIO::file_move( tmpfile.fileName(), d.path(), -1, KIO::Overwrite );
             if ( KIO::NetAccess::synchronousRun( fcj, (QWidget*)UMLApp::app() ) == false ) {
@@ -629,6 +636,7 @@
                 m_doc_url.setFileName(i18n("Untitled"));
                 return false;
             }
+#endif
         }
     }
     if( !uploaded )




More information about the umbrello-devel mailing list