1.1 --- a/exports.cpp Wed Feb 15 12:54:55 2006 +0000
1.2 +++ b/exports.cpp Wed Feb 15 12:54:55 2006 +0000
1.3 @@ -4,7 +4,6 @@
1.4 #include "file.h"
1.5 #include "linkablemapobj.h"
1.6 #include "misc.h"
1.7 -#include "texteditor.h"
1.8 #include "mainwindow.h"
1.9
1.10 extern Main *mainWindow;
1.11 @@ -31,6 +30,7 @@
1.12
1.13 QString ExportBase::getSectionString(BranchObj *bostart)
1.14 {
1.15 + // Make prefix like "2.5.3" for "bo:2,bo:5,bo:3"
1.16 QString r;
1.17 BranchObj *bo=bostart;
1.18 int depth=bo->getDepth();
1.19 @@ -69,8 +69,6 @@
1.20 // Make indentstring
1.21 for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
1.22
1.23 - // Write heading
1.24 - // write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
1.25 if (bo->getDepth()==0)
1.26 {
1.27 ts << (bo->getHeading()+ "\n");
1.28 @@ -106,8 +104,8 @@
1.29 // that makes a full LaTex document.
1.30 QFile file (outputFile);
1.31 if ( !file.open( IO_WriteOnly ) ) {
1.32 - // FIXME
1.33 - cout << "Export::exportMap couldn't open "<<outputFile<<endl;
1.34 + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(outputFile));
1.35 + mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
1.36 return;
1.37 }
1.38 QTextStream ts( &file ); // use LANG decoding here...
1.39 @@ -247,7 +245,8 @@
1.40 QFile f (contentFile);
1.41 if ( !f.open( IO_WriteOnly ) )
1.42 {
1.43 - mainWindow->statusMessage(QString(QObject::tr("Could not write to %1")).arg(contentFile));
1.44 + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(contentFile));
1.45 + mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
1.46 return;
1.47 }
1.48
2.1 --- a/exports.h Wed Feb 15 12:54:55 2006 +0000
2.2 +++ b/exports.h Wed Feb 15 12:54:55 2006 +0000
2.3 @@ -8,8 +8,6 @@
2.4 #include "mapcenterobj.h"
2.5 #include "settings.h"
2.6
2.7 -//using namespace std;
2.8 -
2.9 ///////////////////////////////////////////////////////////////////////
2.10
2.11 class ExportBase
2.12 @@ -26,7 +24,7 @@
2.13 void exportXML();
2.14
2.15 protected:
2.16 - QDir outdir;
2.17 + QDir tmpDir;
2.18 QString outputDir;
2.19 QString outputFile;
2.20 MapCenterObj *mapCenter;
2.21 @@ -50,7 +48,6 @@
2.22 bool setConfigFile (const QString &);
2.23 private:
2.24 QString buildList (BranchObj*);
2.25 - QDir tmpDir;
2.26 bool useSections;
2.27 QString configFile;
2.28 QString configDir;
3.1 --- a/exportxhtmldialog.ui Wed Feb 15 12:54:55 2006 +0000
3.2 +++ b/exportxhtmldialog.ui Wed Feb 15 12:54:55 2006 +0000
3.3 @@ -578,11 +578,11 @@
3.4 </connection>
3.5 </connections>
3.6 <includes>
3.7 - <include location="local" impldecl="in declaration">process.h</include>
3.8 - <include location="local" impldecl="in declaration">showtextdialog.h</include>
3.9 <include location="global" impldecl="in implementation">qfiledialog.h</include>
3.10 <include location="global" impldecl="in implementation">qmessagebox.h</include>
3.11 <include location="local" impldecl="in implementation">settings.h</include>
3.12 + <include location="local" impldecl="in declaration">xsltproc.h</include>
3.13 + <include location="local" impldecl="in declaration">process.h</include>
3.14 <include location="local" impldecl="in implementation">exportxhtmldialog.ui.h</include>
3.15 </includes>
3.16 <variables>
3.17 @@ -592,16 +592,15 @@
3.18 <variable>QString css;</variable>
3.19 <variable>bool useImage;</variable>
3.20 <variable>bool showOutput;</variable>
3.21 - <variable>Process *xsltProc;</variable>
3.22 - <variable>ShowTextDialog *dia;</variable>
3.23 <variable>QString dir;</variable>
3.24 - <variable>QString xsltprocessor;</variable>
3.25 <variable>QString filepath;</variable>
3.26 <variable>QString prescript;</variable>
3.27 <variable>QString postscript;</variable>
3.28 <variable>bool settingsChanged;</variable>
3.29 <variable>QString mapname;</variable>
3.30 <variable>bool saveSettingsInMap;</variable>
3.31 + <variable>XSLTProc p;</variable>
3.32 + <variable>Process *scriptProc;</variable>
3.33 </variables>
3.34 <slots>
3.35 <slot>readSettings()</slot>
4.1 --- a/file.cpp Wed Feb 15 12:54:55 2006 +0000
4.2 +++ b/file.cpp Wed Feb 15 12:54:55 2006 +0000
4.3 @@ -131,9 +131,9 @@
4.4 d.mkdir ("flags");
4.5 }
4.6
4.7 -errorCode zipDir (const QDir &zipDir, const QString &zipName)
4.8 +ErrorCode zipDir (const QDir &zipDir, const QString &zipName)
4.9 {
4.10 - errorCode err=success;
4.11 + ErrorCode err=success;
4.12
4.13 // zip the temporary directory
4.14 Process *zipProc=new Process ();
4.15 @@ -171,13 +171,12 @@
4.16 }
4.17 }
4.18 } // zip could be started
4.19 - if (err==aborted) qWarning("file.cpp: zip aborted");
4.20 return err;
4.21 }
4.22
4.23 -errorCode unzipDir (const QDir &zipDir, const QString &zipName)
4.24 +ErrorCode unzipDir (const QDir &zipDir, const QString &zipName)
4.25 {
4.26 - errorCode err=success;
4.27 + ErrorCode err=success;
4.28
4.29 // Try to unzip file
4.30 Process *zipProc=new Process ();
5.1 --- a/file.h Wed Feb 15 12:54:55 2006 +0000
5.2 +++ b/file.h Wed Feb 15 12:54:55 2006 +0000
5.3 @@ -5,7 +5,7 @@
5.4
5.5 enum LoadMode {NewMap,ImportAdd,ImportReplace};
5.6 enum SaveMode {PartOfMap,CompleteMap,UndoCommand};
5.7 -enum errorCode {success,aborted,nozip};
5.8 +enum ErrorCode {success,aborted,nozip};
5.9
5.10
5.11 /////////////////////////////////////////////////////////////////////////////
5.12 @@ -14,8 +14,8 @@
5.13 QString makeUniqueDir (QString);
5.14 void removeDir(QDir);
5.15 void makeSubDirs (const QString &);
5.16 -errorCode zipDir (const QDir &,const QString&);
5.17 -errorCode unzipDir (const QDir &,const QString&);
5.18 +ErrorCode zipDir (const QDir &,const QString&);
5.19 +ErrorCode unzipDir (const QDir &,const QString&);
5.20 bool loadStringFromDisk (const QString &, QString &);
5.21 bool saveStringToDisk (const QString &, const QString &s);
5.22
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/imports.cpp Wed Feb 15 12:54:55 2006 +0000
6.3 @@ -0,0 +1,56 @@
6.4 +#include <qmessagebox.h>
6.5 +
6.6 +#include "imports.h"
6.7 +#include "file.h"
6.8 +#include "linkablemapobj.h"
6.9 +#include "misc.h"
6.10 +#include "mainwindow.h"
6.11 +#include "xsltproc.h"
6.12 +
6.13 +extern Main *mainWindow;
6.14 +
6.15 +ImportBase::ImportBase()
6.16 +{
6.17 + // Create tmpdir
6.18 + tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
6.19 +}
6.20 +
6.21 +
6.22 +ImportBase::~ImportBase()
6.23 +{
6.24 + // Remove tmpdir
6.25 + removeDir (tmpDir);
6.26 +}
6.27 +
6.28 +void ImportBase::setDir(const QString &p)
6.29 +{
6.30 + inputDir=p;
6.31 +}
6.32 +
6.33 +void ImportBase::setFile (const QString &p)
6.34 +{
6.35 + inputFile=p;
6.36 +}
6.37 +
6.38 +void ImportBase::setMapCenter(MapCenterObj *mc)
6.39 +{
6.40 + mapCenter=mc;
6.41 +}
6.42 +
6.43 +/////////////////////////////////////////////////
6.44 +void ImportKDEBookmarks::transform()
6.45 +{
6.46 + transformedFile=tmpDir.path()+"/bookmarks.xml";
6.47 +
6.48 + XSLTProc p;
6.49 + p.setInputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
6.50 + p.setOutputFile (transformedFile);
6.51 + p.setXSLFile ("styles/kdebookmarks2vym.xsl");
6.52 + p.process();
6.53 +}
6.54 +
6.55 +QString ImportKDEBookmarks::getTransformedFile()
6.56 +{
6.57 + return transformedFile;
6.58 +}
6.59 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/imports.h Wed Feb 15 12:54:55 2006 +0000
7.3 @@ -0,0 +1,42 @@
7.4 +#ifndef IMPORTS_H
7.5 +#define IMPORTS_H
7.6 +
7.7 +#include <qdir.h>
7.8 +#include <qstring.h>
7.9 +#include <iostream>
7.10 +
7.11 +#include "mapcenterobj.h"
7.12 +#include "settings.h"
7.13 +
7.14 +
7.15 +///////////////////////////////////////////////////////////////////////
7.16 +
7.17 +class ImportBase
7.18 +{
7.19 +public:
7.20 + ImportBase();
7.21 + ~ImportBase();
7.22 + void setDir(const QString &);
7.23 + void setFile(const QString &);
7.24 + void setMapCenter (MapCenterObj*);
7.25 +protected:
7.26 + QDir tmpDir;
7.27 + QString inputDir;
7.28 + QString inputFile;
7.29 + MapCenterObj *mapCenter;
7.30 +
7.31 +};
7.32 +
7.33 +///////////////////////////////////////////////////////////////////////
7.34 +class ImportKDEBookmarks:public ImportBase
7.35 +{
7.36 +public:
7.37 + void transform();
7.38 + QString getTransformedFile();
7.39 +private:
7.40 + QString transformedFile;
7.41 +};
7.42 +
7.43 +
7.44 +
7.45 +#endif
8.1 --- a/main.cpp Wed Feb 15 12:54:55 2006 +0000
8.2 +++ b/main.cpp Wed Feb 15 12:54:55 2006 +0000
8.3 @@ -12,6 +12,7 @@
8.4 #include "mainwindow.h"
8.5
8.6 #include "icons/vym-48x48.xpm"
8.7 +#include "icons/vym-128x128.xpm"
8.8 #include "icons/vym-editor.xpm"
8.9
8.10 #include "flagrowobj.h"
8.11 @@ -111,6 +112,7 @@
8.12 QPopupMenu *saveImageFormatMenu;
8.13 QPopupMenu *canvasContextMenu;
8.14 QPopupMenu *lastMapsMenu;
8.15 +QPopupMenu *importMenu;
8.16 QPopupMenu *exportMenu;
8.17 QPopupMenu *exportImageFormatMenu;
8.18
8.19 @@ -125,7 +127,8 @@
8.20 QApplication app(argc,argv);
8.21
8.22 QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory();
8.23 - factory->setPixmap("vym_logo", QPixmap(vym_logo_xpm));
8.24 + factory->setPixmap("vym_48x48", QPixmap(vym_48x48_xpm));
8.25 + factory->setPixmap("vym_128x128", QPixmap(vym_128x128_xpm));
8.26 qInitNetworkProtocols();
8.27
8.28 // Use /usr/share/vym or /usr/local/share/vym or .
8.29 @@ -194,7 +197,7 @@
8.30 // Initialize mainwindow
8.31 Main m;
8.32 //m.resize(m.sizeHint());
8.33 - m.setIcon (QPixmap (vym_logo_xpm));
8.34 + m.setIcon (QPixmap (vym_48x48_xpm));
8.35 m.show();
8.36 m.fileNew();
8.37 m.loadCmdLine();
9.1 --- a/mainwindow.cpp Wed Feb 15 12:54:55 2006 +0000
9.2 +++ b/mainwindow.cpp Wed Feb 15 12:54:55 2006 +0000
9.3 @@ -19,12 +19,6 @@
9.4 #include <cstdlib>
9.5 #include <typeinfo>
9.6
9.7 -#include "file.h"
9.8 -#include "misc.h"
9.9 -#include "version.h"
9.10 -#include "aboutdialog.h"
9.11 -#include "exportoofiledialog.h"
9.12 -
9.13 #include "icons/filenew.xpm"
9.14 #include "icons/fileopen.xpm"
9.15 #include "icons/filesave.xpm"
9.16 @@ -45,8 +39,6 @@
9.17 #include "icons/modecolor.xpm"
9.18 #include "icons/modelink.xpm"
9.19 #include "icons/modecopy.xpm"
9.20 -//#include "icons/vym-48x48.xpm"
9.21 -
9.22 #include "icons/flag-questionmark.xpm"
9.23 #include "icons/flag-exclamationmark.xpm"
9.24 #include "icons/flag-hook-green.xpm"
9.25 @@ -63,22 +55,27 @@
9.26 #include "icons/flag-heart.xpm"
9.27 #include "icons/flag-flash.xpm"
9.28 #include "icons/flag-lifebelt.xpm"
9.29 -
9.30 #include "icons/flag-note.xpm"
9.31 #include "icons/flag-url.xpm"
9.32 #include "icons/flag-vymlink.xpm"
9.33 #include "icons/flag-scrolled-right.xpm"
9.34 #include "icons/flag-tmpUnscrolled-right.xpm"
9.35
9.36 +#include "aboutdialog.h"
9.37 +#include "exporthtmldialog.h"
9.38 +#include "exportoofiledialog.h"
9.39 +#include "exportxhtmldialog.h"
9.40 +#include "file.h"
9.41 #include "flagrowobj.h"
9.42 -#include "texteditor.h"
9.43 +#include "imports.h"
9.44 #include "mapeditor.h"
9.45 -#include "exporthtmldialog.h"
9.46 -#include "exportxhtmldialog.h"
9.47 -#include "showtextdialog.h"
9.48 +#include "misc.h"
9.49 +#include "options.h"
9.50 #include "process.h"
9.51 #include "settings.h"
9.52 -#include "options.h"
9.53 +#include "showtextdialog.h"
9.54 +#include "texteditor.h"
9.55 +#include "version.h"
9.56
9.57 extern TextEditor *textEditor;
9.58 extern Main *mainWindow;
9.59 @@ -86,7 +83,6 @@
9.60 extern QString clipboardDir;
9.61 extern bool clipboardEmpty;
9.62 extern int statusbarTime;
9.63 -extern MapEditor *clipboardME;
9.64 extern FlagRowObj* standardFlagsDefault;
9.65 extern FlagRowObj* systemFlagsDefault;
9.66
9.67 @@ -172,6 +168,7 @@
9.68 extern QPopupMenu* saveImageFormatMenu;
9.69 extern QPopupMenu* canvasContextMenu;
9.70 extern QPopupMenu* lastMapsMenu;
9.71 +extern QPopupMenu* importMenu;
9.72 extern QPopupMenu* exportMenu;
9.73 extern QPopupMenu* exportImageFormatMenu;
9.74
9.75 @@ -386,9 +383,16 @@
9.76
9.77 menu->insertSeparator();
9.78
9.79 + importMenu = new QPopupMenu (this);
9.80 + menu->insertItem (tr("Import"),importMenu );
9.81 +
9.82 + a = new QAction( tr( "Import")+" "+tr("KDE Bookmarks" ), QPixmap(), tr("KDE Bookmarks"), 0, this, "importKDEBookmarks" );
9.83 + connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) );
9.84 + a->addTo (importMenu);
9.85 +
9.86 a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir"+QString("...") ), 0, this, "export" );
9.87 connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
9.88 - a->addTo( menu );
9.89 + a->addTo( importMenu);
9.90
9.91 exportMenu = new QPopupMenu (this);
9.92 menu->insertItem (tr("Export"),exportMenu );
9.93 @@ -1058,7 +1062,7 @@
9.94 connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
9.95 a->addTo( menu );
9.96
9.97 - a = new QAction( tr( "Information about")+" "__VYM, QPixmap(), tr( "About VYM" ), 0, this, "about" );
9.98 + a = new QAction( tr( "About VYM")+" "__VYM, QPixmap(), tr( "About VYM" ), 0, this, "about" );
9.99 connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
9.100 a->addTo( menu );
9.101
9.102 @@ -1162,32 +1166,32 @@
9.103 floatimageContextMenu->insertSeparator();
9.104 actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
9.105
9.106 - a = new QAction( tr( "Export as Open Office 2.0 (Open Document) " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" );
9.107 + a = new QAction( tr( "Export in Open Document Format used e.g. in Open Office " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" );
9.108 connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
9.109 a->addTo (exportMenu);
9.110
9.111 - exportMenu->insertItem ( tr("Image"),exportImageFormatMenu);
9.112 + exportMenu->insertItem ( tr("Export as Image"),exportImageFormatMenu);
9.113
9.114 - a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), "ASCII...", 0, this, "exportASCII" );
9.115 + a = new QAction( tr( "Export as ASCII")+" "+tr("(still experimental)" ), QPixmap(), "ASCII...", 0, this, "exportASCII" );
9.116 connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
9.117 a->addTo( exportMenu );
9.118
9.119 - a = new QAction( tr( "Export as LaTeX (still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" );
9.120 + a = new QAction( tr( "Export as LaTeX")+" "+tr("(still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" );
9.121 connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
9.122 a->addTo( exportMenu );
9.123
9.124 - a = new QAction( tr( "Export (XML)" ), QPixmap(), "XML...", 0, this, "exportXML" );
9.125 + a = new QAction( tr( "Export as XML" ), QPixmap(), "XML...", 0, this, "exportXML" );
9.126 connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
9.127 a->addTo( exportMenu );
9.128
9.129 if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
9.130 {
9.131 - a = new QAction( tr( "Export HTML" ), QPixmap(), "HTML...", 0, this, "exportHTML");
9.132 + a = new QAction( tr( "Export as HTML" ), QPixmap(), "HTML...", 0, this, "exportHTML");
9.133 connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
9.134 a->addTo( exportMenu );
9.135 }
9.136
9.137 - a = new QAction( tr( "Export XHTML" ), QPixmap(), "XHTML...", ALT + Key_X, this, "exportXHTML" );
9.138 + a = new QAction( tr( "Export as XHTML" ), QPixmap(), "XHTML...", ALT + Key_X, this, "exportXHTML" );
9.139 connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
9.140 a->addTo( exportMenu );
9.141
9.142 @@ -1344,9 +1348,9 @@
9.143 medit->select("mc:");
9.144 }
9.145
9.146 -void Main::fileLoad(QString fn, const LoadMode &lmode)
9.147 +ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
9.148 {
9.149 - errorCode err=success;
9.150 + ErrorCode err=success;
9.151
9.152 // fn is usually the archive, mapfile the file after uncompressing
9.153 QString mapfile;
9.154 @@ -1385,7 +1389,7 @@
9.155 break;
9.156 case QMessageBox::Cancel:
9.157 // do nothing
9.158 - return;
9.159 + return aborted;
9.160 break;
9.161 }
9.162 }
9.163 @@ -1431,13 +1435,13 @@
9.164 tabWidget->setTabLabel (currentMapEditor(),
9.165 currentMapEditor()->getFileName() );
9.166 statusBar()->message( "Created " + fn , statusbarTime );
9.167 - return;
9.168 + return success;
9.169
9.170 case QMessageBox::Cancel:
9.171 // don't create new map
9.172 statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
9.173 fileCloseMap();
9.174 - return;
9.175 + return aborted;
9.176 }
9.177 }
9.178
9.179 @@ -1503,8 +1507,7 @@
9.180
9.181 // Finally load map into mapEditor
9.182 me->setFilePath (mapfile,fn);
9.183 - if (me->load(mapfile,lmode))
9.184 - err=aborted;
9.185 + err=me->load(mapfile,lmode);
9.186
9.187 // Restore old (maybe empty) filepath, if this is an import
9.188 if (lmode!=NewMap)
9.189 @@ -1522,8 +1525,13 @@
9.190 {
9.191 me->setFilePath (fn);
9.192 tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
9.193 - lastMaps.prepend(me->getFilePath() );
9.194 - setupLastMapsMenu();
9.195 + if (fn.left(9)!="/tmp/vym-")
9.196 + {
9.197 + // Only append to lastMaps if not loaded from a tmpDir
9.198 + // e.g. imported bookmarks are in a tmpDir
9.199 + lastMaps.prepend(me->getFilePath() );
9.200 + setupLastMapsMenu();
9.201 + }
9.202 actionFilePrint->setEnabled (true);
9.203 }
9.204 statusBar()->message( "Loaded " + fn, statusbarTime );
9.205 @@ -1532,6 +1540,7 @@
9.206 // Delete tmpDir
9.207 removeDir (QDir(tmpMapDir));
9.208 }
9.209 + return err;
9.210 }
9.211
9.212
9.213 @@ -1589,8 +1598,7 @@
9.214 QString tmpMapDir;
9.215
9.216 // Error codes
9.217 - enum errorCode {success,aborted};
9.218 - errorCode err=success;
9.219 + ErrorCode err=success;
9.220
9.221 QString safeFilePath;
9.222
9.223 @@ -1776,6 +1784,14 @@
9.224 currentMapEditor()->importDir();
9.225 }
9.226
9.227 +void Main::fileImportKDEBookmarks()
9.228 +{
9.229 + ImportKDEBookmarks im;
9.230 + im.transform();
9.231 + if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
9.232 + currentMapEditor()->setFilePath ("");
9.233 +}
9.234 +
9.235 void Main::fileExportXML()
9.236 {
9.237 if (currentMapEditor())
9.238 @@ -2500,8 +2516,7 @@
9.239
9.240 void Main::testFunction()
9.241 {
9.242 - fileExportOOPresentation();
9.243 -// currentMapEditor()->testFunction();
9.244 + currentMapEditor()->testFunction();
9.245 }
9.246
9.247 void Main::helpDoc()
10.1 --- a/mainwindow.h Wed Feb 15 12:54:55 2006 +0000
10.2 +++ b/mainwindow.h Wed Feb 15 12:54:55 2006 +0000
10.3 @@ -57,7 +57,7 @@
10.4 void newView();
10.5 void editorChanged(QWidget*);
10.6
10.7 - void fileLoad(QString ,const LoadMode &);
10.8 + ErrorCode fileLoad(QString ,const LoadMode &);
10.9 void fileLoad(const LoadMode &);
10.10 void fileLoad();
10.11 void fileLoadLast(int);
10.12 @@ -66,6 +66,7 @@
10.13 void fileSaveAs(const SaveMode &);
10.14 void fileSaveAs();
10.15 void fileImportDir();
10.16 + void fileImportKDEBookmarks();
10.17 void fileExportXML();
10.18 void fileExportHTML();
10.19 void fileExportXHTML();
11.1 --- a/mapeditor.cpp Wed Feb 15 12:54:55 2006 +0000
11.2 +++ b/mapeditor.cpp Wed Feb 15 12:54:55 2006 +0000
11.3 @@ -717,7 +717,7 @@
11.4
11.5 void MapEditor::setFilePath(QString fname, QString destname)
11.6 {
11.7 - if (fname.isEmpty())
11.8 + if (fname.isEmpty() || fname=="")
11.9 {
11.10 filePath="";
11.11 fileName="";
11.12 @@ -761,12 +761,12 @@
11.13 return destPath;
11.14 }
11.15
11.16 -int MapEditor::load (QString fname, LoadMode lmode)
11.17 +ErrorCode MapEditor::load (QString fname, LoadMode lmode)
11.18 {
11.19 // Finish open lineEdits
11.20 if (lineedit) finishedLineEditNoSave();
11.21
11.22 - int returnCode=0;
11.23 + ErrorCode err=success;
11.24
11.25 if (lmode==NewMap)
11.26 {
11.27 @@ -790,7 +790,7 @@
11.28 {
11.29 QMessageBox::critical( 0, tr( "Critical Parse Error" ),
11.30 tr("Couldn't open map " +fname)+".");
11.31 - returnCode=1;
11.32 + err=aborted;
11.33 } else
11.34 {
11.35 blockReposition=true;
11.36 @@ -826,7 +826,7 @@
11.37 }
11.38 }
11.39 updateActions();
11.40 - return returnCode;
11.41 + return err;
11.42 }
11.43
11.44 int MapEditor::save (const SaveMode &savemode)
11.45 @@ -1065,9 +1065,9 @@
11.46 ExportBase ex;
11.47 ex.setMapCenter(mapCenter);
11.48
11.49 - QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export (ASCII)"));
11.50 + QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export as ASCII"));
11.51 fd->addFilter ("TXT (*.txt)");
11.52 - fd->setCaption(__VYM " -" +tr("Export (ASCII) (still experimental)"));
11.53 + fd->setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
11.54 fd->setMode( QFileDialog::AnyFile );
11.55 fd->show();
11.56
11.57 @@ -1104,9 +1104,9 @@
11.58 void MapEditor::exportLaTeX()
11.59 {
11.60 // TODO still experimental
11.61 - QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export (LaTex)"));
11.62 + QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export as LaTeX"));
11.63 fd->addFilter ("TEX (*.tex)");
11.64 - fd->setCaption(__VYM " - " + tr("Export (LaTex) (still experimental)"));
11.65 + fd->setCaption(__VYM " - " + tr("Export as LaTeX")+" "+tr("(still experimental)"));
11.66 fd->setMode( QFileDialog::AnyFile );
11.67 fd->show();
11.68
11.69 @@ -3017,10 +3017,13 @@
11.70 void MapEditor::testFunction()
11.71 {
11.72 cout << "MapEditor::testFunction() called\n";
11.73 +
11.74 + /*
11.75 if (selection && (typeid(*selection) == typeid(BranchObj)))
11.76 {
11.77 cout << "Note:\n"<<((BranchObj*)selection)->getNoteOpenDoc()<<endl;
11.78 }
11.79 + */
11.80 }
11.81
11.82 void MapEditor::ensureSelectionVisible()
12.1 --- a/mapeditor.h Wed Feb 15 12:54:55 2006 +0000
12.2 +++ b/mapeditor.h Wed Feb 15 12:54:55 2006 +0000
12.3 @@ -60,7 +60,7 @@
12.4 QString getFileName (); // e.g. "map.xml"
12.5 QString getMapName (); // e.g. "map"
12.6 QString getDestPath (); // e.g. "/home/tux/map.vym"
12.7 - int load (QString, LoadMode ); // newmap, import/replace selection
12.8 + ErrorCode load (QString, LoadMode ); // newmap, import/replace selection
12.9 public:
12.10 int save(const SaveMode &); // Save map
12.11 void setZipped(bool); // save map zipped
13.1 --- a/version.h Wed Feb 15 12:54:55 2006 +0000
13.2 +++ b/version.h Wed Feb 15 12:54:55 2006 +0000
13.3 @@ -2,7 +2,7 @@
13.4 #define VERSION_H
13.5
13.6 #define __VYM "VYM"
13.7 -#define __VYM_VERSION "1.7.8"
13.8 -#define __BUILD_DATE "February 1, 2006"
13.9 +#define __VYM_VERSION "1.7.9"
13.10 +#define __BUILD_DATE "February 14, 2006"
13.11
13.12 #endif
14.1 --- a/vym.pro Wed Feb 15 12:54:55 2006 +0000
14.2 +++ b/vym.pro Wed Feb 15 12:54:55 2006 +0000
14.3 @@ -17,6 +17,7 @@
14.4 frameobj.h \
14.5 headingobj.h \
14.6 imageobj.h \
14.7 + imports.h \
14.8 linkablemapobj.h \
14.9 xlinkobj.h \
14.10 mainwindow.h \
14.11 @@ -31,6 +32,7 @@
14.12 texteditor.h \
14.13 version.h \
14.14 xml.h \
14.15 + xsltproc.h \
14.16 settings.h \
14.17 options.h
14.18
14.19 @@ -48,6 +50,7 @@
14.20 frameobj.cpp \
14.21 headingobj.cpp \
14.22 imageobj.cpp \
14.23 + imports.cpp \
14.24 linkablemapobj.cpp \
14.25 xlinkobj.cpp \
14.26 main.cpp \
14.27 @@ -62,6 +65,7 @@
14.28 selection.cpp \
14.29 texteditor.cpp \
14.30 xml.cpp \
14.31 + xsltproc.cpp \
14.32 settings.cpp \
14.33 options.cpp
14.34
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/xsltproc.cpp Wed Feb 15 12:54:55 2006 +0000
15.3 @@ -0,0 +1,91 @@
15.4 +#include "xsltproc.h"
15.5 +
15.6 +#include <iostream>
15.7 +#include <qmessagebox.h>
15.8 +
15.9 +#include "process.h"
15.10 +
15.11 +
15.12 +XSLTProc::XSLTProc ()
15.13 +{
15.14 + xsltprocessor="xsltproc";
15.15 + showOutput=false;
15.16 + dia=new ShowTextDialog;
15.17 +}
15.18 +
15.19 +XSLTProc::~XSLTProc ()
15.20 +{
15.21 + delete (dia);
15.22 +}
15.23 +
15.24 +void XSLTProc::addStringParam (const QString & k, const QString &v)
15.25 +{
15.26 + stringParamKey.append (k);
15.27 + stringParamVal.append (v);
15.28 +}
15.29 +
15.30 +void XSLTProc::setOutputFile (const QString &s)
15.31 +{
15.32 + outputFile=s;
15.33 +}
15.34 +
15.35 +void XSLTProc::setXSLFile(const QString &s)
15.36 +{
15.37 + xslFile=s;
15.38 +}
15.39 +
15.40 +void XSLTProc::setInputFile (const QString &s)
15.41 +{
15.42 + inputFile=s;
15.43 +}
15.44 +
15.45 +void XSLTProc::addOutput (const QString &s)
15.46 +{
15.47 + dia->append (s);
15.48 +}
15.49 +
15.50 +void XSLTProc::process()
15.51 +{
15.52 + ShowTextDialog dia;
15.53 + Process *xsltProc=new Process ();
15.54 + xsltProc->clearArguments();
15.55 + xsltProc->addArgument (xsltprocessor);
15.56 +
15.57 + QStringList::Iterator itk;
15.58 + QStringList::Iterator itv=stringParamVal.begin();
15.59 +
15.60 + for ( itk = stringParamKey.begin(); itk != stringParamKey.end(); ++itk )
15.61 + {
15.62 + xsltProc->addArgument ("--stringparam");
15.63 + xsltProc->addArgument (*itk);
15.64 + xsltProc->addArgument (*itv);
15.65 + ++itv;
15.66 + }
15.67 +
15.68 + xsltProc->addArgument ("--output");
15.69 + xsltProc->addArgument (outputFile);
15.70 + xsltProc->addArgument (xslFile);
15.71 + xsltProc->addArgument (inputFile);
15.72 + dia.append ("vym is executing: \n" + xsltProc->arguments().join(" ") );
15.73 + if (!xsltProc->start() )
15.74 + {
15.75 + QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
15.76 + QObject::tr("Could not start %1").arg(xsltprocessor) );
15.77 + } else
15.78 + {
15.79 + xsltProc->waitFinished();
15.80 + if (!xsltProc->normalExit() )
15.81 + QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
15.82 + QObject::tr("%1 didn't exit normally").arg(xsltprocessor) +
15.83 + xsltProc->getErrout() );
15.84 + else
15.85 + if (xsltProc->exitStatus()>0) showOutput=true;
15.86 +
15.87 + }
15.88 + dia.append ("\n");
15.89 + dia.append (xsltProc->getErrout());
15.90 + dia.append (xsltProc->getStdout());
15.91 +
15.92 + if (showOutput) dia.exec();
15.93 +}
15.94 +