diff -r 657078664946 -r 30c4a6c7ff10 mainwindow.cpp --- a/mainwindow.cpp Wed Feb 15 12:54:55 2006 +0000 +++ b/mainwindow.cpp Wed Feb 15 12:54:55 2006 +0000 @@ -19,12 +19,6 @@ #include #include -#include "file.h" -#include "misc.h" -#include "version.h" -#include "aboutdialog.h" -#include "exportoofiledialog.h" - #include "icons/filenew.xpm" #include "icons/fileopen.xpm" #include "icons/filesave.xpm" @@ -45,8 +39,6 @@ #include "icons/modecolor.xpm" #include "icons/modelink.xpm" #include "icons/modecopy.xpm" -//#include "icons/vym-48x48.xpm" - #include "icons/flag-questionmark.xpm" #include "icons/flag-exclamationmark.xpm" #include "icons/flag-hook-green.xpm" @@ -63,22 +55,27 @@ #include "icons/flag-heart.xpm" #include "icons/flag-flash.xpm" #include "icons/flag-lifebelt.xpm" - #include "icons/flag-note.xpm" #include "icons/flag-url.xpm" #include "icons/flag-vymlink.xpm" #include "icons/flag-scrolled-right.xpm" #include "icons/flag-tmpUnscrolled-right.xpm" +#include "aboutdialog.h" +#include "exporthtmldialog.h" +#include "exportoofiledialog.h" +#include "exportxhtmldialog.h" +#include "file.h" #include "flagrowobj.h" -#include "texteditor.h" +#include "imports.h" #include "mapeditor.h" -#include "exporthtmldialog.h" -#include "exportxhtmldialog.h" -#include "showtextdialog.h" +#include "misc.h" +#include "options.h" #include "process.h" #include "settings.h" -#include "options.h" +#include "showtextdialog.h" +#include "texteditor.h" +#include "version.h" extern TextEditor *textEditor; extern Main *mainWindow; @@ -86,7 +83,6 @@ extern QString clipboardDir; extern bool clipboardEmpty; extern int statusbarTime; -extern MapEditor *clipboardME; extern FlagRowObj* standardFlagsDefault; extern FlagRowObj* systemFlagsDefault; @@ -172,6 +168,7 @@ extern QPopupMenu* saveImageFormatMenu; extern QPopupMenu* canvasContextMenu; extern QPopupMenu* lastMapsMenu; +extern QPopupMenu* importMenu; extern QPopupMenu* exportMenu; extern QPopupMenu* exportImageFormatMenu; @@ -386,9 +383,16 @@ menu->insertSeparator(); + importMenu = new QPopupMenu (this); + menu->insertItem (tr("Import"),importMenu ); + + a = new QAction( tr( "Import")+" "+tr("KDE Bookmarks" ), QPixmap(), tr("KDE Bookmarks"), 0, this, "importKDEBookmarks" ); + connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) ); + a->addTo (importMenu); + a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir"+QString("...") ), 0, this, "export" ); connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) ); - a->addTo( menu ); + a->addTo( importMenu); exportMenu = new QPopupMenu (this); menu->insertItem (tr("Export"),exportMenu ); @@ -1058,7 +1062,7 @@ connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) ); a->addTo( menu ); - a = new QAction( tr( "Information about")+" "__VYM, QPixmap(), tr( "About VYM" ), 0, this, "about" ); + a = new QAction( tr( "About VYM")+" "__VYM, QPixmap(), tr( "About VYM" ), 0, this, "about" ); connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) ); a->addTo( menu ); @@ -1162,32 +1166,32 @@ floatimageContextMenu->insertSeparator(); actionFormatHideLinkUnselected->addTo( floatimageContextMenu ); - a = new QAction( tr( "Export as Open Office 2.0 (Open Document) " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" ); + a = new QAction( tr( "Export in Open Document Format used e.g. in Open Office " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) ); a->addTo (exportMenu); - exportMenu->insertItem ( tr("Image"),exportImageFormatMenu); + exportMenu->insertItem ( tr("Export as Image"),exportImageFormatMenu); - a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), "ASCII...", 0, this, "exportASCII" ); + a = new QAction( tr( "Export as ASCII")+" "+tr("(still experimental)" ), QPixmap(), "ASCII...", 0, this, "exportASCII" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) ); a->addTo( exportMenu ); - a = new QAction( tr( "Export as LaTeX (still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" ); + a = new QAction( tr( "Export as LaTeX")+" "+tr("(still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) ); a->addTo( exportMenu ); - a = new QAction( tr( "Export (XML)" ), QPixmap(), "XML...", 0, this, "exportXML" ); + a = new QAction( tr( "Export as XML" ), QPixmap(), "XML...", 0, this, "exportXML" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) ); a->addTo( exportMenu ); if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) { - a = new QAction( tr( "Export HTML" ), QPixmap(), "HTML...", 0, this, "exportHTML"); + a = new QAction( tr( "Export as HTML" ), QPixmap(), "HTML...", 0, this, "exportHTML"); connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) ); a->addTo( exportMenu ); } - a = new QAction( tr( "Export XHTML" ), QPixmap(), "XHTML...", ALT + Key_X, this, "exportXHTML" ); + a = new QAction( tr( "Export as XHTML" ), QPixmap(), "XHTML...", ALT + Key_X, this, "exportXHTML" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) ); a->addTo( exportMenu ); @@ -1344,9 +1348,9 @@ medit->select("mc:"); } -void Main::fileLoad(QString fn, const LoadMode &lmode) +ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode) { - errorCode err=success; + ErrorCode err=success; // fn is usually the archive, mapfile the file after uncompressing QString mapfile; @@ -1385,7 +1389,7 @@ break; case QMessageBox::Cancel: // do nothing - return; + return aborted; break; } } @@ -1431,13 +1435,13 @@ tabWidget->setTabLabel (currentMapEditor(), currentMapEditor()->getFileName() ); statusBar()->message( "Created " + fn , statusbarTime ); - return; + return success; case QMessageBox::Cancel: // don't create new map statusBar()->message( "Loading " + fn + " failed!", statusbarTime ); fileCloseMap(); - return; + return aborted; } } @@ -1503,8 +1507,7 @@ // Finally load map into mapEditor me->setFilePath (mapfile,fn); - if (me->load(mapfile,lmode)) - err=aborted; + err=me->load(mapfile,lmode); // Restore old (maybe empty) filepath, if this is an import if (lmode!=NewMap) @@ -1522,8 +1525,13 @@ { me->setFilePath (fn); tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName()); - lastMaps.prepend(me->getFilePath() ); - setupLastMapsMenu(); + if (fn.left(9)!="/tmp/vym-") + { + // Only append to lastMaps if not loaded from a tmpDir + // e.g. imported bookmarks are in a tmpDir + lastMaps.prepend(me->getFilePath() ); + setupLastMapsMenu(); + } actionFilePrint->setEnabled (true); } statusBar()->message( "Loaded " + fn, statusbarTime ); @@ -1532,6 +1540,7 @@ // Delete tmpDir removeDir (QDir(tmpMapDir)); } + return err; } @@ -1589,8 +1598,7 @@ QString tmpMapDir; // Error codes - enum errorCode {success,aborted}; - errorCode err=success; + ErrorCode err=success; QString safeFilePath; @@ -1776,6 +1784,14 @@ currentMapEditor()->importDir(); } +void Main::fileImportKDEBookmarks() +{ + ImportKDEBookmarks im; + im.transform(); + if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() ) + currentMapEditor()->setFilePath (""); +} + void Main::fileExportXML() { if (currentMapEditor()) @@ -2500,8 +2516,7 @@ void Main::testFunction() { - fileExportOOPresentation(); -// currentMapEditor()->testFunction(); + currentMapEditor()->testFunction(); } void Main::helpDoc()