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

List:       kde-commits
Subject:    kdeedu/keduca
From:       Henrique Pinto <stampede () coltec ! ufmg ! br>
Date:       2004-11-13 14:03:04
Message-ID: 20041113140304.53D8216D57 () office ! kde ! org
[Download RAW message or body]

CVS commit by pinto: 

Allow to save files uncompressed.


  M +0 -1      TODO   1.8
  M +2 -2      keduca/keducaview.cpp   1.30
  M +9 -3      keducabuilder/keducabuilder.cpp   1.17
  M +8 -5      libkeduca/fileread.cpp   1.11
  M +2 -2      libkeduca/fileread.h   1.5


--- kdeedu/keduca/TODO  #1.7:1.8
@@ -5,5 +5,4 @@
 
   Things that NEED to be done before KDE 3.4:
-    -> Offer the option of saving using the old format or the new "compressed" one
     -> Use KNewStuff
     -> Go through all reports in b.k.o and fix what can be fixed

--- kdeedu/keduca/keducabuilder/keducabuilder.cpp  #1.16:1.17
@@ -31,7 +31,8 @@
 #include <kio/netaccess.h>
 #include <kmessagebox.h>
+#include <kprinter.h>
 
 #include <qlayout.h>
-#include <kprinter.h>
+#include <qcheckbox.h>
 #include <qpaintdevicemetrics.h>
 #include <qpainter.h>
@@ -403,5 +404,8 @@ bool KEducaBuilder::fileSaveAs()
     if( !checkSave() ) return false;
 
-    KFileDialog *dialog=new KFileDialog(QString::null, QString::null, this, "file \
dialog", true); +    QCheckBox *saveCompressedCheckBox = new QCheckBox( i18n( \
"Compress the file" ), 0 ); +    saveCompressedCheckBox->setChecked( true );
+
+    KFileDialog *dialog=new KFileDialog(QString::null, QString::null, this, "file \
dialog", true, saveCompressedCheckBox);  dialog->setCaption( i18n("Save Document As") \
);  dialog->setKeepLocation( true );
@@ -447,4 +451,5 @@ bool KEducaBuilder::fileSaveAs()
     } while ( !bOk );
 
+    bool saveCompressed = saveCompressedCheckBox->isChecked();
 
     delete dialog;
@@ -454,5 +460,5 @@ bool KEducaBuilder::fileSaveAs()
                             "Do you want to copy images?"),
                             i18n("Warning") ) == KMessageBox::Yes;
-        if (_keducaFile->saveFile( newURL, copyImages) ) {
+        if (_keducaFile->saveFile( newURL, copyImages, saveCompressed ) ) {
             _recentFiles->addURL(newURL);
             // we saved the file, so the internal representation is now present as a \
file

--- kdeedu/keduca/libkeduca/fileread.cpp  #1.10:1.11
@@ -638,5 +638,5 @@ void FileRead::recordSwap( bool moveup )
 }
 
-bool FileRead::saveFile( const KURL &url, bool copyimages )
+bool FileRead::saveFile( const KURL &url, bool copyimages, bool saveCompressed )
 {
     if (url.isValid())
@@ -654,5 +654,5 @@ bool FileRead::saveFile( const KURL &url
              _tmpfile = 0;
         }
-        if( saveFile(_currentURL.path(), copyimages) ) {
+        if( saveFile(_currentURL.path(), copyimages, saveCompressed) ) {
             emit completed();
             emit setWindowCaption( _currentURL.prettyURL() );
@@ -668,5 +668,5 @@ bool FileRead::saveFile( const KURL &url
         }
         // otherwise, we already had a temp file
-        if( saveFile(_tmpfile->name(), copyimages) ) {
+        if( saveFile(_tmpfile->name(), copyimages, saveCompressed) ) {
             // upload the file
              KIO::Job * job = KIO::file_copy( KURL::fromPathOrURL( _tmpfile->name() \
), _currentURL, -1, true /*overwrite*/ ); @@ -680,5 +680,5 @@ bool \
FileRead::saveFile( const KURL &url  }
 
-bool FileRead::saveFile( const QString &filename, bool copyimages )
+bool FileRead::saveFile( const QString &filename, bool copyimages, bool \
saveCompressed )  {
     QDomDocument doc("document.xml");
@@ -796,5 +796,8 @@ bool FileRead::saveFile( const QString &
     doc.save( stream, 4);
     buffer.close();
+    if ( saveCompressed )
     file.writeBlock(qCompress(data));
+    else
+        file.writeBlock(data);
     file.close();
 

--- kdeedu/keduca/libkeduca/fileread.h  #1.4:1.5
@@ -120,5 +120,5 @@ public:
     void recordSwap( bool );
     /** Save file */
-    bool saveFile( const KURL &url = KURL(), bool copyimages = false );
+    bool saveFile( const KURL &url = KURL(), bool copyimages = false, bool \
saveCompressed = true );  /** Save results */
     bool saveResults( const KURL &url, const QString &results );
@@ -227,5 +227,5 @@ protected:
     bool loadFile( const QString &filename );
     /** Save KEduca file to the file*/
-    bool saveFile( const QString &filename, bool copyimages );
+    bool saveFile( const QString &filename, bool copyimages, bool saveCompressed = \
true );  /** Save Results file to the file */
     bool saveResults( const QString &filename, const QString &results );


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

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