exports.cpp
changeset 721 12958f987bcf
parent 688 d0086df58648
child 723 11f9124c1cca
     1.1 --- a/exports.cpp	Wed Jul 16 10:44:44 2008 +0000
     1.2 +++ b/exports.cpp	Wed Jul 16 10:46:14 2008 +0000
     1.3 @@ -251,92 +251,77 @@
     1.4  ////////////////////////////////////////////////////////////////////////
     1.5  void ExportKDEBookmarks::doExport() 
     1.6  {
     1.7 -	MapEditor *me=model->getMapEditor();
     1.8 -	if (me)
     1.9 +	WarningDialog dia;
    1.10 +	dia.showCancelButton (true);
    1.11 +	dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE"));
    1.12 +	dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("KDE"));
    1.13 +	dia.setShowAgainName("/exports/KDE/overwriteKDEBookmarks");
    1.14 +	if (dia.exec()==QDialog::Accepted)
    1.15  	{
    1.16 -		WarningDialog dia;
    1.17 -		dia.showCancelButton (true);
    1.18 -		dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE"));
    1.19 -		dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("KDE"));
    1.20 -		dia.setShowAgainName("/exports/KDE/overwriteKDEBookmarks");
    1.21 -		if (dia.exec()==QDialog::Accepted)
    1.22 +		model->exportXML(tmpDir.path(),false);
    1.23 +
    1.24 +		XSLTProc p;
    1.25 +		p.setInputFile (tmpDir.path()+"/"+model->getMapName()+".xml");
    1.26 +		p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
    1.27 +		p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
    1.28 +		p.process();
    1.29 +
    1.30 +		QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
    1.31 +		QProcess *proc= new QProcess ;
    1.32 +		proc->start( ub);
    1.33 +		if (!proc->waitForStarted())
    1.34  		{
    1.35 -			me->exportXML(tmpDir.path(),false);
    1.36 -
    1.37 -			XSLTProc p;
    1.38 -			p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
    1.39 -			p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
    1.40 -			p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
    1.41 -			p.process();
    1.42 -
    1.43 -			QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
    1.44 -			QProcess *proc= new QProcess ;
    1.45 -			proc->start( ub);
    1.46 -			if (!proc->waitForStarted())
    1.47 -			{
    1.48 -				QMessageBox::warning(0, 
    1.49 -					QObject::tr("Warning"),
    1.50 -					QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
    1.51 -			}	
    1.52 -		}
    1.53 +			QMessageBox::warning(0, 
    1.54 +				QObject::tr("Warning"),
    1.55 +				QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
    1.56 +		}	
    1.57  	}
    1.58 -
    1.59  }
    1.60  
    1.61  ////////////////////////////////////////////////////////////////////////
    1.62  void ExportFirefoxBookmarks::doExport() 
    1.63  {
    1.64 -	MapEditor *me=model->getMapEditor();
    1.65 -	if (me)
    1.66 +	WarningDialog dia;
    1.67 +	dia.showCancelButton (true);
    1.68 +	dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("Firefox"));
    1.69 +	dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("Firefox"));
    1.70 +	dia.setShowAgainName("/vym/warnings/overwriteImportBookmarks");
    1.71 +	if (dia.exec()==QDialog::Accepted)
    1.72  	{
    1.73 -		WarningDialog dia;
    1.74 -		dia.showCancelButton (true);
    1.75 -		dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("Firefox"));
    1.76 -		dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("Firefox"));
    1.77 -		dia.setShowAgainName("/vym/warnings/overwriteImportBookmarks");
    1.78 -		if (dia.exec()==QDialog::Accepted)
    1.79 -		{
    1.80 -			me->exportXML(tmpDir.path(),false);
    1.81 +		model->exportXML(tmpDir.path(),false);
    1.82  
    1.83  /*
    1.84 -			XSLTProc p;
    1.85 -			p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
    1.86 -			p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
    1.87 -			p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
    1.88 -			p.process();
    1.89 +		XSLTProc p;
    1.90 +		p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
    1.91 +		p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
    1.92 +		p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
    1.93 +		p.process();
    1.94  
    1.95 -			QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
    1.96 -			QProcess *proc = new QProcess( );
    1.97 -			proc->addArgument(ub);
    1.98 +		QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
    1.99 +		QProcess *proc = new QProcess( );
   1.100 +		proc->addArgument(ub);
   1.101  
   1.102 -			if ( !proc->start() ) 
   1.103 -			{
   1.104 -				QMessageBox::warning(0, 
   1.105 -					QObject::tr("Warning"),
   1.106 -					QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
   1.107 -			}	
   1.108 +		if ( !proc->start() ) 
   1.109 +		{
   1.110 +			QMessageBox::warning(0, 
   1.111 +				QObject::tr("Warning"),
   1.112 +				QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
   1.113 +		}	
   1.114  
   1.115  */
   1.116 -
   1.117 -		}
   1.118  	}
   1.119  }
   1.120  
   1.121  ////////////////////////////////////////////////////////////////////////
   1.122  void ExportTaskjuggler::doExport() 
   1.123  {
   1.124 -	MapEditor *me=model->getMapEditor();
   1.125 -	if (me)
   1.126 -	{
   1.127 -		me->exportXML(tmpDir.path(),false);
   1.128 +	model->exportXML(tmpDir.path(),false);
   1.129  
   1.130 -		XSLTProc p;
   1.131 -		p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
   1.132 -		p.setOutputFile (outputFile);
   1.133 -		p.setXSLFile (vymBaseDir.path()+"/styles/vym2taskjuggler.xsl");
   1.134 -		p.process();
   1.135 -	}
   1.136 -
   1.137 +	XSLTProc p;
   1.138 +	p.setInputFile (tmpDir.path()+"/"+model->getMapName()+".xml");
   1.139 +	p.setOutputFile (outputFile);
   1.140 +	p.setXSLFile (vymBaseDir.path()+"/styles/vym2taskjuggler.xsl");
   1.141 +	p.process();
   1.142  }
   1.143  
   1.144  ////////////////////////////////////////////////////////////////////////