1.1 --- a/mapeditor.cpp Mon Mar 03 09:25:40 2008 +0000
1.2 +++ b/mapeditor.cpp Tue Apr 08 08:28:37 2008 +0000
1.3 @@ -1661,7 +1661,11 @@
1.4
1.5
1.6 // We need to set the tmpDir in order to load files with rel. path
1.7 - QString tmpdir= fname.left(fname.findRev("/",-1));
1.8 + QString tmpdir;
1.9 + if (zipped)
1.10 + tmpdir=tmpZipDir;
1.11 + else
1.12 + tmpdir=fname.left(fname.findRev("/",-1));
1.13 handler->setTmpDir (tmpdir);
1.14 handler->setInputFile (file.name());
1.15 handler->setLoadMode (lmode);
1.16 @@ -1693,18 +1697,16 @@
1.17 }
1.18 }
1.19
1.20 - // Delete tmpDir
1.21 + // Delete tmpZipDir
1.22 removeDir (QDir(tmpZipDir));
1.23
1.24 updateActions();
1.25 +
1.26 return err;
1.27 }
1.28
1.29 ErrorCode MapEditor::save (const SaveMode &savemode)
1.30 {
1.31 - cout <<"ME::save "<<qPrintable (mapName)<<" zipped="<<zipped<<endl; // FIXME debug
1.32 - // Create mapName and fileDir
1.33 - makeSubDirs (fileDir);
1.34 QString tmpZipDir;
1.35 QString mapFileName;
1.36 QString safeFilePath;
1.37 @@ -1757,7 +1759,6 @@
1.38 {
1.39 if ( settings.value ("/mapeditor/writeBackupFile").toBool())
1.40 {
1.41 - cout << "ME::doing backup...\n";//FIXME
1.42 QString backupFileName(destPath + "~");
1.43 QFile backupFile(backupFileName);
1.44 if (backupFile.exists() && !backupFile.remove())
1.45 @@ -1789,6 +1790,9 @@
1.46 setFilePath (tmpZipDir+"/"+ mapName+ ".xml", safeFilePath);
1.47 } // zipped
1.48
1.49 + // Create mapName and fileDir
1.50 + makeSubDirs (fileDir);
1.51 +
1.52 QString saveFile;
1.53 if (savemode==CompleteMap || xelection.isEmpty())
1.54 {
1.55 @@ -1831,17 +1835,6 @@
1.56 return err;
1.57 }
1.58
1.59 -/* FIXME not needed any longer
1.60 -void MapEditor::setZipped (bool z)
1.61 -{
1.62 - zipped=z;
1.63 -}
1.64 -
1.65 -bool MapEditor::saveZipped ()
1.66 -{
1.67 - return zipped;
1.68 -}
1.69 -*/
1.70
1.71 void MapEditor::print()
1.72 {
1.73 @@ -2433,6 +2426,7 @@
1.74 {
1.75 bool old=blockSaveState;
1.76 blockSaveState=true;
1.77 + bool zippedOrg=zipped;
1.78 if (redosAvail > 0 || n!=0)
1.79 {
1.80 // Use the "historical" buffer
1.81 @@ -2442,6 +2436,7 @@
1.82 } else
1.83 // Use the global buffer
1.84 load (clipboardDir+"/"+clipboardFile,ImportAdd, VymMap);
1.85 + zipped=zippedOrg;
1.86 blockSaveState=old;
1.87 }
1.88
1.89 @@ -3191,6 +3186,7 @@
1.90 if (bo1)
1.91 {
1.92 par=(BranchObj*)(bo1->getParObj());
1.93 + if (!par) return;
1.94 bo2=par->getFirstBranch();
1.95 if (bo2) {
1.96 xelection.select(bo2);
1.97 @@ -3209,6 +3205,7 @@
1.98 if (bo1)
1.99 {
1.100 par=(BranchObj*)(bo1->getParObj());
1.101 + if (!par) return;
1.102 bo2=par->getLastBranch();
1.103 if (bo2)
1.104 {
1.105 @@ -5217,6 +5214,7 @@
1.106 cout << "fsaved: "<<qPrintable (fileChangedTime.toString())<<endl;
1.107 cout << " fnow: "<<qPrintable (QFileInfo(filePath).lastModified().toString())<<endl;
1.108 cout << " time: "<<qPrintable (now.toString())<<endl;
1.109 + cout << " zipped="<<zipped<<endl;
1.110 */
1.111 // Disable autosave, while we have gone back in history
1.112 int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail"));