1.1 --- a/mainwindow.cpp Tue Sep 05 13:48:17 2006 +0000
1.2 +++ b/mainwindow.cpp Thu Sep 14 11:38:17 2006 +0000
1.3 @@ -30,13 +30,13 @@
1.4 #include "exportxhtmldialog.h"
1.5 #include "file.h"
1.6 #include "flagrowobj.h"
1.7 +#include "historywindow.h"
1.8 #include "imports.h"
1.9 #include "mapeditor.h"
1.10 #include "misc.h"
1.11 #include "options.h"
1.12 #include "process.h"
1.13 #include "settings.h"
1.14 -#include "showtextdialog.h"
1.15 #include "texteditor.h"
1.16 #include "version.h"
1.17
1.18 @@ -1850,8 +1850,14 @@
1.19 me->viewport()->setFocus();
1.20
1.21 // Create temporary directory for packing
1.22 - char tmpdir1[]="/tmp/vym-XXXXXX";
1.23 - QString tmpMapDir=mkdtemp(tmpdir1);
1.24 + bool ok;
1.25 + QString tmpMapDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX");
1.26 + if (!ok)
1.27 + {
1.28 + QMessageBox::critical( 0, tr( "Critical Load Error" ),
1.29 + tr("Couldn't create temporary directory before load\n"));
1.30 + return aborted;
1.31 + }
1.32
1.33 // Try to unzip file
1.34 err=unzipDir (tmpMapDir,fn);
1.35 @@ -1945,21 +1951,22 @@
1.36
1.37 void Main::fileLoad(const LoadMode &lmode)
1.38 {
1.39 - Q3FileDialog *fd=new Q3FileDialog( this);
1.40 + QStringList filters;
1.41 + filters <<"XML (*.xml)"<<"VYM map (*.vym *.vyp)";
1.42 + QFileDialog *fd=new QFileDialog( this);
1.43 fd->setDir (lastFileDir);
1.44 - fd->setMode (Q3FileDialog::ExistingFiles);
1.45 - fd->addFilter ("XML (*.xml)");
1.46 - fd->addFilter ("VYM map (*.vym *.vyp)");
1.47 + fd->setFileMode (QFileDialog::ExistingFiles);
1.48 + fd->setFilters (filters);
1.49 switch (lmode)
1.50 {
1.51 case NewMap:
1.52 - fd->setCaption(tr("Load vym map"));
1.53 + fd->setCaption(__VYM " - " +tr("Load vym map"));
1.54 break;
1.55 case ImportAdd:
1.56 - fd->setCaption(tr("Import: Add vym map to selection"));
1.57 + fd->setCaption(__VYM " - " +tr("Import: Add vym map to selection"));
1.58 break;
1.59 case ImportReplace:
1.60 - fd->setCaption(tr("Import: Replace selection with vym map"));
1.61 + fd->setCaption(__VYM " - " +tr("Import: Replace selection with vym map"));
1.62 break;
1.63 }
1.64 fd->show();
1.65 @@ -1967,7 +1974,7 @@
1.66 QString fn;
1.67 if ( fd->exec() == QDialog::Accepted )
1.68 {
1.69 - lastFileDir=fd->dirPath();
1.70 + lastFileDir=fd->directory().path();
1.71 QStringList flist = fd->selectedFiles();
1.72 QStringList::Iterator it = flist.begin();
1.73 while( it != flist.end() )
1.74 @@ -2052,9 +2059,16 @@
1.75
1.76 if (saveZipped)
1.77 {
1.78 - char tmpdir1[]="/tmp/vym-XXXXXX";
1.79 - tmpMapDir=mkdtemp(tmpdir1);
1.80 -
1.81 + // Create temporary directory for packing
1.82 + bool ok;
1.83 + QString tmpMapDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX");
1.84 + if (!ok)
1.85 + {
1.86 + QMessageBox::critical( 0, tr( "Critical Load Error" ),
1.87 + tr("Couldn't create temporary directory before save\n"));
1.88 + return;
1.89 + }
1.90 +
1.91 safeFilePath=me->getFilePath();
1.92 me->setFilePath (tmpMapDir+"/"+
1.93 me->getMapName()+ ".xml",
1.94 @@ -3201,7 +3215,9 @@
1.95
1.96 void Main::testFunction()
1.97 {
1.98 - currentMapEditor()->testFunction();
1.99 + HistoryWindow hw;
1.100 + hw.exec();
1.101 + //currentMapEditor()->testFunction();
1.102 }
1.103
1.104 void Main::helpDoc()