exports.cpp
changeset 376 626fd85b1f69
parent 311 6a7db028088e
child 377 5391ab620c95
     1.1 --- a/exports.cpp	Mon May 08 13:25:46 2006 +0000
     1.2 +++ b/exports.cpp	Tue Sep 05 15:05:18 2006 +0000
     1.3 @@ -1,6 +1,8 @@
     1.4 -#include <qfiledialog.h>
     1.5 +#include <q3filedialog.h>
     1.6  #include <qmessagebox.h>
     1.7 -#include <qprocess.h>
     1.8 +#include <QProcess>
     1.9 +//Added by qt3to4:
    1.10 +#include <QTextStream>
    1.11  
    1.12  #include "exports.h"
    1.13  #include "file.h"
    1.14 @@ -18,7 +20,10 @@
    1.15  {
    1.16  	indentPerDepth="  ";
    1.17  	// Create tmpdir
    1.18 -	tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
    1.19 +	// FIXME not neededtmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
    1.20 +	if (!tmpDir.cd ("tmp"))
    1.21 +		qWarning ("Could not access temporary directory for export");
    1.22 +		// FIXME there's more needed here...
    1.23  }
    1.24  
    1.25  ExportBase::~ExportBase()
    1.26 @@ -57,7 +62,7 @@
    1.27  	if (mapCenter && mapCenter->getMapEditor())
    1.28  	{
    1.29  		QFileDialog *fd=new QFileDialog( mapCenter->getMapEditor(), caption);
    1.30 -		fd->addFilter (filter);
    1.31 +		fd->setFilter (filter);
    1.32  		fd->setCaption(caption);
    1.33  		fd->setMode( QFileDialog::AnyFile );
    1.34  		fd->show();
    1.35 @@ -71,7 +76,7 @@
    1.36  				QMessageBox::Warning,
    1.37  				QMessageBox::Yes | QMessageBox::Default,
    1.38  				QMessageBox::Cancel | QMessageBox::Escape,
    1.39 -				QMessageBox::NoButton );
    1.40 +				Qt::NoButton );
    1.41  				mb.setButtonText( QMessageBox::Yes, QObject::tr("Overwrite") );
    1.42  				mb.setButtonText( QMessageBox::No, QObject::tr("Cancel"));
    1.43  				ExportBase ex;
    1.44 @@ -116,9 +121,8 @@
    1.45  void ExportASCII::doExport()
    1.46  {
    1.47  	QFile file (outputFile);
    1.48 -	if ( !file.open( IO_WriteOnly ) )
    1.49 +	if ( !file.open( QIODevice::WriteOnly ) )
    1.50  	{
    1.51 -		// FIXME experimental, testing
    1.52  		qWarning ("ExportBase::exportXML  couldn't open "+outputFile);
    1.53  		return;
    1.54  	}
    1.55 @@ -127,8 +131,7 @@
    1.56  	// Main loop over all branches
    1.57  	QString s;
    1.58  	QString actIndent("");
    1.59 -	int i;
    1.60 -	uint j;
    1.61 +	int i,j;
    1.62  	BranchObj *bo;
    1.63  	bo=mapCenter->first();
    1.64  	while (bo) 
    1.65 @@ -184,17 +187,14 @@
    1.66  			p.process();
    1.67  
    1.68  			QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
    1.69 -			QProcess *proc = new QProcess( );
    1.70 -			proc->addArgument(ub);
    1.71 -
    1.72 -			if ( !proc->start() ) 
    1.73 +			QProcess *proc= new QProcess ();
    1.74 +			proc->start( ub);
    1.75 +			if (!proc->waitForStarted());
    1.76  			{
    1.77  				QMessageBox::warning(0, 
    1.78  					QObject::tr("Warning"),
    1.79  					QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
    1.80  			}	
    1.81 -
    1.82 -
    1.83  		}
    1.84  	}
    1.85  
    1.86 @@ -248,8 +248,6 @@
    1.87  	if (me)
    1.88  	{
    1.89  		me->exportXML(tmpDir.path());
    1.90 -		//FIXME testing
    1.91 -		cout << "tmpDir="<<tmpDir.path()<<endl;
    1.92  
    1.93  		XSLTProc p;
    1.94  		p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
    1.95 @@ -269,7 +267,7 @@
    1.96  	// it will not add a preamble, or anything 
    1.97  	// that makes a full LaTex document.
    1.98    QFile file (outputFile);
    1.99 -  if ( !file.open( IO_WriteOnly ) ) {
   1.100 +  if ( !file.open( QIODevice::WriteOnly ) ) {
   1.101  	QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(outputFile));
   1.102  	mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
   1.103      return;
   1.104 @@ -405,7 +403,7 @@
   1.105  
   1.106  	// Write modified content
   1.107  	QFile f (contentFile);
   1.108 -    if ( !f.open( IO_WriteOnly ) ) 
   1.109 +    if ( !f.open( QIODevice::WriteOnly ) ) 
   1.110  	{
   1.111  		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(contentFile));
   1.112  		mainWindow->statusMessage(QString(QObject::tr("Export failed.")));