# HG changeset patch
# User insilmaril
# Date 1138192495 0
# Node ID 202572375c9822c28bbda4f7f1e3056ae7abcf36
# Parent  3f4bc2397c3cce5f7280fd4212f43bfbd2867f64
Fixed outputFile in OO export

diff -r 3f4bc2397c3c -r 202572375c98 exports.cpp
--- a/exports.cpp	Wed Jan 25 12:34:55 2006 +0000
+++ b/exports.cpp	Wed Jan 25 12:34:55 2006 +0000
@@ -14,9 +14,14 @@
 	indentPerDepth="  ";
 }
 
-void ExportBase::setPath (const QString &p)
+void ExportBase::setDir(const QString &p)
 {
-	filepath=p;
+	outputDir=p;
+}
+
+void ExportBase::setFile (const QString &p)
+{
+	outputFile=p;
 }
 
 void ExportBase::setMapCenter(MapCenterObj *mc)
@@ -43,11 +48,11 @@
 
 void ExportBase::exportXML()
 {
-	QFile file (filepath);
+	QFile file (outputFile);
 	if ( !file.open( IO_WriteOnly ) )
 	{
 		// FIXME experimental, testing
-		cout << "ExportBase::exportXML  couldn't open "<<filepath<<endl;
+		cout << "ExportBase::exportXML  couldn't open "<<outputFile<<endl;
 		return;
 	}
 	QTextStream ts( &file );	// use LANG decoding here...
@@ -99,10 +104,10 @@
 	// or inported into a LaTex document
 	// it will not add a preamble, or anything 
 	// that makes a full LaTex document.
-  QFile file (filepath);
+  QFile file (outputFile);
   if ( !file.open( IO_WriteOnly ) ) {
-    // FIXME
-    cout << "Export::exportMap  couldn't open "<<filepath<<endl;
+    // FIXME 
+    cout << "Export::exportMap  couldn't open "<<outputFile<<endl;
     return;
   }
   QTextStream ts( &file );	// use LANG decoding here...
@@ -145,6 +150,7 @@
 
 ExportOO::ExportOO()
 {
+	useSections=false;
 	// Create tmpdir
 	tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
 }
@@ -189,8 +195,6 @@
 {
 	QString allPages;
 
-	bool useSections=true;
-
 	// Insert new content
 	content.replace ("<!-- INSERT TITLE -->",quotemeta(mapCenter->getHeading()));
 	content.replace ("<!-- INSERT AUTHOR -->",quotemeta(mapCenter->getAuthor()));
@@ -243,7 +247,7 @@
 	QFile f (contentFile);
     if ( !f.open( IO_WriteOnly ) ) 
 	{
-		mainWindow->statusMessage(QString(QObject::tr("Could not write to %1")).arg(outputFile));
+		mainWindow->statusMessage(QString(QObject::tr("Could not write to %1")).arg(contentFile));
 		return;
     }
 
@@ -279,8 +283,9 @@
 	pageTemplateFile=templateDir+"page-template.xml";
 	sectionTemplateFile=templateDir+"section-template.xml";
 
-	outputFile=tmpDir.currentDirPath()+"/vym-out.odp";
-	
+	if (set.readEntry("useSections").contains("yes"))
+		useSections=true;
+
 	// Copy template to tmpdir
 	system ("cp -r "+templateDir+"* "+tmpDir.path());
 
diff -r 3f4bc2397c3c -r 202572375c98 exports.h
--- a/exports.h	Wed Jan 25 12:34:55 2006 +0000
+++ b/exports.h	Wed Jan 25 12:34:55 2006 +0000
@@ -16,7 +16,8 @@
 {
 public:
 	ExportBase();
-	void setPath(const QString &);
+	void setDir(const QString &);
+	void setFile(const QString &);
 	void setMapCenter (MapCenterObj*);
 	void setIndentPerDepth (QString);
 protected:  
@@ -26,7 +27,8 @@
 
 protected:
 	QDir outdir;
-	QString filepath;
+	QString outputDir;
+	QString outputFile;
 	MapCenterObj *mapCenter;
 	QString	indentPerDepth;
 };
@@ -57,7 +59,6 @@
 	QString contentTemplate;
 	QString contentTemplateFile;
 	QString contentFile;
-	QString outputFile;
 	QString pageTemplate;
 	QString pageTemplateFile;
 	QString sectionTemplate;
diff -r 3f4bc2397c3c -r 202572375c98 mapeditor.cpp
--- a/mapeditor.cpp	Wed Jan 25 12:34:55 2006 +0000
+++ b/mapeditor.cpp	Wed Jan 25 12:34:55 2006 +0000
@@ -1096,7 +1096,7 @@
 					break;
 			}
 		}
-		ex.setPath (fd->selectedFile() );
+		ex.setFile(fd->selectedFile() );
 		ex.exportXML();
 	}
 }
@@ -1115,8 +1115,7 @@
 		if (QFile (fd->selectedFile()).exists() )
 		{
 			QMessageBox mb( "VYM",
-				tr("The file ") + fd->selectedFile() + 
-				tr(" exists already. Do you want to overwrite it?"),
+				tr("The file %1\nexists already. Do you want to overwrite it?").arg(fd->selectedFile()),
 			QMessageBox::Warning,
 			QMessageBox::Yes | QMessageBox::Default,
 			QMessageBox::Cancel | QMessageBox::Escape,
@@ -1137,7 +1136,7 @@
 			}
 		}
 		ExportLaTeX ex;
-		ex.setPath (fd->selectedFile() );
+		ex.setFile (fd->selectedFile() );
 		ex.setMapCenter(mapCenter);
 		ex.exportLaTeX();
 	}
@@ -1146,7 +1145,7 @@
 void MapEditor::exportOOPresentation(const QString &fn, const QString &cf)
 {
 	ExportOO ex;
-	ex.setPath (fn);
+	ex.setFile (fn);
 	ex.setMapCenter(mapCenter);
 	if (ex.setConfigFile(cf)) ex.exportPresentation();
 }