diff -r 9eb7767c2dfa -r 608f976aa7bb mainwindow.cpp --- a/mainwindow.cpp Sun Jan 30 12:58:47 2005 +0000 +++ b/mainwindow.cpp Tue Jun 06 14:58:11 2006 +0000 @@ -7,61 +7,58 @@ #include #include #include -#include +#include #include #include #include #include +//Added by qt3to4: +#include +#include +#include +#include +#include +#include +#include +#include +//#include // for random seed #include -#include +#include #include -#include "version.h" - -#include "icons/filenew.xpm" -#include "icons/fileopen.xpm" -#include "icons/filesave.xpm" -#include "icons/fileprint.xpm" -#include "icons/editundo.xpm" -//#include "icons/editredo.xpm" // TODO -#include "icons/editcopy.xpm" -#include "icons/editcut.xpm" -#include "icons/editpaste.xpm" -#include "icons/editmoveup.xpm" -#include "icons/editmovedown.xpm" -#include "icons/formatcoloritem.xpm" -#include "icons/formatcolorbranch.xpm" -#include "icons/formatcolorpicker.xpm" -#include "icons/viewzoomreset.xpm" -#include "icons/viewzoomin.xpm" -#include "icons/viewzoomout.xpm" -#include "icons/vym-48x48.xpm" -#include "icons/flag-note.xpm" -#include "icons/flag-url.xpm" -#include "icons/flag-vymlink.xpm" -#include "icons/flag-scrolled-right.xpm" - +#include "aboutdialog.h" +#include "exportoofiledialog.h" +#include "exports.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; +extern QString tmpVymDir; +extern QString clipboardDir; +extern bool clipboardEmpty; extern int statusbarTime; -extern MapEditor *clipboardME; extern FlagRowObj* standardFlagsDefault; +extern FlagRowObj* systemFlagsDefault; + +extern Q3PtrList actionListBranches; extern QAction* actionFileSave; extern QAction* actionFilePrint; extern QAction* actionEditUndo; +extern QAction* actionEditRedo; extern QAction *actionEditCopy; extern QAction *actionEditCut; extern QAction *actionEditPaste; @@ -69,25 +66,30 @@ extern QAction *actionEditMoveDown; extern QAction *actionEditToggleScroll; extern QAction* actionEditOpenURL; +extern QAction* actionEditOpenURLTab; extern QAction* actionEditURL; extern QAction* actionEditHeading2URL; extern QAction* actionEditBugzilla2URL; +extern QAction* actionEditFATE2URL; extern QAction *actionEditOpenVymLink; extern QAction *actionEditVymLink; extern QAction *actionEditDeleteVymLink; +extern QAction *actionEditToggleHideExport; extern QAction *actionEditMapInfo; extern QAction *actionEditHeading; extern QAction *actionEditDelete; extern QAction *actionEditAddBranch; +extern QAction *actionEditAddBranchHere; extern QAction *actionEditAddBranchAbove; extern QAction *actionEditAddBranchBelow; +extern QAction *actionEditRemoveBranchKeepChilds; +extern QAction *actionEditRemoveChilds; extern QAction *actionEditImportAdd; extern QAction *actionEditImportReplace; extern QAction *actionEditSaveBranch; extern QAction *actionEditSelectFirst; extern QAction *actionEditSelectLast; extern QAction *actionEditLoadImage; -extern QAction *actionEditToggleFloatExport; extern QAction* actionFormatColor; extern QAction* actionFormatPickColor; @@ -96,18 +98,27 @@ extern QAction* actionFormatLinkColorHint; extern QAction* actionFormatBackColor; extern QAction* actionFormatLinkColor; +extern QAction *actionFormatIncludeImagesVer; +extern QAction *actionFormatIncludeImagesHor; -extern QActionGroup *actionGroupFormatFrameTypes; +extern Q3ActionGroup* actionGroupModModes; +extern QAction* actionModModeColor; +extern QAction* actionModModeLink; +extern QAction* actionModModeCopy; + +extern Q3ActionGroup *actionGroupFormatFrameTypes; extern QAction *actionFormatFrameNone; extern QAction *actionFormatFrameRectangle; -extern QActionGroup *actionGroupFormatLinkStyles; +extern Q3ActionGroup *actionGroupFormatLinkStyles; extern QAction *actionFormatLinkStyleLine; extern QAction *actionFormatLinkStyleParabel; extern QAction *actionFormatLinkStylePolyLine; extern QAction *actionFormatLinkStylePolyParabel; +extern QAction *actionFormatHideLinkUnselected; extern QAction *actionViewToggleNoteEditor; +extern QAction *actionViewToggleHistoryWindow; extern QAction* actionSettingsAutoedit; extern QAction* actionSettingsAutoselectHeading; @@ -115,25 +126,31 @@ extern QAction* actionSettingsAutoselectText; extern QAction* actionSettingsPasteNewHeading; extern QAction* actionSettingsUseDelKey; +extern QAction* actionSettingsUseFlagGroups; +extern QAction* actionSettingsUseHideExport; -extern QPopupMenu* branchContextMenu; -extern QPopupMenu* floatimageContextMenu; -extern QPopupMenu* saveImageFormatMenu; -extern QPopupMenu* canvasContextMenu; -extern QPopupMenu* lastMapsMenu; -extern QPopupMenu* exportMenu; -extern QPopupMenu* exportImageFormatMenu; +extern Q3PopupMenu* branchContextMenu; +extern Q3PopupMenu* branchAddContextMenu; +extern Q3PopupMenu* branchRemoveContextMenu; +extern Q3PopupMenu* branchLinksContextMenu; +extern Q3PopupMenu* branchLinksContextMenuDup; +extern Q3PopupMenu* floatimageContextMenu; +extern Q3PopupMenu* saveImageFormatMenu; +extern Q3PopupMenu* canvasContextMenu; +extern Q3PopupMenu* lastMapsMenu; +extern Q3PopupMenu* importMenu; +extern Q3PopupMenu* exportMenu; +extern Q3PopupMenu* exportImageFormatMenu; extern Settings settings; extern Options options; +extern QDir vymBaseDir; +extern QString iconPath; +extern QString flagsPath; -#if defined(Q_OS_LINUX) -extern void qt_wait_for_window_manager( QWidget* w ); -#endif - -Main::Main(QWidget* parent, const char* name, WFlags f) : - QMainWindow(parent,name,f) +Main::Main(QWidget* parent, const char* name, Qt::WFlags f) : + Q3MainWindow(parent,name,f) { mainWindow=this; @@ -146,6 +163,24 @@ settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100)); + // Create unique temporary directory + tmpVymDir=makeUniqueDir ("/tmp/vym-XXXXXX"); + + // Create direcctory for clipboard + clipboardDir=tmpVymDir+"/clipboard"; + QDir d(clipboardDir); + d.mkdir (clipboardDir,true); + makeSubDirs (clipboardDir); + clipboardEmpty=true; + + procBrowser=NULL; + + // FIXME not used currently + // Set random seed (random used for object IDs) + // QTime t = QTime::currentTime(); // set random seed + // srand( t.hour()*12+t.minute()*60+t.second()*60 ); + + // Initialize some settings, which are platform dependant QString p,s; @@ -155,7 +190,7 @@ s=settings.readEntry (p,"konqueror"); #else #if defined(Q_OS_MACX) - s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari"); + s=settings.readEntry (p,"/usr/bin/open"); #else s=settings.readEntry (p,"mozilla"); #endif @@ -168,7 +203,7 @@ s=settings.readEntry (p,"acroread"); #else #if defined(Q_OS_MACX) - s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari"); + s=settings.readEntry (p,"/usr/bin/open"); #else s=settings.readEntry (p,"acroread"); #endif @@ -189,6 +224,7 @@ setupEditActions(); setupFormatActions(); setupViewActions(); + setupModeActions(); setupFlagActions(); setupSettingsActions(); setupContextMenus(); @@ -200,10 +236,6 @@ statusBar(); - // Create the default map into first tab -// fileNew(); -// tabWidget->addTab (new MapEditor(tabWidget,true), "unnamed"); -// currentMapEditor()->show(); // Initialize Find window findWindow=new FindWindow(NULL,"findwindow"); @@ -212,6 +244,9 @@ connect (findWindow, SIGNAL( somethingChanged() ), this, SLOT(editFindChanged() ) ); + // Connect TextEditor, so that we can update flags if text changes + connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag())); + updateGeometry(); } @@ -223,29 +258,33 @@ settings.writeEntry( "/vym/mainwindow/geometry/posX", pos().x() ); settings.writeEntry( "/vym/mainwindow/geometry/posY", pos().y() ); - settings.writeEntry( "/vym/version/version", __VYM_VERSION__ ); - settings.writeEntry( "/vym/version/builddate", __BUILD_DATE__ ); + settings.writeEntry( "/vym/version/version", __VYM_VERSION ); + settings.writeEntry( "/vym/version/builddate", __BUILD_DATE ); settings.writeEntry( "/vym/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() ); settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() ); settings.writeEntry( "/vym/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() ); settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() ); settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() ); + settings.writeEntry( "/vym/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() ); + settings.writeEntry( "/vym/export/useHideExport",actionSettingsUseHideExport->isOn() ); QString s; int maps=lastMaps.count(); settings.writeEntry( "/vym/lastMaps/number",maps ); for (int i=1;i<=maps;i++) { - QStringList::Iterator it = lastMaps.at(i-1); s=QString("/vym/lastMaps/map-%1").arg(i); if (!s.isEmpty() && i<=maxLastMaps) - settings.writeEntry (s, *it); + settings.writeEntry (s, lastMaps.at(i-1)); } // To make the texteditor save its settings, call the destructor delete (textEditor); + + // Remove temporary directory + removeDir (QDir(tmpVymDir)); } void Main::loadCmdLine() @@ -280,385 +319,622 @@ // File Actions void Main::setupFileActions() { - QToolBar *tb = new QToolBar( this ); + Q3ToolBar *tb = new Q3ToolBar( this ); tb->setLabel( "File Actions" ); - QPopupMenu *menu = new QPopupMenu( this ); + Q3PopupMenu *menu = new Q3PopupMenu( this ); menuBar()->insertItem( tr( "&File" ), menu ); // Keycodes: /usr/lib64/qt3/include/qnamespace.h QAction *a; - a = new QAction( tr( "New map" ), QPixmap( filenew_xpm ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); + a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this); + a->setStatusTip ( tr( "New map","File menu" ) ); + a->setShortcut ( Qt::CTRL + Qt::Key_N ); a->addTo( tb ); a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); - a = new QAction( tr( "Open" ), QPixmap( fileopen_xpm), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) ); + a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ),this); + a->setStatusTip (tr( "Open","File menu" ) ); + a->setShortcut ( Qt::CTRL + Qt::Key_O ); a->addTo( tb ); a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) ); - lastMapsMenu = new QPopupMenu (this); + lastMapsMenu = new Q3PopupMenu (this); menu->insertItem (tr("Open Recent"),lastMapsMenu ); menu->insertSeparator(); - a = new QAction( tr( "Save" ), QPixmap( filesave_xpm ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) ); + a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), this); + a->setStatusTip ( tr( "Save" )); + a->setShortcut (Qt::CTRL + Qt::Key_S ); a->addTo( tb ); a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) ); actionFileSave=a; - a = new QAction( tr( "Save &As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" ); + a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this); + a->setStatusTip (tr( "Save &As" ) ); + a->addTo( menu ); connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) ); - a->addTo( menu ); menu->insertSeparator(); - a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir" ), 0, this, "export" ); + importMenu = new Q3PopupMenu (this); + menu->insertItem (tr("Import"),importMenu ); + + a = new QAction(tr("KDE Bookmarks"), this); + a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" )); + a->addTo (importMenu); + connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) ); + + if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) + { + a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this); + a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) ); + a->addTo (importMenu); + connect( a, SIGNAL( activated() ), this, SLOT( fileImportFirefoxBookmarks() ) ); + } + + a = new QAction("Mind Manager...",this); + a->setStatusTip ( tr( "Import")+" Mind Manager" ); + a->addTo (importMenu); + connect( a, SIGNAL( activated() ), this, SLOT( fileImportMM() ) ); + + a = new QAction( tr( "Import Dir"+QString("...") ), this); + a->setStatusTip (tr( "Import directory structure (experimental)" ) ); + a->addTo( importMenu); connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) ); - a->addTo( menu ); - exportMenu = new QPopupMenu (this); + exportMenu = new Q3PopupMenu (this); menu->insertItem (tr("Export"),exportMenu ); menu->insertSeparator(); - a = new QAction( tr( "Print" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" ); - connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) ); + a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this); + a->setStatusTip ( tr( "Print" ) ); + a->setShortcut (Qt::CTRL + Qt::Key_P ); a->addTo( tb ); a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) ); actionFilePrint=a; - a = new QAction( tr( "Close Map" ), QPixmap(), tr( "&Close Map" ), ALT + Key_C, this, "fileCloseMap" ); + a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this); + a->setStatusTip (tr( "Close Map" ) ); + a->setShortcut (Qt::ALT + Qt::Key_C ); + a->addTo( menu ); connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) ); + + a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, this); + a->setStatusTip ( tr( "Exit")+" "+__VYM ); + a->setShortcut (Qt::CTRL + Qt::Key_Q ); a->addTo( menu ); - - a = new QAction( tr( "Exit VYM" ), QPixmap(), tr( "E&xit VYM" ), CTRL + Key_Q, this, "fileExitVYM" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) ); - a->addTo( menu ); } //Edit Actions void Main::setupEditActions() { - QToolBar *tb = new QToolBar( this ); + Q3ToolBar *tb = new Q3ToolBar( this ); tb->setLabel( "Edit Actions" ); - QPopupMenu *menu = new QPopupMenu( this ); + Q3PopupMenu *menu = new Q3PopupMenu( this ); menuBar()->insertItem( tr( "&Edit" ), menu ); QAction *a; - a = new QAction( tr( "Undo" ), QPixmap( editundo_xpm ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" ); + QAction *alt; + a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo" ),this); connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) ); + a->setStatusTip (tr( "Undo" ) ); + a->setShortcut ( Qt::CTRL + Qt::Key_Z ); a->setEnabled (false); a->addTo( tb ); a->addTo( menu ); actionEditUndo=a; - /* - a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); - connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); - a->addTo( tb ); - a->addTo( menu ); - */ + + if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) + { + a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this); + a->setStatusTip (tr( "Redo" )); + a->setShortcut (Qt::CTRL + Qt::Key_Y ); + a->addTo( tb ); + a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); + } + menu->insertSeparator(); - a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" ); - connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); + a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), this); + a->setStatusTip ( tr( "Copy" ) ); + a->setShortcut (Qt::CTRL + Qt::Key_C ); a->setEnabled (false); a->addTo( tb ); a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); actionEditCopy=a; - a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" ); - connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); + + a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t" ), this); + a->setStatusTip ( tr( "Cut" ) ); + a->setShortcut (Qt::CTRL + Qt::Key_X ); a->setEnabled (false); a->addTo( tb ); a->addTo( menu ); actionEditCut=a; - a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" ); + connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); + + a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ),this); connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); + a->setStatusTip ( tr( "Paste" ) ); + a->setShortcut ( Qt::CTRL + Qt::Key_V ); a->setEnabled (false); a->addTo( tb ); a->addTo( menu ); actionEditPaste=a; - a = new QAction( tr( "Move branch up" ), QPixmap( editmoveup_xpm ), tr( "Move up" ), Key_PageUp, this, "editMoveUp" ); - connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) ); + + a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up" ), this); + a->setStatusTip ( tr( "Move branch up" ) ); + a->setShortcut (Qt::Key_PageUp ); a->setEnabled (false); a->addTo( tb ); a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) ); actionEditMoveUp=a; - a = new QAction( tr( "Move branch down" ), QPixmap( editmovedown_xpm ), tr( "Move down" ), Key_PageDown, this, "editMoveDown" ); + + a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down" ),this); connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) ); + a->setStatusTip (tr( "Move branch down" ) ); + a->setShortcut ( Qt::Key_PageDown ); a->setEnabled (false); a->addTo( tb ); a->addTo( menu ); actionEditMoveDown=a; + - a = new QAction( tr( "Scroll branch" ), QPixmap(flag_scrolled_right_xpm), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" ); + a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ),this); + a->setShortcut ( Qt::Key_ScrollLock ); + a->setStatusTip (tr( "Scroll branch" ) ); connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) ); - a->setEnabled (false); - a->addTo( tb ); + alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), this); + alt->setShortcut ( Qt::Key_S ); + alt->setStatusTip (tr( "Scroll branch" )); + connect( alt, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) ); + #if defined(Q_OS_MACX) + actionEditToggleScroll=alt; + #else + actionEditToggleScroll=a; + #endif + actionEditToggleScroll->setEnabled (false); + actionEditToggleScroll->setToggleAction(true); + actionEditToggleScroll->addTo( tb ); + actionEditToggleScroll->addTo( menu ); + actionListBranches.append(actionEditToggleScroll); + + a = new QAction( tr( "Unscroll all scrolled branches" ), this); + a->setStatusTip (tr( "Unscroll all" )); a->addTo( menu ); - actionEditToggleScroll=a; - - a = new QAction( tr( "Unscroll all" ), QPixmap(), tr( "Unscroll all scrolled branches" ), 0, this, "scroll" ); connect( a, SIGNAL( activated() ), this, SLOT( editUnScrollAll() ) ); - a->addTo( menu ); menu->insertSeparator(); - a = new QAction( tr( "Find" ), QPixmap(), tr( "Find" ), CTRL + Key_F, this, "find" ); + a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), this); + a->setStatusTip (tr( "Find" ) ); + a->setShortcut (Qt::CTRL + Qt::Key_F ); + a->addTo( menu ); connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) ); - a->addTo( menu ); menu->insertSeparator(); - a = new QAction( tr( "Open URL" ), QPixmap(flag_url_xpm), tr( "Open URL" ), CTRL + Key_U, this, "url" ); - connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) ); - a->addTo( menu ); + a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), this); + a->setShortcut (Qt::CTRL + Qt::Key_U ); + a->setShortcut (tr( "Open URL" )); a->addTo( tb ); a->setEnabled (false); + connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) ); actionEditOpenURL=a; - a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL" ), SHIFT + CTRL + Key_U, this, "url" ); + a = new QAction( tr( "Open URL in new tab" ), this); + a->setStatusTip (tr( "Open URL in new tab" )); + a->setShortcut (Qt::CTRL+Qt::Key_U ); + a->setEnabled (false); + connect( a, SIGNAL( activated() ), this, SLOT( editOpenURLTab() ) ); + actionEditOpenURLTab=a; + + a = new QAction(QPixmap(), tr( "Edit URL"+QString("...") ), this); + a->setStatusTip ( tr( "Edit URL" ) ); + a->setShortcut (Qt::SHIFT + Qt::CTRL+Qt::Key_U ); + a->setEnabled (false); + actionListBranches.append(a); connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) ); - a->addTo( menu ); - a->setEnabled (false); actionEditURL=a; - a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" ); + a = new QAction( tr( "Use heading for URL" ), this); + a->setStatusTip ( tr( "Use heading of selected branch as URL" )); + a->setEnabled (false); + actionListBranches.append(a); connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) ); - a->addTo( menu ); - a->setEnabled (false); actionEditHeading2URL=a; - a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" ); + a = new QAction(tr( "Create URL to Bugzilla" ), this); + a->setStatusTip ( tr( "Create URL to Bugzilla" )); + a->setEnabled (false); + actionListBranches.append(a); connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) ); - a->setEnabled (false); actionEditBugzilla2URL=a; - menu->insertSeparator(); + a = new QAction(tr( "Create URL to FATE" ), this); + a->setStatusTip ( tr( "Create URL to FATE" )); + a->setEnabled (false); + actionListBranches.append(a); + connect( a, SIGNAL( activated() ), this, SLOT( editFATE2URL() ) ); + actionEditFATE2URL=a; - a = new QAction( tr( "Jump to another vym map, if needed load it first" ), QPixmap(flag_vymlink_xpm), tr( "Jump to map" ), 0, this, "jumpMap" ); - connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) ); - a->addTo( menu ); + a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Jump to map" ), this); + a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" )); a->addTo( tb ); a->setEnabled (false); + connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) ); actionEditOpenVymLink=a; - a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link" ), 0, this, "editLinkMap" ); + a = new QAction(tr( "Edit vym link"+QString("...") ), this); + a->setEnabled (false); + a->setStatusTip ( tr( "Edit link to another vym map" )); connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) ); - a->addTo( menu ); - a->setEnabled (false); + actionListBranches.append(a); actionEditVymLink=a; - a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" ); + a = new QAction(tr( "Delete vym link" ),this); + a->setStatusTip ( tr( "Delete link to another vym map" )); + a->setEnabled (false); connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) ); - a->addTo( menu ); - a->setEnabled (false); actionEditDeleteVymLink=a; - menu->insertSeparator(); + a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), this); + a->setStatusTip ( tr( "Hide object in exports" ) ); + a->setShortcut (Qt::Key_H ); + a->setToggleAction(true); + a->addTo( tb ); + a->setEnabled (false); + connect( a, SIGNAL( activated() ), this, SLOT( editToggleHideExport() ) ); + actionEditToggleHideExport=a; - a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info" ), 0, this, "editMapInfo" ); + a = new QAction(tr( "Edit Map Info"+QString("...") ),this); + a->setStatusTip ( tr( "Edit Map Info" )); + a->setEnabled (true); connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) ); - a->addTo( menu ); - a->setEnabled (true); actionEditMapInfo=a; menu->insertSeparator(); // Shortcuts to modify heading: - a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Enter, this, "editHeading" ); + a = new QAction(tr( "Edit heading" ),this); + a->setStatusTip ( tr( "edit Heading" )); + a->setShortcut ( Qt::Key_Enter ); + connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); + actionListBranches.append(a); + a = new QAction( tr( "Edit heading" ), this); + a->setStatusTip (tr( "edit Heading" )); + a->setShortcut (Qt::Key_Return ); + connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); + actionListBranches.append(a); + actionEditHeading=a; + a = new QAction( tr( "Edit heading" ),this); + a->setStatusTip (tr( "edit Heading" )); + a->setShortcut ( Qt::Key_F2 ); connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); a->setEnabled (false); - a->addTo ( menu ); actionEditHeading=a; - a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" ); - connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); - //a->addTo ( menu ); + actionListBranches.append(a); // Shortcut to delete selection - a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" ); + a = new QAction( tr( "Delete Selection" ),this); + a->setStatusTip (tr( "Delete Selection" )); + a->setShortcut ( Qt::Key_Delete); connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) ); a->setEnabled (false); - a->addTo ( menu ); actionEditDelete=a; // Shortcut to add branch + alt = new QAction(tr( "Add branch as child" ), this); + alt->setStatusTip ( tr( "Add a branch as child of selection" )); + alt->setShortcut (Qt::Key_A); + connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) ); + a = new QAction(tr( "Add branch as child" ), this); + a->setStatusTip ( tr( "Add a branch as child of selection" )); + a->setShortcut (Qt::Key_Insert); + a->setEnabled (false); + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) ); + actionListBranches.append(a); #if defined (Q_OS_MACX) - a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), CTRL + Key_I, this, "newBranch" ); - #else - a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), Key_Insert, this, "newBranch" ); - #endif - connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) ); + // In OSX show different shortcut in menues, the keys work independtly always + actionEditAddBranch=alt; + #else + actionEditAddBranch=a; + #endif + + // Add branch by inserting it at selection + a = new QAction(tr( "Add branch (insert)" ), this); + a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" )); + a->setShortcut (Qt::ALT + Qt::Key_Insert ); + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) ); a->setEnabled (false); - a->addTo ( menu ); - actionEditAddBranch=a; + actionListBranches.append(a); + actionEditAddBranchHere=a; + a = new QAction(tr( "Add branch (insert)" ),this); + a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" )); + a->setShortcut ( Qt::ALT + Qt::Key_A ); + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) ); + actionListBranches.append(a); // Add branch above - a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" ); + a = new QAction(tr( "Add branch above" ), this); + a->setStatusTip ( tr( "Add a branch above selection" )); + a->setShortcut (Qt::SHIFT+Qt::Key_Insert ); connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) ); a->setEnabled (false); - a->addTo ( menu ); + actionListBranches.append(a); actionEditAddBranchAbove=a; + a = new QAction(tr( "Add branch above" ), this); + a->setStatusTip ( tr( "Add a branch above selection" )); + a->setShortcut (Qt::SHIFT+Qt::Key_A ); + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) ); + actionListBranches.append(a); // Add branch below - a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" ); + a = new QAction(tr( "Add branch below" ), this); + a->setStatusTip ( tr( "Add a branch below selection" )); + a->setShortcut (Qt::CTRL +Qt::Key_Insert ); connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) ); a->setEnabled (false); - a->addTo ( menu ); + actionListBranches.append(a); actionEditAddBranchBelow=a; + a = new QAction(tr( "Add branch below" ), this); + a->setStatusTip ( tr( "Add a branch below selection" )); + a->setShortcut (Qt::CTRL +Qt::Key_A ); + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) ); + actionListBranches.append(a); // Import at selection (adding to selection) - a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" ); + a = new QAction( tr( "Add map (insert)" ),this); + a->setStatusTip (tr( "Add map at selection" )); connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) ); a->setEnabled (false); - a->addTo ( menu ); + actionListBranches.append(a); actionEditImportAdd=a; // Import at selection (replacing selection) - a = new QAction( tr( "Replace selection with map" ),tr( "Import (replace)" ), 0, this, "importReplace" ); + a = new QAction( tr( "Add map (replace)" ), this); + a->setStatusTip (tr( "Replace selection with map" )); connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) ); a->setEnabled (false); - a->addTo ( menu ); + actionListBranches.append(a); actionEditImportReplace=a; // Save selection - a = new QAction( tr( "Save selction" ),tr( "Save selection" ), 0, this, "saveSelection" ); + a = new QAction( tr( "Save selection" ), this); + a->setStatusTip (tr( "Save selection" )); connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) ); a->setEnabled (false); - a->addTo ( menu ); + actionListBranches.append(a); actionEditSaveBranch=a; + // Only remove branch, not its childs + a = new QAction(tr( "Remove only branch " ), this); + a->setStatusTip ( tr( "Remove only branch and keep its childs" )); + a->setShortcut (Qt::ALT + Qt::Key_Delete ); + connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchKeepChilds() ) ); + a->setEnabled (false); + actionListBranches.append(a); + actionEditRemoveBranchKeepChilds=a; + + // Only remove childs of a branch + a = new QAction( tr( "Remove childs" ), this); + a->setStatusTip (tr( "Remove childs of branch" )); + a->setShortcut (Qt::SHIFT + Qt::Key_Delete ); + connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) ); + a->setEnabled (false); + actionListBranches.append(a); + actionEditRemoveChilds=a; + // Shortcuts for navigating with cursor: - a = new QAction( tr( "Select upper branch" ),tr( "Select upper branch" ), Key_Up, this, "upperBranch" ); + a = new QAction(tr( "Select upper branch" ), this); + a->setStatusTip ( tr( "Select upper branch" )); + a->setShortcut (Qt::Key_Up ); connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) ); - a = new QAction( tr( "Select lower branch" ),tr( "Select lower branch" ), Key_Down, this, "lowerBranch" ); + a = new QAction( tr( "Select lower branch" ),this); + a->setStatusTip (tr( "Select lower branch" )); + a->setShortcut ( Qt::Key_Down ); connect( a, SIGNAL( activated() ), this, SLOT( editLowerBranch() ) ); - a = new QAction( tr( "Select left branch" ),tr( "Select left branch" ), Key_Left, this, "upperBranch" ); + a = new QAction(tr( "Select left branch" ), this); + a->setStatusTip ( tr( "Select left branch" )); + a->setShortcut (Qt::Key_Left ); connect( a, SIGNAL( activated() ), this, SLOT( editLeftBranch() ) ); - a = new QAction( tr( "Select right branch" ),tr( "Select child branch" ), Key_Right, this, "rightBranch" ); + a = new QAction( tr( "Select child branch" ), this); + a->setStatusTip (tr( "Select right branch" )); + a->setShortcut (Qt::Key_Right); connect( a, SIGNAL( activated() ), this, SLOT( editRightBranch() ) ); - a = new QAction( tr( "Select first branch" ),tr( "Select first branch" ), Key_Home, this, "firstBranch" ); + a = new QAction( tr( "Select first branch" ), this); + a->setStatusTip (tr( "Select first branch" )); + a->setShortcut (Qt::Key_Home ); a->setEnabled (false); a->addTo ( menu ); + actionListBranches.append(a); actionEditSelectFirst=a; connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) ); - a = new QAction( tr( "Select last branch" ),tr( "Select last branch" ), Key_End, this, "lastBranch" ); + a = new QAction( tr( "Select last branch" ),this); + a->setStatusTip (tr( "Select last branch" )); + a->setShortcut ( Qt::Key_End ); connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) ); a->setEnabled (false); a->addTo ( menu ); + actionListBranches.append(a); actionEditSelectLast=a; - a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" ); + a = new QAction( tr( "Add Image" )+QString("..."), this); + a->setStatusTip (tr( "Add Image" )); connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) ); actionEditLoadImage=a; + } // Format Actions void Main::setupFormatActions() { - QPopupMenu *menu = new QPopupMenu( this ); - menuBar()->insertItem( tr( "&Format" ), menu ); + Q3PopupMenu *menu = new Q3PopupMenu( this ); + menuBar()->insertItem( tr( "F&ormat" ), menu ); - QToolBar *tb = new QToolBar( this ); + Q3ToolBar *tb = new Q3ToolBar( this ); QAction *a; QPixmap pix( 16,16); - pix.fill (black); - actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" ), 0, this, "formatColor" ); - connect( actionFormatColor, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) ); - actionFormatColor->addTo( tb ); - actionFormatColor->addTo( menu ); - a= new QAction( tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ), QPixmap(formatcolorpicker_xpm), tr( "Pic&k color" ), CTRL + Key_K, this, "pickColor" ); + pix.fill (Qt::black); + a= new QAction(pix, tr( "Set &Color" )+QString("..."), this); + a->setStatusTip ( tr( "Set Color" )); + connect( a, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) ); + a->addTo( tb ); + a->addTo( menu ); + actionFormatColor=a; + a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), this); + a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) ); + a->setShortcut (Qt::CTRL + Qt::Key_K ); connect( a, SIGNAL( activated() ), this, SLOT( formatPickColor() ) ); a->setEnabled (false); a->addTo( tb ); a->addTo( menu ); + actionListBranches.append(a); actionFormatPickColor=a; - a= new QAction( tr( "Color branch" ), QPixmap(formatcoloritem_xpm), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" ); + + a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), this); + a->setStatusTip ( tr( "Color branch" ) ); + a->setShortcut (Qt::CTRL + Qt::Key_I); connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) ); a->setEnabled (false); a->addTo( tb ); a->addTo( menu ); + actionListBranches.append(a); actionFormatColorBranch=a; - a= new QAction( tr( "Color Subtree" ), QPixmap(formatcolorbranch_xpm), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" ); + + a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), this); + a->setStatusTip ( tr( "Color Subtree" )); + a->setShortcut (Qt::CTRL + Qt::Key_T); connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) ); a->setEnabled (false); a->addTo( menu ); a->addTo( tb ); + actionListBranches.append(a); actionFormatColorSubtree=a; menu->insertSeparator(); - actionGroupFormatLinkStyles=new QActionGroup ( this, "formatLinkStyles"); + actionGroupFormatLinkStyles=new Q3ActionGroup ( this, "formatLinkStyles"); actionGroupFormatLinkStyles->setExclusive (true); - a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" ); + a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles); + a->setStatusTip (tr( "Line" )); a->setToggleAction(true); connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleLine() ) ); actionFormatLinkStyleLine=a; - a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" ); + a= new QAction( tr( "Linkstyle Parabel" ), actionGroupFormatLinkStyles); + a->setStatusTip (tr( "Line" )); a->setToggleAction(true); connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleParabel() ) ); actionFormatLinkStyleParabel=a; - a= new QAction( tr( "PolyLine" ), QPixmap(), tr( "Linkstyle Thick Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" ); + a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles ); + a->setStatusTip (tr( "PolyLine" )); a->setToggleAction(true); connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyLine() ) ); actionFormatLinkStylePolyLine=a; - a= new QAction( tr( "PolyParabel" ), QPixmap(), tr( "Linkstyle Thick Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStylePolyParabel" ); + a= new QAction( tr( "Linkstyle Thick Parabel" ), actionGroupFormatLinkStyles); + a->setStatusTip (tr( "PolyParabel" ) ); a->setToggleAction(true); connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyParabel() ) ); actionFormatLinkStylePolyParabel=a; actionGroupFormatLinkStyles->addTo (menu); - actionGroupFormatFrameTypes=new QActionGroup ( this, "formatFrameTypes"); + actionGroupFormatFrameTypes=new Q3ActionGroup ( this, "formatFrameTypes"); actionGroupFormatFrameTypes->setExclusive (true); - a = new QAction( tr( "No Frame" ),tr( "No Frame" ), 0, actionGroupFormatFrameTypes, "frameNone" ); + a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes ); + a->setStatusTip (tr("No Frame")); a->setToggleAction(true); connect( a, SIGNAL( activated() ), this, SLOT( formatFrameNone() ) ); actionFormatFrameNone=a; - a = new QAction( tr( "Rectangle" ),tr( "Rectangle" ), 0, actionGroupFormatFrameTypes, "frameRectangle" ); + a = new QAction( tr( "Rectangle" ), actionGroupFormatFrameTypes); + a->setStatusTip (tr( "Rectangle" )); a->setToggleAction(true); connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) ); actionFormatFrameRectangle=a; + a = new QAction( tr( "Include images vertically" ), actionFormatIncludeImagesVer); + a->setStatusTip ( tr ("Include top and bottom position of images into branch")); + a->setToggleAction(true); + connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesVer() ) ); + actionFormatIncludeImagesVer=a; + + a = new QAction( tr( "Include images horizontally" ), actionFormatIncludeImagesHor ); + a->setStatusTip ( tr ("Include left and right position of images into branch")); + a->setToggleAction(true); + connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesHor() ) ); + actionFormatIncludeImagesHor=a; + + a = new QAction( tr( "Hide link if object is not selected" ), actionFormatHideLinkUnselected); + a->setStatusTip (tr( "Hide link" )); + a->setToggleAction(true); + connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) ); + actionFormatHideLinkUnselected=a; + menu->insertSeparator(); - a= new QAction( tr( "Use same color for links and headings" ), QPixmap(), tr( "&Use color of heading for link" ), 0, this, "formatLinkColorHint" ); + a= new QAction( tr( "&Use color of heading for link" ), this); + a->setStatusTip (tr( "Use same color for links and headings" )); a->setToggleAction(true); connect( a, SIGNAL( activated() ), this, SLOT( formatToggleLinkColorHint() ) ); a->addTo( menu ); actionFormatLinkColorHint=a; - pix.fill (white); - actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color" ), 0, this, "formatLinkColor" ); - connect( actionFormatLinkColor, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) ); - actionFormatLinkColor->addTo( menu ); - actionFormatBackColor= new QAction( tr( "Set Background Color" ), pix, tr( "Set &Background Color" ), 0, this, "formatBackColor" ); - connect( actionFormatBackColor, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) ); - actionFormatBackColor->addTo( menu ); + + pix.fill (Qt::white); + a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this ); + a->setStatusTip (tr( "Set Link Color" )); + a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) ); + actionFormatLinkColor=a; + + a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this ); + a->setStatusTip (tr( "Set Background Color" )); + a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) ); + actionFormatBackColor=a; } // View Actions void Main::setupViewActions() { - QToolBar *tb = new QToolBar( this ); + Q3ToolBar *tb = new Q3ToolBar( this ); tb->setLabel( "View Actions" ); - QPopupMenu *menu = new QPopupMenu( this ); + Q3PopupMenu *menu = new Q3PopupMenu( this ); menuBar()->insertItem( tr( "&View" ), menu ); QAction *a; - a = new QAction( tr( "Zoom reset" ), QPixmap(viewzoomreset_xpm), tr( "reset Zoom" ), 0, this, "zoomReset" ); - connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) ); + a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), this); + a->setStatusTip ( tr( "Zoom reset" ) ); + a->setShortcut (Qt::CTRL + Qt::Key_0 ); a->addTo( tb ); a->addTo( menu ); - a = new QAction( tr( "Zoom in" ), QPixmap(viewzoomin_xpm), tr( "Zoom in" ), CTRL + Key_Plus, this, "zoomIn" ); - connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) ); + connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) ); + + a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in" ), this); + a->setStatusTip (tr( "Zoom in" )); + a->setShortcut (Qt::CTRL + Qt::Key_Plus); a->addTo( tb ); a->addTo( menu ); - a = new QAction( tr( "Zoom out" ), QPixmap(viewzoomout_xpm), tr( "Zoom out" ), CTRL + Key_Minus, this, "zoomOut" ); - connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) ); + connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) ); + + a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out" ), this); + a->setStatusTip (tr( "Zoom out" )); + a->setShortcut (Qt::CTRL + Qt::Key_Minus ); a->addTo( tb ); a->addTo( menu ); - a = new QAction( tr( "Toggle Note Editor" ), QPixmap(flag_note_xpm), tr( "Toggle Note Editor" ), CTRL + Key_E , this, "noteEditor" ); - connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) ); + connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) ); + + + a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ),this); + a->setStatusTip ( tr( "Show Note Editor" )); + a->setShortcut ( Qt::CTRL + Qt::Key_E ); a->setToggleAction(true); if (textEditor->showWithMain()) a->setOn(true); @@ -666,102 +942,348 @@ a->setOn(false); a->addTo( tb ); a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) ); actionViewToggleNoteEditor=a; - a = new QAction( tr( "&Next Window" ), QPixmap(), tr( "Next Window" ), ALT + Key_N , this, "nextWindow" ); + + a = new QAction( tr( "Show history window" ),this ); + a->setStatusTip ( tr( "Show history window" )); + a->setShortcut ( Qt::CTRL + Qt::Key_H ); + a->setToggleAction(false); + a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT(windowToggleHistory() ) ); + actionViewToggleHistoryWindow=a; + + a = new QAction(tr( "Next Window" ), this); + a->setStatusTip ( tr( "&Next Window" ) ); + a->setShortcut (Qt::ALT + Qt::Key_N ); + a->addTo( menu ); connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) ); + + a = new QAction (tr( "Previous Window" ), this ); + a->setStatusTip (tr( "&Previous Window" )); + a->setShortcut (Qt::ALT + Qt::Key_P ); a->addTo( menu ); - a = new QAction( tr( "&Previous Window" ), QPixmap(), tr( "Previous Window" ), ALT + Key_P , this, "previousWindow" ); connect( a, SIGNAL( activated() ), this, SLOT(windowPreviousEditor() ) ); - a->addTo( menu ); +} + +// Mode Actions +void Main::setupModeActions() +{ + //QPopupMenu *menu = new QPopupMenu( this ); + //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu ); + + Q3ToolBar *tb = new Q3ToolBar( this ); + tb->setLabel( tr ("Modes when using modifiers") ); + QAction *a; + actionGroupModModes=new Q3ActionGroup ( this, "formatLinkStyles"); + actionGroupModModes->setExclusive (true); + a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes); + a->setShortcut (Qt::Key_J); + a->setStatusTip ( tr( "Use modifier to color branches" )); + a->setToggleAction(true); + a->addTo (tb); + a->setOn(true); + actionModModeColor=a; + + a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy" ), actionGroupModModes ); + a->setShortcut( Qt::Key_K); + a->setStatusTip( tr( "Use modifier to copy" )); + a->setToggleAction(true); + a->addTo (tb); + actionModModeCopy=a; + + a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks" ), actionGroupModModes ); + a->setShortcut (Qt::Key_L); + a->setStatusTip( tr( "Use modifier to draw xLinks" )); + a->setToggleAction(true); + a->addTo (tb); + actionModModeLink=a; } // Flag Actions void Main::setupFlagActions() { + // Create System Flags + systemFlagsDefault = new FlagRowObj (); + systemFlagsDefault->setVisibility (false); + systemFlagsDefault->setName ("systemFlagsDef"); + + FlagObj *fo = new FlagObj (); + fo->load(QPixmap(flagsPath+"flag-note.png")); + fo->setName("note"); + fo->setToolTip(tr("Note","Systemflag")); + systemFlagsDefault->addFlag (fo); // makes deep copy + + fo->load(QPixmap(flagsPath+"flag-url.png")); + fo->setName("url"); + fo->setToolTip(tr("WWW Document (external)","Systemflag")); + systemFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-vymlink.png")); + fo->setName("vymLink"); + fo->setToolTip(tr("Link to another vym map","Systemflag")); + systemFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-scrolled-right.png")); + fo->setName("scrolledright"); + fo->setToolTip(tr("subtree is scrolled","Systemflag")); + systemFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png")); + fo->setName("tmpUnscrolledright"); + fo->setToolTip(tr("subtree is temporary scrolled","Systemflag")); + systemFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-hideexport.png")); + fo->setName("hideInExport"); + fo->setToolTip(tr("Hide object in exported maps","Systemflag")); + systemFlagsDefault->addFlag (fo); + + // Create Standard Flags + standardFlagsDefault = new FlagRowObj (); + standardFlagsDefault->setVisibility (false); + standardFlagsDefault->setName ("standardFlagsDef"); + + fo->load(QPixmap(flagsPath+"flag-exclamationmark.png")); + fo->setName ("exclamationmark"); + fo->setGroup("standard-mark"); + fo->setToolTip(tr("Take care!","Standardflag")); + standardFlagsDefault->addFlag (fo); // makes deep copy + + fo->load(QPixmap(flagsPath+"flag-questionmark.png")); + fo->setName("questionmark"); + fo->setGroup("standard-mark"); + fo->setToolTip(tr("Really?","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-hook-green.png")); + fo->setName("hook-green"); + fo->setGroup("standard-hook"); + fo->setToolTip(tr("ok!","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-cross-red.png")); + fo->setName("cross-red"); + fo->setGroup("standard-hook"); + fo->setToolTip(tr("Not ok!","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-stopsign.png")); + fo->setName("stopsign"); + fo->setToolTip(tr("This won't work!","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-smiley-good.png")); + fo->setName("smiley-good"); + fo->setGroup("standard-smiley"); + fo->setToolTip(tr("Good","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-smiley-sad.png")); + fo->setName("smiley-sad"); + fo->setGroup("standard-smiley"); + fo->setToolTip(tr("Bad","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-smiley-omg.png")); + // Original omg.png (in KDE emoticons) + fo->setName("smiley-omg"); + fo->setGroup("standard-smiley"); + fo->setToolTip(tr("Oh no!","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-kalarm.png")); + fo->setName("clock"); + fo->setToolTip(tr("Time critical","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-phone.png")); + fo->setName("phone"); + fo->setToolTip(tr("Call...","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-lamp.png")); + fo->setName("lamp"); + fo->setToolTip(tr("Idea!","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-arrow-up.png")); + fo->setName("arrow-up"); + fo->setGroup("standard-arrow"); + fo->setToolTip(tr("Important","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-arrow-down.png")); + fo->setName("arrow-down"); + fo->setGroup("standard-arrow"); + fo->setToolTip(tr("Unimportant","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-arrow-2up.png")); + fo->setName("2arrow-up"); + fo->setGroup("standard-arrow"); + fo->setToolTip(tr("Very important!","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-arrow-2down.png")); + fo->setName("2arrow-down"); + fo->setGroup("standard-arrow"); + fo->setToolTip(tr("Very unimportant!","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-thumb-up.png")); + fo->setName("thumb-up"); + fo->setGroup("standard-thumb"); + fo->setToolTip(tr("I like this","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-thumb-down.png")); + fo->setName("thumb-down"); + fo->setGroup("standard-thumb"); + fo->setToolTip(tr("I like this","Standardflag")); + fo->setToolTip(tr("I do not like this","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-rose.png")); + fo->setName("rose"); + fo->setToolTip(tr("Rose","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-heart.png")); + fo->setName("heart"); + fo->setToolTip(tr("I just love... ","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-present.png")); + fo->setName("present"); + fo->setToolTip(tr("Surprise!","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-flash.png")); + fo->setName("flash"); + fo->setToolTip(tr("Dangerous","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-info.png")); + // Original: xsldbg_output.png + fo->setName("info"); + fo->setToolTip(tr("Info","Standardflag")); + standardFlagsDefault->addFlag (fo); + + fo->load(QPixmap(flagsPath+"flag-lifebelt.png")); + // Original khelpcenter.png + fo->setName("lifebelt"); + fo->setToolTip(tr("This will help","Standardflag")); + standardFlagsDefault->addFlag (fo); + + delete (fo); + standardFlagsDefault->makeToolbar(this, "Standard Flags"); } // Settings Actions void Main::setupSettingsActions() { - QPopupMenu *menu = new QPopupMenu( this ); + Q3PopupMenu *menu = new Q3PopupMenu( this ); menuBar()->insertItem( tr( "&Settings" ), menu ); QAction *a; - a = new QAction( tr( "Set application to open pdf files" ), QPixmap(), tr( "Set application to open pdf files" ), 0, this, "setPDF" ); + a = new QAction( tr( "Set application to open pdf files"), this); + a->setStatusTip ( tr( "Set application to open pdf files")); connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) ); a->addTo( menu ); - a = new QAction( tr( "Set application to open an URL" ), QPixmap(), tr( "Set application to open an URL" ), 0, this, "setURL" ); + a = new QAction( tr( "Set application to open external links"), this); + a->setStatusTip( tr( "Set application to open external links")); connect( a, SIGNAL( activated() ), this, SLOT( settingsURL() ) ); a->addTo( menu ); menu->insertSeparator(); - a = new QAction( tr( "Edit branch after adding it" ), QPixmap(), tr( "Edit branch after adding it" ), 0, this, "autoedit" ); + a = new QAction( tr( "Edit branch after adding it" ), this ); + a->setStatusTip( tr( "Edit branch after adding it" )); a->setToggleAction(true); a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoedit",true) ); a->addTo( menu ); actionSettingsAutoedit=a; - a= new QAction( tr( "Select branch after adding it" ), QPixmap(), tr( "Select branch after adding it" ), 0, this, "autoselectheading" ); + a= new QAction( tr( "Select branch after adding it" ), this ); + a->setStatusTip( tr( "Select branch after adding it" )); a->setToggleAction(true); a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselect",false) ); a->addTo( menu ); actionSettingsAutoselectHeading=a; - a= new QAction( tr( "Select heading before editing" ), QPixmap(), tr( "Select existing heading" ), 0, this, "autoselectexistingtext" ); + a= new QAction(tr( "Select existing heading" ), this); + a->setStatusTip( tr( "Select heading before editing" )); a->setToggleAction(true); a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselectexistingtext",true) ); a->addTo( menu ); actionSettingsAutoselectText=a; - a= new QAction( tr( "Enable pasting into new branch" ), QPixmap(), tr( "Enable pasting into new branch" ), 0, this, "pastenewheading" ); + a= new QAction(tr( "pasting into new branch" ), this ); + a->setStatusTip( tr( "Pasting into new branch" )); a->setToggleAction(true); a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/newheadingisempty",true) ); a->addTo( menu ); actionSettingsPasteNewHeading=a; - a= new QAction( tr( "Enable Delete key for deleting branches" ), QPixmap(), tr( "Enable Delete key" ), 0, this, "delkey" ); + a= new QAction( tr( "Delete key" ), this); + a->setStatusTip( tr( "Delete key for deleting branches" )); a->setToggleAction(true); a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) ); a->addTo( menu ); + connect( a, SIGNAL( activated() ), this, SLOT( settingsToggleDelKey() ) ); actionSettingsUseDelKey=a; + + a= new QAction( tr( "Exclusive flags" ), this); + a->setStatusTip( tr( "Use exclusive flags in flag toolbars" )); + a->setToggleAction(true); + a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) ); + a->addTo( menu ); + actionSettingsUseFlagGroups=a; + + a= new QAction( tr( "Use hide flags" ), this); + a->setStatusTip( tr( "Use hide flag during exports " )); + a->setToggleAction(true); + a->setOn ( settings.readBoolEntry ("/vym/export/useHideExport",true) ); + a->addTo( menu ); + actionSettingsUseHideExport=a; } // Test Actions void Main::setupTestActions() { - QPopupMenu *menu = new QPopupMenu( this ); + Q3PopupMenu *menu = new Q3PopupMenu( this ); menuBar()->insertItem( tr( "&Test" ), menu ); QAction *a; - a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" ); + a = new QAction( tr( "test flag" ), this); + a->setStatusTip( tr( "Call test function" )); connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) ); a->addTo( menu ); - - a = new QAction( tr( "Show Clipboard" ), QPixmap(), tr( "Show clipboard" ), 0, this, "clipboard" ); - connect( a, SIGNAL( activated() ), this, SLOT( testShowClipboard() ) ); - a->addTo( menu ); } // Help Actions void Main::setupHelpActions() { - QPopupMenu *menu = new QPopupMenu( this ); + Q3PopupMenu *menu = new Q3PopupMenu( this ); menuBar()->insertItem( tr( "&Help" ), menu ); QAction *a; - a = new QAction( tr( "Open VYM Documentation (pdf)" ), QPixmap(), tr( "Open VYM Documentation (pdf) " ), 0, this, "about" ); + a = new QAction( tr( "Open VYM Documentation (pdf) " ), this ); + a->setStatusTip( tr( "Open VYM Documentation (pdf)" )); 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" ), this); + a->setStatusTip( tr( "About VYM")+" "__VYM); connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) ); a->addTo( menu ); - a = new QAction( tr( "Information about QT toolkit" ), QPixmap(), tr( "About QT" ), 0, this, "about" ); + a = new QAction( tr( "About QT" ), this); + a->setStatusTip( tr( "Information about QT toolkit" )); connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQT() ) ); a->addTo( menu ); } @@ -772,44 +1294,89 @@ QAction*a; // Context Menu for branch or mapcenter - branchContextMenu =new QPopupMenu (this); - actionEditAddBranch->addTo ( branchContextMenu ); - actionEditAddBranchAbove->addTo ( branchContextMenu ); - actionEditAddBranchBelow->addTo ( branchContextMenu ); + branchContextMenu =new Q3PopupMenu (this); + + // Submenu "Add" + branchAddContextMenu =new Q3PopupMenu (this); + actionEditPaste->addTo ( branchAddContextMenu ); + actionEditAddBranch->addTo ( branchAddContextMenu ); + actionEditAddBranchHere->addTo ( branchAddContextMenu ); + actionEditAddBranchAbove->addTo ( branchAddContextMenu ); + actionEditAddBranchBelow->addTo ( branchAddContextMenu ); + branchAddContextMenu->insertSeparator(); + actionEditLoadImage->addTo( branchAddContextMenu ); + branchAddContextMenu->insertSeparator(); + actionEditImportAdd->addTo ( branchAddContextMenu ); + actionEditImportReplace->addTo ( branchAddContextMenu ); + + // Submenu "Remove" + branchRemoveContextMenu =new Q3PopupMenu (this); + actionEditCut->addTo ( branchRemoveContextMenu ); + actionEditDelete->addTo ( branchRemoveContextMenu ); + actionEditRemoveBranchKeepChilds->addTo( branchRemoveContextMenu ); + actionEditRemoveChilds->addTo( branchRemoveContextMenu ); + + branchContextMenu->insertItem (tr("Add"),branchAddContextMenu); + branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu); + actionEditSaveBranch->addTo( branchContextMenu ); - branchContextMenu->insertSeparator(); - actionEditImportAdd->addTo ( branchContextMenu ); - actionEditImportReplace->addTo ( branchContextMenu ); + branchContextMenu->insertSeparator(); actionEditOpenURL->addTo ( branchContextMenu ); + actionEditOpenURLTab->addTo ( branchContextMenu ); actionEditURL->addTo ( branchContextMenu ); actionEditHeading2URL->addTo ( branchContextMenu ); + actionEditBugzilla2URL->addTo( branchContextMenu ); if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) - actionEditBugzilla2URL->addTo( branchContextMenu ); + { + actionEditFATE2URL->addTo( branchContextMenu ); + } branchContextMenu->insertSeparator(); actionEditOpenVymLink->addTo ( branchContextMenu ); actionEditVymLink->addTo ( branchContextMenu ); actionEditDeleteVymLink->addTo ( branchContextMenu ); - branchContextMenu->insertSeparator(); - actionEditLoadImage->addTo( branchContextMenu ); - branchContextMenu->insertSeparator(); - actionEditCopy->addTo( branchContextMenu ); - actionEditCut->addTo( branchContextMenu ); - actionEditPaste->addTo( branchContextMenu ); + branchContextMenu->insertSeparator(); actionGroupFormatFrameTypes->addTo( branchContextMenu ); + branchContextMenu->insertSeparator(); + actionFormatIncludeImagesVer->addTo( branchContextMenu ); + actionFormatIncludeImagesHor->addTo( branchContextMenu ); + actionFormatHideLinkUnselected->addTo( branchContextMenu ); + + // Context Menu for links in a branch menu + // This will be populated "on demand" in MapEditor::updateActions + branchContextMenu->insertSeparator(); + branchLinksContextMenu =new Q3PopupMenu (this); + branchLinksContextMenuDup =new Q3PopupMenu (this); + branchContextMenu->insertItem (tr("Edit XLink"),branchLinksContextMenuDup); + connect( branchLinksContextMenuDup, SIGNAL( activated(int) ), this, SLOT( editEditXLink(int ) ) ); + + branchContextMenu->insertItem (tr("Goto XLink"),branchLinksContextMenu); + connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowXLink(int ) ) ); + // Context menu for floatimage - floatimageContextMenu =new QPopupMenu (this); - saveImageFormatMenu=new QPopupMenu (this); - exportImageFormatMenu=new QPopupMenu (this); + floatimageContextMenu =new Q3PopupMenu (this); + saveImageFormatMenu=new Q3PopupMenu (this); + exportImageFormatMenu=new Q3PopupMenu (this); - QStrList fmt = QImage::outputFormats(); +/* FIXME strange error + foreach (QByteArray format, QImageWriter::supportedImageFormats()) + { + QString text = tr("%1...").arg(QString(format).toUpper()); + saveImageFormatMenu->insertItem( text ); + exportImageFormatMenu->insertItem( text ); + } +*/ + +/* FIXME not needed any longer + Q3StrList fmt = QImageWriter::supportedImageFormats(); for (const char* f = fmt.first(); f; f = fmt.next()) { saveImageFormatMenu->insertItem( f ); exportImageFormatMenu->insertItem( f ); } +*/ connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) ); connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) ); floatimageContextMenu->insertItem( tr("Save image"),saveImageFormatMenu ); @@ -819,39 +1386,48 @@ actionEditCut->addTo( floatimageContextMenu ); floatimageContextMenu->insertSeparator(); - a = new QAction( tr( "Use for Export" ), QPixmap(), tr( "Use for Export"), 0, this, "useForExport" ); - a->setToggleAction(true); - connect( a, SIGNAL( activated() ), this, SLOT( editToggleFloatExport() ) ); - a->addTo( floatimageContextMenu); - actionEditToggleFloatExport=a; + actionFormatHideLinkUnselected->addTo( floatimageContextMenu ); + exportMenu->insertItem ( tr("Export as")+" Image",exportImageFormatMenu); + a = new QAction( "Open Office"+QString("..."), this); + a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " )); + connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) ); + a->addTo (exportMenu); - // Context menu for exports - exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu); - - a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) ); + a = new QAction( "Webpage (XHTML)...",this ); + a->setShortcut (Qt::ALT + Qt::Key_X); + a->setStatusTip ( tr( "Export as")+" webpage (XHTML)"); + connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) ); a->addTo( exportMenu ); - a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ), 0, this, "exportXML" ); + a = new QAction( "Text (ASCII)...", this); + a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" )); + connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) ); + a->addTo( exportMenu ); + + a = new QAction( tr("KDE Bookmarks"), this); + a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" )); + connect( a, SIGNAL( activated() ), this, SLOT( fileExportKDEBookmarks() ) ); + a->addTo (exportMenu); + + a = new QAction( "Taskjuggler...", this ); + a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" )); + connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) ); + a->addTo( exportMenu ); + + a = new QAction( "LaTeX...", this); + a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" )); + connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) ); + a->addTo( exportMenu ); + + a = new QAction( "XML..." , this ); + a->setStatusTip (tr( "Export as")+" XML"); connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) ); a->addTo( exportMenu ); - if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) - { - a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export HTML" ), 0, this, "exportHTML" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) ); - a->addTo( exportMenu ); - } - - a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" ), ALT + Key_X, this, "exportXHTML" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) ); - a->addTo( exportMenu ); - - // Context menu for canvas - canvasContextMenu =new QPopupMenu (this); + canvasContextMenu =new Q3PopupMenu (this); actionEditMapInfo->addTo( canvasContextMenu ); canvasContextMenu->insertSeparator(); actionGroupFormatLinkStyles->addTo( canvasContextMenu ); @@ -910,7 +1486,7 @@ void Main::showEvent (QShowEvent * ) { - if (textEditor->showWithMain()) textEditor->show(); + if (textEditor->showWithMain()) textEditor->showNormal(); } bool Main::reallyWriteDirectory(const QString &dir) @@ -920,9 +1496,8 @@ if (eList.first() =="..") eList.pop_front(); // remove "." if (!eList.isEmpty()) { - QMessageBox mb( "VYM", - tr("The directory ") + dir + - tr(" is not empty. Do you risk to overwrite its contents?"), + QMessageBox mb( __VYM, + tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?").arg(dir), QMessageBox::Warning, QMessageBox::Yes , QMessageBox::Cancel | QMessageBox::Default, @@ -945,9 +1520,9 @@ QString Main::browseDirectory (const QString &caption) { - QFileDialog fd(this,caption); - fd.setMode (QFileDialog::DirectoryOnly); - fd.setCaption("VYM - "+caption); + Q3FileDialog fd(this,caption); + fd.setMode (Q3FileDialog::DirectoryOnly); + fd.setCaption(__VYM " - "+caption); fd.show(); if ( fd.exec() == QDialog::Accepted ) @@ -968,7 +1543,7 @@ void Main::newView() { // Open a new view... have it delete when closed. - Main *m = new Main(0, 0, WDestructiveClose); + Main *m = new Main(0, 0, Qt::WDestructiveClose); qApp->setMainWidget(m); m->show(); qApp->setMainWidget(0); @@ -995,18 +1570,17 @@ void Main::fileNew() { QString fn="unnamed"; - MapEditor* medit = new MapEditor (tabWidget, true); + MapEditor* medit = new MapEditor ( NULL,true); tabWidget->addTab (medit,fn); tabWidget->showPage(medit); medit->viewport()->setFocus(); + // For the very first map we do not have flagrows yet... medit->select("mc:"); } -void Main::fileLoad(QString fn, const LoadMode &lmode) +ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode) { - // Error codes - enum errorCode {success,aborted}; - errorCode err=success; + ErrorCode err=success; // fn is usually the archive, mapfile the file after uncompressing QString mapfile; @@ -1026,15 +1600,15 @@ if (me->getFilePath() == fn) { // Already there, ask for confirmation - QMessageBox mb( "VYM", - tr("The map ") + fn + tr ("\n is already opened." + QMessageBox mb( __VYM, + tr("The map %1\nis already opened." "Opening the same map in multiple editors may lead \n" "to confusion when finishing working with vym." - "Do you want to"), + "Do you want to").arg(fn), QMessageBox::Warning, QMessageBox::Yes | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, - QMessageBox::QMessageBox::NoButton); + QMessageBox::NoButton); mb.setButtonText( QMessageBox::Yes, tr("Open anyway") ); mb.setButtonText( QMessageBox::Cancel, tr("Cancel")); switch( mb.exec() ) @@ -1045,7 +1619,7 @@ break; case QMessageBox::Cancel: // do nothing - return; + return aborted; break; } } @@ -1074,13 +1648,12 @@ // from command line if (!QFile(fn).exists() ) { - QMessageBox mb( "VYM", - tr("The map") + fn + - tr(" does not exist.\n Do you want to create a new one?"), + QMessageBox mb( __VYM, + tr("This map does not exist:\n %1\nDo you want to create a new one?").arg(fn), QMessageBox::Question, QMessageBox::Yes , QMessageBox::Cancel | QMessageBox::Default, - QMessageBox::QMessageBox::NoButton ); + QMessageBox::NoButton ); mb.setButtonText( QMessageBox::Yes, tr("Create")); mb.setButtonText( QMessageBox::No, tr("Cancel")); @@ -1092,13 +1665,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; } } @@ -1112,130 +1685,101 @@ QString tmpMapDir=mkdtemp(tmpdir1); // Try to unzip file - Process *zipProc=new Process (); - zipProc->clearArguments(); - zipProc->setWorkingDirectory (QDir(tmpMapDir)); - zipProc->addArgument ("unzip"); - zipProc->addArgument (fn ); - zipProc->addArgument ("-d"); - zipProc->addArgument (tmpMapDir); - - if (!zipProc->start() ) + err=unzipDir (tmpMapDir,fn); + if (err==nozip) { - QMessageBox::critical( 0, tr( "Critical Load Error" ), - tr("Couldn't start unzip to decompress data.")); - err=aborted; - + mapfile=fn; + me->setZipped(false); } else { - zipProc->waitFinished(); - if (!zipProc->normalExit() ) + me->setZipped(true); + + // Look for mapname.xml + mapfile= fn.left(fn.findRev(".",-1,true)); + mapfile=mapfile.section( '/', -1 ); + QFile file( tmpMapDir + "/" + mapfile + ".xml"); + if (!file.exists() ) { - QMessageBox::critical( 0, tr( "Critical Load Error" ), - tr("unzip didn't exit normally") + - zipProc->getErrout() ); - err=aborted; - } else - { - if (zipProc->exitStatus()>0) + // mapname.xml does not exist, well, + // maybe some renamed the mapname.vym file... + // Try to find any .xml in the toplevel + // directory of the .vym file + QStringList flist=QDir (tmpMapDir).entryList("*.xml"); + if (flist.count()==1) { - if (zipProc->exitStatus()==9) - { - // no zipped file, but maybe .xml or old version? Try again. - mapfile=fn; - me->setZipped(false); - } - else - { - QMessageBox::critical( 0, tr( "Critical Load Error" ), - QString("unzip exit code: %1").arg(zipProc->exitStatus() ) + - zipProc->getErrout() ); - err=aborted; - } + // Only one entry, take this one + mapfile=tmpMapDir + "/"+flist.first(); } else - { // Uncompressing was successfull, - // load from uncompressed temporary directory - - me->setZipped(true); - + { + for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) + *it=tmpMapDir + "/" + *it; + // TODO Multiple entries, load all (but only the first one into this ME) + //mainWindow->fileLoadFromTmp (flist); + //returnCode=1; // Silently forget this attempt to load + qWarning ("MainWindow::load (fn) multimap found..."); + } - // Look for mapname.xml - mapfile= fn.left(fn.findRev(".",-1,true)); - mapfile=mapfile.section( '/', -1 ); - QFile file( tmpMapDir + "/" + mapfile + ".xml"); - if (!file.exists() ) - { - // mapname.xml does not exist, well, - // maybe some renamed the mapname.vym file... - // Try to find any .xml in the toplevel - // directory of the .vym file - QStringList flist=QDir (tmpMapDir).entryList("*.xml"); - if (flist.count()==1) - { - // Only one entry, take this one - mapfile=tmpMapDir + "/"+flist.first(); - } else - { - for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) - *it=tmpMapDir + "/" + *it; - // FIXME - // Multiple entries, load all (but only the first one into this ME) - //mainWindow->fileLoadFromTmp (flist); - //returnCode=1; // Silently forget this attempt to load - qWarning ("MainWindow::load (fn) multimap found..."); - } - - if (flist.isEmpty() ) - { - QMessageBox::critical( 0, tr( "Critical Load Error" ), - tr("Couldn't find a map (*.xml) in .vym archive.\n")); - err=aborted; - } - } //file doesn't exist - else - mapfile=file.name(); - } // Uncompressing successfull - } + if (flist.isEmpty() ) + { + QMessageBox::critical( 0, tr( "Critical Load Error" ), + tr("Couldn't find a map (*.xml) in .vym archive.\n")); + err=aborted; + } + } //file doesn't exist + else + mapfile=file.name(); } - // Finally load map into mapEditor - me->setFilePath (mapfile,fn); - if (me->load(mapfile,lmode)) - err=aborted; + if (err!=aborted) + { + // Save existing filename in case we import + QString fn_org=me->getFilePath(); - // Delete tmpDir - system ( "rm -rf "+tmpMapDir); + // Finally load map into mapEditor + me->setFilePath (mapfile,fn); + err=me->load(mapfile,lmode); - // Check for errors - if (err==success) + // Restore old (maybe empty) filepath, if this is an import + if (lmode!=NewMap) + me->setFilePath (fn_org); + } + + // Finally check for errors and go home + if (err==aborted) + { + if (lmode==NewMap) fileCloseMap(); + statusBar()->message( "Could not load " + fn, statusbarTime ); + } else { if (lmode==NewMap) { 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 ); - return; - } else - { - if (lmode==NewMap) - fileCloseMap(); } - + // Delete tmpDir + removeDir (QDir(tmpMapDir)); } - statusBar()->message( "Could not load " + fn, statusbarTime ); + return err; } void Main::fileLoad(const LoadMode &lmode) { - QFileDialog *fd=new QFileDialog( this); + Q3FileDialog *fd=new Q3FileDialog( this); if (!lastFileDir.isEmpty()) fd->setDir (lastFileDir); + fd->setMode (Q3FileDialog::ExistingFiles); fd->addFilter ("XML (*.xml)"); fd->addFilter ("VYM map (*.vym *.vyp)"); switch (lmode) @@ -1256,9 +1800,16 @@ if ( fd->exec() == QDialog::Accepted ) { lastFileDir=fd->dirPath(); - fn = fd->selectedFile(); - fileLoad(fn, lmode); + QStringList flist = fd->selectedFiles(); + QStringList::Iterator it = flist.begin(); + while( it != flist.end() ) + { + fn = *it; + fileLoad(*it, lmode); + ++it; + } } + delete (fd); } void Main::fileLoad() @@ -1268,7 +1819,7 @@ void Main::fileLoadLast(int i) { - fileLoad(*lastMaps.at(lastMapsMenu->indexOf (i) ),NewMap); + fileLoad(QString(*lastMaps.at(lastMapsMenu->indexOf (i)) ),NewMap); } void Main::fileSave(const SaveMode &savemode) @@ -1277,16 +1828,16 @@ QString tmpMapDir; // Error codes - enum errorCode {success,aborted}; - errorCode err=success; + ErrorCode err=success; QString safeFilePath; bool saveZipped=currentMapEditor()->saveZipped(); - if (currentMapEditor()) + MapEditor * me=currentMapEditor(); + if (me) { - QString fn=currentMapEditor()->getFilePath(); + QString fn=me->getFilePath(); // filename=unnamed, filepath="" in constructor... if ( !fn.isEmpty() ) { @@ -1302,12 +1853,11 @@ // Look, if we should zip the data: if (!saveZipped) { - QMessageBox mb( "VYM", - tr("The map ") + fn + - tr ("\ndid not use the compressed " + QMessageBox mb( __VYM, + tr("The map %1\ndid not use the compressed " "vym file format.\nWriting it uncompressed will also write images \n" "and flags and thus may overwrite files in the " - "given directory\n\nDo you want to write the map"), + "given directory\n\nDo you want to write the map").arg(fn), QMessageBox::Warning, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No , @@ -1337,57 +1887,22 @@ char tmpdir1[]="/tmp/vym-XXXXXX"; tmpMapDir=mkdtemp(tmpdir1); - safeFilePath=currentMapEditor()->getFilePath(); - currentMapEditor()->setFilePath (tmpMapDir+"/"+ - currentMapEditor()->getMapName()+ ".xml", + safeFilePath=me->getFilePath(); + me->setFilePath (tmpMapDir+"/"+ + me->getMapName()+ ".xml", safeFilePath); - currentMapEditor()->save (savemode); - currentMapEditor()->setFilePath (safeFilePath); + me->save (savemode); + me->setFilePath (safeFilePath); - // zip the temporary directory - Process *zipProc=new Process (); - zipProc->clearArguments(); - zipProc->setWorkingDirectory (QDir(tmpMapDir)); - zipProc->addArgument ("zip"); - zipProc->addArgument ("-r"); - zipProc->addArgument (fn); - zipProc->addArgument ("."); - - if (!zipProc->start() ) - { - // zip could not be started - QMessageBox::critical( 0, tr( "Critical Save Error" ), - tr("Couldn't start zip to compress data.")); - err=aborted; - } else - { - // zip could be started - zipProc->waitFinished(); - if (!zipProc->normalExit() ) - { - QMessageBox::critical( 0, tr( "Critical Save Error" ), - tr("zip didn't exit normally")+ - "\n" + zipProc->getErrout()); - err=aborted; - } else - { - if (zipProc->exitStatus()>0) - { - QMessageBox::critical( 0, tr( "Critical Save Error" ), - QString("zip exit code: %1").arg(zipProc->exitStatus() )+ - "\n" + zipProc->getErrout() ); - err=aborted; - } - } - } // zip could be started + zipDir (tmpMapDir,fn); } // save zipped else { // Save unzipped. - safeFilePath=currentMapEditor()->getFilePath(); - currentMapEditor()->setFilePath (fn, safeFilePath); - currentMapEditor()->save (savemode); - currentMapEditor()->setFilePath (safeFilePath); + safeFilePath=me->getFilePath(); + me->setFilePath (fn, safeFilePath); + me->save (savemode); + me->setFilePath (safeFilePath); } // save zipped } // filepath available else @@ -1399,19 +1914,20 @@ } } - if (currentMapEditor()->saveZipped()) - { + if (saveZipped && !tmpMapDir.isEmpty()) // Delete tmpDir - system ( "rm -rf "+ tmpMapDir ); - } + removeDir (QDir(tmpMapDir)); if (err==success) + { statusBar()->message( - tr("Saved")+" " + currentMapEditor()->getFilePath(), + tr("Saved %1").arg(me->getFilePath()), statusbarTime ); - else + lastMaps.prepend(me->getFilePath() ); + setupLastMapsMenu(); + } else statusBar()->message( - tr("Couldn't save")+" " + currentMapEditor()->getFilePath(), + tr("Couldn't save ").arg(me->getFilePath()), statusbarTime ); } @@ -1422,26 +1938,25 @@ void Main::fileSaveAs(const SaveMode& savemode) { - QString tmpMapDir; QString fn; if (currentMapEditor()) { if (savemode==CompleteMap) - fn = QFileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this ); + fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this ); else - fn = QFileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this ); + fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this ); if ( !fn.isEmpty() ) { // Check for existing file if (QFile (fn).exists()) { - QMessageBox mb( "VYM", - tr("The file ") + fn + tr ("\nexists already. Do you want to"), + QMessageBox mb( __VYM, + tr("The file %1\nexists already. Do you want to").arg(fn), QMessageBox::Warning, QMessageBox::Yes | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, - QMessageBox::QMessageBox::NoButton); + QMessageBox::NoButton); mb.setButtonText( QMessageBox::Yes, tr("Overwrite") ); mb.setButtonText( QMessageBox::Cancel, tr("Cancel")); switch( mb.exec() ) @@ -1477,8 +1992,9 @@ fileSave(savemode); // Set name of tab - tabWidget->setTabLabel (currentMapEditor(), - currentMapEditor()->getFileName() ); + if (savemode==CompleteMap) + tabWidget->setTabLabel (currentMapEditor(), + currentMapEditor()->getFileName() ); return; } } @@ -1489,6 +2005,73 @@ fileSaveAs (CompleteMap); } +void Main::fileImportKDEBookmarks() +{ + ImportKDEBookmarks im; + im.transform(); + if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() ) + currentMapEditor()->setFilePath (""); +} + +void Main::fileImportFirefoxBookmarks() +{ + Q3FileDialog *fd=new Q3FileDialog( this); + fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox"); + fd->setMode (Q3FileDialog::ExistingFiles); + fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)"); + fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks")); + fd->show(); + + if ( fd->exec() == QDialog::Accepted ) + { + ImportFirefoxBookmarks im; + QStringList flist = fd->selectedFiles(); + QStringList::Iterator it = flist.begin(); + while( it != flist.end() ) + { + im.setFile (*it); + if (im.transform() && + success==fileLoad (im.getTransformedFile(),NewMap) && + currentMapEditor() ) + currentMapEditor()->setFilePath (""); + ++it; + } + } + delete (fd); +} + +void Main::fileImportMM() +{ + ImportMM im; + + Q3FileDialog *fd=new Q3FileDialog( this); + if (!lastFileDir.isEmpty()) + fd->setDir (lastFileDir); + fd->setMode (Q3FileDialog::ExistingFiles); + fd->addFilter ("Mind Manager (*.mmap)"); + fd->setCaption(tr("Import")+" "+"Mind Manager"); + fd->show(); + + if ( fd->exec() == QDialog::Accepted ) + { + lastFileDir=fd->dirPath(); + QStringList flist = fd->selectedFiles(); + QStringList::Iterator it = flist.begin(); + while( it != flist.end() ) + { + im.setFile (*it); + if (im.transform() && + success==fileLoad (im.getTransformedFile(),NewMap) && + currentMapEditor() ) + currentMapEditor()->setFilePath (""); + + ++it; + } + } + delete (fd); + +} + void Main::fileImportDir() { if (currentMapEditor()) @@ -1505,32 +2088,16 @@ } } -void Main::fileExportHTML() -{ - if (currentMapEditor()) - { - ExportHTMLDialog dia(this); - - if (dia.exec()==QDialog::Accepted) - { - QString dir=dia.getDir(); - if (reallyWriteDirectory(dir) ) - { - currentMapEditor()->exportXML (dia.getDir() ); - dia.doExport(currentMapEditor()->getMapName() ); - } - } - } -} void Main::fileExportXHTML() { + MapEditor *me=currentMapEditor(); QString dir; - if (currentMapEditor()) + if (me) { ExportXHTMLDialog dia(this); - dia.setFilePath (currentMapEditor()->getFilePath() ); - dia.setMapName (currentMapEditor()->getMapName() ); + dia.setFilePath (me->getFilePath() ); + dia.setMapName (me->getMapName() ); dia.readSettings(); if (dia.exec()==QDialog::Accepted) @@ -1546,10 +2113,10 @@ if (ok) { - currentMapEditor()->exportXML (dia.getDir() ); - dia.doExport(currentMapEditor()->getMapName() ); + me->exportXML (dia.getDir() ); + dia.doExport(me->getMapName() ); if (dia.hasChanged()) - currentMapEditor()->setChanged(); + me->setChanged(); } } } @@ -1557,23 +2124,103 @@ void Main::fileExportImage(int item) { - if (currentMapEditor()) + MapEditor *me=currentMapEditor(); + if (me) { - QString fn = QFileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)", + QString fn = Q3FileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)", this ); if ( !fn.isEmpty() ) - { - currentMapEditor()->exportImage(fn,item); - } else { - statusBar()->message( tr("Couldn't save") + fn, statusbarTime ); - } + me->exportImage(fn,item); + else + statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime ); + } } void Main::fileExportASCII() { - if (currentMapEditor()) - currentMapEditor()->exportASCII(); + MapEditor *me=currentMapEditor(); + if (me) + { + ExportASCII ex; + ex.setMapCenter(me->getMapCenter()); + ex.addFilter ("TXT (*.txt)"); + ex.setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)")); + if (ex.execDialog() ) + { + me->setExportMode(true); + ex.doExport(); + me->setExportMode(false); + } + } +} + +void Main::fileExportLaTeX() +{ + MapEditor *me=currentMapEditor(); + if (me) + { + ExportLaTeX ex; + ex.setMapCenter(me->getMapCenter()); + ex.addFilter ("Tex (*.tex)"); + ex.setCaption(__VYM " -" +tr("Export as LaTeX")+" "+tr("(still experimental)")); + if (ex.execDialog() ) + { + me->setExportMode(true); + ex.doExport(); + me->setExportMode(false); + } + } +} + +void Main::fileExportKDEBookmarks() +{ + ExportKDEBookmarks ex; + MapEditor *me=currentMapEditor(); + if (me) + { + ex.setMapCenter (me->getMapCenter() ); + ex.doExport(); + } +} + +void Main::fileExportTaskjuggler() +{ + ExportTaskjuggler ex; + MapEditor *me=currentMapEditor(); + if (me) + { + ex.setMapCenter (me->getMapCenter() ); + ex.setCaption ( __VYM " - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)")); + ex.addFilter ("Taskjuggler (*.tjp)"); + if (ex.execDialog() ) + { + me->setExportMode(true); + ex.doExport(); + me->setExportMode(false); + } + } +} + +void Main::fileExportOOPresentation() +{ + ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office"); + // FIXME add extra info in dialog + //ImagePreview *p =new ImagePreview (fd); + //fd->setContentsPreviewEnabled( TRUE ); + //fd->setContentsPreview( p, p ); + //fd->setPreviewMode( QFileDialog::Contents ); + fd->setCaption(__VYM " - " +tr("Export to")+" Open Office"); + //fd->setDir (lastImageDir); + fd->show(); + + if ( fd->exec() == QDialog::Accepted ) + { + QString fn=fd->selectedFile(); + //lastImageDir=fn.left(fn.findRev ("/")); + if (currentMapEditor()) + currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig()); + } } void Main::fileCloseMap() @@ -1582,9 +2229,8 @@ { if (currentMapEditor()->hasChanged()) { - QMessageBox mb( "VYM", - tr("The map ") + currentMapEditor()->getFileName() + - tr(" has been modified but not saved yet. Do you want to"), + QMessageBox mb( __VYM, + tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()), QMessageBox::Warning, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, @@ -1632,7 +2278,7 @@ if (me->isUnsaved()) { tabWidget->setCurrentPage(i); - QMessageBox mb( "VYM", + QMessageBox mb( __VYM, tr("This map is not saved yet. Do you want to"), QMessageBox::Warning, QMessageBox::Yes | QMessageBox::Default, @@ -1641,12 +2287,6 @@ mb.setButtonText( QMessageBox::Yes, tr("Save map") ); mb.setButtonText( QMessageBox::No, tr("Discard changes") ); mb.show(); - // Call undocumented function: setActiveWindow is only - // possible, if widget is visible. This depends on - // windowmanager... -#if defined(Q_OS_LINUX) - qt_wait_for_window_manager( this); -#endif mb.setActiveWindow(); switch( mb.exec() ) { case QMessageBox::Yes: @@ -1671,8 +2311,10 @@ currentMapEditor()->undo(); } -void Main::editRedo() // TODO +void Main::editRedo() { + if (currentMapEditor()) + currentMapEditor()->redo(); } void Main::editCopy() @@ -1697,13 +2339,6 @@ { findWindow->popup(); findWindow->raise(); - - // Call undocumented function: setActiveWindow is only - // possible, if widget is visible. This depends on - // windowmanager... -#if defined(Q_OS_LINUX) - qt_wait_for_window_manager( this); -#endif findWindow->setActiveWindow(); } @@ -1717,8 +2352,7 @@ } else { QMessageBox::information( findWindow, tr( "VYM -Information:" ), - tr("No matches found for ")+ - "'"+s+"'"); + tr("No matches found for \"%1\"").arg(s)); } } @@ -1729,8 +2363,70 @@ void Main::editOpenURL() { + // Open new browser if (currentMapEditor()) - currentMapEditor()->openURL(); + { + QString url=currentMapEditor()->getURL(); + if (url=="") return; + QString browser=settings.readEntry("/vym/mainwindow/readerURL" ); + procBrowser = new Q3Process( this ); + + procBrowser->addArgument( browser); + procBrowser->addArgument( url); + + if ( !procBrowser->start() ) + { + // try to set path to browser + QMessageBox::warning(0, + tr("Warning"), + tr("Couldn't find a viewer to open %1.\n").arg(url)+ + tr("Please use Settings->")+tr("Set application to open an URL")); + settingsURL() ; + } + } +} +void Main::editOpenURLTab() +{ + if (currentMapEditor()) + { + QString url=currentMapEditor()->getURL(); + if (url=="") return; + QString browser=settings.readEntry("/vym/mainwindow/readerURL" ); + if (procBrowser && procBrowser->isRunning()) + { + if (browser.contains("konqueror")) + { + // Try to open new tab in existing konqueror started previously by vym + Q3Process *p=new Q3Process (this); + p->addArgument ("dcop"); + p->addArgument (QString("konqueror-%1").arg(procBrowser->processIdentifier())); + p->addArgument ("konqueror-mainwindow#1"); + p->addArgument ("newTab"); + p->addArgument (url); + if ( !p->start() ) + // try to set browser + QMessageBox::warning(0, + tr("Warning"), + tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror")); + return; + } else if (browser.contains ("firefox") || browser.contains ("mozilla") ) + { + // Try to open new tab in firefox + Q3Process *p=new Q3Process (this); + p->addArgument (browser); + p->addArgument ("-remote"); + p->addArgument (QString("openurl(%1,new-tab)").arg(url)); + if ( !p->start() ) + // try to set browser + QMessageBox::warning(0, + tr("Warning"), + tr("Couldn't start %1 to open a new tab").arg(browser)); + return; + } + } + // Open new browser + editOpenURL(); + } } void Main::editURL() @@ -1751,6 +2447,12 @@ currentMapEditor()->editBugzilla2URL(); } +void Main::editFATE2URL() +{ + if (currentMapEditor()) + currentMapEditor()->editFATE2URL(); +} + void Main::editOpenVymLink() { // Get current path to map @@ -1776,7 +2478,7 @@ { if (!QFile(currentVymLink).exists() ) QMessageBox::critical( 0, tr( "Critical Error" ), - tr("Couldn't open map " +currentVymLink)+"."); + tr("Couldn't open map %1").arg(currentVymLink)); else { fileLoad (currentVymLink, NewMap); @@ -1800,6 +2502,12 @@ currentMapEditor()->deleteVymLink(); } +void Main::editToggleHideExport() +{ + if (currentMapEditor()) + currentMapEditor()->toggleHideExport(); +} + void Main::editMapInfo() { if (currentMapEditor()) @@ -1846,6 +2554,12 @@ currentMapEditor()->addNewBranch(0); } +void Main::editNewBranchHere() +{ + if (currentMapEditor()) + currentMapEditor()->addNewBranchHere(); +} + void Main::editNewBranchAbove() { if (currentMapEditor()) @@ -1873,9 +2587,21 @@ fileSaveAs (PartOfMap); } +void Main::editRemoveBranchKeepChilds() +{ + if (currentMapEditor()) + currentMapEditor()->removeBranchKeepChilds(); +} + +void Main::editRemoveChilds() +{ + if (currentMapEditor()) + currentMapEditor()->removeChilds(); +} + void Main::editDeleteSelection() { - if (currentMapEditor()) + if (currentMapEditor() && actionSettingsUseDelKey->isOn()) currentMapEditor()->deleteSelection(); } @@ -1927,10 +2653,16 @@ currentMapEditor()->saveFloatImage(item); } -void Main::editToggleFloatExport() +void Main::editFollowXLink(int item) { if (currentMapEditor()) - currentMapEditor()->toggleFloatExport(); + currentMapEditor()->followXLink(branchLinksContextMenu->indexOf(item)); +} + +void Main::editEditXLink(int item) +{ + if (currentMapEditor()) + currentMapEditor()->editXLink(branchLinksContextMenuDup->indexOf(item)); } void Main::formatSelectColor() @@ -2022,11 +2754,29 @@ currentMapEditor()->setFrame(Rectangle); } +void Main::formatIncludeImagesVer() +{ + if (currentMapEditor()) + currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn()); +} + +void Main::formatIncludeImagesHor() +{ + if (currentMapEditor()) + currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn()); +} + +void Main::formatHideLinkUnselected() +{ + if (currentMapEditor()) + currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn()); +} + void Main::viewZoomReset() { if (currentMapEditor()) { - QWMatrix m; + QMatrix m; m.reset(); currentMapEditor()->setWorldMatrix( m ); currentMapEditor()->setViewCenter(); @@ -2038,7 +2788,7 @@ { if (currentMapEditor()) { - QWMatrix m = currentMapEditor()->worldMatrix(); + QMatrix m = currentMapEditor()->worldMatrix(); m.scale( 1.25, 1.25 ); currentMapEditor()->setWorldMatrix( m ); currentMapEditor()->setViewCenter(); @@ -2050,19 +2800,28 @@ { if (currentMapEditor()) { - QWMatrix m = currentMapEditor()->worldMatrix(); + QMatrix m = currentMapEditor()->worldMatrix(); m.scale( 0.8, 0.8 ); currentMapEditor()->setWorldMatrix( m ); currentMapEditor()->setViewCenter(); currentMapEditor()->adjustCanvasSize(); } } + +void Main::modModeColor() +{ +} + +void Main::modModeLink() +{ +} + bool Main::settingsPDF() { // Default browser is set in constructor bool ok; QString text = QInputDialog::getText( - "VYM", tr("Enter path for pdf reader:"), QLineEdit::Normal, + "VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal, settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this ); if (ok) settings.writeEntry ("/vym/mainwindow/readerPDF",text); @@ -2075,7 +2834,7 @@ // Default browser is set in constructor bool ok; QString text = QInputDialog::getText( - "VYM", tr("Enter path for application to open an URL:"), QLineEdit::Normal, + "VYM", tr("Set application to open an URL")+":", QLineEdit::Normal, settings.readEntry("/vym/mainwindow/readerURL") , &ok, this ); if (ok) @@ -2083,6 +2842,17 @@ return ok; } +void Main::settingsToggleDelKey() +{ + if (actionSettingsUseDelKey->isOn()) + { + actionEditDelete->setAccel (QKeySequence (Qt::Key_Delete)); + } else + { + actionEditDelete->setAccel (QKeySequence ("")); + } +} + void Main::windowToggleNoteEditor() { if (textEditor->showWithMain() ) @@ -2091,6 +2861,18 @@ windowShowNoteEditor(); } +void Main::windowToggleHistory() +{ + if (currentMapEditor()) + currentMapEditor()->toggleHistoryWindow(); +} + +void Main::updateNoteFlag() +{ + if (currentMapEditor()) + currentMapEditor()->updateNoteFlag(); +} + void Main::windowShowNoteEditor() { textEditor->setShowWithMain(true); @@ -2124,20 +2906,18 @@ void Main::testFunction() { - //textEditor->stackUnder(this); currentMapEditor()->testFunction(); } -void Main::testShowClipboard() -{ - clipboardME->show(); -} - void Main::helpDoc() { QString docpath; - // default path in SUSE LINUX - docpath="/usr/share/doc/packages/vym/doc/vym.pdf"; + #if defined(Q_OS_MACX) + docpath="./vym.app/Contents/vym.pdf"; + #else + // default path in SUSE LINUX + docpath="/usr/share/doc/packages/vym/doc/vym.pdf"; + #endif if (!QFile (docpath).exists() ) { @@ -2149,11 +2929,16 @@ docpath="doc/tex/vym.pdf"; if (!QFile (docpath).exists() ) { - QMessageBox::critical(0, - tr("Critcal error"), - tr("Couldn't find the documentation\n" - "vym.pdf in various places.")); - return; + // Try yet another one for Knoppix + docpath="/usr/share/doc/packages/vym/vym.pdf"; + if (!QFile (docpath).exists() ) + { + QMessageBox::critical(0, + tr("Critcal error"), + tr("Couldn't find the documentation\n" + "vym.pdf in various places.")); + return; + } } } } @@ -2166,10 +2951,11 @@ if ( !pdfProc->start() ) { // error handling - QMessageBox::critical(0, - tr("Critcal error"), - tr("Couldn't find a viewer to read vym.pdf.\n" - "Please use Settings->")+tr("Set application to open pdf files")); + QMessageBox::warning(0, + tr("Warning"), + tr("Couldn't find a viewer to open %1.\n").arg("vym.pdf")+ + tr("Please use Settings->")+tr("Set application to open PDF files")); + settingsPDF(); return; } } @@ -2177,33 +2963,11 @@ void Main::helpAbout() { - static QMessageBox* about = new QMessageBox( "VYM", - "

VYM - View Your Mind

" - "

A tool to put the things you have got in your mind into a map.

" - "
    " - "
  • (c) by Uwe Drechsel (vym@InSilmaril.de)
  • " - "
  • vym is released under the GPL (Gnu General Public License)" - ", with one exception (see the file \"LICENSE\"which " - "comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.
  • " - "
  • Project homepage " - "http:/www.InSilmaril.de/vym
  • " - "
  • Credits " - "
      " - "
    • Thomas Schraitle for the stylesheet used for XHTML-export
    • " - "
    • Clemens Kraus for stylesheets and script used for HTML-export " - "(www.clemens-kraus.de)
    • " - "
    • Alexander Johannesen for providing stylesheets from his xsiteable project " - "(www.shelter.nu/xsiteable/xsiteable.html).
    • " - "
    • Ken Wimer and Olaf Hering for Mac support
    • " - "
    " - "
  • " - "
  • Version " __VYM_VERSION__ "
  • " - "
  • Build date " __BUILD_DATE__"
  • " - "
", QMessageBox::Information, 1, 0, 0, this, 0, FALSE ); - about->setButtonText( 1, "Dismiss" ); - about->setMinimumSize(QSize(300,300)); - about->setIconPixmap (QPixmap(vym_logo_xpm)); - about->show(); + AboutDialog ad; + ad.setName ("aboutwindow"); + ad.setMinimumSize(500,500); + ad.resize (QSize (500,500)); + ad.exec(); } void Main::helpAboutQT()