[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/office/datakiosk/src
From:       Adam Treat <treat () kde ! org>
Date:       2005-12-12 22:01:42
Message-ID: 1134424902.419970.30351.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 488027 by treat:

Use KSaveFile

 M  +12 -9     project.cpp  


--- trunk/extragear/office/datakiosk/src/project.cpp #488026:488027
@@ -49,6 +49,7 @@
 #include <kconfig.h>
 #include <config.h>
 #include <kmdcodec.h>
+#include <ksavefile.h>
 #include <kiconloader.h>
 #include <kicondialog.h>
 #include <kactionclasses.h>
@@ -344,25 +345,27 @@
     if ( m_fileName.isEmpty() )
         saveAsProject();
 
+    KSaveFile saveFile( makeAbsolute( m_fileName ) );
+    if ( saveFile.status() != 0 )
+        return QString::null;
+
     QFile f( makeAbsolute( m_fileName ) );
 
     if ( m_dbConnections.isEmpty() && m_dataTables.isEmpty() )
     {
-        if ( f.exists() )
-            f.remove();
+        if ( saveFile.file()->exists() )
+            saveFile.file()->remove();
         m_fileName = QString::null;
         return QByteArray();
     }
 
-    widget->setCaption( QFileInfo( f ).baseName() );
+    widget->setCaption( QFileInfo( *saveFile.file() ).baseName() );
 
     QString md5sum;
-    if ( f.open( IO_ReadWrite | IO_Translate ) )
-    {
-        QTextStream ts( &f );
-        md5sum = writeProject( ts );
-    }
-    f.close();
+    QTextStream ts( saveFile.file() );
+    md5sum = writeProject( ts );
+    saveFile.file()->close();
+    saveFile.close();
     m_newProject = false;
     return md5sum;
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic