Introduced basic export to Open Document format
authorinsilmaril
Tue, 24 Jan 2006 15:09:48 +0000
changeset 181bd530b01f77f
parent 180 60e2297bab39
child 182 2747c4145c71
Introduced basic export to Open Document format
aboutdialog.cpp
demos/todo.vym
exportoofiledialog.cpp
mapcenterobj.cpp
xml.cpp
     1.1 --- a/aboutdialog.cpp	Tue Jan 24 15:09:48 2006 +0000
     1.2 +++ b/aboutdialog.cpp	Tue Jan 24 15:09:48 2006 +0000
     1.3 @@ -25,7 +25,7 @@
     1.4  	"<h3><center><img src=\"vym_logo\">VYM - View Your Mind </h3>"
     1.5  	"<p align=\"center\"> A tool to put the things you have got in your mind into a map.</p>"
     1.6  	"<p align=\"center\"> (c) by Uwe Drechsel (<a href=\"mailto:vym@InSilmaril.de\">vym@InSilmaril.de</a>)</p>"
     1.7 -	"<p align=\"center\"> Version " __VYM_VERSION__" - " __BUILD_DATE__"</p>"
     1.8 +	"<p align=\"center\"> Version " __VYM_VERSION" - " __BUILD_DATE"</p>"
     1.9  	"<ul>"
    1.10  	"<li> Contact</li>"
    1.11  		"<ul>"
     2.1 Binary file demos/todo.vym has changed
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/exportoofiledialog.cpp	Tue Jan 24 15:09:48 2006 +0000
     3.3 @@ -0,0 +1,87 @@
     3.4 +#include <iostream>
     3.5 +
     3.6 +#include "exportoofiledialog.h"
     3.7 +
     3.8 +ExportOOFileDialog::ExportOOFileDialog():QFileDialog()
     3.9 +{
    3.10 +	init();
    3.11 +}
    3.12 +
    3.13 +ExportOOFileDialog::ExportOOFileDialog (QWidget * parent, const char* name, bool modal):QFileDialog(parent, name,modal)
    3.14 +{
    3.15 +	init();
    3.16 +}
    3.17 +
    3.18 +QString ExportOOFileDialog::selectedConfig()
    3.19 +{
    3.20 +	QStringList::Iterator itpath=configPaths.begin();
    3.21 +	QStringList::Iterator itf=filters.begin();
    3.22 +	while (itf != filters.end()) 
    3.23 +	{
    3.24 +		if (*itf==lastFilter) return *itpath;
    3.25 +		itpath++;	
    3.26 +		itf++;
    3.27 +    }
    3.28 +	qWarning ("ExportOOFileDialog::selectedConfig  No filter found!");
    3.29 +	return "";
    3.30 +}
    3.31 +
    3.32 +void ExportOOFileDialog::newConfigPath(const QString &s)
    3.33 +{
    3.34 +	lastFilter=s;
    3.35 +}
    3.36 +
    3.37 +QString ExportOOFileDialog::selectedFile()
    3.38 +{
    3.39 +	return QFileDialog::selectedFile();
    3.40 +}
    3.41 +
    3.42 +
    3.43 +void ExportOOFileDialog::addFilter(const QString &f)
    3.44 +{
    3.45 +	lastFilter=f;
    3.46 +	filters.append (f);
    3.47 +	QFileDialog::addFilter (f);
    3.48 +}
    3.49 +
    3.50 +void ExportOOFileDialog::init()
    3.51 +{
    3.52 +	QDir d;
    3.53 +	d.setPath ("/usr/share/vym/exports");
    3.54 +	scanExportConfigs(d);
    3.55 +	d.setPath (d.homeDirPath()+"/exports");
    3.56 +	scanExportConfigs(d);
    3.57 +	d.setPath ("exports");
    3.58 +	scanExportConfigs(d);
    3.59 +
    3.60 +	connect (
    3.61 +		this,SIGNAL (filterSelected(const QString&)),
    3.62 +		this, SLOT( newConfigPath(const QString &)));
    3.63 +}
    3.64 +
    3.65 +void ExportOOFileDialog::scanExportConfigs(QDir d)
    3.66 +{
    3.67 +	// Scan existing export configurations
    3.68 +	SimpleSettings set;
    3.69 +	QFile f;
    3.70 +	if (d.exists())
    3.71 +	{
    3.72 +		// Traverse files
    3.73 +		d.setFilter( QDir::Files| QDir::Hidden | QDir::NoSymLinks );
    3.74 +		const QFileInfoList *filelist = d.entryInfoList();
    3.75 +		QFileInfoListIterator itfile( *filelist );
    3.76 +		QFileInfo *fi;
    3.77 +
    3.78 +		while ( (fi = itfile.current()) != 0 ) 
    3.79 +		{
    3.80 +			if (fi->fileName().endsWith(".conf") )
    3.81 +			{
    3.82 +				configPaths.append (fi->absFilePath());
    3.83 +				set.clear();
    3.84 +				set.readSettings (fi->absFilePath());
    3.85 +				addFilter (set.readEntry("Name") + " (*.odp)");
    3.86 +			}		
    3.87 +			++itfile;
    3.88 +		}	
    3.89 +	}		
    3.90 +}
     4.1 --- a/mapcenterobj.cpp	Tue Jan 24 15:09:48 2006 +0000
     4.2 +++ b/mapcenterobj.cpp	Tue Jan 24 15:09:48 2006 +0000
     4.3 @@ -192,9 +192,9 @@
     4.4  	QString s2=version.section (".",1,1);
     4.5  	QString s3=version.section (".",2,2);
     4.6  	bool ok;
     4.7 -	int vv1 =QString(__VYM_VERSION__).section (".",0,0).toInt(&ok,10);
     4.8 -	int vv2 =QString(__VYM_VERSION__).section (".",1,1).toInt(&ok,10);
     4.9 -	int vv3 =QString(__VYM_VERSION__).section (".",2,2).toInt(&ok,10);
    4.10 +	int vv1 =QString(__VYM_VERSION).section (".",0,0).toInt(&ok,10);
    4.11 +	int vv2 =QString(__VYM_VERSION).section (".",1,1).toInt(&ok,10);
    4.12 +	int vv3 =QString(__VYM_VERSION).section (".",2,2).toInt(&ok,10);
    4.13  	int mv1=0;
    4.14  	int mv2=0;
    4.15  	int mv3=0;
     5.1 --- a/xml.cpp	Tue Jan 24 15:09:48 2006 +0000
     5.2 +++ b/xml.cpp	Tue Jan 24 15:09:48 2006 +0000
     5.3 @@ -61,7 +61,7 @@
     5.4  				   "<h3>Map is newer than VYM</h3>"
     5.5  				   "<p>The map you are just trying to load was "
     5.6  				   "saved using vym " +atts.value("version")+". "
     5.7 -				   "The version of this vym is " __VYM_VERSION__
     5.8 +				   "The version of this vym is " __VYM_VERSION
     5.9  				   ". If you run into problems after pressing "
    5.10  				   "the ok-button below, updating vym should help.");
    5.11  
    5.12 @@ -387,7 +387,18 @@
    5.13      .arg( exception.message() )
    5.14      .arg( exception.lineNumber() )
    5.15      .arg( exception.columnNumber() );
    5.16 +	/* FIXME Testing only
    5.17 +	errorProt += exception.publicId ()+"\n";
    5.18 +	errorProt += exception.systemId()+"\n";
    5.19  
    5.20 +	// Try to read the bogus line
    5.21 +	int i=0;
    5.22 +	QString s;
    5.23 +	if (loadStringFromDisk (,s))
    5.24 +	{
    5.25 +		errorProt +=
    5.26 +	}
    5.27 +*/
    5.28      return QXmlDefaultHandler::fatalError( exception );
    5.29  }
    5.30