1.1 --- a/mainwindow.cpp Mon Mar 03 09:25:40 2008 +0000
1.2 +++ b/mainwindow.cpp Mon Mar 03 09:25:40 2008 +0000
1.3 @@ -1938,117 +1938,8 @@
1.4
1.5 void Main::fileSave(MapEditor *me, const SaveMode &savemode)
1.6 {
1.7 - /* FIXME moved to ME
1.8 - // Error codes
1.9 - ErrorCode err=success;
1.10 -
1.11 - QString safeFilePath;
1.12 -
1.13 if (!me) return;
1.14 - bool saveZipped=me->saveZipped();
1.15 -
1.16 - // tmp dir for zipping
1.17 - QString tmpZipDir;
1.18 -
1.19 - */
1.20 -
1.21 -
1.22 - if (!me) return;
1.23 -
1.24 - // filename=unnamed, filepath="" in constructor of mapEditor
1.25 -
1.26 - /* FIXME moved to ME
1.27 - if ( !fn.isEmpty() )
1.28 - {
1.29 - // We have a filepath, go on saving
1.30 -
1.31 - // Look, if we should zip the data:
1.32 - if (!saveZipped)
1.33 - {
1.34 - QMessageBox mb( vymName,
1.35 - tr("The map %1\ndid not use the compressed "
1.36 - "vym file format.\nWriting it uncompressed will also write images \n"
1.37 - "and flags and thus may overwrite files in the "
1.38 - "given directory\n\nDo you want to write the map").arg(fn),
1.39 - QMessageBox::Warning,
1.40 - QMessageBox::Yes | QMessageBox::Default,
1.41 - QMessageBox::No ,
1.42 - QMessageBox::Cancel | QMessageBox::Escape);
1.43 - mb.setButtonText( QMessageBox::Yes, tr("compressed (vym default)") );
1.44 - mb.setButtonText( QMessageBox::No, tr("uncompressed") );
1.45 - mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
1.46 - switch( mb.exec() )
1.47 - {
1.48 - case QMessageBox::Yes:
1.49 - // save compressed (default file format)
1.50 - saveZipped=true;
1.51 - break;
1.52 - case QMessageBox::No:
1.53 - // save uncompressed
1.54 - saveZipped=false;
1.55 - break;
1.56 - case QMessageBox::Cancel:
1.57 - // do nothing
1.58 - return;
1.59 - break;
1.60 - }
1.61 - me->setZipped (saveZipped);
1.62 - }
1.63 -
1.64 - // First backup existing file, we
1.65 - // don't want to add to old zip archives
1.66 - QFile f(fn);
1.67 - if (f.exists())
1.68 - {
1.69 - if (actionSettingsWriteBackupFile->isOn())
1.70 - {
1.71 - QString bfn(fn + "~");
1.72 - QFile bf(bfn);
1.73 - if (bf.exists() && !bf.remove())
1.74 - {
1.75 - QMessageBox::warning(0, tr("Save Error"),
1.76 - bfn + tr("\ncould not be removed before saving"));
1.77 - }
1.78 - else if (!f.rename(bfn))
1.79 - {
1.80 - QMessageBox::warning(0, tr("Save Error"),
1.81 - fn + tr("\ncould not be renamed before saving"));
1.82 - }
1.83 - }
1.84 - }
1.85 -
1.86 - if (saveZipped)
1.87 - {
1.88 - // Create temporary directory for packing
1.89 - bool ok;
1.90 - tmpZipDir=makeTmpDir (ok,"vym-zip");
1.91 - if (!ok)
1.92 - {
1.93 - QMessageBox::critical( 0, tr( "Critical Load Error" ),
1.94 - tr("Couldn't create temporary directory before save\n"));
1.95 - return;
1.96 - }
1.97 -
1.98 - safeFilePath=me->getFilePath();
1.99 - me->setFilePath (tmpZipDir+"/"+
1.100 - me->getMapName()+ ".xml",
1.101 - safeFilePath);
1.102 - me->save (savemode);
1.103 - me->setFilePath (safeFilePath);
1.104 -
1.105 - zipDir (tmpZipDir,fn);
1.106 - } // save zipped
1.107 - else
1.108 - {
1.109 - // Save unzipped.
1.110 - safeFilePath=me->getFilePath();
1.111 - me->setFilePath (fn, safeFilePath);
1.112 - me->save (savemode);
1.113 - me->setFilePath (safeFilePath);
1.114 - } // save zipped
1.115 - } // filepath available
1.116 - else
1.117 - */
1.118 +
1.119 if ( me->getFilePath().isEmpty() )
1.120 {
1.121 // We have no filepath yet,
1.122 @@ -2059,11 +1950,6 @@
1.123 fileSaveAs(savemode);
1.124 }
1.125
1.126 -/* FIXME moved to ME
1.127 - if (saveZipped && !tmpZipDir.isEmpty())
1.128 - // Delete tmpDir
1.129 - removeDir (QDir(tmpZipDir));
1.130 -*/
1.131 if (me->save (savemode)==success)
1.132 {
1.133 statusBar()->message(