1.1 --- a/exporthtmldialog.cpp Thu Feb 25 11:03:52 2010 +0000
1.2 +++ b/exporthtmldialog.cpp Tue Mar 02 13:59:19 2010 +0000
1.3 @@ -20,7 +20,6 @@
1.4
1.5 filepath="";
1.6 settingsChanged=false;
1.7 - scriptProc=new Process;
1.8
1.9 // signals and slots connections
1.10 connect(ui.browseExportDirButton, SIGNAL(pressed()), this, SLOT(browseDirectoryPressed()));
1.11 @@ -31,8 +30,6 @@
1.12 connect(ui.lineEditDir, SIGNAL(textChanged(const QString&)), this, SLOT(dirChanged()));
1.13 connect(ui.lineEditCSS, SIGNAL(textChanged(const QString&)), this, SLOT(cssChanged()));
1.14 connect(ui.saveSettingsInMapButton, SIGNAL(toggled(bool)), this, SLOT(saveSettingsInMapButtonPressed(bool)));
1.15 - connect(ui.browsePreExportButton, SIGNAL(pressed()), this, SLOT(browsePreExportButtonPressed()));
1.16 - connect(ui.lineEditPreScript, SIGNAL(textChanged(const QString&)), this, SLOT(prescriptChanged()));
1.17 connect(ui.lineEditPostScript, SIGNAL(textChanged(const QString&)), this, SLOT(postscriptChanged()));
1.18 connect(ui.browsePostExportButton, SIGNAL(pressed()), this, SLOT(browsePostExportButtonPressed()));
1.19 }
1.20 @@ -88,22 +85,18 @@
1.21 }
1.22 ui.lineEditCSS->setText(css);
1.23
1.24 - prescript=settings.readLocalEntry
1.25 - (filepath,"/export/html/prescript","");
1.26 - ui.lineEditPreScript->setText (prescript);
1.27 -
1.28 postscript=settings.readLocalEntry
1.29 (filepath,"/export/html/postscript","");
1.30 ui.lineEditPostScript->setText (postscript);
1.31
1.32 - if (!prescript.isEmpty() || !postscript.isEmpty())
1.33 + if (!postscript.isEmpty())
1.34 {
1.35 QMessageBox::warning( 0, tr( "Warning" ),tr(
1.36 "The settings saved in the map "
1.37 - "would like to run scripts:\n\n"
1.38 + "would like to run script:\n\n"
1.39 "%1\n\n"
1.40 "Please check, if you really\n"
1.41 - "want to allow this in your system!").arg(prescript+" "+postscript));
1.42 + "want to allow this in your system!").arg(postscript));
1.43
1.44 }
1.45 }
1.46 @@ -195,35 +188,12 @@
1.47 }
1.48 }
1.49
1.50 -void ExportHTMLDialog::prescriptChanged()
1.51 -{
1.52 - prescript=ui.lineEditPreScript->text();
1.53 - settingsChanged=true;
1.54 -}
1.55 -
1.56 void ExportHTMLDialog::postscriptChanged()
1.57 {
1.58 postscript=ui.lineEditPostScript->text();
1.59 settingsChanged=true;
1.60 }
1.61
1.62 -void ExportHTMLDialog::browsePreExportButtonPressed()
1.63 -{
1.64 - QFileDialog fd( this);
1.65 - fd.setModal (true);
1.66 - fd.setFilter ("Scripts (*.sh *.pl *.py *.php)");
1.67 - fd.setDirectory (QDir::current());
1.68 - fd.show();
1.69 -
1.70 - if ( fd.exec() == QDialog::Accepted )
1.71 - {
1.72 - prescript=fd.selectedFile();
1.73 - ui.lineEditPreScript->setText (prescript );
1.74 - settingsChanged=true;
1.75 - }
1.76 -
1.77 -}
1.78 -
1.79 void ExportHTMLDialog::browsePostExportButtonPressed()
1.80 {
1.81 QFileDialog fd( this);
1.82 @@ -241,14 +211,13 @@
1.83 }
1.84
1.85
1.86 -void ExportHTMLDialog::doExport (const QString &mapname)
1.87 +void ExportHTMLDialog::saveSettings ()
1.88 {
1.89
1.90 // Save options to settings file
1.91 // (but don't save at destructor, which
1.92 // is called for "cancel", too)
1.93 settings.setLocalEntry (filepath,"/export/html/exportDir",dir);
1.94 - settings.setLocalEntry (filepath,"/export/html/prescript",prescript);
1.95 settings.setLocalEntry (filepath,"/export/html/postscript",postscript);
1.96
1.97 if (useImage)
1.98 @@ -285,7 +254,7 @@
1.99 settings.setLocalEntry
1.100 (filepath,"/export/html/saveSettingsInMap","yes");
1.101
1.102 - // Provide a smaller URL-icon to improve Layout //FIXME-1
1.103 + // Provide a smaller URL-icon to improve Layout //FIXME-1 add option to choose this
1.104 QPixmap pm;
1.105 if (!pm.load(ipath,"PNG") )
1.106 QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath));
1.107 @@ -294,22 +263,6 @@
1.108 if(!pm.save (dir + "flags/flag-url-16x16.png","PNG"))
1.109 QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath));
1.110
1.111 - if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml");
1.112 -
1.113 - /* FIXME-1
1.114 - if (useImage)
1.115 - p.addStringParam ("imagemap","images/"+mapname+".png");
1.116 - if (useTextColor)
1.117 - p.addStringParam ("use.textcolor","1");
1.118 - p.addStringParam ("mapname",mapname+".vym");
1.119 -
1.120 - p.setOutputFile (dir+mapname+".html");
1.121 - p.setInputFile (dir+mapname+".xml");
1.122 - p.process();
1.123 - */
1.124 -
1.125 - if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html");
1.126 -
1.127 }
1.128
1.129 void ExportHTMLDialog::setFilePath(const QString &s)
1.130 @@ -338,31 +291,3 @@
1.131 }
1.132
1.133
1.134 -void ExportHTMLDialog::runScript(QString spath, QString fpath)
1.135 -{
1.136 - spath.replace ("%f",fpath);
1.137 - QStringList args=QStringList::split (' ',spath,false);
1.138 -
1.139 - //FIXME-1 p.addOutput ("vym is executing: \n" + spath+" "+args.join(" ") );
1.140 - scriptProc->start (spath,args);
1.141 - if (!scriptProc->waitForStarted() )
1.142 - {
1.143 - QMessageBox::critical( 0, tr( "Critical Error" ),
1.144 - tr("Could not start %1").arg(spath) );
1.145 - } else
1.146 - {
1.147 - if (!scriptProc->waitForFinished())
1.148 - QMessageBox::critical( 0, tr( "Critical Error" ),
1.149 - tr("%1 didn't exit normally").arg(spath) +
1.150 - scriptProc->getErrout() );
1.151 - else
1.152 - if (scriptProc->exitStatus()>0) showOutput=true;
1.153 -
1.154 - }
1.155 - /* FIXME-1
1.156 - p.addOutput ("\n");
1.157 - p.addOutput (scriptProc->getErrout());
1.158 - p.addOutput (scriptProc->getStdout());
1.159 - */
1.160 -}
1.161 -