1.1 --- a/mainwindow.cpp Wed Feb 15 12:54:55 2006 +0000
1.2 +++ b/mainwindow.cpp Wed Feb 15 12:54:55 2006 +0000
1.3 @@ -19,12 +19,6 @@
1.4 #include <cstdlib>
1.5 #include <typeinfo>
1.6
1.7 -#include "file.h"
1.8 -#include "misc.h"
1.9 -#include "version.h"
1.10 -#include "aboutdialog.h"
1.11 -#include "exportoofiledialog.h"
1.12 -
1.13 #include "icons/filenew.xpm"
1.14 #include "icons/fileopen.xpm"
1.15 #include "icons/filesave.xpm"
1.16 @@ -45,8 +39,6 @@
1.17 #include "icons/modecolor.xpm"
1.18 #include "icons/modelink.xpm"
1.19 #include "icons/modecopy.xpm"
1.20 -//#include "icons/vym-48x48.xpm"
1.21 -
1.22 #include "icons/flag-questionmark.xpm"
1.23 #include "icons/flag-exclamationmark.xpm"
1.24 #include "icons/flag-hook-green.xpm"
1.25 @@ -63,22 +55,27 @@
1.26 #include "icons/flag-heart.xpm"
1.27 #include "icons/flag-flash.xpm"
1.28 #include "icons/flag-lifebelt.xpm"
1.29 -
1.30 #include "icons/flag-note.xpm"
1.31 #include "icons/flag-url.xpm"
1.32 #include "icons/flag-vymlink.xpm"
1.33 #include "icons/flag-scrolled-right.xpm"
1.34 #include "icons/flag-tmpUnscrolled-right.xpm"
1.35
1.36 +#include "aboutdialog.h"
1.37 +#include "exporthtmldialog.h"
1.38 +#include "exportoofiledialog.h"
1.39 +#include "exportxhtmldialog.h"
1.40 +#include "file.h"
1.41 #include "flagrowobj.h"
1.42 -#include "texteditor.h"
1.43 +#include "imports.h"
1.44 #include "mapeditor.h"
1.45 -#include "exporthtmldialog.h"
1.46 -#include "exportxhtmldialog.h"
1.47 -#include "showtextdialog.h"
1.48 +#include "misc.h"
1.49 +#include "options.h"
1.50 #include "process.h"
1.51 #include "settings.h"
1.52 -#include "options.h"
1.53 +#include "showtextdialog.h"
1.54 +#include "texteditor.h"
1.55 +#include "version.h"
1.56
1.57 extern TextEditor *textEditor;
1.58 extern Main *mainWindow;
1.59 @@ -86,7 +83,6 @@
1.60 extern QString clipboardDir;
1.61 extern bool clipboardEmpty;
1.62 extern int statusbarTime;
1.63 -extern MapEditor *clipboardME;
1.64 extern FlagRowObj* standardFlagsDefault;
1.65 extern FlagRowObj* systemFlagsDefault;
1.66
1.67 @@ -172,6 +168,7 @@
1.68 extern QPopupMenu* saveImageFormatMenu;
1.69 extern QPopupMenu* canvasContextMenu;
1.70 extern QPopupMenu* lastMapsMenu;
1.71 +extern QPopupMenu* importMenu;
1.72 extern QPopupMenu* exportMenu;
1.73 extern QPopupMenu* exportImageFormatMenu;
1.74
1.75 @@ -386,9 +383,16 @@
1.76
1.77 menu->insertSeparator();
1.78
1.79 + importMenu = new QPopupMenu (this);
1.80 + menu->insertItem (tr("Import"),importMenu );
1.81 +
1.82 + a = new QAction( tr( "Import")+" "+tr("KDE Bookmarks" ), QPixmap(), tr("KDE Bookmarks"), 0, this, "importKDEBookmarks" );
1.83 + connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) );
1.84 + a->addTo (importMenu);
1.85 +
1.86 a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir"+QString("...") ), 0, this, "export" );
1.87 connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
1.88 - a->addTo( menu );
1.89 + a->addTo( importMenu);
1.90
1.91 exportMenu = new QPopupMenu (this);
1.92 menu->insertItem (tr("Export"),exportMenu );
1.93 @@ -1058,7 +1062,7 @@
1.94 connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
1.95 a->addTo( menu );
1.96
1.97 - a = new QAction( tr( "Information about")+" "__VYM, QPixmap(), tr( "About VYM" ), 0, this, "about" );
1.98 + a = new QAction( tr( "About VYM")+" "__VYM, QPixmap(), tr( "About VYM" ), 0, this, "about" );
1.99 connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
1.100 a->addTo( menu );
1.101
1.102 @@ -1162,32 +1166,32 @@
1.103 floatimageContextMenu->insertSeparator();
1.104 actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
1.105
1.106 - a = new QAction( tr( "Export as Open Office 2.0 (Open Document) " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" );
1.107 + a = new QAction( tr( "Export in Open Document Format used e.g. in Open Office " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" );
1.108 connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
1.109 a->addTo (exportMenu);
1.110
1.111 - exportMenu->insertItem ( tr("Image"),exportImageFormatMenu);
1.112 + exportMenu->insertItem ( tr("Export as Image"),exportImageFormatMenu);
1.113
1.114 - a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), "ASCII...", 0, this, "exportASCII" );
1.115 + a = new QAction( tr( "Export as ASCII")+" "+tr("(still experimental)" ), QPixmap(), "ASCII...", 0, this, "exportASCII" );
1.116 connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
1.117 a->addTo( exportMenu );
1.118
1.119 - a = new QAction( tr( "Export as LaTeX (still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" );
1.120 + a = new QAction( tr( "Export as LaTeX")+" "+tr("(still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" );
1.121 connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
1.122 a->addTo( exportMenu );
1.123
1.124 - a = new QAction( tr( "Export (XML)" ), QPixmap(), "XML...", 0, this, "exportXML" );
1.125 + a = new QAction( tr( "Export as XML" ), QPixmap(), "XML...", 0, this, "exportXML" );
1.126 connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
1.127 a->addTo( exportMenu );
1.128
1.129 if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
1.130 {
1.131 - a = new QAction( tr( "Export HTML" ), QPixmap(), "HTML...", 0, this, "exportHTML");
1.132 + a = new QAction( tr( "Export as HTML" ), QPixmap(), "HTML...", 0, this, "exportHTML");
1.133 connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
1.134 a->addTo( exportMenu );
1.135 }
1.136
1.137 - a = new QAction( tr( "Export XHTML" ), QPixmap(), "XHTML...", ALT + Key_X, this, "exportXHTML" );
1.138 + a = new QAction( tr( "Export as XHTML" ), QPixmap(), "XHTML...", ALT + Key_X, this, "exportXHTML" );
1.139 connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
1.140 a->addTo( exportMenu );
1.141
1.142 @@ -1344,9 +1348,9 @@
1.143 medit->select("mc:");
1.144 }
1.145
1.146 -void Main::fileLoad(QString fn, const LoadMode &lmode)
1.147 +ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
1.148 {
1.149 - errorCode err=success;
1.150 + ErrorCode err=success;
1.151
1.152 // fn is usually the archive, mapfile the file after uncompressing
1.153 QString mapfile;
1.154 @@ -1385,7 +1389,7 @@
1.155 break;
1.156 case QMessageBox::Cancel:
1.157 // do nothing
1.158 - return;
1.159 + return aborted;
1.160 break;
1.161 }
1.162 }
1.163 @@ -1431,13 +1435,13 @@
1.164 tabWidget->setTabLabel (currentMapEditor(),
1.165 currentMapEditor()->getFileName() );
1.166 statusBar()->message( "Created " + fn , statusbarTime );
1.167 - return;
1.168 + return success;
1.169
1.170 case QMessageBox::Cancel:
1.171 // don't create new map
1.172 statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
1.173 fileCloseMap();
1.174 - return;
1.175 + return aborted;
1.176 }
1.177 }
1.178
1.179 @@ -1503,8 +1507,7 @@
1.180
1.181 // Finally load map into mapEditor
1.182 me->setFilePath (mapfile,fn);
1.183 - if (me->load(mapfile,lmode))
1.184 - err=aborted;
1.185 + err=me->load(mapfile,lmode);
1.186
1.187 // Restore old (maybe empty) filepath, if this is an import
1.188 if (lmode!=NewMap)
1.189 @@ -1522,8 +1525,13 @@
1.190 {
1.191 me->setFilePath (fn);
1.192 tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
1.193 - lastMaps.prepend(me->getFilePath() );
1.194 - setupLastMapsMenu();
1.195 + if (fn.left(9)!="/tmp/vym-")
1.196 + {
1.197 + // Only append to lastMaps if not loaded from a tmpDir
1.198 + // e.g. imported bookmarks are in a tmpDir
1.199 + lastMaps.prepend(me->getFilePath() );
1.200 + setupLastMapsMenu();
1.201 + }
1.202 actionFilePrint->setEnabled (true);
1.203 }
1.204 statusBar()->message( "Loaded " + fn, statusbarTime );
1.205 @@ -1532,6 +1540,7 @@
1.206 // Delete tmpDir
1.207 removeDir (QDir(tmpMapDir));
1.208 }
1.209 + return err;
1.210 }
1.211
1.212
1.213 @@ -1589,8 +1598,7 @@
1.214 QString tmpMapDir;
1.215
1.216 // Error codes
1.217 - enum errorCode {success,aborted};
1.218 - errorCode err=success;
1.219 + ErrorCode err=success;
1.220
1.221 QString safeFilePath;
1.222
1.223 @@ -1776,6 +1784,14 @@
1.224 currentMapEditor()->importDir();
1.225 }
1.226
1.227 +void Main::fileImportKDEBookmarks()
1.228 +{
1.229 + ImportKDEBookmarks im;
1.230 + im.transform();
1.231 + if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
1.232 + currentMapEditor()->setFilePath ("");
1.233 +}
1.234 +
1.235 void Main::fileExportXML()
1.236 {
1.237 if (currentMapEditor())
1.238 @@ -2500,8 +2516,7 @@
1.239
1.240 void Main::testFunction()
1.241 {
1.242 - fileExportOOPresentation();
1.243 -// currentMapEditor()->testFunction();
1.244 + currentMapEditor()->testFunction();
1.245 }
1.246
1.247 void Main::helpDoc()