diff -r 36eb4b8f409e -r fac2248e2afa exports.cpp --- a/exports.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/exports.cpp Mon Mar 08 12:22:15 2010 +0000 @@ -484,7 +484,6 @@ singularDelimiter=": "; noSingulars=true; frameURLs=true; - useMapColors=true; cssFileName="vym.css"; cssOriginalPath=""; // Is set in VymModel, based on default setting in ExportHTMLDialog @@ -506,7 +505,7 @@ } QString col; QString id=model->getSelectString(current); - if (useMapColors) + if (dia.useTextColor) col=QString("style='color:%1'").arg(current->getHeadingColor().name()); QString s=QString("") .arg(current->depth()) @@ -531,7 +530,7 @@ s+=quotemeta(current->getHeading()); s+=""; - if (vis) + if (vis && dia.useImage) imageMap+=QString(" \n") .arg(hr.left()-offset.x()) .arg(hr.top()-offset.y()) @@ -595,9 +594,39 @@ cssOriginalPath=p; } -void ExportHTML::doExport() +void ExportHTML::doExport(bool useDialog) { - //FIXME-1 check for errors// Copy CSS file + // Execute dialog + dia.setFilePath (model->getFilePath()); + dia.setMapName (model->getMapName()); + dia.readSettings(); + if (useDialog && dia.exec()!=QDialog::Accepted) return; + + // Check if destination is not empty + QDir d=dia.getDir(); + // Check, if warnings should be used before overwriting + // the output directory + if (d.exists() && d.count()>0) + { + WarningDialog warn; + warn.showCancelButton (true); + warn.setText(QString( + "The directory %1 is not empty.\n" + "Do you risk to overwrite some of its contents?").arg(d.path() )); + warn.setCaption("Warning: Directory not empty"); + warn.setShowAgainName("mainwindow/export-XML-overwrite-dir"); + + if (warn.exec()!=QDialog::Accepted) + { + mainWindow->statusMessage(QString(QObject::tr("Export aborted."))); + return; + } + } + + setFile (d.path()+"/"+model->getMapName()+".html"); + setCSSPath( dia.getCSSPath() ); + + // Copy CSS file QFile css_src (cssOriginalPath); QFile css_dst (outDir.path()+"/"+cssFileName); if (!css_src.open ( QIODevice::ReadOnly)) @@ -631,13 +660,19 @@ QTextStream ts( &file ); // use LANG decoding here... ts.setEncoding (QTextStream::UnicodeUTF8); // Force UTF8 + // Hide stuff during export + model->setExportMode (true); + // Write header ts<<""+model->getMapName()<<""; ts<<" \n"; // Include image - ts<<"
getMapName()<<".png\" usemap='#imagemap'>
\n"; - + if (dia.useImage) + { + ts<<"
getMapName()<<".png\" usemap='#imagemap'>
\n"; + model->exportImage (d.path()+"/"+model->getMapName()+".png",false,"PNG"); + } // Main loop over all mapcenters QString s; @@ -667,6 +702,16 @@ \n"; ts<<""; file.close(); + + if (!dia.postscript.isEmpty()) + { + Process p; + p.runScript (dia.postscript,d.path()+"/"+model->getMapName()+".html"); + } + + + dia.saveSettings(); + model->setExportMode (true); } ////////////////////////////////////////////////////////////////////////