diff -r 3674e9236634 -r 728f51b71e71 mainwindow.cpp --- a/mainwindow.cpp Tue Jan 03 09:44:41 2006 +0000 +++ b/mainwindow.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -12,13 +12,14 @@ #include #include #include -#include // for random seed +//#include // for random seed #include #include #include +#include "file.h" #include "misc.h" #include "version.h" #include "aboutdialog.h" @@ -104,6 +105,7 @@ extern QAction* actionEditURL; extern QAction* actionEditHeading2URL; extern QAction* actionEditBugzilla2URL; +extern QAction* actionEditFATE2URL; extern QAction *actionEditOpenVymLink; extern QAction *actionEditVymLink; extern QAction *actionEditDeleteVymLink; @@ -131,6 +133,8 @@ extern QAction* actionFormatLinkColorHint; extern QAction* actionFormatBackColor; extern QAction* actionFormatLinkColor; +extern QAction *actionFormatIncludeImagesVer; +extern QAction *actionFormatIncludeImagesHor; extern QActionGroup* actionGroupModModes; extern QAction* actionModModeColor; @@ -519,6 +523,11 @@ 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() ) ); + a->setEnabled (false); + actionListBranches.append(a); + actionEditFATE2URL=a; a = new QAction( tr( "Jump to another vym map, if needed load it first" ), QPixmap(flag_vymlink_xpm), tr( "Jump to map" ), 0, this, "jumpMap" ); connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) ); @@ -572,6 +581,7 @@ a->setEnabled (false); actionListBranches.append(a); #if defined (Q_OS_MACX) + // In OSX show different shortcut in menues, the keys work independtly always actionEditAddBranch=alt; #else actionEditAddBranch=a; @@ -583,6 +593,9 @@ 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() ) ); + actionListBranches.append(a); // Add branch above a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" ); @@ -590,6 +603,9 @@ 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() ) ); + actionListBranches.append(a); // Add branch below a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" ); @@ -597,6 +613,9 @@ 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() ) ); + actionListBranches.append(a); // Import at selection (adding to selection) a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" ); @@ -729,6 +748,16 @@ connect( a, SIGNAL( activated() ), 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->setToggleAction(true); + connect( a, SIGNAL( activated() ), 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->setToggleAction(true); + connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesHor() ) ); + actionFormatIncludeImagesHor=a; + a = new QAction( tr( "Hide link" ),tr( "Hide link if object is not selected" ), 0, actionFormatHideLinkUnselected, "hideLinkUnselected" ); a->setToggleAction(true); connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) ); @@ -1012,7 +1041,7 @@ menuBar()->insertItem( tr( "&Test" ), menu ); QAction *a; - a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" ); + a = new QAction( tr( "Call test function" ), QPixmap(), tr( "test flag" ), 0, this, "flag" ); connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) ); a->addTo( menu ); } @@ -1075,8 +1104,10 @@ actionEditURL->addTo ( branchContextMenu ); actionEditHeading2URL->addTo ( branchContextMenu ); if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) + { actionEditBugzilla2URL->addTo( branchContextMenu ); - + actionEditFATE2URL->addTo( branchContextMenu ); + } branchContextMenu->insertSeparator(); actionEditOpenVymLink->addTo ( branchContextMenu ); actionEditVymLink->addTo ( branchContextMenu ); @@ -1086,6 +1117,8 @@ actionGroupFormatFrameTypes->addTo( branchContextMenu ); branchContextMenu->insertSeparator(); + actionFormatIncludeImagesVer->addTo( branchContextMenu ); + actionFormatIncludeImagesHor->addTo( branchContextMenu ); actionFormatHideLinkUnselected->addTo( branchContextMenu ); // Context Menu for links in a branch menu @@ -1522,7 +1555,7 @@ me->setFilePath (fn_org); // Delete tmpDir - system ( "rm -rf "+tmpMapDir); + removeDir (QDir(tmpMapDir)); // Check for errors if (err==success) @@ -1662,42 +1695,7 @@ me->save (savemode); me->setFilePath (safeFilePath); - // zip the temporary directory - Process *zipProc=new Process (); - zipProc->clearArguments(); - zipProc->setWorkingDirectory (QDir(tmpMapDir)); - zipProc->addArgument ("zip"); - zipProc->addArgument ("-r"); - zipProc->addArgument (fn); - zipProc->addArgument ("."); - - if (!zipProc->start() ) - { - // zip could not be started - QMessageBox::critical( 0, tr( "Critical Save Error" ), - tr("Couldn't start zip to compress data.")); - err=aborted; - } else - { - // zip could be started - zipProc->waitFinished(); - if (!zipProc->normalExit() ) - { - QMessageBox::critical( 0, tr( "Critical Save Error" ), - tr("zip didn't exit normally")+ - "\n" + zipProc->getErrout()); - err=aborted; - } else - { - if (zipProc->exitStatus()>0) - { - QMessageBox::critical( 0, tr( "Critical Save Error" ), - QString("zip exit code: %1").arg(zipProc->exitStatus() )+ - "\n" + zipProc->getErrout() ); - err=aborted; - } - } - } // zip could be started + zipDir (tmpMapDir,fn); } // save zipped else { @@ -1720,7 +1718,7 @@ if (me->saveZipped()) { // Delete tmpDir - system ( "rm -rf "+ tmpMapDir ); + removeDir (QDir(tmpMapDir)); } if (err==success) @@ -2085,6 +2083,12 @@ currentMapEditor()->editBugzilla2URL(); } +void Main::editFATE2URL() +{ + if (currentMapEditor()) + currentMapEditor()->editFATE2URL(); +} + void Main::editOpenVymLink() { // Get current path to map @@ -2386,6 +2390,18 @@ currentMapEditor()->setFrame(Rectangle); } +void Main::formatIncludeImagesVer() +{ + if (currentMapEditor()) + currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn()); +} + +void Main::formatIncludeImagesHor() +{ + if (currentMapEditor()) + currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn()); +} + void Main::formatHideLinkUnselected() { if (currentMapEditor()) @@ -2533,11 +2549,16 @@ docpath="doc/tex/vym.pdf"; if (!QFile (docpath).exists() ) { - QMessageBox::critical(0, - tr("Critcal error"), - tr("Couldn't find the documentation\n" - "vym.pdf in various places.")); - return; + // Try yet another one for Knoppix + docpath="/usr/share/doc/packages/vym/vym.pdf"; + if (!QFile (docpath).exists() ) + { + QMessageBox::critical(0, + tr("Critcal error"), + tr("Couldn't find the documentation\n" + "vym.pdf in various places.")); + return; + } } } }