fix KSaveFile::open

Matthias Kretz kretz at kde.org
Mon Nov 19 10:46:24 GMT 2007


Oh, I'd like to remove the open() function:

Index: io/ksavefile.cpp
===================================================================
--- io/ksavefile.cpp    (revision 738067)
+++ io/ksavefile.cpp    (working copy)
@@ -76,7 +76,7 @@
     delete d;
 }

-bool KSaveFile::open()
+bool KSaveFile::open(OpenMode flags)
 {
     if ( d->realFileName.isNull() ) {
         d->error=QFile::OpenError;
@@ -131,7 +131,7 @@

     //Open oursleves with the temporary file
     QFile::setFileName(tempFile.fileName());
-    if ( !QFile::open(QIODevice::ReadWrite) ) {
+    if (!QFile::open(flags)) {
         tempFile.setAutoRemove(true);
         return false;
     }
Index: io/ksavefile.h
===================================================================
--- io/ksavefile.h      (revision 738067)
+++ io/ksavefile.h      (working copy)
@@ -151,9 +151,13 @@
      * This function will open the save file by creating a temporary file to 
write
      * to. It will also check to ensure that there are sufficient permissions 
to
      * write to the target file.
+     *
+     * @param flags Sets the QIODevice::OpenMode. It should contain the write 
flag, otherwise you
+     * have a save file you cannot save to.
+     *
      * @return true if successful, or false if an error has occurred.
      */
-    bool open();
+    virtual bool open(OpenMode flags = QIODevice::ReadWrite);

     /**
      * @brief Discard changes without affecting the target file.

-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071119/86afbb78/attachment.sig>


More information about the kde-core-devel mailing list