diff -r 1cc73bd7ee1f -r e95081c21da2 mainwindow.cpp --- a/mainwindow.cpp Tue Sep 05 09:47:13 2006 +0000 +++ b/mainwindow.cpp Tue Sep 05 09:47:14 2006 +0000 @@ -1,20 +1,25 @@ #include "mainwindow.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#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 @@ -44,7 +49,7 @@ extern FlagRowObj* standardFlagsDefault; extern FlagRowObj* systemFlagsDefault; -extern QPtrList actionListBranches; +extern Q3PtrList actionListBranches; extern QAction* actionFileSave; extern QAction* actionFilePrint; @@ -58,11 +63,13 @@ extern QAction *actionEditToggleScroll; extern QAction* actionEditOpenURL; extern QAction* actionEditOpenURLTab; +extern QAction* actionEditOpenMultipleURLTabs; extern QAction* actionEditURL; extern QAction* actionEditHeading2URL; extern QAction* actionEditBugzilla2URL; extern QAction* actionEditFATE2URL; extern QAction *actionEditOpenVymLink; +extern QAction *actionEditOpenMultipleVymLinks; extern QAction *actionEditVymLink; extern QAction *actionEditDeleteVymLink; extern QAction *actionEditToggleHideExport; @@ -115,36 +122,34 @@ extern QAction* actionSettingsAutoselectHeading; extern QAction* actionSettingsAutoselectHeading; extern QAction* actionSettingsAutoselectText; -extern QAction* actionSettingsPasteNewHeading; extern QAction* actionSettingsUseDelKey; extern QAction* actionSettingsUseFlagGroups; extern QAction* actionSettingsUseHideExport; -extern QPopupMenu* branchContextMenu; -extern QPopupMenu* branchAddContextMenu; -extern QPopupMenu* branchRemoveContextMenu; -extern QPopupMenu* branchLinksContextMenu; -extern QPopupMenu* branchLinksContextMenuDup; -extern QPopupMenu* floatimageContextMenu; -extern QPopupMenu* saveImageFormatMenu; -extern QPopupMenu* canvasContextMenu; -extern QPopupMenu* lastMapsMenu; -extern QPopupMenu* importMenu; -extern QPopupMenu* exportMenu; -extern QPopupMenu* exportImageFormatMenu; +extern QMenu* branchContextMenu; +extern QMenu* branchAddContextMenu; +extern QMenu* branchRemoveContextMenu; +extern QMenu* branchLinksContextMenu; +extern QMenu* branchXLinksContextMenuEdit; +extern QMenu* branchXLinksContextMenuFollow; +extern QMenu* floatimageContextMenu; +extern QMenu* canvasContextMenu; +extern QMenu* fileLastMapsMenu; +extern QMenu* fileImportMenu; +extern QMenu* fileExportMenu; extern Settings settings; extern Options options; +extern ImageIO imageIO; + extern QDir vymBaseDir; +extern QDir lastImageDir; +extern QDir lastFileDir; 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) : +Main::Main(QWidget* parent, const char* name, Qt::WFlags f) : QMainWindow(parent,name,f) { mainWindow=this; @@ -152,14 +157,18 @@ setCaption ("VYM - View Your Mind"); // Load window settings - resize (settings.readNumEntry( "/vym/mainwindow/geometry/width", 800), - settings.readNumEntry( "/vym/mainwindow/geometry/height",600)); - move (settings.readNumEntry( "/vym/mainwindow/geometry/posX", 100), - settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100)); + resize (settings.value( "/mainwindow/geometry/size",QSize (800,600)).toSize()); + move (settings.value( "/mainwindow/geometry/pos", QPoint(300,100)).toPoint()); // Create unique temporary directory - tmpVymDir=makeUniqueDir ("/tmp/vym-XXXXXX"); + bool ok; + tmpVymDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX"); + if (!ok) + { + qWarning ("Mainwindow: Could not create temporary directory, failed to start vym"); + exit (1); + } // Create direcctory for clipboard clipboardDir=tmpVymDir+"/clipboard"; @@ -180,30 +189,30 @@ QString p,s; // application to open URLs - p="/vym/mainwindow/readerURL"; + p="/mainwindow/readerURL"; #if defined(Q_OS_LINUX) - s=settings.readEntry (p,"konqueror"); + s=settings.value (p,"konqueror").toString(); #else #if defined(Q_OS_MACX) - s=settings.readEntry (p,"/usr/bin/open"); + s=settings.value (p,"/usr/bin/open").toString(); #else - s=settings.readEntry (p,"mozilla"); + s=settings.value (p,"mozilla"); #endif #endif - settings.writeEntry( p,s); + settings.setValue( p,s); // application to open PDFs - p="/vym/mainwindow/readerPDF"; + p="/mainwindow/readerPDF"; #if defined(Q_OS_LINUX) - s=settings.readEntry (p,"acroread"); + s=settings.value (p,"acroread").toString(); #else #if defined(Q_OS_MACX) - s=settings.readEntry (p,"/usr/bin/open"); + s=settings.value (p,"/usr/bin/open").toString(); #else - s=settings.readEntry (p,"acroread"); + s=settings.value (p,"acroread").toString(); #endif #endif - settings.writeEntry( p,s); + settings.setValue( p,s); maxLastMaps=9; @@ -213,6 +222,9 @@ connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ), this, SLOT( editorChanged( QWidget * ) ) ); + lineedit=new QLineEdit (this); + lineedit->hide(); + setCentralWidget(tabWidget); setupFileActions(); @@ -223,14 +235,12 @@ setupFlagActions(); setupSettingsActions(); setupContextMenus(); - if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) setupTestActions(); + if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions(); setupHelpActions(); - // After menu is created, we can enable some actions - actionFilePrint->setEnabled (true); - statusBar(); + restoreState (settings.value("/mainwindow/state",0).toByteArray()); // Initialize Find window findWindow=new FindWindow(NULL,"findwindow"); @@ -248,31 +258,29 @@ Main::~Main() { // Save Settings - settings.writeEntry( "/vym/mainwindow/geometry/width", width() ); - settings.writeEntry( "/vym/mainwindow/geometry/height", height() ); - 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/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() ); + settings.setValue ( "/mainwindow/geometry/size", size() ); + settings.setValue ( "/mainwindow/geometry/pos", pos() ); + + settings.setValue ("/mainwindow/state",saveState(0)); + + settings.setValue( "/version/version", __VYM_VERSION ); + settings.setValue( "/version/builddate", __BUILD_DATE ); + + settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoselectHeading->isOn() ); + settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoselectText->isOn() ); + settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoedit->isOn() ); + settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() ); + settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() ); + settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() ); QString s; int maps=lastMaps.count(); - settings.writeEntry( "/vym/lastMaps/number",maps ); + settings.setValue( "/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); + s=QString("/lastMaps/map-%1").arg(i); if (!s.isEmpty() && i<=maxLastMaps) - settings.writeEntry (s, *it); + settings.setValue (s, lastMaps.at(i-1)); } @@ -315,215 +323,327 @@ // File Actions void Main::setupFileActions() { - QToolBar *tb = new QToolBar( this ); - tb->setLabel( "File Actions" ); - QPopupMenu *menu = new QPopupMenu( this ); - menuBar()->insertItem( tr( "&File" ), menu ); - - // Keycodes: /usr/lib64/qt3/include/qnamespace.h + QMenu *fileMenu = menuBar()->addMenu ( tr ("&Map") ); + QToolBar *tb = addToolBar( tr ("&Map") ); + tb->setObjectName ("mapTB"); QAction *a; - a = new QAction( tr( "New map","File menu" ), QPixmap( iconPath+"filenew.png"), 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 ); + fileMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) ); - a = new QAction( tr( "Open","File menu" ), QPixmap( iconPath+"fileopen.png"), 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 ); + fileMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( fileLoad() ) ); - lastMapsMenu = new QPopupMenu (this); - - menu->insertItem (tr("Open Recent"),lastMapsMenu ); - menu->insertSeparator(); + fileLastMapsMenu = fileMenu->addMenu (tr("Open Recent")); + fileMenu->addSeparator(); - a = new QAction( tr( "Save" ), QPixmap( iconPath+"filesave.png"), 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 ); + fileMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) ); actionFileSave=a; - a = new QAction( tr( "Save &As" ), QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), 0, this, "fileSaveAs" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) ); - a->addTo( menu ); - - menu->insertSeparator(); - - importMenu = new QPopupMenu (this); - menu->insertItem (tr("Import"),importMenu ); - - a = new QAction( tr( "Import")+" "+tr("KDE Bookmarks" ), QPixmap(), tr("KDE Bookmarks"), 0, this, "importKDEBookmarks" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) ); - a->addTo (importMenu); - - if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) + a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this); + a->setStatusTip (tr( "Save &As" ) ); + fileMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) ); + + fileMenu->addSeparator(); + + fileImportMenu = fileMenu->addMenu (tr("Import")); + + a = new QAction(tr("KDE Bookmarks"), this); + a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" )); + a->addTo (fileImportMenu); + connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDEBookmarks() ) ); + + if (settings.value( "/mainwindow/showTestMenu",false).toBool()) { - a = new QAction( tr( "Import")+" "+tr("Firefox Bookmarks" ), QPixmap(), tr("Firefox Bookmarks"), 0, this, "importFirefoxBookmarks" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileImportFirefoxBookmarks() ) ); - a->addTo (importMenu); + a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this); + a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) ); + a->addTo (fileImportMenu); + connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFirefoxBookmarks() ) ); } - a = new QAction( tr( "Import")+" Mind Manager" , QPixmap(), "Mind Manager...", 0, this, "importMM" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileImportMM() ) ); - a->addTo (importMenu); - - a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir"+QString("...") ), 0, this, "export" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) ); - a->addTo( importMenu); - - exportMenu = new QPopupMenu (this); - menu->insertItem (tr("Export"),exportMenu ); - - menu->insertSeparator(); - - - a = new QAction( tr( "Print" ), QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), CTRL + Key_P, this, "filePrint" ); - connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) ); + a = new QAction("Mind Manager...",this); + a->setStatusTip ( tr( "Import")+" Mind Manager" ); + fileImportMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( fileImportMM() ) ); + + a = new QAction( tr( "Import Dir"+QString("...") ), this); + a->setStatusTip (tr( "Import directory structure (experimental)" ) ); + fileImportMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( fileImportDir() ) ); + + fileExportMenu = fileMenu->addMenu (tr("Export")); + + a = new QAction( tr("Image")+QString("..."), this); + a->setStatusTip( tr( "Export map as image" )); + connect( a, SIGNAL( triggered() ), this, SLOT( fileExportImage() ) ); + fileExportMenu->addAction (a); + + a = new QAction( "Open Office"+QString("..."), this); + a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " )); + connect( a, SIGNAL( triggered() ), this, SLOT( fileExportOOPresentation() ) ); + fileExportMenu->addAction (a); + + a = new QAction( "Webpage (XHTML)...",this ); + a->setShortcut (Qt::ALT + Qt::Key_X); + a->setStatusTip ( tr( "Export as")+" webpage (XHTML)"); + connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXHTML() ) ); + fileExportMenu->addAction (a); + + a = new QAction( "Text (ASCII)...", this); + a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" )); + connect( a, SIGNAL( triggered() ), this, SLOT( fileExportASCII() ) ); + fileExportMenu->addAction (a); + + a = new QAction( tr("KDE Bookmarks"), this); + a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" )); + connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDEBookmarks() ) ); + fileExportMenu->addAction (a); + + a = new QAction( "Taskjuggler...", this ); + a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" )); + connect( a, SIGNAL( triggered() ), this, SLOT( fileExportTaskjuggler() ) ); + fileExportMenu->addAction (a); + + a = new QAction( "LaTeX...", this); + a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" )); + connect( a, SIGNAL( triggered() ), this, SLOT( fileExportLaTeX() ) ); + fileExportMenu->addAction (a); + + a = new QAction( "XML..." , this ); + a->setStatusTip (tr( "Export as")+" XML"); + connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXML() ) ); + fileExportMenu->addAction (a); + + fileMenu->addSeparator(); + + 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 ); + fileMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) ); actionFilePrint=a; - a = new QAction( tr( "Close Map" ), QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), ALT + Key_C, this, "fileCloseMap" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) ); - a->addTo( menu ); - - a = new QAction( tr( "Exit")+" "+__VYM, QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, CTRL + Key_Q, this, "fileExitVYM" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) ); - a->addTo( menu ); + a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this); + a->setStatusTip (tr( "Close Map" ) ); + a->setShortcut (Qt::ALT + Qt::Key_C ); + fileMenu->addAction (a); + connect( a, SIGNAL( triggered() ), 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 ); + fileMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( fileExitVYM() ) ); } //Edit Actions void Main::setupEditActions() { - QToolBar *tb = new QToolBar( this ); + QToolBar *tb = addToolBar( tr ("&Actions") ); tb->setLabel( "Edit Actions" ); - QPopupMenu *menu = new QPopupMenu( this ); - menuBar()->insertItem( tr( "&Edit" ), menu ); + tb->setObjectName ("actionsTB"); + QMenu *editMenu = menuBar()->addMenu( tr("&Edit") ); QAction *a; QAction *alt; - a = new QAction( tr( "Undo" ), QPixmap( iconPath+"undo.png"), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" ); - connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) ); + a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo" ),this); + connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) ); + a->setStatusTip (tr( "Undo" ) ); + a->setShortcut ( Qt::CTRL + Qt::Key_Z ); a->setEnabled (false); - a->addTo( tb ); - a->addTo( menu ); + tb->addAction (a); + editMenu->addAction (a); actionEditUndo=a; - if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) - { - a = new QAction( tr( "Redo" ), QPixmap( iconPath+"redo.png"), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); - connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); - a->addTo( tb ); - a->addTo( menu ); - } + a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this); + a->setStatusTip (tr( "Redo" )); + a->setShortcut (Qt::CTRL + Qt::Key_Y ); + tb->addAction (a); + editMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) ); + actionEditRedo=a; - menu->insertSeparator(); - a = new QAction( tr( "Copy" ), QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" ); - connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); + editMenu->addSeparator(); + 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 ); + tb->addAction (a); + editMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) ); actionEditCopy=a; - a = new QAction( tr( "Cut" ), QPixmap( iconPath+"editcut.png" ), 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 ); + tb->addAction (a); + editMenu->addAction (a); actionEditCut=a; - a = new QAction( tr( "Paste" ), QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" ); - connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) ); + + a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ),this); + connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) ); + a->setStatusTip ( tr( "Paste" ) ); + a->setShortcut ( Qt::CTRL + Qt::Key_V ); a->setEnabled (false); - a->addTo( tb ); - a->addTo( menu ); + tb->addAction (a); + editMenu->addAction (a); actionEditPaste=a; // Shortcuts to modify heading: - a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Enter, this, "editHeading" ); - connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); + a = new QAction(tr( "Edit heading" ),this); + a->setStatusTip ( tr( "edit Heading" )); + a->setShortcut ( Qt::Key_Enter); +// a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) ); actionListBranches.append(a); - a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" ); - connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); + a = new QAction( tr( "Edit heading" ), this); + a->setStatusTip (tr( "edit Heading" )); + a->setShortcut (Qt::Key_Return ); + //a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) ); actionListBranches.append(a); + editMenu->addAction (a); actionEditHeading=a; - a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_F2, this, "editHeading" ); - connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); - a->setEnabled (false); - actionEditHeading=a; + a = new QAction( tr( "Edit heading" ), this); + a->setStatusTip (tr( "edit Heading" )); + a->setShortcut ( Qt::Key_F2 ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) ); actionListBranches.append(a); // Shortcut to delete selection - a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" ); - connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) ); - a->setEnabled (false); + a = new QAction( tr( "Delete Selection" ),this); + a->setStatusTip (tr( "Delete Selection" )); + a->setShortcut ( Qt::Key_Delete); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) ); actionEditDelete=a; // Shortcut to add branch - alt = new QAction( tr( "Add a branch as child of selection" ),QPixmap(iconPath+"newbranch.png"),tr( "Add branch as child" ), Key_A, this, "newBranch" ); - connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) ); - a = new QAction( tr( "Add a branch as child of selection" ),QPixmap(iconPath+"newbranch.png"),tr( "Add branch as child" ), Key_Insert, this, "newBranch" ); - connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) ); - a->setEnabled (false); + alt = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child" ), this); + alt->setStatusTip ( tr( "Add a branch as child of selection" )); + alt->setShortcut (Qt::Key_A); + alt->setShortcutContext (Qt::WindowShortcut); + addAction (alt); + connect( alt, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) ); + a = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child" ), this); + a->setStatusTip ( tr( "Add a branch as child of selection" )); + a->setShortcut (Qt::Key_Insert); + connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) ); actionListBranches.append(a); #if defined (Q_OS_MACX) - // In OSX show different shortcut in menues, the keys work independtly always + // In OSX show different shortcut in menues, the keys work indepently always actionEditAddBranch=alt; #else actionEditAddBranch=a; #endif - actionEditAddBranch->addTo( menu ); - actionEditAddBranch->addTo( tb ); + editMenu->addAction (actionEditAddBranch); + tb->addAction (actionEditAddBranch); + // Add branch by inserting it at selection - a = new QAction( tr( "Add a branch by inserting and making selection its child" ),tr( "Add branch (insert)" ), ALT + Key_Insert, this, "newBranchHere" ); - connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) ); + 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 ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchHere() ) ); a->setEnabled (false); actionListBranches.append(a); actionEditAddBranchHere=a; - a = new QAction( tr( "Add a branch by inserting and making selection its child" ),tr( "Add branch (insert)" ), ALT + Key_A, this, "newBranchHere" ); - connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) ); + 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 ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), 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" ); - connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) ); + a = new QAction(tr( "Add branch above" ), this); + a->setStatusTip ( tr( "Add a branch above selection" )); + a->setShortcut (Qt::SHIFT+Qt::Key_Insert ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) ); a->setEnabled (false); actionListBranches.append(a); actionEditAddBranchAbove=a; - a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_A, this, "newBranch" ); - connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) ); + a = new QAction(tr( "Add branch above" ), this); + a->setStatusTip ( tr( "Add a branch above selection" )); + a->setShortcut (Qt::SHIFT+Qt::Key_A ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), 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" ); - connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) ); + a = new QAction(tr( "Add branch below" ), this); + a->setStatusTip ( tr( "Add a branch below selection" )); + a->setShortcut (Qt::CTRL +Qt::Key_Insert ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) ); a->setEnabled (false); actionListBranches.append(a); actionEditAddBranchBelow=a; - a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_A, this, "newBranch" ); - connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) ); + a = new QAction(tr( "Add branch below" ), this); + a->setStatusTip ( tr( "Add a branch below selection" )); + a->setShortcut (Qt::CTRL +Qt::Key_A ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) ); actionListBranches.append(a); - a = new QAction( tr( "Move branch up" ), QPixmap(iconPath+"up.png" ), 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 ); + tb->addAction (a); + editMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editMoveUp() ) ); actionEditMoveUp=a; - a = new QAction( tr( "Move branch down" ), QPixmap( iconPath+"down.png"), tr( "Move down" ), Key_PageDown, this, "editMoveDown" ); - connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) ); + a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down" ),this); + connect( a, SIGNAL( triggered() ), this, SLOT( editMoveDown() ) ); + a->setStatusTip (tr( "Move branch down" ) ); + a->setShortcut ( Qt::Key_PageDown ); a->setEnabled (false); - a->addTo( tb ); - a->addTo( menu ); + tb->addAction (a); + editMenu->addAction (a); actionEditMoveDown=a; - a = new QAction( tr( "Scroll branch" ), QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" ); - connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) ); - alt = new QAction( tr( "Scroll branch" ), QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), Key_S, this, "scroll" ); - connect( alt, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) ); + 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( triggered() ), this, SLOT( editToggleScroll() ) ); + 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( triggered() ), this, SLOT( editToggleScroll() ) ); #if defined(Q_OS_MACX) actionEditToggleScroll=alt; #else @@ -531,147 +651,215 @@ #endif actionEditToggleScroll->setEnabled (false); actionEditToggleScroll->setToggleAction(true); - actionEditToggleScroll->addTo( tb ); - actionEditToggleScroll->addTo( menu ); + tb->addAction (actionEditToggleScroll); + editMenu->addAction ( actionEditToggleScroll); + editMenu->addAction (actionEditToggleScroll); actionListBranches.append(actionEditToggleScroll); - 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 ); + a = new QAction( tr( "Unscroll all scrolled branches" ), this); + a->setStatusTip (tr( "Unscroll all" )); + editMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editUnScrollAll() ) ); - menu->insertSeparator(); - - a = new QAction( tr( "Find" ), QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), CTRL + Key_F, this, "find" ); - connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) ); - a->addTo( menu ); + editMenu->addSeparator(); + + a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), this); + a->setStatusTip (tr( "Find" ) ); + a->setShortcut (Qt::CTRL + Qt::Key_F ); + editMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWindow() ) ); - menu->insertSeparator(); - - a = new QAction( tr( "Open URL" ), QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), CTRL + Key_U, this, "url" ); - connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) ); - a->addTo( tb ); - a->setEnabled (false); + editMenu->addSeparator(); + + a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), this); + a->setShortcut (Qt::CTRL + Qt::Key_U ); + a->setShortcut (tr( "Open URL" )); + tb->addAction (a); + addAction(a); + connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURL() ) ); actionEditOpenURL=a; - a = new QAction( tr( "Open URL in new tab" ), QPixmap(), tr( "Open URL in new tab" ), CTRL + Key_U, this, "urltab" ); - connect( a, SIGNAL( activated() ), this, SLOT( editOpenURLTab() ) ); - a->setEnabled (false); + 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 ); + addAction(a); + connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) ); actionEditOpenURLTab=a; - a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL"+QString("...") ), SHIFT + CTRL + Key_U, this, "url" ); - connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) ); + a = new QAction( tr( "Open all URLs in subtree" ), this); + a->setStatusTip (tr( "Open all URLs in subtree" )); + addAction(a); + actionListBranches.append(a); + connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) ); + actionEditOpenMultipleURLTabs=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->setShortcut ( Qt::Key_U ); + a->setShortcutContext (Qt::WindowShortcut); + actionListBranches.append(a); + addAction(a); + connect( a, SIGNAL( triggered() ), this, SLOT( editURL() ) ); + actionEditURL=a; + + 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); - actionEditURL=a; - - a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" ); - connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( editHeading2URL() ) ); + actionEditHeading2URL=a; + + a = new QAction(tr( "Create URL to Bugzilla" ), this); + a->setStatusTip ( tr( "Create URL to Bugzilla" )); a->setEnabled (false); actionListBranches.append(a); - actionEditHeading2URL=a; + connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) ); + actionEditBugzilla2URL=a; - a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" ); - connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) ); + a = new QAction(tr( "Create URL to FATE" ), this); + a->setStatusTip ( tr( "Create URL to FATE" )); a->setEnabled (false); actionListBranches.append(a); - actionEditBugzilla2URL=a; - - a = new QAction( tr( "Create URL to FATE" ), QPixmap(), tr( "Create URL to FATE" ), 0, this, "FATE2url" ); - connect( a, SIGNAL( activated() ), this, SLOT( editFATE2URL() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) ); + actionEditFATE2URL=a; + + a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Open xlinked map" ), this); + a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" )); + tb->addAction (a); + a->setEnabled (false); + connect( a, SIGNAL( triggered() ), this, SLOT( editOpenVymLink() ) ); + actionEditOpenVymLink=a; + + a = new QAction(QPixmap(), tr( "Open all vym links in subtree" ), this); + a->setStatusTip ( tr( "Open all vym links in subtree" )); a->setEnabled (false); actionListBranches.append(a); - actionEditFATE2URL=a; + connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVymLinks() ) ); + actionEditOpenMultipleVymLinks=a; - a = new QAction( tr( "Jump to another vym map, if needed load it first" ), QPixmap(flagsPath+"flag-vymlink.png"), tr( "Jump to map" ), 0, this, "jumpMap" ); - connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) ); - a->addTo( tb ); + + a = new QAction(tr( "Edit vym link"+QString("...") ), this); a->setEnabled (false); - actionEditOpenVymLink=a; - - a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link"+QString("...") ), 0, this, "editLinkMap" ); - connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) ); - a->setEnabled (false); + a->setStatusTip ( tr( "Edit link to another vym map" )); + connect( a, SIGNAL( triggered() ), this, SLOT( editVymLink() ) ); actionListBranches.append(a); actionEditVymLink=a; - a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" ); - connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) ); + a = new QAction(tr( "Delete vym link" ),this); + a->setStatusTip ( tr( "Delete link to another vym map" )); a->setEnabled (false); + connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteVymLink() ) ); actionEditDeleteVymLink=a; - a = new QAction( tr( "Hide object in exports" ), QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), Key_H, this, "hideExport" ); - connect( a, SIGNAL( activated() ), this, SLOT( editToggleHideExport() ) ); + 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 ); + tb->addAction (a); a->setEnabled (false); + connect( a, SIGNAL( triggered() ), this, SLOT( editToggleHideExport() ) ); actionEditToggleHideExport=a; - a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info"+QString("...") ), 0, this, "editMapInfo" ); - connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) ); + a = new QAction(tr( "Edit Map Info"+QString("...") ),this); + a->setStatusTip ( tr( "Edit Map Info" )); a->setEnabled (true); + connect( a, SIGNAL( triggered() ), this, SLOT( editMapInfo() ) ); actionEditMapInfo=a; - menu->insertSeparator(); + editMenu->addSeparator(); // Import at selection (adding to selection) - a = new QAction( tr( "Add map at selection" ),tr( "Add map (insert)" ), 0, this, "importAdd" ); - connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) ); + a = new QAction( tr( "Add map (insert)" ),this); + a->setStatusTip (tr( "Add map at selection" )); + connect( a, SIGNAL( triggered() ), this, SLOT( editImportAdd() ) ); a->setEnabled (false); actionListBranches.append(a); actionEditImportAdd=a; // Import at selection (replacing selection) - a = new QAction( tr( "Replace selection with map" ),tr( "Add map (replace)" ), 0, this, "importReplace" ); - connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) ); + a = new QAction( tr( "Add map (replace)" ), this); + a->setStatusTip (tr( "Replace selection with map" )); + connect( a, SIGNAL( triggered() ), this, SLOT( editImportReplace() ) ); a->setEnabled (false); actionListBranches.append(a); actionEditImportReplace=a; // Save selection - a = new QAction( tr( "Save selection" ),tr( "Save selection" ), 0, this, "saveSelection" ); - connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) ); + a = new QAction( tr( "Save selection" ), this); + a->setStatusTip (tr( "Save selection" )); + connect( a, SIGNAL( triggered() ), this, SLOT( editSaveBranch() ) ); a->setEnabled (false); actionListBranches.append(a); actionEditSaveBranch=a; // Only remove branch, not its childs - a = new QAction( tr( "Remove only branch and keep its childs" ),tr( "Remove only branch " ), ALT + Key_Delete, this, "removeBranchHere" ); - connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchKeepChilds() ) ); + 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( triggered() ), this, SLOT( editRemoveBranchKeepChilds() ) ); a->setEnabled (false); actionListBranches.append(a); actionEditRemoveBranchKeepChilds=a; // Only remove childs of a branch - a = new QAction( tr( "Remove childs of branch" ),tr( "Remove childs" ), SHIFT + Key_Delete, this, "removeBranchChilds" ); - connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) ); + a = new QAction( tr( "Remove childs" ), this); + a->setStatusTip (tr( "Remove childs of branch" )); + a->setShortcut (Qt::SHIFT + Qt::Key_Delete ); + connect( a, SIGNAL( triggered() ), 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" ); - connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) ); - a = new QAction( tr( "Select lower branch" ),tr( "Select lower branch" ), Key_Down, this, "lowerBranch" ); - connect( a, SIGNAL( activated() ), this, SLOT( editLowerBranch() ) ); - a = new QAction( tr( "Select left branch" ),tr( "Select left branch" ), Key_Left, this, "upperBranch" ); - connect( a, SIGNAL( activated() ), this, SLOT( editLeftBranch() ) ); - a = new QAction( tr( "Select right branch" ),tr( "Select child branch" ), Key_Right, this, "rightBranch" ); - 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 upper branch" ), this); + a->setStatusTip ( tr( "Select upper branch" )); + a->setShortcut (Qt::Key_Up ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editUpperBranch() ) ); + a = new QAction( tr( "Select lower branch" ),this); + a->setStatusTip (tr( "Select lower branch" )); + a->setShortcut ( Qt::Key_Down ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editLowerBranch() ) ); + a = new QAction(tr( "Select left branch" ), this); + a->setStatusTip ( tr( "Select left branch" )); + a->setShortcut (Qt::Key_Left ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editLeftBranch() ) ); + a = new QAction( tr( "Select child branch" ), this); + a->setStatusTip (tr( "Select right branch" )); + a->setShortcut (Qt::Key_Right); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editRightBranch() ) ); + a = new QAction( tr( "Select first branch" ), this); + a->setStatusTip (tr( "Select first branch" )); + a->setShortcut (Qt::Key_Home ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); a->setEnabled (false); - a->addTo ( menu ); + editMenu->addAction (a); 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" ); - connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( editFirstBranch() ) ); + a = new QAction( tr( "Select last branch" ),this); + a->setStatusTip (tr( "Select last branch" )); + a->setShortcut ( Qt::Key_End ); + a->setShortcutContext (Qt::WindowShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editLastBranch() ) ); a->setEnabled (false); - a->addTo ( menu ); + editMenu->addAction (a); actionListBranches.append(a); actionEditSelectLast=a; - a = new QAction( tr( "Add Image" ),tr( "Add Image" )+QString("..."), 0, this, "loadImage" ); - connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) ); + a = new QAction( tr( "Add Image" )+QString("..."), this); + a->setStatusTip (tr( "Add Image" )); + connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) ); actionEditLoadImage=a; } @@ -679,147 +867,194 @@ // Format Actions void Main::setupFormatActions() { - QPopupMenu *menu = new QPopupMenu( this ); - menuBar()->insertItem( tr( "F&ormat" ), menu ); - - QToolBar *tb = new QToolBar( this ); + QMenu *formatMenu = menuBar()->addMenu (tr ("F&ormat")); + + QToolBar *tb = addToolBar( tr("Format Actions","Toolbars")); + tb->setObjectName ("formatTB"); QAction *a; QPixmap pix( 16,16); - pix.fill (black); - actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" )+QString("..."), 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(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), CTRL + Key_K, this, "pickColor" ); - connect( a, SIGNAL( activated() ), this, SLOT( formatPickColor() ) ); + pix.fill (Qt::black); + a= new QAction(pix, tr( "Set &Color" )+QString("..."), this); + a->setStatusTip ( tr( "Set Color" )); + connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectColor() ) ); + a->addTo( tb ); + formatMenu->addAction (a); + 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( triggered() ), this, SLOT( formatPickColor() ) ); a->setEnabled (false); a->addTo( tb ); - a->addTo( menu ); + formatMenu->addAction (a); actionListBranches.append(a); actionFormatPickColor=a; - a= new QAction( tr( "Color branch" ), QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" ); - connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) ); + + 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( triggered() ), this, SLOT( formatColorItem() ) ); a->setEnabled (false); a->addTo( tb ); - a->addTo( menu ); + formatMenu->addAction (a); actionListBranches.append(a); actionFormatColorBranch=a; - a= new QAction( tr( "Color Subtree" ), QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" ); - connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) ); + + 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( triggered() ), this, SLOT( formatColorBranch() ) ); a->setEnabled (false); - a->addTo( menu ); + formatMenu->addAction (a); a->addTo( tb ); actionListBranches.append(a); actionFormatColorSubtree=a; - menu->insertSeparator(); - actionGroupFormatLinkStyles=new QActionGroup ( this, "formatLinkStyles"); + formatMenu->addSeparator(); + actionGroupFormatLinkStyles=new QActionGroup ( this); 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() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleLine() ) ); + formatMenu->addAction (a); 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() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleParabel() ) ); + formatMenu->addAction (a); 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() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyLine() ) ); + formatMenu->addAction (a); 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() ) ); + a->setChecked (true); + connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyParabel() ) ); + formatMenu->addAction (a); actionFormatLinkStylePolyParabel=a; - actionGroupFormatLinkStyles->addTo (menu); - actionGroupFormatFrameTypes=new QActionGroup ( this, "formatFrameTypes"); + actionGroupFormatFrameTypes=new QActionGroup ( this); 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() ) ); + connect( a, SIGNAL( triggered() ), 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() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameRectangle() ) ); actionFormatFrameRectangle=a; - a = new QAction( tr ("Include top and bottom position of images into branch"), tr( "Include images vertically" ), 0, actionFormatIncludeImagesVer, "includeImagesVer" ); + 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() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesVer() ) ); actionFormatIncludeImagesVer=a; - a = new QAction( tr ("Include left and right position of images into branch"), tr( "Include images horizontally" ), 0, actionFormatIncludeImagesHor, "includeImagesHor" ); + 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() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesHor() ) ); actionFormatIncludeImagesHor=a; - a = new QAction( tr( "Hide link" ),tr( "Hide link if object is not selected" ), 0, actionFormatHideLinkUnselected, "hideLinkUnselected" ); + 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() ) ); + connect( a, SIGNAL( triggered() ), 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" ); + formatMenu->addSeparator(); + 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 ); + connect( a, SIGNAL( triggered() ), this, SLOT( formatToggleLinkColorHint() ) ); + formatMenu->addAction (a); actionFormatLinkColorHint=a; - pix.fill (white); - actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color"+QString("...") ), 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" )+QString("..."), 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" )); + formatMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectLinkColor() ) ); + actionFormatLinkColor=a; + + a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this ); + a->setStatusTip (tr( "Set Background Color" )); + formatMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackColor() ) ); + actionFormatBackColor=a; } // View Actions void Main::setupViewActions() { - QToolBar *tb = new QToolBar( this ); + QToolBar *tb = addToolBar( tr("View Actions","Toolbars") ); tb->setLabel( "View Actions" ); - QPopupMenu *menu = new QPopupMenu( this ); - menuBar()->insertItem( tr( "&View" ), menu ); + tb->setObjectName ("viewTB"); + QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" )); QAction *a; - a = new QAction( tr( "Zoom reset" ), QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), CTRL + Key_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(iconPath+"viewmag+.png"), tr( "Zoom in" ), CTRL + Key_Plus, this, "zoomIn" ); - connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) ); + viewMenu->addAction (a); + connect( a, SIGNAL( triggered() ), 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(iconPath+"viewmag-.png"), tr( "Zoom out" ), CTRL + Key_Minus, this, "zoomOut" ); - connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) ); + viewMenu->addAction (a); + connect( a, SIGNAL( triggered() ), 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( "Show Note Editor" ), QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ), CTRL + Key_E , this, "noteEditor" ); - connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) ); + viewMenu->addAction (a); + connect( a, SIGNAL( triggered() ), 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); else a->setOn(false); a->addTo( tb ); - a->addTo( menu ); + viewMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) ); actionViewToggleNoteEditor=a; - a = new QAction( tr( "Show history window" ), QPixmap(), tr( "Show history window" ), CTRL + Key_H , this, "historyWindow" ); - connect( a, SIGNAL( activated() ), this, SLOT(windowToggleHistory() ) ); + 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 ); + viewMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) ); actionViewToggleHistoryWindow=a; - a = new QAction( tr( "&Next Window" ), QPixmap(), tr( "Next Window" ), ALT + Key_N , this, "nextWindow" ); - connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) ); - 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 ); + a = new QAction(tr( "Next Window" ), this); + a->setStatusTip ( tr( "&Next Window" ) ); + a->setShortcut (Qt::ALT + Qt::Key_N ); + viewMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT(windowNextEditor() ) ); + + a = new QAction (tr( "Previous Window" ), this ); + a->setStatusTip (tr( "&Previous Window" )); + a->setShortcut (Qt::ALT + Qt::Key_P ); + viewMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) ); } // Mode Actions @@ -828,23 +1063,29 @@ //QPopupMenu *menu = new QPopupMenu( this ); //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu ); - QToolBar *tb = new QToolBar( this ); - tb->setLabel( tr ("Modes when using modifiers") ); + QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Toolbars") ); + tb->setObjectName ("modesTB"); QAction *a; - actionGroupModModes=new QActionGroup ( this, "formatLinkStyles"); + actionGroupModModes=new QActionGroup ( this); actionGroupModModes->setExclusive (true); - a= new QAction( tr( "Use modifier to color branches" ), QPixmap(iconPath+"modecolor.png"), 0, Key_J, actionGroupModModes, "modModeColor" ); + 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( tr( "Use modifier to copy" ), QPixmap(iconPath+"modecopy.png"), 0, Key_K, actionGroupModModes, "modModeCopy" ); + 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( tr( "Use modifier to draw xLinks" ), QPixmap(iconPath+"modelink.png"), 0, Key_L, actionGroupModModes, "modModeLink" ); + 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; @@ -890,239 +1131,379 @@ systemFlagsDefault->addFlag (fo); // Create Standard Flags + QToolBar *tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar")); + tb->setObjectName ("standardFlagTB"); + standardFlagsDefault = new FlagRowObj (); standardFlagsDefault->setVisibility (false); standardFlagsDefault->setName ("standardFlagsDef"); + standardFlagsDefault->setToolBar (tb); fo->load(QPixmap(flagsPath+"flag-exclamationmark.png")); fo->setName ("exclamationmark"); fo->setGroup("standard-mark"); - fo->setToolTip(tr("Take care!","Standardflag")); + QAction *a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Take care!","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); 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")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Really?","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-hook-green.png")); fo->setName("hook-green"); fo->setGroup("standard-hook"); - fo->setToolTip(tr("ok!","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("ok!","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); 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")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Not ok!","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-stopsign.png")); fo->setName("stopsign"); - fo->setToolTip(tr("This won't work!","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("This won't work!","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-smiley-good.png")); fo->setName("smiley-good"); fo->setGroup("standard-smiley"); - fo->setToolTip(tr("Good","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Good","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-smiley-sad.png")); fo->setName("smiley-sad"); fo->setGroup("standard-smiley"); - fo->setToolTip(tr("Bad","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Bad","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); 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")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Oh no!","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-kalarm.png")); fo->setName("clock"); - fo->setToolTip(tr("Time critical","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Time critical","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-phone.png")); fo->setName("phone"); - fo->setToolTip(tr("Call...","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Call...","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-lamp.png")); fo->setName("lamp"); - fo->setToolTip(tr("Idea!","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Idea!","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-arrow-up.png")); fo->setName("arrow-up"); fo->setGroup("standard-arrow"); - fo->setToolTip(tr("Important","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Important","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-arrow-down.png")); fo->setName("arrow-down"); fo->setGroup("standard-arrow"); - fo->setToolTip(tr("Unimportant","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Unimportant","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); 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")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Very important!","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); 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")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Very unimportant!","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); 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")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("I like this","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); 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")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("I do not like this","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-rose.png")); fo->setName("rose"); - fo->setToolTip(tr("Rose","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Rose","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-heart.png")); fo->setName("heart"); - fo->setToolTip(tr("I just love... ","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("I just love... ","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-present.png")); fo->setName("present"); - fo->setToolTip(tr("Surprise!","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Surprise!","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-flash.png")); fo->setName("flash"); - fo->setToolTip(tr("Dangerous","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Dangerous","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-info.png")); // Original: xsldbg_output.png fo->setName("info"); - fo->setToolTip(tr("Info","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("Info","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flagsPath+"flag-lifebelt.png")); // Original khelpcenter.png fo->setName("lifebelt"); - fo->setToolTip(tr("This will help","Standardflag")); + a=new QAction (fo->getPixmap(),fo->getName(),this); + tb->addAction (a); + fo->setAction (a); + a->setCheckable(true); + a->setObjectName(fo->getName()); + a->setToolTip(tr("This will help","Standardflag")); + connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) ); standardFlagsDefault->addFlag (fo); delete (fo); - - standardFlagsDefault->makeToolbar(this, "Standard Flags"); } // Settings Actions void Main::setupSettingsActions() { - QPopupMenu *menu = new QPopupMenu( this ); - menuBar()->insertItem( tr( "&Settings" ), menu ); + QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" )); QAction *a; - - a = new QAction( tr( "Set application to open pdf files"), QPixmap(), tr( "Set application to open pdf files ...") , 0, this, "setPDF" ); - connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) ); - a->addTo( menu ); - - a = new QAction( tr( "Set application to open external links"), QPixmap(), tr( "Set application to open external links..."), 0, this, "setURL" ); - 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( "Set application to open pdf files"), this); + a->setStatusTip ( tr( "Set application to open pdf files")); + connect( a, SIGNAL( triggered() ), this, SLOT( settingsPDF() ) ); + settingsMenu->addAction (a); + + a = new QAction( tr( "Set application to open external links"), this); + a->setStatusTip( tr( "Set application to open external links")); + connect( a, SIGNAL( triggered() ), this, SLOT( settingsURL() ) ); + settingsMenu->addAction (a); + + settingsMenu->addSeparator(); + 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 ); + a->setOn ( settings.value ("/mapeditor/editmode/autoEdit",true).toBool()); + settingsMenu->addAction (a); 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 ); + a->setOn ( settings.value ("/mapeditor/editmode/autoSelectHeading",false).toBool() ); + settingsMenu->addAction (a); 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 ); + a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() ); + settingsMenu->addAction (a); actionSettingsAutoselectText=a; - a= new QAction( tr( "Pasting into new branch" ), QPixmap(), tr( "pasting into new branch" ), 0, this, "pastenewheading" ); + 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/newheadingisempty",true) ); - a->addTo( menu ); - actionSettingsPasteNewHeading=a; - - a= new QAction( tr( "Delete key for deleting branches" ), QPixmap(), tr( "Delete key" ), 0, this, "delkey" ); + a->setOn ( settings.value ("/mapeditor/editmode/useDelKey",false).toBool() ); + settingsMenu->addAction (a); + connect( a, SIGNAL( triggered() ), 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/useDelKey",false) ); - a->addTo( menu ); - connect( a, SIGNAL( activated() ), this, SLOT( settingsToggleDelKey() ) ); - actionSettingsUseDelKey=a; - - a= new QAction( tr( "Use exclusive flags in flag toolbars" ), QPixmap(), tr( "Exclusive flags" ), 0, this, "flaggroups" ); - a->setToggleAction(true); - a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) ); - a->addTo( menu ); + a->setOn ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() ); + settingsMenu->addAction (a); actionSettingsUseFlagGroups=a; - a= new QAction( tr( "Use hide flag during exports " ), QPixmap(), tr( "Use hide flags" ), 0, this, "hideexport" ); + 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 ); + a->setOn ( settings.value ("/export/useHideExport",true).toBool() ); + settingsMenu->addAction (a); actionSettingsUseHideExport=a; } // Test Actions void Main::setupTestActions() { - QPopupMenu *menu = new QPopupMenu( this ); - menuBar()->insertItem( tr( "&Test" ), menu ); + QMenu *testMenu = menuBar()->addMenu( tr( "&Test" )); QAction *a; - a = new QAction( tr( "Call test function" ), QPixmap(), tr( "test flag" ), 0, this, "flag" ); - connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) ); - a->addTo( menu ); + a = new QAction( tr( "test flag" ), this); + a->setStatusTip( tr( "Call test function" )); + connect( a, SIGNAL( triggered() ), this, SLOT( testFunction() ) ); + testMenu->addAction (a); } // Help Actions void Main::setupHelpActions() { - QPopupMenu *menu = new QPopupMenu( this ); - menuBar()->insertItem( tr( "&Help" ), menu ); + QMenu *helpMenu = menuBar()->addMenu ( tr( "&Help" )); QAction *a; - a = new QAction( tr( "Open VYM Documentation (pdf)" ), QPixmap(), tr( "Open VYM Documentation (pdf) " ), 0, this, "about" ); - connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) ); - a->addTo( menu ); - - a = new QAction( tr( "About VYM")+" "__VYM, QPixmap(), tr( "About VYM" ), 0, this, "about" ); - 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" ); - connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQT() ) ); - a->addTo( menu ); + a = new QAction( tr( "Open VYM Documentation (pdf) " ), this ); + a->setStatusTip( tr( "Open VYM Documentation (pdf)" )); + connect( a, SIGNAL( triggered() ), this, SLOT( helpDoc() ) ); + helpMenu->addAction (a); + + a = new QAction( tr( "About VYM" ), this); + a->setStatusTip( tr( "About VYM")+" "__VYM); + connect( a, SIGNAL( triggered() ), this, SLOT( helpAbout() ) ); + helpMenu->addAction (a); + + a = new QAction( tr( "About QT" ), this); + a->setStatusTip( tr( "Information about QT toolkit" )); + connect( a, SIGNAL( triggered() ), this, SLOT( helpAboutQT() ) ); + helpMenu->addAction (a); } // Context Menus @@ -1131,130 +1512,87 @@ QAction*a; // Context Menu for branch or mapcenter - branchContextMenu =new QPopupMenu (this); + branchContextMenu =new QMenu (this); // Submenu "Add" - branchAddContextMenu =new QPopupMenu (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 ); + branchAddContextMenu =branchContextMenu->addMenu (tr("Add")); + branchAddContextMenu->addAction (actionEditPaste ); + branchAddContextMenu->addAction ( actionEditAddBranch ); + branchAddContextMenu->addAction ( actionEditAddBranchHere ); + branchAddContextMenu->addAction ( actionEditAddBranchAbove); + branchAddContextMenu->addAction ( actionEditAddBranchBelow ); + branchAddContextMenu->addSeparator(); + branchAddContextMenu->addAction ( actionEditLoadImage); + branchAddContextMenu->addSeparator(); + branchAddContextMenu->addAction ( actionEditImportAdd ); + branchAddContextMenu->addAction ( actionEditImportReplace ); // Submenu "Remove" - branchRemoveContextMenu =new QPopupMenu (this); - actionEditCut->addTo ( branchRemoveContextMenu ); - actionEditDelete->addTo ( branchRemoveContextMenu ); - actionEditRemoveBranchKeepChilds->addTo( branchRemoveContextMenu ); - actionEditRemoveChilds->addTo( branchRemoveContextMenu ); + branchRemoveContextMenu =branchContextMenu->addMenu (tr ("Remove")); + branchRemoveContextMenu->addAction (actionEditCut); + branchRemoveContextMenu->addAction ( actionEditDelete ); + branchRemoveContextMenu->addAction ( actionEditRemoveBranchKeepChilds ); + branchRemoveContextMenu->addAction ( actionEditRemoveChilds ); - branchContextMenu->insertItem (tr("Add"),branchAddContextMenu); - branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu); actionEditSaveBranch->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)) - { - actionEditFATE2URL->addTo( branchContextMenu ); - } - branchContextMenu->insertSeparator(); - actionEditOpenVymLink->addTo ( branchContextMenu ); - actionEditVymLink->addTo ( branchContextMenu ); - actionEditDeleteVymLink->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 + branchContextMenu->addSeparator(); + branchContextMenu->addAction ( actionFormatFrameNone ); + branchContextMenu->addAction ( actionFormatFrameRectangle); + + branchContextMenu->addSeparator(); + branchContextMenu->addAction ( actionFormatIncludeImagesVer ); + branchContextMenu->addAction ( actionFormatIncludeImagesHor ); + branchContextMenu->addAction ( actionFormatHideLinkUnselected ); + + // Submenu for Links (URLs, vymLinks) + branchLinksContextMenu =new QMenu (this); + + branchContextMenu->addSeparator(); + branchLinksContextMenu=branchContextMenu->addMenu(tr("URLs and vymLinks")); + branchLinksContextMenu->addAction ( actionEditOpenURL ); + branchLinksContextMenu->addAction ( actionEditOpenURLTab ); + branchLinksContextMenu->addAction ( actionEditOpenMultipleURLTabs ); + branchLinksContextMenu->addAction ( actionEditURL ); + branchLinksContextMenu->addAction ( actionEditHeading2URL ); + branchLinksContextMenu->addAction ( actionEditBugzilla2URL ); + if (settings.value( "/mainwindow/showTestMenu",true).toBool() ) + { + branchLinksContextMenu->addAction ( actionEditFATE2URL ); + } + branchLinksContextMenu->addSeparator(); + branchLinksContextMenu->addAction ( actionEditOpenVymLink ); + branchLinksContextMenu->addAction ( actionEditOpenMultipleVymLinks ); + branchLinksContextMenu->addAction ( actionEditVymLink ); + branchLinksContextMenu->addAction ( actionEditDeleteVymLink ); + + + // Context Menu for XLinks in a branch menu // This will be populated "on demand" in MapEditor::updateActions - branchContextMenu->insertSeparator(); - branchLinksContextMenu =new QPopupMenu (this); - branchLinksContextMenuDup =new QPopupMenu (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 ) ) ); + branchContextMenu->addSeparator(); + branchXLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink")); + branchXLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink")); + connect( branchXLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) ); + connect( branchXLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) ); + // Context menu for floatimage - floatimageContextMenu =new QPopupMenu (this); - saveImageFormatMenu=new QPopupMenu (this); - exportImageFormatMenu=new QPopupMenu (this); - - QStrList fmt = QImage::outputFormats(); - 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 ); - - floatimageContextMenu->insertSeparator(); + floatimageContextMenu =new QMenu (this); + a= new QAction (tr ("Save image"),this); + connect (a, SIGNAL (triggered()), this, SLOT (editSaveImage())); + floatimageContextMenu->addAction (a); + + floatimageContextMenu->addSeparator(); actionEditCopy->addTo( floatimageContextMenu ); actionEditCut->addTo( floatimageContextMenu ); -/* FIXME not needed any longer - 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; - */ - - floatimageContextMenu->insertSeparator(); - actionFormatHideLinkUnselected->addTo( floatimageContextMenu ); - - exportMenu->insertItem ( tr("Export as")+" Image",exportImageFormatMenu); - - a = new QAction( tr( "Export in Open Document Format used e.g. in Open Office " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) ); - a->addTo (exportMenu); - - a = new QAction( tr( "Export as")+" webpage (XHTML)" , QPixmap(), "Webpage (XHTML)...", ALT + Key_X, this, "exportXHTML" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) ); - a->addTo( exportMenu ); - - a = new QAction( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ), QPixmap(), "Text (ASCII)...", 0, this, "exportASCII" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) ); - a->addTo( exportMenu ); - - a = new QAction( tr( "Export as")+" "+tr("KDE Bookmarks" ), QPixmap(), tr("KDE Bookmarks"), 0, this, "importKDEBookmarks" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExportKDEBookmarks() ) ); - a->addTo (exportMenu); - - a = new QAction( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ), QPixmap(), "Taskjuggler...", 0, this, "exportTJ" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) ); - a->addTo( exportMenu ); - - a = new QAction( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) ); - a->addTo( exportMenu ); - - a = new QAction( tr( "Export as")+" XML" , QPixmap(), "XML...", 0, this, "exportXML" ); - connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) ); - a->addTo( exportMenu ); + floatimageContextMenu->addSeparator(); + floatimageContextMenu->addAction ( actionFormatHideLinkUnselected ); + // Context menu for canvas - canvasContextMenu =new QPopupMenu (this); + canvasContextMenu =new QMenu (this); actionEditMapInfo->addTo( canvasContextMenu ); canvasContextMenu->insertSeparator(); actionGroupFormatLinkStyles->addTo( canvasContextMenu ); @@ -1266,15 +1604,15 @@ // Menu for last opened files // Read settings initially QString s; - int j=settings.readNumEntry( "/vym/lastMaps/number",0); + int j=settings.readNumEntry( "/lastMaps/number",0); for (int i=1;i<=j;i++) { - s=settings.readEntry(QString("/vym/lastMaps/map-%1").arg(i),""); + s=settings.value(QString("/lastMaps/map-%1").arg(i),"").toString(); if (!s.isEmpty() && j<=maxLastMaps) lastMaps.append(s); } setupLastMapsMenu(); - connect( lastMapsMenu, SIGNAL( activated(int) ), this, SLOT( fileLoadLast(int ) ) ); + connect( fileLastMapsMenu, SIGNAL( triggered(QAction *) ), this, SLOT( fileLoadLast(QAction*) ) ); } void Main::setupLastMapsMenu() @@ -1300,10 +1638,9 @@ while ((int)(lastMaps.count()) > maxLastMaps) lastMaps.pop_back(); // build Menu from lastMaps string list - lastMapsMenu->clear(); + fileLastMapsMenu->clear(); for (it = lastMaps.begin(); it != lastMaps.end(); ++it ) - lastMapsMenu->insertItem (*it ); - + fileLastMapsMenu->addAction (*it ); } void Main::hideEvent (QHideEvent * ) @@ -1347,8 +1684,8 @@ QString Main::browseDirectory (const QString &caption) { - QFileDialog fd(this,caption); - fd.setMode (QFileDialog::DirectoryOnly); + Q3FileDialog fd(this,caption); + fd.setMode (Q3FileDialog::DirectoryOnly); fd.setCaption(__VYM " - "+caption); fd.show(); @@ -1370,7 +1707,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); @@ -1397,12 +1734,12 @@ 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:"); + // For the very first map we do not have flagrows yet... + medit->select("mc:"); } ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode) @@ -1435,7 +1772,7 @@ 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() ) @@ -1465,7 +1802,7 @@ // create a new mapeditor in a new tab if ( lmode==NewMap && (!me || !me->isDefault() ) ) { - me = new MapEditor (tabWidget,true); + me= new MapEditor ( NULL,true); tabWidget->addTab (me,fn); tabIndex=tabWidget->indexOf (me); tabWidget->setCurrentPage (tabIndex); @@ -1480,7 +1817,7 @@ 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")); @@ -1603,10 +1940,9 @@ void Main::fileLoad(const LoadMode &lmode) { - QFileDialog *fd=new QFileDialog( this); - if (!lastFileDir.isEmpty()) - fd->setDir (lastFileDir); - fd->setMode (QFileDialog::ExistingFiles); + Q3FileDialog *fd=new Q3FileDialog( this); + fd->setDir (lastFileDir); + fd->setMode (Q3FileDialog::ExistingFiles); fd->addFilter ("XML (*.xml)"); fd->addFilter ("VYM map (*.vym *.vyp)"); switch (lmode) @@ -1644,9 +1980,9 @@ fileLoad (NewMap); } -void Main::fileLoadLast(int i) +void Main::fileLoadLast(QAction *a) { - fileLoad(*lastMaps.at(lastMapsMenu->indexOf (i) ),NewMap); + fileLoad(lastMaps.at(fileLastMapsMenu->actions().indexOf(a)) ,NewMap); } void Main::fileSave(const SaveMode &savemode) @@ -1770,9 +2106,9 @@ 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 @@ -1783,7 +2119,7 @@ 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() ) @@ -1842,9 +2178,9 @@ void Main::fileImportFirefoxBookmarks() { - QFileDialog *fd=new QFileDialog( this); + Q3FileDialog *fd=new Q3FileDialog( this); fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox"); - fd->setMode (QFileDialog::ExistingFiles); + fd->setMode (Q3FileDialog::ExistingFiles); fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)"); fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks")); fd->show(); @@ -1871,10 +2207,9 @@ { ImportMM im; - QFileDialog *fd=new QFileDialog( this); - if (!lastFileDir.isEmpty()) - fd->setDir (lastFileDir); - fd->setMode (QFileDialog::ExistingFiles); + Q3FileDialog *fd=new Q3FileDialog( this); + fd->setDir (lastFileDir); + fd->setMode (Q3FileDialog::ExistingFiles); fd->addFilter ("Mind Manager (*.mmap)"); fd->setCaption(tr("Import")+" "+"Mind Manager"); fd->show(); @@ -1949,18 +2284,23 @@ } } -void Main::fileExportImage(int item) +void Main::fileExportImage() { MapEditor *me=currentMapEditor(); if (me) { - QString fn = QFileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)", - this ); - if ( !fn.isEmpty() ) - me->exportImage(fn,item); - else - statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime ); - + QStringList fl; + QFileDialog *fd=new QFileDialog (this); + fd->setCaption (tr("Export map as image")); + fd->setFileMode(QFileDialog::AnyFile); + fd->setFilters (imageIO.getFilters() ); + fd->setDirectory (lastImageDir); + if (fd->exec()) + { + fl=fd->selectedFiles(); + qWarning ("Selected "+fl.first()+" filter: "+fd->selectedFilter()); + me->exportImage (fl.first(), imageIO.getType (fd->selectedFilter() ) ); + } } } @@ -2032,13 +2372,13 @@ void Main::fileExportOOPresentation() { ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office"); - // FIXME add extra info in dialog + // TODO add preview 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->setDir (QDir().current()); if (fd->foundConfig()) { fd->show(); @@ -2046,6 +2386,9 @@ if ( fd->exec() == QDialog::Accepted ) { QString fn=fd->selectedFile(); + if (!fn.contains (".odp")) + fn +=".odp"; + //lastImageDir=fn.left(fn.findRev ("/")); if (currentMapEditor()) currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig()); @@ -2053,8 +2396,8 @@ } else { QMessageBox::warning(0, - tr("Warning"), - tr("Couldn't find configuration for export to Open Office\n")); + tr("Warning"), + tr("Couldn't find configuration for export to Open Office\n")); } } @@ -2121,13 +2464,8 @@ QMessageBox::Cancel | QMessageBox::Escape ); mb.setButtonText( QMessageBox::Yes, tr("Save map") ); mb.setButtonText( QMessageBox::No, tr("Discard changes") ); + mb.setModal (true); 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: @@ -2180,13 +2518,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(); } @@ -2209,20 +2540,86 @@ currentMapEditor()->findReset(); } +void Main::openTabs(QStringList urls) +{ + if (!urls.isEmpty()) + { + bool success=true; + QStringList args; + QString browser=settings.value("/mainwindow/readerURL" ).toString(); + QProcess *p; + if (!procBrowser || procBrowser->state()!=QProcess::Running) + { + QString u=urls.takeFirst(); + procBrowser = new QProcess( this ); + args<start(browser,args); + if ( !procBrowser->waitForStarted()) + { + // try to set path to browser + QMessageBox::warning(0, + tr("Warning"), + tr("Couldn't find a viewer to open %1.\n").arg(u)+ + tr("Please use Settings->")+tr("Set application to open an URL")); + return; + } + sleep (3); + } + if (browser.contains("konqueror")) + { + for (int i=0; ipid())<< + "konqueror-mainwindow#1"<< + "newTab" << + urls.at(i); + p->start ("dcop",args); + if ( !p->waitForStarted() ) success=false; + } + if (!success) + 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") ) + { + for (int i=0; istart (browser,args); + if ( !p->waitForStarted() ) success=false; + } + if (!success) + QMessageBox::warning(0, + tr("Warning"), + tr("Couldn't start %1 to open a new tab").arg(browser)); + return; + } + QMessageBox::warning(0, + tr("Warning"), + tr("Sorry, currently only Konqueror and Mozilla support tabbed browsing.")); + } +} + void Main::editOpenURL() { // Open new browser if (currentMapEditor()) { QString url=currentMapEditor()->getURL(); + QStringList args; if (url=="") return; - QString browser=settings.readEntry("/vym/mainwindow/readerURL" ); + QString browser=settings.value("/mainwindow/readerURL" ).toString(); procBrowser = new QProcess( this ); - - procBrowser->addArgument( browser); - procBrowser->addArgument( url); - - if ( !procBrowser->start() ) + args<start(browser,args); + if ( !procBrowser->waitForStarted()) { // try to set path to browser QMessageBox::warning(0, @@ -2237,45 +2634,21 @@ { 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 - QProcess *p=new QProcess (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 - QProcess *p=new QProcess (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(); + QStringList urls; + urls.append(currentMapEditor()->getURL()); + openTabs (urls); } } +void Main::editOpenMultipleURLTabs() +{ + if (currentMapEditor()) + { + QStringList urls; + urls=currentMapEditor()->getURLs(); + openTabs (urls); + } +} + void Main::editURL() { @@ -2301,13 +2674,66 @@ currentMapEditor()->editFATE2URL(); } -void Main::editOpenVymLink() +void Main::editHeading() { - // Get current path to map - QString currentVymLink; - if (currentMapEditor()) + if (lineedit->isVisible()) { - currentVymLink=currentMapEditor()->getVymLink(); + if (currentMapEditor()) + { + MapEditor *me=currentMapEditor(); + QString oldSel=me->getSelectString(); + if (me->select (editSel)) + me->setHeading(lineedit->text()); + me->select (oldSel); + } + lineedit->releaseKeyboard(); + lineedit->hide(); + setFocus(); + } else + { + if (currentMapEditor()) + { + bool ok; + QPoint p; + QString s=currentMapEditor()->getHeading(ok,p); + + if (ok) + { +#if defined(Q_OS_MACX) + p = currentMapEditor()->mapToGlobal( currentMapEditor()->worldMatrix().map( p)); + QDialog *d =new QDialog(NULL); + QLineEdit *le=new QLineEdit (d); + d->setWindowFlags (Qt::FramelessWindowHint); + d->setGeometry(p.x(),p.y(),200,25); + le->resize (d->size()); + le->setText (s); + le->selectAll(); + connect (le, SIGNAL (returnPressed()), d, SLOT (accept())); + d->activateWindow(); + d->exec(); + currentMapEditor()->setHeading (le->text()); +#else + p = currentMapEditor()->mapTo(this, currentMapEditor()->worldMatrix().map( p)); + lineedit->setGeometry(p.x(),p.y(),200,25); + lineedit->setText(s); + lineedit->setCursorPosition(1); + lineedit->selectAll(); + lineedit->show(); + lineedit->grabKeyboard(); + lineedit->setFocus(); + + editSel=currentMapEditor()->getSelectString(); +#endif + + } + } + } +} + +void Main::openVymLinks(const QStringList &vl) +{ + for (int j=0; jcount() -1;i++) { me=(MapEditor*)tabWidget->page(i); - if (currentVymLink==me->getFilePath() ) + if (vl.at(j)==me->getFilePath() ) { index=i; break; @@ -2324,12 +2750,12 @@ if (index<0) // Load map { - if (!QFile(currentVymLink).exists() ) + if (!QFile(vl.at(j)).exists() ) QMessageBox::critical( 0, tr( "Critical Error" ), - tr("Couldn't open map %1").arg(currentVymLink)); + tr("Couldn't open map %1").arg(vl.at(j))); else { - fileLoad (currentVymLink, NewMap); + fileLoad (vl.at(j), NewMap); tabWidget->setCurrentPage (tabWidget->count()-1); } } else @@ -2338,6 +2764,26 @@ } } +void Main::editOpenVymLink() +{ + if (currentMapEditor()) + { + QStringList vl; + vl.append(currentMapEditor()->getVymLink()); + openVymLinks (vl); + } +} + +void Main::editOpenMultipleVymLinks() +{ + QString currentVymLink; + if (currentMapEditor()) + { + QStringList vl=currentMapEditor()->getVymLinks(); + openVymLinks (vl); + } +} + void Main::editVymLink() { if (currentMapEditor()) @@ -2390,15 +2836,10 @@ } } -void Main::editHeading() -{ - if (currentMapEditor()) - currentMapEditor()->editHeading(); -} - void Main::editNewBranch() { - if (currentMapEditor()) + + if (!lineedit->isVisible() && currentMapEditor()) currentMapEditor()->addNewBranch(0); } @@ -2495,22 +2936,23 @@ currentMapEditor()->loadFloatImage(); } -void Main::editSaveImage(int item) +void Main::editSaveImage() { if (currentMapEditor()) - currentMapEditor()->saveFloatImage(item); + currentMapEditor()->saveFloatImage(); } -void Main::editFollowXLink(int item) +void Main::editFollowXLink(QAction *a) +{ + + if (currentMapEditor()) + currentMapEditor()->followXLink(branchXLinksContextMenuFollow->actions().indexOf(a)); +} + +void Main::editEditXLink(QAction *a) { if (currentMapEditor()) - currentMapEditor()->followXLink(branchLinksContextMenu->indexOf(item)); -} - -void Main::editEditXLink(int item) -{ - if (currentMapEditor()) - currentMapEditor()->editXLink(branchLinksContextMenuDup->indexOf(item)); + currentMapEditor()->editXLink(branchXLinksContextMenuEdit->actions().indexOf(a)); } void Main::formatSelectColor() @@ -2624,7 +3066,7 @@ { if (currentMapEditor()) { - QWMatrix m; + QMatrix m; m.reset(); currentMapEditor()->setWorldMatrix( m ); currentMapEditor()->setViewCenter(); @@ -2636,7 +3078,7 @@ { if (currentMapEditor()) { - QWMatrix m = currentMapEditor()->worldMatrix(); + QMatrix m = currentMapEditor()->worldMatrix(); m.scale( 1.25, 1.25 ); currentMapEditor()->setWorldMatrix( m ); currentMapEditor()->setViewCenter(); @@ -2648,7 +3090,7 @@ { if (currentMapEditor()) { - QWMatrix m = currentMapEditor()->worldMatrix(); + QMatrix m = currentMapEditor()->worldMatrix(); m.scale( 0.8, 0.8 ); currentMapEditor()->setWorldMatrix( m ); currentMapEditor()->setViewCenter(); @@ -2670,9 +3112,9 @@ bool ok; QString text = QInputDialog::getText( "VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal, - settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this ); + settings.value("/mainwindow/readerPDF").toString(), &ok, this ); if (ok) - settings.writeEntry ("/vym/mainwindow/readerPDF",text); + settings.setValue ("/mainwindow/readerPDF",text); return ok; } @@ -2683,10 +3125,10 @@ bool ok; QString text = QInputDialog::getText( "VYM", tr("Set application to open an URL")+":", QLineEdit::Normal, - settings.readEntry("/vym/mainwindow/readerURL") + settings.value("/mainwindow/readerURL").toString() , &ok, this ); if (ok) - settings.writeEntry ("/vym/mainwindow/readerURL",text); + settings.setValue ("/mainwindow/readerURL",text); return ok; } @@ -2694,7 +3136,7 @@ { if (actionSettingsUseDelKey->isOn()) { - actionEditDelete->setAccel (QKeySequence (Key_Delete)); + actionEditDelete->setAccel (QKeySequence (Qt::Key_Delete)); } else { actionEditDelete->setAccel (QKeySequence ("")); @@ -2793,7 +3235,7 @@ Process *pdfProc = new Process(); pdfProc->clearArguments(); - pdfProc->addArgument( settings.readEntry("/vym/mainwindow/readerPDF")); + pdfProc->addArgument( settings.value("/mainwindow/readerPDF").toString()); pdfProc->addArgument( docpath); if ( !pdfProc->start() )