diff -r 0bba81dde1bc -r 36eb4b8f409e exports.cpp --- a/exports.cpp Fri Feb 19 13:47:03 2010 +0000 +++ b/exports.cpp Thu Feb 25 11:03:52 2010 +0000 @@ -8,6 +8,7 @@ #include "warningdialog.h" #include "xsltproc.h" + extern Main *mainWindow; extern QDir vymBaseDir; extern QString vymName; @@ -344,14 +345,11 @@ QString s; QString curIndent(""); int i; - BranchObj *bo; //FIXME-3 still needed? BranchItem *cur=NULL; BranchItem *prev=NULL; cur=model->nextBranch (cur,prev); while (cur) { - bo=(BranchObj*)(cur->getLMO()); - if (!cur->hasHiddenExportParent() ) { // If necessary, write note @@ -487,6 +485,8 @@ noSingulars=true; frameURLs=true; useMapColors=true; + cssFileName="vym.css"; + cssOriginalPath=""; // Is set in VymModel, based on default setting in ExportHTMLDialog if (model &&model->getMapEditor()) offset=model->getMapEditor()->getTotalBBox().topLeft(); @@ -590,8 +590,37 @@ return r; } +void ExportHTML::setCSSPath(const QString &p) +{ + cssOriginalPath=p; +} + void ExportHTML::doExport() { + //FIXME-1 check for errors// Copy CSS file + QFile css_src (cssOriginalPath); + QFile css_dst (outDir.path()+"/"+cssFileName); + if (!css_src.open ( QIODevice::ReadOnly)) + QMessageBox::warning( 0, QObject::tr( "Warning","ExportHTML" ),QObject::tr("Could not open %1","ExportHTML").arg(cssOriginalPath)); + else + { + if (!css_dst.open( QIODevice::WriteOnly)) + QMessageBox::warning( 0, QObject::tr( "Warning" ), QObject::tr("Could not open %1").arg(css_dst.fileName())); + else + { + + QTextStream tsout( &css_dst); + QTextStream tsin ( &css_src); + QString s= tsin.read(); + tsout << s; + css_dst.close(); + } + css_src.close(); + } + + + + // Open file for writing QFile file (outputFile); if ( !file.open( QIODevice::WriteOnly ) ) { @@ -604,7 +633,7 @@ // Write header ts<<""+model->getMapName()<<""; - ts<<" \n"; + ts<<" \n"; // Include image ts<<"
getMapName()<<".png\" usemap='#imagemap'>
\n";