mainwindow.cpp
branchqt4-port
changeset 2 608f976aa7bb
parent 0 7a96bd401351
child 3 6a0342b3c519
     1.1 --- a/mainwindow.cpp	Sun Jan 30 12:58:47 2005 +0000
     1.2 +++ b/mainwindow.cpp	Tue Jun 06 14:58:11 2006 +0000
     1.3 @@ -7,61 +7,58 @@
     1.4  #include <qpainter.h>
     1.5  #include <qprinter.h>
     1.6  #include <qfile.h>
     1.7 -#include <qfiledialog.h>
     1.8 +#include <q3filedialog.h>
     1.9  #include <qcolor.h>
    1.10  #include <qcolordialog.h>
    1.11  #include <qbitmap.h>
    1.12  #include <qinputdialog.h>
    1.13 +//Added by qt3to4:
    1.14 +#include <Q3StrList>
    1.15 +#include <QPixmap>
    1.16 +#include <QCloseEvent>
    1.17 +#include <QShowEvent>
    1.18 +#include <QHideEvent>
    1.19 +#include <Q3PopupMenu>
    1.20 +#include <Q3ActionGroup>
    1.21 +#include <Q3PtrList>
    1.22 +//#include <qdatetime.h>			// for random seed
    1.23  
    1.24  
    1.25  #include <iostream>
    1.26 -#include <stdlib.h>
    1.27 +#include <cstdlib>
    1.28  #include <typeinfo>
    1.29  
    1.30 -#include "version.h"
    1.31 -
    1.32 -#include "icons/filenew.xpm"
    1.33 -#include "icons/fileopen.xpm"
    1.34 -#include "icons/filesave.xpm"
    1.35 -#include "icons/fileprint.xpm"
    1.36 -#include "icons/editundo.xpm"
    1.37 -//#include "icons/editredo.xpm"	// TODO
    1.38 -#include "icons/editcopy.xpm"
    1.39 -#include "icons/editcut.xpm"
    1.40 -#include "icons/editpaste.xpm"
    1.41 -#include "icons/editmoveup.xpm"
    1.42 -#include "icons/editmovedown.xpm"
    1.43 -#include "icons/formatcoloritem.xpm"
    1.44 -#include "icons/formatcolorbranch.xpm"
    1.45 -#include "icons/formatcolorpicker.xpm"
    1.46 -#include "icons/viewzoomreset.xpm"
    1.47 -#include "icons/viewzoomin.xpm"
    1.48 -#include "icons/viewzoomout.xpm"
    1.49 -#include "icons/vym-48x48.xpm"
    1.50 -#include "icons/flag-note.xpm"
    1.51 -#include "icons/flag-url.xpm"
    1.52 -#include "icons/flag-vymlink.xpm"	
    1.53 -#include "icons/flag-scrolled-right.xpm"
    1.54 -
    1.55 +#include "aboutdialog.h"
    1.56 +#include "exportoofiledialog.h"
    1.57 +#include "exports.h"
    1.58 +#include "exportxhtmldialog.h"
    1.59 +#include "file.h"
    1.60  #include "flagrowobj.h"
    1.61 -#include "texteditor.h"
    1.62 +#include "imports.h"
    1.63  #include "mapeditor.h"
    1.64 -#include "exporthtmldialog.h"
    1.65 -#include "exportxhtmldialog.h"
    1.66 -#include "showtextdialog.h"
    1.67 +#include "misc.h"
    1.68 +#include "options.h"
    1.69  #include "process.h"
    1.70  #include "settings.h"
    1.71 -#include "options.h"
    1.72 +#include "showtextdialog.h"
    1.73 +#include "texteditor.h"
    1.74 +#include "version.h"
    1.75  
    1.76  extern TextEditor *textEditor;
    1.77  extern Main *mainWindow;
    1.78 +extern QString tmpVymDir;
    1.79 +extern QString clipboardDir;
    1.80 +extern bool clipboardEmpty;
    1.81  extern int statusbarTime;
    1.82 -extern MapEditor *clipboardME;
    1.83  extern FlagRowObj* standardFlagsDefault;
    1.84 +extern FlagRowObj* systemFlagsDefault;
    1.85 +
    1.86 +extern Q3PtrList <QAction> actionListBranches;
    1.87  
    1.88  extern QAction* actionFileSave;
    1.89  extern QAction* actionFilePrint;
    1.90  extern QAction* actionEditUndo;
    1.91 +extern QAction* actionEditRedo;
    1.92  extern QAction *actionEditCopy;
    1.93  extern QAction *actionEditCut;
    1.94  extern QAction *actionEditPaste;
    1.95 @@ -69,25 +66,30 @@
    1.96  extern QAction *actionEditMoveDown;
    1.97  extern QAction *actionEditToggleScroll;
    1.98  extern QAction* actionEditOpenURL;
    1.99 +extern QAction* actionEditOpenURLTab;
   1.100  extern QAction* actionEditURL;
   1.101  extern QAction* actionEditHeading2URL;
   1.102  extern QAction* actionEditBugzilla2URL;
   1.103 +extern QAction* actionEditFATE2URL;
   1.104  extern QAction *actionEditOpenVymLink;
   1.105  extern QAction *actionEditVymLink;
   1.106  extern QAction *actionEditDeleteVymLink;
   1.107 +extern QAction *actionEditToggleHideExport;
   1.108  extern QAction *actionEditMapInfo;
   1.109  extern QAction *actionEditHeading;
   1.110  extern QAction *actionEditDelete;
   1.111  extern QAction *actionEditAddBranch;
   1.112 +extern QAction *actionEditAddBranchHere;
   1.113  extern QAction *actionEditAddBranchAbove;
   1.114  extern QAction *actionEditAddBranchBelow;
   1.115 +extern QAction *actionEditRemoveBranchKeepChilds;
   1.116 +extern QAction *actionEditRemoveChilds;
   1.117  extern QAction *actionEditImportAdd;
   1.118  extern QAction *actionEditImportReplace;
   1.119  extern QAction *actionEditSaveBranch;
   1.120  extern QAction *actionEditSelectFirst;
   1.121  extern QAction *actionEditSelectLast;
   1.122  extern QAction *actionEditLoadImage;
   1.123 -extern QAction *actionEditToggleFloatExport;
   1.124  
   1.125  extern QAction* actionFormatColor;
   1.126  extern QAction* actionFormatPickColor;
   1.127 @@ -96,18 +98,27 @@
   1.128  extern QAction* actionFormatLinkColorHint;
   1.129  extern QAction* actionFormatBackColor;
   1.130  extern QAction* actionFormatLinkColor;
   1.131 +extern QAction *actionFormatIncludeImagesVer;
   1.132 +extern QAction *actionFormatIncludeImagesHor;
   1.133  
   1.134 -extern QActionGroup *actionGroupFormatFrameTypes;
   1.135 +extern Q3ActionGroup* actionGroupModModes;
   1.136 +extern QAction* actionModModeColor;
   1.137 +extern QAction* actionModModeLink;
   1.138 +extern QAction* actionModModeCopy;
   1.139 +
   1.140 +extern Q3ActionGroup *actionGroupFormatFrameTypes;
   1.141  extern QAction *actionFormatFrameNone;
   1.142  extern QAction *actionFormatFrameRectangle;
   1.143  
   1.144 -extern QActionGroup *actionGroupFormatLinkStyles;
   1.145 +extern Q3ActionGroup *actionGroupFormatLinkStyles;
   1.146  extern QAction *actionFormatLinkStyleLine;
   1.147  extern QAction *actionFormatLinkStyleParabel;
   1.148  extern QAction *actionFormatLinkStylePolyLine;
   1.149  extern QAction *actionFormatLinkStylePolyParabel;
   1.150 +extern QAction *actionFormatHideLinkUnselected;
   1.151  
   1.152  extern QAction *actionViewToggleNoteEditor;
   1.153 +extern QAction *actionViewToggleHistoryWindow;
   1.154  
   1.155  extern QAction* actionSettingsAutoedit;
   1.156  extern QAction* actionSettingsAutoselectHeading;
   1.157 @@ -115,25 +126,31 @@
   1.158  extern QAction* actionSettingsAutoselectText;
   1.159  extern QAction* actionSettingsPasteNewHeading;
   1.160  extern QAction* actionSettingsUseDelKey;
   1.161 +extern QAction* actionSettingsUseFlagGroups;
   1.162 +extern QAction* actionSettingsUseHideExport;
   1.163  
   1.164 -extern QPopupMenu* branchContextMenu;
   1.165 -extern QPopupMenu* floatimageContextMenu;
   1.166 -extern QPopupMenu* saveImageFormatMenu;
   1.167 -extern QPopupMenu* canvasContextMenu;
   1.168 -extern QPopupMenu* lastMapsMenu;
   1.169 -extern QPopupMenu* exportMenu;
   1.170 -extern QPopupMenu* exportImageFormatMenu;
   1.171 +extern Q3PopupMenu* branchContextMenu;
   1.172 +extern Q3PopupMenu* branchAddContextMenu;
   1.173 +extern Q3PopupMenu* branchRemoveContextMenu;
   1.174 +extern Q3PopupMenu* branchLinksContextMenu;
   1.175 +extern Q3PopupMenu* branchLinksContextMenuDup;
   1.176 +extern Q3PopupMenu* floatimageContextMenu;
   1.177 +extern Q3PopupMenu* saveImageFormatMenu;
   1.178 +extern Q3PopupMenu* canvasContextMenu;
   1.179 +extern Q3PopupMenu* lastMapsMenu;
   1.180 +extern Q3PopupMenu* importMenu;
   1.181 +extern Q3PopupMenu* exportMenu;
   1.182 +extern Q3PopupMenu* exportImageFormatMenu;
   1.183  
   1.184  
   1.185  extern Settings settings;
   1.186  extern Options options;
   1.187 +extern QDir vymBaseDir;
   1.188 +extern QString iconPath;
   1.189 +extern QString flagsPath;
   1.190  
   1.191 -#if defined(Q_OS_LINUX)
   1.192 -extern void qt_wait_for_window_manager( QWidget* w );
   1.193 -#endif
   1.194 -
   1.195 -Main::Main(QWidget* parent, const char* name, WFlags f) :
   1.196 -    QMainWindow(parent,name,f)
   1.197 +Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
   1.198 +    Q3MainWindow(parent,name,f)
   1.199  {
   1.200  	mainWindow=this;
   1.201  
   1.202 @@ -146,6 +163,24 @@
   1.203  	        settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100));
   1.204  
   1.205  
   1.206 +	// Create unique temporary directory
   1.207 +	tmpVymDir=makeUniqueDir ("/tmp/vym-XXXXXX");
   1.208 +
   1.209 +	// Create direcctory for clipboard
   1.210 +	clipboardDir=tmpVymDir+"/clipboard";
   1.211 +	QDir d(clipboardDir);
   1.212 +	d.mkdir (clipboardDir,true);
   1.213 +	makeSubDirs (clipboardDir);
   1.214 +	clipboardEmpty=true;
   1.215 +
   1.216 +	procBrowser=NULL;
   1.217 +
   1.218 +	// FIXME not used currently
   1.219 +	// Set random seed (random used for object IDs)
   1.220 +    // QTime t = QTime::currentTime();		// set random seed
   1.221 +    // srand( t.hour()*12+t.minute()*60+t.second()*60 );
   1.222 +
   1.223 +
   1.224  	// Initialize some settings, which are platform dependant
   1.225  	QString p,s;
   1.226  
   1.227 @@ -155,7 +190,7 @@
   1.228  			s=settings.readEntry (p,"konqueror");
   1.229  		#else
   1.230  			#if defined(Q_OS_MACX)
   1.231 -				s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari");
   1.232 +				s=settings.readEntry (p,"/usr/bin/open");
   1.233  			#else
   1.234  				s=settings.readEntry (p,"mozilla");
   1.235  			#endif
   1.236 @@ -168,7 +203,7 @@
   1.237  			s=settings.readEntry (p,"acroread");
   1.238  		#else
   1.239  			#if defined(Q_OS_MACX)
   1.240 -				s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari");
   1.241 +				s=settings.readEntry (p,"/usr/bin/open");
   1.242  			#else
   1.243  				s=settings.readEntry (p,"acroread");
   1.244  			#endif
   1.245 @@ -189,6 +224,7 @@
   1.246      setupEditActions();
   1.247      setupFormatActions();
   1.248      setupViewActions();
   1.249 +    setupModeActions();
   1.250  	setupFlagActions();
   1.251      setupSettingsActions();
   1.252  	setupContextMenus();
   1.253 @@ -200,10 +236,6 @@
   1.254  
   1.255      statusBar();
   1.256  
   1.257 -	// Create the default map into first tab
   1.258 -//	fileNew();
   1.259 -//	tabWidget->addTab (new MapEditor(tabWidget,true), "unnamed");
   1.260 -//	currentMapEditor()->show();
   1.261  
   1.262  	// Initialize Find window
   1.263  	findWindow=new FindWindow(NULL,"findwindow");
   1.264 @@ -212,6 +244,9 @@
   1.265  	connect (findWindow, SIGNAL( somethingChanged() ), 
   1.266  		this, SLOT(editFindChanged() ) );	
   1.267  
   1.268 +	// Connect TextEditor, so that we can update flags if text changes
   1.269 +	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
   1.270 +
   1.271  	updateGeometry();
   1.272  }
   1.273  
   1.274 @@ -223,29 +258,33 @@
   1.275  	settings.writeEntry( "/vym/mainwindow/geometry/posX", pos().x() );
   1.276  	settings.writeEntry( "/vym/mainwindow/geometry/posY", pos().y() );
   1.277  
   1.278 -	settings.writeEntry( "/vym/version/version", __VYM_VERSION__ );
   1.279 -	settings.writeEntry( "/vym/version/builddate", __BUILD_DATE__ );
   1.280 +	settings.writeEntry( "/vym/version/version", __VYM_VERSION );
   1.281 +	settings.writeEntry( "/vym/version/builddate", __BUILD_DATE );
   1.282  
   1.283  	settings.writeEntry( "/vym/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
   1.284  	settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
   1.285  	settings.writeEntry( "/vym/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() );
   1.286  	settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
   1.287  	settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
   1.288 +	settings.writeEntry( "/vym/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
   1.289 +	settings.writeEntry( "/vym/export/useHideExport",actionSettingsUseHideExport->isOn() );
   1.290  
   1.291  	QString s;
   1.292  	int maps=lastMaps.count();
   1.293  	settings.writeEntry( "/vym/lastMaps/number",maps );
   1.294  	for (int i=1;i<=maps;i++)
   1.295  	{
   1.296 -		QStringList::Iterator it = lastMaps.at(i-1);
   1.297  		s=QString("/vym/lastMaps/map-%1").arg(i);
   1.298  		if (!s.isEmpty() && i<=maxLastMaps) 
   1.299 -			settings.writeEntry (s, *it);
   1.300 +			settings.writeEntry (s, lastMaps.at(i-1));
   1.301  	}
   1.302  
   1.303  
   1.304  	// To make the texteditor save its settings, call the destructor
   1.305  	delete (textEditor);
   1.306 +
   1.307 +	// Remove temporary directory
   1.308 +	removeDir (QDir(tmpVymDir));
   1.309  }
   1.310  
   1.311  void Main::loadCmdLine()
   1.312 @@ -280,385 +319,622 @@
   1.313  // File Actions
   1.314  void Main::setupFileActions()
   1.315  {
   1.316 -    QToolBar *tb = new QToolBar( this );
   1.317 +    Q3ToolBar *tb = new Q3ToolBar( this );
   1.318      tb->setLabel( "File Actions" );
   1.319 -    QPopupMenu *menu = new QPopupMenu( this );
   1.320 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
   1.321      menuBar()->insertItem( tr( "&File" ), menu );
   1.322  
   1.323  	// Keycodes:  /usr/lib64/qt3/include/qnamespace.h
   1.324  
   1.325      QAction *a;
   1.326 -    a = new QAction( tr( "New map" ), QPixmap( filenew_xpm ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
   1.327 -    connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
   1.328 +    a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
   1.329 +	a->setStatusTip ( tr( "New map","File menu" ) );
   1.330 +	a->setShortcut ( Qt::CTRL + Qt::Key_N );
   1.331      a->addTo( tb );
   1.332      a->addTo( menu );
   1.333 +    connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
   1.334  	
   1.335 -    a = new QAction( tr( "Open" ), QPixmap( fileopen_xpm), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
   1.336 -    connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
   1.337 +    a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ),this);
   1.338 +	a->setStatusTip (tr( "Open","File menu" ) );
   1.339 +	a->setShortcut ( Qt::CTRL + Qt::Key_O );
   1.340      a->addTo( tb );
   1.341      a->addTo( menu );
   1.342 +    connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
   1.343  	
   1.344 -	lastMapsMenu = new QPopupMenu (this);
   1.345 +	lastMapsMenu = new Q3PopupMenu (this);
   1.346  
   1.347      menu->insertItem (tr("Open Recent"),lastMapsMenu );
   1.348      menu->insertSeparator();
   1.349  	
   1.350 -    a = new QAction( tr( "Save" ), QPixmap( filesave_xpm ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
   1.351 -    connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
   1.352 +    a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), this);
   1.353 +	a->setStatusTip ( tr( "Save" ));
   1.354 +	a->setShortcut (Qt::CTRL + Qt::Key_S );
   1.355      a->addTo( tb );
   1.356      a->addTo( menu );
   1.357 +    connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
   1.358  	actionFileSave=a;
   1.359  	
   1.360 -    a = new QAction( tr( "Save &As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" );
   1.361 +    a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this);
   1.362 +	a->setStatusTip (tr( "Save &As" ) );
   1.363 +    a->addTo( menu );
   1.364      connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
   1.365 -    a->addTo( menu );
   1.366  
   1.367      menu->insertSeparator();
   1.368  
   1.369 -    a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir" ), 0, this, "export" );
   1.370 +	importMenu = new Q3PopupMenu (this);
   1.371 +    menu->insertItem (tr("Import"),importMenu );
   1.372 +
   1.373 +	a = new QAction(tr("KDE Bookmarks"), this);
   1.374 +	a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" ));
   1.375 +	a->addTo (importMenu);
   1.376 +	connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) );
   1.377 +
   1.378 +    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
   1.379 +	{
   1.380 +		a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this);
   1.381 +		a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) );
   1.382 +		a->addTo (importMenu);
   1.383 +		connect( a, SIGNAL( activated() ), this, SLOT( fileImportFirefoxBookmarks() ) );
   1.384 +	}	
   1.385 +
   1.386 +	a = new QAction("Mind Manager...",this);
   1.387 +	a->setStatusTip ( tr( "Import")+" Mind Manager"  );
   1.388 +	a->addTo (importMenu);
   1.389 +	connect( a, SIGNAL( activated() ), this, SLOT( fileImportMM() ) );
   1.390 +
   1.391 +    a = new QAction( tr( "Import Dir"+QString("...") ), this);
   1.392 +	a->setStatusTip (tr( "Import directory structure (experimental)" ) );
   1.393 +    a->addTo( importMenu);
   1.394      connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
   1.395 -    a->addTo( menu );
   1.396  
   1.397 -	exportMenu = new QPopupMenu (this);
   1.398 +	exportMenu = new Q3PopupMenu (this);
   1.399      menu->insertItem (tr("Export"),exportMenu );
   1.400  
   1.401      menu->insertSeparator();
   1.402  
   1.403  
   1.404 -    a = new QAction( tr( "Print" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
   1.405 -    connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
   1.406 +    a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this);
   1.407 +	a->setStatusTip ( tr( "Print" ) );
   1.408 +	a->setShortcut (Qt::CTRL + Qt::Key_P );
   1.409      a->addTo( tb );
   1.410      a->addTo( menu );
   1.411 +    connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
   1.412  	actionFilePrint=a;
   1.413  
   1.414 -    a = new QAction( tr( "Close Map" ), QPixmap(), tr( "&Close Map" ), ALT + Key_C, this, "fileCloseMap" );
   1.415 +    a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this);
   1.416 +	a->setStatusTip (tr( "Close Map" ) );
   1.417 +	a->setShortcut (Qt::ALT + Qt::Key_C );
   1.418 +    a->addTo( menu );
   1.419      connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
   1.420 +
   1.421 +    a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, this);
   1.422 +	a->setStatusTip ( tr( "Exit")+" "+__VYM );
   1.423 +	a->setShortcut (Qt::CTRL + Qt::Key_Q );
   1.424      a->addTo( menu );
   1.425 -
   1.426 -    a = new QAction( tr( "Exit VYM" ), QPixmap(), tr( "E&xit VYM" ), CTRL + Key_Q, this, "fileExitVYM" );
   1.427      connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
   1.428 -    a->addTo( menu );
   1.429  }
   1.430  
   1.431  
   1.432  //Edit Actions
   1.433  void Main::setupEditActions()
   1.434  {
   1.435 -    QToolBar *tb = new QToolBar( this );
   1.436 +    Q3ToolBar *tb = new Q3ToolBar( this );
   1.437      tb->setLabel( "Edit Actions" );
   1.438 -    QPopupMenu *menu = new QPopupMenu( this );
   1.439 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
   1.440      menuBar()->insertItem( tr( "&Edit" ), menu );
   1.441  
   1.442      QAction *a;
   1.443 -    a = new QAction( tr( "Undo" ), QPixmap( editundo_xpm ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
   1.444 +	QAction *alt;
   1.445 +    a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo" ),this);
   1.446      connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
   1.447 +	a->setStatusTip (tr( "Undo" ) );
   1.448 +	a->setShortcut ( Qt::CTRL + Qt::Key_Z );
   1.449  	a->setEnabled (false);
   1.450      a->addTo( tb );
   1.451      a->addTo( menu );
   1.452  	actionEditUndo=a;
   1.453 -    /*
   1.454 -    a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); 
   1.455 -    connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
   1.456 -    a->addTo( tb );
   1.457 -    a->addTo( menu );
   1.458 -    */
   1.459 +    
   1.460 +    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
   1.461 +	{
   1.462 +		a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this); 
   1.463 +		a->setStatusTip (tr( "Redo" ));
   1.464 +		a->setShortcut (Qt::CTRL + Qt::Key_Y );
   1.465 +		a->addTo( tb );
   1.466 +		a->addTo( menu );
   1.467 +		connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
   1.468 +	}
   1.469 +   
   1.470      menu->insertSeparator();
   1.471 -    a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
   1.472 -    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
   1.473 +    a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), this);
   1.474 +	a->setStatusTip ( tr( "Copy" ) );
   1.475 +	a->setShortcut (Qt::CTRL + Qt::Key_C );
   1.476  	a->setEnabled (false);
   1.477      a->addTo( tb );
   1.478      a->addTo( menu );
   1.479 +    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
   1.480  	actionEditCopy=a;
   1.481 -    a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
   1.482 -    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
   1.483 +	
   1.484 +    a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t" ), this);
   1.485 +	a->setStatusTip ( tr( "Cut" ) );
   1.486 +	a->setShortcut (Qt::CTRL + Qt::Key_X );
   1.487  	a->setEnabled (false);
   1.488      a->addTo( tb );
   1.489      a->addTo( menu );
   1.490  	actionEditCut=a;
   1.491 -    a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
   1.492 +    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
   1.493 +	
   1.494 +    a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ),this);
   1.495      connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
   1.496 +	a->setStatusTip ( tr( "Paste" ) );
   1.497 +	a->setShortcut ( Qt::CTRL + Qt::Key_V );
   1.498  	a->setEnabled (false);
   1.499      a->addTo( tb );
   1.500      a->addTo( menu );
   1.501  	actionEditPaste=a;
   1.502 -    a = new QAction( tr( "Move branch up" ), QPixmap( editmoveup_xpm ), tr( "Move up" ), Key_PageUp, this, "editMoveUp" );
   1.503 -    connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
   1.504 +
   1.505 +    a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up" ), this);
   1.506 +	a->setStatusTip ( tr( "Move branch up" ) );
   1.507 +	a->setShortcut (Qt::Key_PageUp );
   1.508  	a->setEnabled (false);
   1.509      a->addTo( tb );
   1.510      a->addTo( menu );
   1.511 +    connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
   1.512  	actionEditMoveUp=a;
   1.513 -    a = new QAction( tr( "Move branch down" ), QPixmap( editmovedown_xpm ), tr( "Move down" ), Key_PageDown, this, "editMoveDown" );
   1.514 +
   1.515 +    a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down" ),this);
   1.516      connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) );
   1.517 +	a->setStatusTip (tr( "Move branch down" ) );
   1.518 +	a->setShortcut ( Qt::Key_PageDown );
   1.519  	a->setEnabled (false);
   1.520      a->addTo( tb );
   1.521      a->addTo( menu );
   1.522  	actionEditMoveDown=a;
   1.523 +	
   1.524  
   1.525 -    a = new QAction( tr( "Scroll branch" ), QPixmap(flag_scrolled_right_xpm), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" );
   1.526 +	a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ),this);
   1.527 +	a->setShortcut ( Qt::Key_ScrollLock );
   1.528 +	a->setStatusTip (tr( "Scroll branch" ) );
   1.529      connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
   1.530 -	a->setEnabled (false);
   1.531 -    a->addTo( tb );
   1.532 +	alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), this);
   1.533 +	alt->setShortcut ( Qt::Key_S );
   1.534 +	alt->setStatusTip (tr( "Scroll branch" )); 
   1.535 +    connect( alt, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
   1.536 +	#if defined(Q_OS_MACX)
   1.537 +		actionEditToggleScroll=alt;
   1.538 +	#else	
   1.539 +		actionEditToggleScroll=a;
   1.540 +	#endif	
   1.541 +	actionEditToggleScroll->setEnabled (false);
   1.542 +	actionEditToggleScroll->setToggleAction(true);
   1.543 +    actionEditToggleScroll->addTo( tb );
   1.544 +    actionEditToggleScroll->addTo( menu );
   1.545 +	actionListBranches.append(actionEditToggleScroll);
   1.546 +	
   1.547 +    a = new QAction( tr( "Unscroll all scrolled branches" ), this);
   1.548 +	a->setStatusTip (tr( "Unscroll all" ));
   1.549      a->addTo( menu );
   1.550 -	actionEditToggleScroll=a;
   1.551 -	
   1.552 -    a = new QAction( tr( "Unscroll all" ), QPixmap(), tr( "Unscroll all scrolled branches" ), 0, this, "scroll" );
   1.553      connect( a, SIGNAL( activated() ), this, SLOT( editUnScrollAll() ) );
   1.554 -    a->addTo( menu );
   1.555  	
   1.556      menu->insertSeparator();
   1.557  
   1.558 -	a = new QAction( tr( "Find" ), QPixmap(), tr( "Find" ), CTRL + Key_F, this, "find" );
   1.559 +	a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), this);
   1.560 +	a->setStatusTip (tr( "Find" ) );
   1.561 +	a->setShortcut (Qt::CTRL + Qt::Key_F );
   1.562 +    a->addTo( menu );
   1.563      connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) );
   1.564 -    a->addTo( menu );
   1.565      
   1.566  	menu->insertSeparator();
   1.567  
   1.568 -	a = new QAction( tr( "Open URL" ), QPixmap(flag_url_xpm), tr( "Open URL" ), CTRL + Key_U, this, "url" );
   1.569 -    connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
   1.570 -    a->addTo( menu );
   1.571 +	a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), this);
   1.572 +	a->setShortcut (Qt::CTRL + Qt::Key_U );
   1.573 +	a->setShortcut (tr( "Open URL" ));
   1.574      a->addTo( tb );
   1.575  	a->setEnabled (false);
   1.576 +    connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
   1.577  	actionEditOpenURL=a;
   1.578  
   1.579 -	a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL" ), SHIFT + CTRL + Key_U, this, "url" );
   1.580 +	a = new QAction( tr( "Open URL in new tab" ), this);
   1.581 +	a->setStatusTip (tr( "Open URL in new tab" ));
   1.582 +	a->setShortcut (Qt::CTRL+Qt::Key_U );
   1.583 +	a->setEnabled (false);
   1.584 +    connect( a, SIGNAL( activated() ), this, SLOT( editOpenURLTab() ) );
   1.585 +	actionEditOpenURLTab=a;
   1.586 +
   1.587 +	a = new QAction(QPixmap(), tr( "Edit URL"+QString("...") ), this);
   1.588 +	a->setStatusTip ( tr( "Edit URL" ) );
   1.589 +	a->setShortcut (Qt::SHIFT + Qt::CTRL+Qt::Key_U );
   1.590 +	a->setEnabled (false);
   1.591 +	actionListBranches.append(a);
   1.592      connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
   1.593 -    a->addTo( menu );
   1.594 -	a->setEnabled (false);
   1.595  	actionEditURL=a;
   1.596  	
   1.597 -	a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" );
   1.598 +	a = new QAction( tr( "Use heading for URL" ), this);
   1.599 +	a->setStatusTip ( tr( "Use heading of selected branch as URL" ));
   1.600 +	a->setEnabled (false);
   1.601 +	actionListBranches.append(a);
   1.602      connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
   1.603 -    a->addTo( menu );
   1.604 -	a->setEnabled (false);
   1.605  	actionEditHeading2URL=a;
   1.606      
   1.607 -	a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" );
   1.608 +	a = new QAction(tr( "Create URL to Bugzilla" ), this);
   1.609 +	a->setStatusTip ( tr( "Create URL to Bugzilla" ));
   1.610 +	a->setEnabled (false);
   1.611 +	actionListBranches.append(a);
   1.612      connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) );
   1.613 -	a->setEnabled (false);
   1.614  	actionEditBugzilla2URL=a;
   1.615      
   1.616 -	menu->insertSeparator();
   1.617 +	a = new QAction(tr( "Create URL to FATE" ), this);
   1.618 +	a->setStatusTip ( tr( "Create URL to FATE" ));
   1.619 +	a->setEnabled (false);
   1.620 +	actionListBranches.append(a);
   1.621 +    connect( a, SIGNAL( activated() ), this, SLOT( editFATE2URL() ) );
   1.622 +	actionEditFATE2URL=a;
   1.623  	
   1.624 -    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" );
   1.625 -    connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
   1.626 -    a->addTo( menu );
   1.627 +    a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Jump to map" ), this);
   1.628 +	a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
   1.629      a->addTo( tb );
   1.630  	a->setEnabled (false);
   1.631 +    connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
   1.632  	actionEditOpenVymLink=a;
   1.633  	
   1.634 -    a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link" ), 0, this, "editLinkMap" );
   1.635 +    a = new QAction(tr( "Edit vym link"+QString("...") ), this);
   1.636 +	a->setEnabled (false);
   1.637 +	a->setStatusTip ( tr( "Edit link to another vym map" ));
   1.638      connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
   1.639 -    a->addTo( menu );
   1.640 -	a->setEnabled (false);
   1.641 +	actionListBranches.append(a);
   1.642  	actionEditVymLink=a;
   1.643  
   1.644 -    a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" );
   1.645 +    a = new QAction(tr( "Delete vym link" ),this);
   1.646 +	a->setStatusTip ( tr( "Delete link to another vym map" ));
   1.647 +	a->setEnabled (false);
   1.648      connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) );
   1.649 -    a->addTo( menu );
   1.650 -	a->setEnabled (false);
   1.651  	actionEditDeleteVymLink=a;
   1.652  
   1.653 -	menu->insertSeparator();
   1.654 +    a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), this);
   1.655 +	a->setStatusTip ( tr( "Hide object in exports" ) );
   1.656 +	a->setShortcut (Qt::Key_H );
   1.657 +	a->setToggleAction(true);
   1.658 +    a->addTo( tb );
   1.659 +	a->setEnabled (false);
   1.660 +    connect( a, SIGNAL( activated() ), this, SLOT( editToggleHideExport() ) );
   1.661 +	actionEditToggleHideExport=a;
   1.662  
   1.663 -    a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info" ), 0, this, "editMapInfo" );
   1.664 +    a = new QAction(tr( "Edit Map Info"+QString("...") ),this);
   1.665 +	a->setStatusTip ( tr( "Edit Map Info" ));
   1.666 +	a->setEnabled (true);
   1.667      connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) );
   1.668 -    a->addTo( menu );
   1.669 -	a->setEnabled (true);
   1.670  	actionEditMapInfo=a;
   1.671  
   1.672  	menu->insertSeparator();
   1.673  
   1.674      // Shortcuts to modify heading:
   1.675 -    a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Enter, this, "editHeading" );
   1.676 +    a = new QAction(tr( "Edit heading" ),this);
   1.677 +	a->setStatusTip ( tr( "edit Heading" ));
   1.678 +	a->setShortcut ( Qt::Key_Enter );
   1.679 +    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
   1.680 +	actionListBranches.append(a);
   1.681 +    a = new QAction( tr( "Edit heading" ), this);
   1.682 +	a->setStatusTip (tr( "edit Heading" ));
   1.683 +	a->setShortcut (Qt::Key_Return );
   1.684 +    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
   1.685 +	actionListBranches.append(a);
   1.686 +	actionEditHeading=a;
   1.687 +    a = new QAction( tr( "Edit heading" ),this);
   1.688 +	a->setStatusTip (tr( "edit Heading" ));
   1.689 +	a->setShortcut ( Qt::Key_F2 );
   1.690      connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
   1.691  	a->setEnabled (false);
   1.692 -    a->addTo ( menu );
   1.693  	actionEditHeading=a;
   1.694 -    a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" );
   1.695 -    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
   1.696 -    //a->addTo ( menu );
   1.697 +	actionListBranches.append(a);
   1.698      
   1.699      // Shortcut to delete selection
   1.700 -    a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
   1.701 +    a = new QAction( tr( "Delete Selection" ),this);
   1.702 +	a->setStatusTip (tr( "Delete Selection" ));
   1.703 +	a->setShortcut ( Qt::Key_Delete);
   1.704      connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) );
   1.705  	a->setEnabled (false);
   1.706 -    a->addTo ( menu );
   1.707  	actionEditDelete=a;
   1.708      
   1.709      // Shortcut to add branch
   1.710 +	alt = new QAction(tr( "Add branch as child" ), this);
   1.711 +	alt->setStatusTip ( tr( "Add a branch as child of selection" ));
   1.712 +	alt->setShortcut (Qt::Key_A);
   1.713 +    connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
   1.714 +	a = new QAction(tr( "Add branch as child" ), this);
   1.715 +	a->setStatusTip ( tr( "Add a branch as child of selection" ));
   1.716 +	a->setShortcut (Qt::Key_Insert);	
   1.717 +	a->setEnabled (false);
   1.718 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
   1.719 +	actionListBranches.append(a);
   1.720  	#if defined (Q_OS_MACX)
   1.721 -		a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), CTRL + Key_I, this, "newBranch" );
   1.722 -	#else
   1.723 -		a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), Key_Insert, this, "newBranch" );
   1.724 -	#endif
   1.725 -    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
   1.726 +		// In OSX show different shortcut in menues, the keys work independtly always			
   1.727 +		actionEditAddBranch=alt;
   1.728 +	#else	
   1.729 +		actionEditAddBranch=a;
   1.730 +	#endif	
   1.731 +
   1.732 +    // Add branch by inserting it at selection
   1.733 +	a = new QAction(tr( "Add branch (insert)" ), this);
   1.734 +	a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
   1.735 +	a->setShortcut (Qt::ALT + Qt::Key_Insert );
   1.736 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
   1.737  	a->setEnabled (false);
   1.738 -    a->addTo ( menu );
   1.739 -	actionEditAddBranch=a;
   1.740 +	actionListBranches.append(a);
   1.741 +	actionEditAddBranchHere=a;
   1.742 +	a = new QAction(tr( "Add branch (insert)" ),this);
   1.743 +	a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
   1.744 +	a->setShortcut ( Qt::ALT + Qt::Key_A );
   1.745 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
   1.746 +	actionListBranches.append(a);
   1.747  
   1.748  	// Add branch above
   1.749 -    a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" );
   1.750 +    a = new QAction(tr( "Add branch above" ), this);
   1.751 +	a->setStatusTip ( tr( "Add a branch above selection" ));
   1.752 +	a->setShortcut (Qt::SHIFT+Qt::Key_Insert );
   1.753      connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
   1.754  	a->setEnabled (false);
   1.755 -    a->addTo ( menu );
   1.756 +	actionListBranches.append(a);
   1.757  	actionEditAddBranchAbove=a;
   1.758 +    a = new QAction(tr( "Add branch above" ), this);
   1.759 +	a->setStatusTip ( tr( "Add a branch above selection" ));
   1.760 +	a->setShortcut (Qt::SHIFT+Qt::Key_A );
   1.761 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
   1.762 +	actionListBranches.append(a);
   1.763  
   1.764  	// Add branch below 
   1.765 -    a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" );
   1.766 +    a = new QAction(tr( "Add branch below" ), this);
   1.767 +	a->setStatusTip ( tr( "Add a branch below selection" ));
   1.768 +	a->setShortcut (Qt::CTRL +Qt::Key_Insert );
   1.769      connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
   1.770  	a->setEnabled (false);
   1.771 -    a->addTo ( menu );
   1.772 +	actionListBranches.append(a);
   1.773  	actionEditAddBranchBelow=a;
   1.774 +    a = new QAction(tr( "Add branch below" ), this);
   1.775 +	a->setStatusTip ( tr( "Add a branch below selection" ));
   1.776 +	a->setShortcut (Qt::CTRL +Qt::Key_A );
   1.777 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
   1.778 +	actionListBranches.append(a);
   1.779  
   1.780  	// Import at selection (adding to selection)
   1.781 -    a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" );
   1.782 +    a = new QAction( tr( "Add map (insert)" ),this);
   1.783 +	a->setStatusTip (tr( "Add map at selection" ));
   1.784      connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
   1.785  	a->setEnabled (false);
   1.786 -    a->addTo ( menu );
   1.787 +	actionListBranches.append(a);
   1.788  	actionEditImportAdd=a;
   1.789  
   1.790  	// Import at selection (replacing selection)
   1.791 -    a = new QAction( tr( "Replace selection with map" ),tr( "Import (replace)" ), 0, this, "importReplace" );
   1.792 +    a = new QAction( tr( "Add map (replace)" ), this);
   1.793 +	a->setStatusTip (tr( "Replace selection with map" ));
   1.794      connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
   1.795  	a->setEnabled (false);
   1.796 -    a->addTo ( menu );
   1.797 +	actionListBranches.append(a);
   1.798  	actionEditImportReplace=a;
   1.799  
   1.800  	// Save selection 
   1.801 -    a = new QAction( tr( "Save selction" ),tr( "Save selection" ), 0, this, "saveSelection" );
   1.802 +    a = new QAction( tr( "Save selection" ), this);
   1.803 +	a->setStatusTip (tr( "Save selection" ));
   1.804      connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) );
   1.805  	a->setEnabled (false);
   1.806 -    a->addTo ( menu );
   1.807 +	actionListBranches.append(a);
   1.808  	actionEditSaveBranch=a;
   1.809  
   1.810 +	// Only remove branch, not its childs
   1.811 +    a = new QAction(tr( "Remove only branch " ), this);
   1.812 +	a->setStatusTip ( tr( "Remove only branch and keep its childs" ));
   1.813 +	a->setShortcut (Qt::ALT + Qt::Key_Delete );
   1.814 +    connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchKeepChilds() ) );
   1.815 +	a->setEnabled (false);
   1.816 +	actionListBranches.append(a);
   1.817 +	actionEditRemoveBranchKeepChilds=a;
   1.818 +
   1.819 +	// Only remove childs of a branch
   1.820 +    a = new QAction( tr( "Remove childs" ), this);
   1.821 +	a->setStatusTip (tr( "Remove childs of branch" ));
   1.822 +	a->setShortcut (Qt::SHIFT + Qt::Key_Delete );
   1.823 +    connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) );
   1.824 +	a->setEnabled (false);
   1.825 +	actionListBranches.append(a);
   1.826 +	actionEditRemoveChilds=a;
   1.827 +
   1.828      // Shortcuts for navigating with cursor:
   1.829 -    a = new QAction( tr( "Select upper branch" ),tr( "Select upper branch" ), Key_Up, this, "upperBranch" );
   1.830 +    a = new QAction(tr( "Select upper branch" ), this);
   1.831 +	a->setStatusTip ( tr( "Select upper branch" ));
   1.832 +	a->setShortcut (Qt::Key_Up );
   1.833      connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) );
   1.834 -    a = new QAction( tr( "Select lower branch" ),tr( "Select lower branch" ), Key_Down, this, "lowerBranch" );
   1.835 +    a = new QAction( tr( "Select lower branch" ),this);
   1.836 +	a->setStatusTip (tr( "Select lower branch" ));
   1.837 +	a->setShortcut ( Qt::Key_Down );
   1.838      connect( a, SIGNAL( activated() ), this, SLOT( editLowerBranch() ) );
   1.839 -    a = new QAction( tr( "Select left branch" ),tr( "Select left branch" ), Key_Left, this, "upperBranch" );
   1.840 +    a = new QAction(tr( "Select left branch" ), this);
   1.841 +	a->setStatusTip ( tr( "Select left branch" ));
   1.842 +	a->setShortcut (Qt::Key_Left );
   1.843      connect( a, SIGNAL( activated() ), this, SLOT( editLeftBranch() ) );
   1.844 -    a = new QAction( tr( "Select right branch" ),tr( "Select child branch" ), Key_Right, this, "rightBranch" );
   1.845 +    a = new QAction( tr( "Select child branch" ), this);
   1.846 +	a->setStatusTip (tr( "Select right branch" ));
   1.847 +	a->setShortcut (Qt::Key_Right);
   1.848      connect( a, SIGNAL( activated() ), this, SLOT( editRightBranch() ) );
   1.849 -    a = new QAction( tr( "Select first branch" ),tr( "Select first branch" ), Key_Home, this, "firstBranch" );
   1.850 +    a = new QAction( tr( "Select first branch" ), this);
   1.851 +	a->setStatusTip (tr( "Select first branch" ));
   1.852 +	a->setShortcut (Qt::Key_Home );
   1.853  	a->setEnabled (false);
   1.854      a->addTo ( menu );
   1.855 +	actionListBranches.append(a);
   1.856  	actionEditSelectFirst=a;
   1.857      connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) );
   1.858 -    a = new QAction( tr( "Select last branch" ),tr( "Select last branch" ), Key_End, this, "lastBranch" );
   1.859 +    a = new QAction( tr( "Select last branch" ),this);
   1.860 +	a->setStatusTip (tr( "Select last branch" ));
   1.861 +	a->setShortcut ( Qt::Key_End );
   1.862      connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) );
   1.863  	a->setEnabled (false);
   1.864      a->addTo ( menu );
   1.865 +	actionListBranches.append(a);
   1.866  	actionEditSelectLast=a;
   1.867  
   1.868 -    a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" );
   1.869 +    a = new QAction( tr( "Add Image" )+QString("..."), this);
   1.870 +	a->setStatusTip (tr( "Add Image" ));
   1.871      connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) );
   1.872  	actionEditLoadImage=a;
   1.873 +
   1.874  }
   1.875  
   1.876  // Format Actions
   1.877  void Main::setupFormatActions()
   1.878  {
   1.879 -    QPopupMenu *menu = new QPopupMenu( this );
   1.880 -    menuBar()->insertItem( tr( "&Format" ), menu );
   1.881 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
   1.882 +    menuBar()->insertItem( tr( "F&ormat" ), menu );
   1.883  
   1.884 -    QToolBar *tb = new QToolBar( this );
   1.885 +    Q3ToolBar *tb = new Q3ToolBar( this );
   1.886      QAction *a;
   1.887      QPixmap pix( 16,16);
   1.888 -    pix.fill (black);
   1.889 -    actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" ), 0, this, "formatColor" );
   1.890 -    connect( actionFormatColor, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
   1.891 -    actionFormatColor->addTo( tb );
   1.892 -    actionFormatColor->addTo( menu );
   1.893 -    a= new QAction( tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ), QPixmap(formatcolorpicker_xpm), tr( "Pic&k color" ), CTRL + Key_K, this, "pickColor" );
   1.894 +    pix.fill (Qt::black);
   1.895 +    a= new QAction(pix, tr( "Set &Color" )+QString("..."), this);
   1.896 +	a->setStatusTip ( tr( "Set Color" ));
   1.897 +    connect( a, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
   1.898 +    a->addTo( tb );
   1.899 +    a->addTo( menu );
   1.900 +	actionFormatColor=a;
   1.901 +    a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), this);
   1.902 +	a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) );
   1.903 +	a->setShortcut (Qt::CTRL + Qt::Key_K );
   1.904      connect( a, SIGNAL( activated() ), this, SLOT( formatPickColor() ) );
   1.905  	a->setEnabled (false);
   1.906      a->addTo( tb );
   1.907      a->addTo( menu );
   1.908 +	actionListBranches.append(a);
   1.909  	actionFormatPickColor=a;
   1.910 -    a= new QAction( tr( "Color branch" ), QPixmap(formatcoloritem_xpm), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" );
   1.911 +
   1.912 +    a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), this);
   1.913 +	a->setStatusTip ( tr( "Color branch" ) );
   1.914 +	a->setShortcut (Qt::CTRL + Qt::Key_I);
   1.915      connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) );
   1.916  	a->setEnabled (false);
   1.917      a->addTo( tb );
   1.918      a->addTo( menu );
   1.919 +	actionListBranches.append(a);
   1.920  	actionFormatColorBranch=a;
   1.921 -    a= new QAction( tr( "Color Subtree" ), QPixmap(formatcolorbranch_xpm), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" );
   1.922 +
   1.923 +    a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), this);
   1.924 +	a->setStatusTip ( tr( "Color Subtree" ));
   1.925 +	a->setShortcut (Qt::CTRL + Qt::Key_T);
   1.926      connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) );
   1.927  	a->setEnabled (false);
   1.928      a->addTo( menu );
   1.929      a->addTo( tb );
   1.930 +	actionListBranches.append(a);
   1.931  	actionFormatColorSubtree=a;
   1.932  
   1.933      menu->insertSeparator();
   1.934 -	actionGroupFormatLinkStyles=new QActionGroup ( this, "formatLinkStyles");
   1.935 +	actionGroupFormatLinkStyles=new Q3ActionGroup ( this, "formatLinkStyles");
   1.936  	actionGroupFormatLinkStyles->setExclusive (true);
   1.937 -    a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
   1.938 +    a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
   1.939 +	a->setStatusTip (tr( "Line" ));
   1.940  	a->setToggleAction(true);
   1.941      connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleLine() ) );
   1.942  	actionFormatLinkStyleLine=a;
   1.943 -    a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
   1.944 +    a= new QAction( tr( "Linkstyle Parabel" ), actionGroupFormatLinkStyles);
   1.945 +	a->setStatusTip (tr( "Line" ));
   1.946  	a->setToggleAction(true);
   1.947      connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleParabel() ) );
   1.948  	actionFormatLinkStyleParabel=a;
   1.949 -    a= new QAction( tr( "PolyLine" ), QPixmap(), tr( "Linkstyle Thick Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
   1.950 +    a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles );
   1.951 +	a->setStatusTip (tr( "PolyLine" ));
   1.952  	a->setToggleAction(true);
   1.953      connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyLine() ) );
   1.954  	actionFormatLinkStylePolyLine=a;
   1.955 -    a= new QAction( tr( "PolyParabel" ), QPixmap(), tr( "Linkstyle Thick Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStylePolyParabel" );
   1.956 +    a= new QAction( tr( "Linkstyle Thick Parabel" ), actionGroupFormatLinkStyles);
   1.957 +	a->setStatusTip (tr( "PolyParabel" ) );
   1.958  	a->setToggleAction(true);
   1.959      connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyParabel() ) );
   1.960  	actionFormatLinkStylePolyParabel=a;
   1.961  	actionGroupFormatLinkStyles->addTo (menu);
   1.962  	
   1.963 -	actionGroupFormatFrameTypes=new QActionGroup ( this, "formatFrameTypes");
   1.964 +	actionGroupFormatFrameTypes=new Q3ActionGroup ( this, "formatFrameTypes");
   1.965  	actionGroupFormatFrameTypes->setExclusive (true);
   1.966 -    a = new QAction( tr( "No Frame" ),tr( "No Frame" ), 0, actionGroupFormatFrameTypes, "frameNone" );
   1.967 +    a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes );
   1.968 +	a->setStatusTip (tr("No Frame"));
   1.969  	a->setToggleAction(true);
   1.970      connect( a, SIGNAL( activated() ), this, SLOT( formatFrameNone() ) );
   1.971  	actionFormatFrameNone=a;
   1.972 -    a = new QAction( tr( "Rectangle" ),tr( "Rectangle" ), 0, actionGroupFormatFrameTypes, "frameRectangle" );
   1.973 +    a = new QAction( tr( "Rectangle" ), actionGroupFormatFrameTypes);
   1.974 +	a->setStatusTip (tr( "Rectangle" ));
   1.975  	a->setToggleAction(true);
   1.976      connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) );
   1.977  	actionFormatFrameRectangle=a;
   1.978  
   1.979 +    a = new QAction( tr( "Include images vertically" ),  actionFormatIncludeImagesVer);
   1.980 +	a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
   1.981 +	a->setToggleAction(true);
   1.982 +    connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesVer() ) );
   1.983 +	actionFormatIncludeImagesVer=a;
   1.984 +
   1.985 +    a = new QAction( tr( "Include images horizontally" ),  actionFormatIncludeImagesHor );
   1.986 +	a->setStatusTip ( tr ("Include left and right position of images into branch"));
   1.987 +	a->setToggleAction(true);
   1.988 +    connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesHor() ) );
   1.989 +	actionFormatIncludeImagesHor=a;
   1.990 +
   1.991 +    a = new QAction( tr( "Hide link if object is not selected" ), actionFormatHideLinkUnselected);
   1.992 +	a->setStatusTip (tr( "Hide link" ));
   1.993 +	a->setToggleAction(true);
   1.994 +    connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) );
   1.995 +	actionFormatHideLinkUnselected=a;
   1.996 +
   1.997      menu->insertSeparator();
   1.998 -    a= new QAction( tr( "Use same color for links and headings" ), QPixmap(), tr( "&Use color of heading for link" ), 0, this, "formatLinkColorHint" );
   1.999 +    a= new QAction( tr( "&Use color of heading for link" ),  this);
  1.1000 +	a->setStatusTip (tr( "Use same color for links and headings" ));
  1.1001  	a->setToggleAction(true);
  1.1002      connect( a, SIGNAL( activated() ), this, SLOT( formatToggleLinkColorHint() ) );
  1.1003  	a->addTo( menu );
  1.1004  	actionFormatLinkColorHint=a;
  1.1005 -    pix.fill (white);
  1.1006 -    actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color" ), 0, this, "formatLinkColor" );
  1.1007 -    connect( actionFormatLinkColor, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
  1.1008 -    actionFormatLinkColor->addTo( menu );
  1.1009 -    actionFormatBackColor= new QAction( tr( "Set Background Color" ), pix, tr( "Set &Background Color" ), 0, this, "formatBackColor" );
  1.1010 -    connect( actionFormatBackColor, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
  1.1011 -    actionFormatBackColor->addTo( menu );
  1.1012 +
  1.1013 +    pix.fill (Qt::white);
  1.1014 +    a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this  );
  1.1015 +	a->setStatusTip (tr( "Set Link Color" ));
  1.1016 +    a->addTo( menu );
  1.1017 +    connect( a, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
  1.1018 +    actionFormatLinkColor=a;
  1.1019 +
  1.1020 +    a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this );
  1.1021 +	a->setStatusTip (tr( "Set Background Color" ));
  1.1022 +    a->addTo( menu );
  1.1023 +    connect( a, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
  1.1024 +    actionFormatBackColor=a;
  1.1025  }
  1.1026  
  1.1027  // View Actions
  1.1028  void Main::setupViewActions()
  1.1029  {
  1.1030 -    QToolBar *tb = new QToolBar( this );
  1.1031 +    Q3ToolBar *tb = new Q3ToolBar( this );
  1.1032      tb->setLabel( "View Actions" );
  1.1033 -    QPopupMenu *menu = new QPopupMenu( this );
  1.1034 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  1.1035      menuBar()->insertItem( tr( "&View" ), menu );
  1.1036  
  1.1037      QAction *a;
  1.1038 -    a = new QAction( tr( "Zoom reset" ), QPixmap(viewzoomreset_xpm), tr( "reset Zoom" ), 0, this, "zoomReset" );
  1.1039 -    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
  1.1040 +    a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), this);
  1.1041 +	a->setStatusTip ( tr( "Zoom reset" ) );
  1.1042 +	a->setShortcut (Qt::CTRL + Qt::Key_0 );
  1.1043      a->addTo( tb );
  1.1044      a->addTo( menu );
  1.1045 -    a = new QAction( tr( "Zoom in" ), QPixmap(viewzoomin_xpm), tr( "Zoom in" ), CTRL + Key_Plus, this, "zoomIn" );
  1.1046 -    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
  1.1047 +    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
  1.1048 +	
  1.1049 +    a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in" ), this);
  1.1050 +	a->setStatusTip (tr( "Zoom in" ));
  1.1051 +	a->setShortcut (Qt::CTRL + Qt::Key_Plus);
  1.1052      a->addTo( tb );
  1.1053      a->addTo( menu );
  1.1054 -    a = new QAction( tr( "Zoom out" ), QPixmap(viewzoomout_xpm), tr( "Zoom out" ), CTRL + Key_Minus, this, "zoomOut" );
  1.1055 -    connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
  1.1056 +    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
  1.1057 +	
  1.1058 +    a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out" ), this);
  1.1059 +	a->setStatusTip (tr( "Zoom out" ));
  1.1060 +	a->setShortcut (Qt::CTRL + Qt::Key_Minus );
  1.1061      a->addTo( tb );
  1.1062      a->addTo( menu );
  1.1063 -    a = new QAction( tr( "Toggle Note Editor" ), QPixmap(flag_note_xpm), tr( "Toggle Note Editor" ), CTRL + Key_E , this, "noteEditor" );
  1.1064 -    connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
  1.1065 +    connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
  1.1066 +
  1.1067 +
  1.1068 +    a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ),this);
  1.1069 +	a->setStatusTip ( tr( "Show Note Editor" ));
  1.1070 +	a->setShortcut ( Qt::CTRL + Qt::Key_E );
  1.1071  	a->setToggleAction(true);
  1.1072  	if (textEditor->showWithMain())
  1.1073  		a->setOn(true);
  1.1074 @@ -666,102 +942,348 @@
  1.1075  		a->setOn(false);
  1.1076      a->addTo( tb );
  1.1077      a->addTo( menu );
  1.1078 +    connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
  1.1079  	actionViewToggleNoteEditor=a;
  1.1080 -    a = new QAction( tr( "&Next Window" ), QPixmap(), tr( "Next Window" ), ALT + Key_N , this, "nextWindow" );
  1.1081 +
  1.1082 +    a = new QAction(  tr( "Show history window" ),this );
  1.1083 +	a->setStatusTip ( tr( "Show history window" ));
  1.1084 +	a->setShortcut ( Qt::CTRL + Qt::Key_H  );
  1.1085 +	a->setToggleAction(false);
  1.1086 +    a->addTo( menu );
  1.1087 +    connect( a, SIGNAL( activated() ), this, SLOT(windowToggleHistory() ) );
  1.1088 +	actionViewToggleHistoryWindow=a;
  1.1089 +
  1.1090 +    a = new QAction(tr( "Next Window" ), this);
  1.1091 +	a->setStatusTip ( tr( "&Next Window" ) );
  1.1092 +	a->setShortcut (Qt::ALT + Qt::Key_N );
  1.1093 +    a->addTo( menu );
  1.1094      connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) );
  1.1095 +
  1.1096 +    a = new QAction (tr( "Previous Window" ), this );
  1.1097 +	a->setStatusTip (tr( "&Previous Window" ));
  1.1098 +	a->setShortcut (Qt::ALT + Qt::Key_P );
  1.1099      a->addTo( menu );
  1.1100 -    a = new QAction( tr( "&Previous Window" ), QPixmap(), tr( "Previous Window" ), ALT + Key_P , this, "previousWindow" );
  1.1101      connect( a, SIGNAL( activated() ), this, SLOT(windowPreviousEditor() ) );
  1.1102 -    a->addTo( menu );
  1.1103 +}
  1.1104 +
  1.1105 +// Mode Actions
  1.1106 +void Main::setupModeActions()
  1.1107 +{
  1.1108 +    //QPopupMenu *menu = new QPopupMenu( this );
  1.1109 +    //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
  1.1110 +
  1.1111 +    Q3ToolBar *tb = new Q3ToolBar( this );
  1.1112 +    tb->setLabel( tr ("Modes when using modifiers") );
  1.1113 +    QAction *a;
  1.1114 +	actionGroupModModes=new Q3ActionGroup ( this, "formatLinkStyles");
  1.1115 +	actionGroupModModes->setExclusive (true);
  1.1116 +    a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes);
  1.1117 +	a->setShortcut (Qt::Key_J);
  1.1118 +    a->setStatusTip ( tr( "Use modifier to color branches" ));
  1.1119 +	a->setToggleAction(true);
  1.1120 +	a->addTo (tb);
  1.1121 +	a->setOn(true);
  1.1122 +	actionModModeColor=a;
  1.1123 +	
  1.1124 +    a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy" ), actionGroupModModes );
  1.1125 +	a->setShortcut( Qt::Key_K); 
  1.1126 +    a->setStatusTip( tr( "Use modifier to copy" ));
  1.1127 +	a->setToggleAction(true);
  1.1128 +	a->addTo (tb);
  1.1129 +	actionModModeCopy=a;
  1.1130 +
  1.1131 +    a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks" ), actionGroupModModes );
  1.1132 +	a->setShortcut (Qt::Key_L);
  1.1133 +    a->setStatusTip( tr( "Use modifier to draw xLinks" ));
  1.1134 +	a->setToggleAction(true);
  1.1135 +	a->addTo (tb);
  1.1136 +	actionModModeLink=a;
  1.1137  }
  1.1138  
  1.1139  // Flag Actions
  1.1140  void Main::setupFlagActions()
  1.1141  {
  1.1142 +	// Create System Flags
  1.1143 +	systemFlagsDefault = new FlagRowObj ();
  1.1144 +	systemFlagsDefault->setVisibility (false);
  1.1145 +	systemFlagsDefault->setName ("systemFlagsDef");
  1.1146 +
  1.1147 +	FlagObj *fo = new FlagObj ();
  1.1148 +	fo->load(QPixmap(flagsPath+"flag-note.png"));
  1.1149 +	fo->setName("note");
  1.1150 +	fo->setToolTip(tr("Note","Systemflag"));
  1.1151 +	systemFlagsDefault->addFlag (fo);	// makes deep copy
  1.1152 +
  1.1153 +	fo->load(QPixmap(flagsPath+"flag-url.png"));
  1.1154 +	fo->setName("url");
  1.1155 +	fo->setToolTip(tr("WWW Document (external)","Systemflag"));
  1.1156 +	systemFlagsDefault->addFlag (fo);
  1.1157 +	
  1.1158 +	fo->load(QPixmap(flagsPath+"flag-vymlink.png"));
  1.1159 +	fo->setName("vymLink");
  1.1160 +	fo->setToolTip(tr("Link to another vym map","Systemflag"));
  1.1161 +	systemFlagsDefault->addFlag (fo);	
  1.1162 +
  1.1163 +	fo->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
  1.1164 +	fo->setName("scrolledright");
  1.1165 +	fo->setToolTip(tr("subtree is scrolled","Systemflag"));
  1.1166 +	systemFlagsDefault->addFlag (fo);
  1.1167 +	
  1.1168 +	fo->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
  1.1169 +	fo->setName("tmpUnscrolledright");
  1.1170 +	fo->setToolTip(tr("subtree is temporary scrolled","Systemflag"));
  1.1171 +	systemFlagsDefault->addFlag (fo);
  1.1172 +
  1.1173 +	fo->load(QPixmap(flagsPath+"flag-hideexport.png"));
  1.1174 +	fo->setName("hideInExport");
  1.1175 +	fo->setToolTip(tr("Hide object in exported maps","Systemflag"));
  1.1176 +	systemFlagsDefault->addFlag (fo);
  1.1177 +
  1.1178 +	// Create Standard Flags
  1.1179 +	standardFlagsDefault = new FlagRowObj ();
  1.1180 +	standardFlagsDefault->setVisibility (false);
  1.1181 +	standardFlagsDefault->setName ("standardFlagsDef");
  1.1182 +
  1.1183 +	fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
  1.1184 +	fo->setName ("exclamationmark");
  1.1185 +	fo->setGroup("standard-mark");
  1.1186 +	fo->setToolTip(tr("Take care!","Standardflag"));
  1.1187 +	standardFlagsDefault->addFlag (fo);	// makes deep copy
  1.1188 +	
  1.1189 +	fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
  1.1190 +	fo->setName("questionmark");
  1.1191 +	fo->setGroup("standard-mark");
  1.1192 +	fo->setToolTip(tr("Really?","Standardflag"));
  1.1193 +	standardFlagsDefault->addFlag (fo);	
  1.1194 +
  1.1195 +	fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
  1.1196 +	fo->setName("hook-green");
  1.1197 +	fo->setGroup("standard-hook");
  1.1198 +	fo->setToolTip(tr("ok!","Standardflag"));
  1.1199 +	standardFlagsDefault->addFlag (fo);	
  1.1200 +
  1.1201 +	fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
  1.1202 +	fo->setName("cross-red");
  1.1203 +	fo->setGroup("standard-hook");
  1.1204 +	fo->setToolTip(tr("Not ok!","Standardflag"));
  1.1205 +	standardFlagsDefault->addFlag (fo);	
  1.1206 +
  1.1207 +	fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
  1.1208 +	fo->setName("stopsign");
  1.1209 +	fo->setToolTip(tr("This won't work!","Standardflag"));
  1.1210 +	standardFlagsDefault->addFlag (fo);	
  1.1211 +
  1.1212 +	fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
  1.1213 +	fo->setName("smiley-good");
  1.1214 +	fo->setGroup("standard-smiley");
  1.1215 +	fo->setToolTip(tr("Good","Standardflag"));
  1.1216 +	standardFlagsDefault->addFlag (fo);	
  1.1217 +
  1.1218 +	fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
  1.1219 +	fo->setName("smiley-sad");
  1.1220 +	fo->setGroup("standard-smiley");
  1.1221 +	fo->setToolTip(tr("Bad","Standardflag"));
  1.1222 +	standardFlagsDefault->addFlag (fo);	
  1.1223 +
  1.1224 +	fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
  1.1225 +	// Original omg.png (in KDE emoticons)
  1.1226 +	fo->setName("smiley-omg");
  1.1227 +	fo->setGroup("standard-smiley");
  1.1228 +	fo->setToolTip(tr("Oh no!","Standardflag"));
  1.1229 +	standardFlagsDefault->addFlag (fo);	
  1.1230 +
  1.1231 +	fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
  1.1232 +	fo->setName("clock");
  1.1233 +	fo->setToolTip(tr("Time critical","Standardflag"));
  1.1234 +	standardFlagsDefault->addFlag (fo);	
  1.1235 +
  1.1236 +	fo->load(QPixmap(flagsPath+"flag-phone.png"));
  1.1237 +	fo->setName("phone");
  1.1238 +	fo->setToolTip(tr("Call...","Standardflag"));
  1.1239 +	standardFlagsDefault->addFlag (fo);	
  1.1240 +
  1.1241 +	fo->load(QPixmap(flagsPath+"flag-lamp.png"));
  1.1242 +	fo->setName("lamp");
  1.1243 +	fo->setToolTip(tr("Idea!","Standardflag"));
  1.1244 +	standardFlagsDefault->addFlag (fo);	
  1.1245 +
  1.1246 +	fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
  1.1247 +	fo->setName("arrow-up");
  1.1248 +	fo->setGroup("standard-arrow");
  1.1249 +	fo->setToolTip(tr("Important","Standardflag"));
  1.1250 +	standardFlagsDefault->addFlag (fo);	
  1.1251 +
  1.1252 +	fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
  1.1253 +	fo->setName("arrow-down");
  1.1254 +	fo->setGroup("standard-arrow");
  1.1255 +	fo->setToolTip(tr("Unimportant","Standardflag"));
  1.1256 +	standardFlagsDefault->addFlag (fo);	
  1.1257 +
  1.1258 +	fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
  1.1259 +	fo->setName("2arrow-up");
  1.1260 +	fo->setGroup("standard-arrow");
  1.1261 +	fo->setToolTip(tr("Very important!","Standardflag"));
  1.1262 +	standardFlagsDefault->addFlag (fo);	
  1.1263 +
  1.1264 +	fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
  1.1265 +	fo->setName("2arrow-down");
  1.1266 +	fo->setGroup("standard-arrow");
  1.1267 +	fo->setToolTip(tr("Very unimportant!","Standardflag"));
  1.1268 +	standardFlagsDefault->addFlag (fo);	
  1.1269 +
  1.1270 +	fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
  1.1271 +	fo->setName("thumb-up");
  1.1272 +	fo->setGroup("standard-thumb");
  1.1273 +	fo->setToolTip(tr("I like this","Standardflag"));
  1.1274 +	standardFlagsDefault->addFlag (fo);	
  1.1275 +
  1.1276 +	fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
  1.1277 +	fo->setName("thumb-down");
  1.1278 +	fo->setGroup("standard-thumb");
  1.1279 +	fo->setToolTip(tr("I like this","Standardflag"));
  1.1280 +	fo->setToolTip(tr("I do not like this","Standardflag"));
  1.1281 +	standardFlagsDefault->addFlag (fo);	
  1.1282 +	
  1.1283 +	fo->load(QPixmap(flagsPath+"flag-rose.png"));
  1.1284 +	fo->setName("rose");
  1.1285 +	fo->setToolTip(tr("Rose","Standardflag"));
  1.1286 +	standardFlagsDefault->addFlag (fo);	
  1.1287 +
  1.1288 +	fo->load(QPixmap(flagsPath+"flag-heart.png"));
  1.1289 +	fo->setName("heart");
  1.1290 +	fo->setToolTip(tr("I just love... ","Standardflag"));
  1.1291 +	standardFlagsDefault->addFlag (fo);	
  1.1292 +
  1.1293 +	fo->load(QPixmap(flagsPath+"flag-present.png"));
  1.1294 +	fo->setName("present");
  1.1295 +	fo->setToolTip(tr("Surprise!","Standardflag"));
  1.1296 +	standardFlagsDefault->addFlag (fo);	
  1.1297 +
  1.1298 +	fo->load(QPixmap(flagsPath+"flag-flash.png"));
  1.1299 +	fo->setName("flash");
  1.1300 +	fo->setToolTip(tr("Dangerous","Standardflag"));
  1.1301 +	standardFlagsDefault->addFlag (fo);	
  1.1302 +	
  1.1303 +	fo->load(QPixmap(flagsPath+"flag-info.png"));
  1.1304 +	// Original: xsldbg_output.png
  1.1305 +	fo->setName("info");
  1.1306 +	fo->setToolTip(tr("Info","Standardflag"));
  1.1307 +	standardFlagsDefault->addFlag (fo);	
  1.1308 +
  1.1309 +	fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
  1.1310 +	// Original khelpcenter.png
  1.1311 +	fo->setName("lifebelt");
  1.1312 +	fo->setToolTip(tr("This will help","Standardflag"));
  1.1313 +	standardFlagsDefault->addFlag (fo);	
  1.1314 +
  1.1315 +	delete (fo);
  1.1316 +
  1.1317  	standardFlagsDefault->makeToolbar(this, "Standard Flags");
  1.1318  }
  1.1319  
  1.1320  // Settings Actions
  1.1321  void Main::setupSettingsActions()
  1.1322  {
  1.1323 -    QPopupMenu *menu = new QPopupMenu( this );
  1.1324 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  1.1325      menuBar()->insertItem( tr( "&Settings" ), menu );
  1.1326  
  1.1327  	QAction *a;
  1.1328  
  1.1329  
  1.1330 -    a = new QAction( tr( "Set application to open pdf files" ), QPixmap(), tr( "Set application to open pdf files" ), 0, this, "setPDF" );
  1.1331 +    a = new QAction( tr( "Set application to open pdf files"), this);
  1.1332 +    a->setStatusTip ( tr( "Set application to open pdf files"));
  1.1333      connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) );
  1.1334      a->addTo( menu );
  1.1335  
  1.1336 -    a = new QAction( tr( "Set application to open an URL" ), QPixmap(), tr( "Set application to open an URL" ), 0, this, "setURL" );
  1.1337 +    a = new QAction( tr( "Set application to open external links"), this);
  1.1338 +    a->setStatusTip( tr( "Set application to open external links"));
  1.1339      connect( a, SIGNAL( activated() ), this, SLOT( settingsURL() ) );
  1.1340      a->addTo( menu );
  1.1341  
  1.1342      menu->insertSeparator();
  1.1343 -    a = new QAction( tr( "Edit branch after adding it" ), QPixmap(), tr( "Edit branch after adding it" ), 0, this, "autoedit" );
  1.1344 +    a = new QAction( tr( "Edit branch after adding it" ), this );
  1.1345 +    a->setStatusTip( tr( "Edit branch after adding it" ));
  1.1346  	a->setToggleAction(true);
  1.1347  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoedit",true) );
  1.1348      a->addTo( menu );
  1.1349  	actionSettingsAutoedit=a;
  1.1350  
  1.1351 -    a= new QAction( tr( "Select branch after adding it" ), QPixmap(), tr( "Select branch after adding it" ), 0, this, "autoselectheading" );
  1.1352 +    a= new QAction( tr( "Select branch after adding it" ), this );
  1.1353 +    a->setStatusTip( tr( "Select branch after adding it" ));
  1.1354  	a->setToggleAction(true);
  1.1355  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselect",false) );
  1.1356      a->addTo( menu );
  1.1357  	actionSettingsAutoselectHeading=a;
  1.1358  	
  1.1359 -    a= new QAction( tr( "Select heading before editing" ), QPixmap(), tr( "Select existing heading" ), 0, this, "autoselectexistingtext" );
  1.1360 +    a= new QAction(tr( "Select existing heading" ), this);
  1.1361 +    a->setStatusTip( tr( "Select heading before editing" ));
  1.1362  	a->setToggleAction(true);
  1.1363  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselectexistingtext",true) );
  1.1364      a->addTo( menu );
  1.1365  	actionSettingsAutoselectText=a;
  1.1366  	
  1.1367 -    a= new QAction( tr( "Enable pasting into new branch" ), QPixmap(), tr( "Enable pasting into new branch" ), 0, this, "pastenewheading" );
  1.1368 +    a= new QAction(tr( "pasting into new branch" ), this );
  1.1369 +    a->setStatusTip( tr( "Pasting into new branch" ));
  1.1370  	a->setToggleAction(true);
  1.1371  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/newheadingisempty",true) );
  1.1372      a->addTo( menu );
  1.1373  	actionSettingsPasteNewHeading=a;
  1.1374  	
  1.1375 -    a= new QAction( tr( "Enable Delete key for deleting branches" ), QPixmap(), tr( "Enable Delete key" ), 0, this, "delkey" );
  1.1376 +    a= new QAction( tr( "Delete key" ), this);
  1.1377 +    a->setStatusTip( tr( "Delete key for deleting branches" ));
  1.1378  	a->setToggleAction(true);
  1.1379  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) );
  1.1380      a->addTo( menu );
  1.1381 +    connect( a, SIGNAL( activated() ), this, SLOT( settingsToggleDelKey() ) );
  1.1382  	actionSettingsUseDelKey=a;
  1.1383 +
  1.1384 +    a= new QAction( tr( "Exclusive flags" ), this);
  1.1385 +    a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
  1.1386 +	a->setToggleAction(true);
  1.1387 +	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) );
  1.1388 +    a->addTo( menu );
  1.1389 +	actionSettingsUseFlagGroups=a;
  1.1390 +	
  1.1391 +    a= new QAction( tr( "Use hide flags" ), this);
  1.1392 +    a->setStatusTip( tr( "Use hide flag during exports " ));
  1.1393 +	a->setToggleAction(true);
  1.1394 +	a->setOn ( settings.readBoolEntry ("/vym/export/useHideExport",true) );
  1.1395 +    a->addTo( menu );
  1.1396 +	actionSettingsUseHideExport=a;
  1.1397  }
  1.1398  
  1.1399  // Test Actions
  1.1400  void Main::setupTestActions()
  1.1401  {
  1.1402 -    QPopupMenu *menu = new QPopupMenu( this );
  1.1403 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  1.1404      menuBar()->insertItem( tr( "&Test" ), menu );
  1.1405  
  1.1406      QAction *a;
  1.1407 -    a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" );
  1.1408 +    a = new QAction( tr( "test flag" ), this);
  1.1409 +    a->setStatusTip( tr( "Call test function" ));
  1.1410      connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) );
  1.1411      a->addTo( menu );
  1.1412 -
  1.1413 -	a = new QAction( tr( "Show Clipboard" ), QPixmap(), tr( "Show clipboard" ), 0, this, "clipboard" );
  1.1414 -    connect( a, SIGNAL( activated() ), this, SLOT( testShowClipboard() ) );
  1.1415 -    a->addTo( menu );
  1.1416  }
  1.1417  
  1.1418  // Help Actions
  1.1419  void Main::setupHelpActions()
  1.1420  {
  1.1421 -    QPopupMenu *menu = new QPopupMenu( this );
  1.1422 +    Q3PopupMenu *menu = new Q3PopupMenu( this );
  1.1423      menuBar()->insertItem( tr( "&Help" ), menu );
  1.1424  
  1.1425      QAction *a;
  1.1426 -    a = new QAction( tr( "Open VYM Documentation (pdf)" ), QPixmap(), tr( "Open VYM Documentation (pdf) " ), 0, this, "about" );
  1.1427 +    a = new QAction(  tr( "Open VYM Documentation (pdf) " ), this );
  1.1428 +    a->setStatusTip( tr( "Open VYM Documentation (pdf)" ));
  1.1429      connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
  1.1430      a->addTo( menu );
  1.1431  
  1.1432 -    a = new QAction( tr( "Information about VYM" ), QPixmap(), tr( "About VYM" ), 0, this, "about" );
  1.1433 +    a = new QAction( tr( "About VYM" ), this);
  1.1434 +    a->setStatusTip( tr( "About VYM")+" "__VYM);
  1.1435      connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
  1.1436      a->addTo( menu );
  1.1437  
  1.1438 -    a = new QAction( tr( "Information about QT toolkit" ), QPixmap(), tr( "About QT" ), 0, this, "about" );
  1.1439 +    a = new QAction( tr( "About QT" ), this);
  1.1440 +    a->setStatusTip( tr( "Information about QT toolkit" ));
  1.1441      connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQT() ) );
  1.1442      a->addTo( menu );
  1.1443  }
  1.1444 @@ -772,44 +1294,89 @@
  1.1445  	QAction*a;
  1.1446  
  1.1447  	// Context Menu for branch or mapcenter
  1.1448 -	branchContextMenu =new QPopupMenu (this);
  1.1449 -	actionEditAddBranch->addTo ( branchContextMenu );
  1.1450 -	actionEditAddBranchAbove->addTo ( branchContextMenu );
  1.1451 -	actionEditAddBranchBelow->addTo ( branchContextMenu );
  1.1452 +	branchContextMenu =new Q3PopupMenu (this);
  1.1453 +
  1.1454 +		// Submenu "Add"
  1.1455 +		branchAddContextMenu =new Q3PopupMenu (this);
  1.1456 +		actionEditPaste->addTo ( branchAddContextMenu );
  1.1457 +		actionEditAddBranch->addTo ( branchAddContextMenu );
  1.1458 +		actionEditAddBranchHere->addTo ( branchAddContextMenu );
  1.1459 +		actionEditAddBranchAbove->addTo ( branchAddContextMenu );
  1.1460 +		actionEditAddBranchBelow->addTo ( branchAddContextMenu );
  1.1461 +		branchAddContextMenu->insertSeparator();	
  1.1462 +		actionEditLoadImage->addTo( branchAddContextMenu );
  1.1463 +		branchAddContextMenu->insertSeparator();	
  1.1464 +		actionEditImportAdd->addTo ( branchAddContextMenu );
  1.1465 +		actionEditImportReplace->addTo ( branchAddContextMenu );
  1.1466 +
  1.1467 +		// Submenu "Remove"
  1.1468 +		branchRemoveContextMenu =new Q3PopupMenu (this);
  1.1469 +		actionEditCut->addTo ( branchRemoveContextMenu );
  1.1470 +		actionEditDelete->addTo ( branchRemoveContextMenu );
  1.1471 +		actionEditRemoveBranchKeepChilds->addTo( branchRemoveContextMenu );
  1.1472 +		actionEditRemoveChilds->addTo( branchRemoveContextMenu );
  1.1473 +		
  1.1474 +	branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);	
  1.1475 +	branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu);	
  1.1476 +
  1.1477  	actionEditSaveBranch->addTo( branchContextMenu );
  1.1478 -	branchContextMenu->insertSeparator();	
  1.1479 -	actionEditImportAdd->addTo ( branchContextMenu );
  1.1480 -	actionEditImportReplace->addTo ( branchContextMenu );
  1.1481 +
  1.1482  	branchContextMenu->insertSeparator();	
  1.1483  	actionEditOpenURL->addTo ( branchContextMenu );
  1.1484 +	actionEditOpenURLTab->addTo ( branchContextMenu );
  1.1485  	actionEditURL->addTo ( branchContextMenu );
  1.1486  	actionEditHeading2URL->addTo ( branchContextMenu );
  1.1487 +	actionEditBugzilla2URL->addTo( branchContextMenu );
  1.1488      if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
  1.1489 -		actionEditBugzilla2URL->addTo( branchContextMenu );
  1.1490 +	{
  1.1491 +		actionEditFATE2URL->addTo( branchContextMenu );
  1.1492 +	}	
  1.1493  	branchContextMenu->insertSeparator();	
  1.1494  	actionEditOpenVymLink->addTo ( branchContextMenu );
  1.1495  	actionEditVymLink->addTo ( branchContextMenu );
  1.1496  	actionEditDeleteVymLink->addTo ( branchContextMenu );
  1.1497 -	branchContextMenu->insertSeparator();	
  1.1498 -	actionEditLoadImage->addTo( branchContextMenu );
  1.1499 -	branchContextMenu->insertSeparator();	
  1.1500 -	actionEditCopy->addTo( branchContextMenu );
  1.1501 -	actionEditCut->addTo( branchContextMenu );
  1.1502 -	actionEditPaste->addTo( branchContextMenu );
  1.1503 +	
  1.1504  	branchContextMenu->insertSeparator();	
  1.1505  	actionGroupFormatFrameTypes->addTo( branchContextMenu );
  1.1506  
  1.1507 +	branchContextMenu->insertSeparator();	
  1.1508 +	actionFormatIncludeImagesVer->addTo( branchContextMenu );
  1.1509 +	actionFormatIncludeImagesHor->addTo( branchContextMenu );
  1.1510 +	actionFormatHideLinkUnselected->addTo( branchContextMenu );
  1.1511 +
  1.1512 +	// Context Menu for links in a branch menu
  1.1513 +	// This will be populated "on demand" in MapEditor::updateActions
  1.1514 +	branchContextMenu->insertSeparator();	
  1.1515 +	branchLinksContextMenu =new Q3PopupMenu (this);
  1.1516 +	branchLinksContextMenuDup =new Q3PopupMenu (this);
  1.1517 +	branchContextMenu->insertItem (tr("Edit XLink"),branchLinksContextMenuDup);
  1.1518 +	connect( branchLinksContextMenuDup, SIGNAL( activated(int) ), this, SLOT( editEditXLink(int ) ) );
  1.1519 +
  1.1520 +	branchContextMenu->insertItem (tr("Goto XLink"),branchLinksContextMenu);
  1.1521 +	connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowXLink(int ) ) );
  1.1522 +	
  1.1523  	// Context menu for floatimage
  1.1524 -	floatimageContextMenu =new QPopupMenu (this);
  1.1525 -	saveImageFormatMenu=new QPopupMenu (this);
  1.1526 -	exportImageFormatMenu=new QPopupMenu (this);
  1.1527 +	floatimageContextMenu =new Q3PopupMenu (this);
  1.1528 +	saveImageFormatMenu=new Q3PopupMenu (this);
  1.1529 +	exportImageFormatMenu=new Q3PopupMenu (this);
  1.1530  
  1.1531 -	QStrList fmt = QImage::outputFormats();
  1.1532 +/* FIXME strange error
  1.1533 +    foreach (QByteArray format, QImageWriter::supportedImageFormats()) 
  1.1534 +	{
  1.1535 +        QString text = tr("%1...").arg(QString(format).toUpper());
  1.1536 +		saveImageFormatMenu->insertItem( text );
  1.1537 +		exportImageFormatMenu->insertItem( text );
  1.1538 +    }
  1.1539 +*/
  1.1540 +
  1.1541 +/* FIXME  not needed any longer
  1.1542 +	Q3StrList fmt = QImageWriter::supportedImageFormats();
  1.1543  	for (const char* f = fmt.first(); f; f = fmt.next()) 
  1.1544  	{
  1.1545  		saveImageFormatMenu->insertItem( f );
  1.1546  		exportImageFormatMenu->insertItem( f );
  1.1547  	}	
  1.1548 +*/	
  1.1549  	connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) );
  1.1550  	connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) );
  1.1551  	floatimageContextMenu->insertItem( tr("Save image"),saveImageFormatMenu );
  1.1552 @@ -819,39 +1386,48 @@
  1.1553  	actionEditCut->addTo( floatimageContextMenu );
  1.1554  
  1.1555  	floatimageContextMenu->insertSeparator();	
  1.1556 -    a = new QAction( tr( "Use for Export" ), QPixmap(), tr( "Use for Export"), 0, this, "useForExport" );
  1.1557 -	a->setToggleAction(true);
  1.1558 -    connect( a, SIGNAL( activated() ), this, SLOT( editToggleFloatExport() ) );
  1.1559 -    a->addTo( floatimageContextMenu);
  1.1560 -	actionEditToggleFloatExport=a;
  1.1561 +	actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
  1.1562  
  1.1563 +	exportMenu->insertItem ( tr("Export as")+" Image",exportImageFormatMenu);
  1.1564  
  1.1565 +	a = new QAction( "Open Office"+QString("..."), this);
  1.1566 +	a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " ));
  1.1567 +	connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
  1.1568 +	a->addTo (exportMenu);
  1.1569  
  1.1570 -	// Context menu for exports
  1.1571 -	exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu);
  1.1572 -
  1.1573 -    a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" );
  1.1574 -    connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
  1.1575 +	a = new QAction(  "Webpage (XHTML)...",this );
  1.1576 +	a->setShortcut (Qt::ALT + Qt::Key_X);
  1.1577 +	a->setStatusTip ( tr( "Export as")+" webpage (XHTML)");
  1.1578 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
  1.1579      a->addTo( exportMenu );
  1.1580  
  1.1581 -	a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ),  0, this, "exportXML" );
  1.1582 +    a = new QAction( "Text (ASCII)...", this);
  1.1583 +	a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ));
  1.1584 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
  1.1585 +	a->addTo( exportMenu );
  1.1586 +
  1.1587 +	a = new QAction( tr("KDE Bookmarks"), this);
  1.1588 +	a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" ));
  1.1589 +	connect( a, SIGNAL( activated() ), this, SLOT( fileExportKDEBookmarks() ) );
  1.1590 +	a->addTo (exportMenu);
  1.1591 +
  1.1592 +    a = new QAction( "Taskjuggler...", this );
  1.1593 +    a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ));
  1.1594 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) );
  1.1595 +	a->addTo( exportMenu );
  1.1596 +
  1.1597 +    a = new QAction( "LaTeX...", this);
  1.1598 +    a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ));
  1.1599 +    connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
  1.1600 +	a->addTo( exportMenu );
  1.1601 +
  1.1602 +	a = new QAction( "XML..." , this );
  1.1603 +	a->setStatusTip (tr( "Export as")+" XML");
  1.1604      connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
  1.1605      a->addTo( exportMenu );
  1.1606  	
  1.1607 -    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
  1.1608 -	{
  1.1609 -		a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export HTML" ), 0, this, "exportHTML" );
  1.1610 -		connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
  1.1611 -		a->addTo( exportMenu );
  1.1612 -	}
  1.1613 -
  1.1614 -	a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" ), ALT + Key_X, this, "exportXHTML" );
  1.1615 -    connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
  1.1616 -    a->addTo( exportMenu );
  1.1617 -
  1.1618 -	
  1.1619  	// Context menu for canvas
  1.1620 -	canvasContextMenu =new QPopupMenu (this);
  1.1621 +	canvasContextMenu =new Q3PopupMenu (this);
  1.1622  	actionEditMapInfo->addTo( canvasContextMenu );
  1.1623  	canvasContextMenu->insertSeparator();	
  1.1624  	actionGroupFormatLinkStyles->addTo( canvasContextMenu );
  1.1625 @@ -910,7 +1486,7 @@
  1.1626  
  1.1627  void Main::showEvent (QShowEvent * )
  1.1628  {
  1.1629 -	if (textEditor->showWithMain()) textEditor->show();
  1.1630 +	if (textEditor->showWithMain()) textEditor->showNormal();
  1.1631  }
  1.1632  
  1.1633  bool Main::reallyWriteDirectory(const QString &dir)
  1.1634 @@ -920,9 +1496,8 @@
  1.1635  	if (eList.first() =="..") eList.pop_front();	// remove "."
  1.1636  	if (!eList.isEmpty())
  1.1637  	{
  1.1638 -		QMessageBox mb( "VYM",
  1.1639 -			tr("The directory ") + dir + 
  1.1640 -			tr(" is not empty. Do you risk to overwrite its contents?"),
  1.1641 +		QMessageBox mb( __VYM,
  1.1642 +			tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?").arg(dir),
  1.1643  		QMessageBox::Warning,
  1.1644  		QMessageBox::Yes ,
  1.1645  		QMessageBox::Cancel | QMessageBox::Default,
  1.1646 @@ -945,9 +1520,9 @@
  1.1647  
  1.1648  QString Main::browseDirectory (const QString &caption)
  1.1649  {
  1.1650 -	QFileDialog fd(this,caption);
  1.1651 -	fd.setMode (QFileDialog::DirectoryOnly);
  1.1652 -	fd.setCaption("VYM - "+caption);
  1.1653 +	Q3FileDialog fd(this,caption);
  1.1654 +	fd.setMode (Q3FileDialog::DirectoryOnly);
  1.1655 +	fd.setCaption(__VYM " - "+caption);
  1.1656  	fd.show();
  1.1657  	
  1.1658  	if ( fd.exec() == QDialog::Accepted )
  1.1659 @@ -968,7 +1543,7 @@
  1.1660  void Main::newView() 
  1.1661  {
  1.1662      // Open a new view... have it delete when closed.
  1.1663 -    Main *m = new Main(0, 0, WDestructiveClose);
  1.1664 +    Main *m = new Main(0, 0, Qt::WDestructiveClose);
  1.1665      qApp->setMainWidget(m);
  1.1666      m->show();
  1.1667      qApp->setMainWidget(0);
  1.1668 @@ -995,18 +1570,17 @@
  1.1669  void Main::fileNew()
  1.1670  {
  1.1671  	QString fn="unnamed";
  1.1672 -	MapEditor* medit = new MapEditor (tabWidget, true);
  1.1673 +	MapEditor* medit = new MapEditor ( NULL,true);
  1.1674  	tabWidget->addTab (medit,fn);
  1.1675  	tabWidget->showPage(medit);
  1.1676  	medit->viewport()->setFocus();
  1.1677 +	// For the very first map we do not have flagrows yet...
  1.1678  	medit->select("mc:");
  1.1679  }
  1.1680  
  1.1681 -void Main::fileLoad(QString fn, const LoadMode &lmode)
  1.1682 +ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
  1.1683  {
  1.1684 -	// Error codes
  1.1685 -	enum errorCode {success,aborted};
  1.1686 -	errorCode err=success;
  1.1687 +	ErrorCode err=success;
  1.1688  	
  1.1689  	// fn is usually the archive, mapfile the file after uncompressing
  1.1690  	QString mapfile;
  1.1691 @@ -1026,15 +1600,15 @@
  1.1692  			if (me->getFilePath() == fn)
  1.1693  			{
  1.1694  				// Already there, ask for confirmation
  1.1695 -				QMessageBox mb( "VYM",
  1.1696 -					tr("The map ") + fn + tr ("\n is already opened."
  1.1697 +				QMessageBox mb( __VYM,
  1.1698 +					tr("The map %1\nis already opened."
  1.1699  					"Opening the same map in multiple editors may lead \n"
  1.1700  					"to confusion when finishing working with vym."
  1.1701 -					"Do you want to"),
  1.1702 +					"Do you want to").arg(fn),
  1.1703  					QMessageBox::Warning,
  1.1704  					QMessageBox::Yes | QMessageBox::Default,
  1.1705  					QMessageBox::Cancel | QMessageBox::Escape,
  1.1706 -					QMessageBox::QMessageBox::NoButton);
  1.1707 +					QMessageBox::NoButton);
  1.1708  				mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
  1.1709  				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
  1.1710  				switch( mb.exec() ) 
  1.1711 @@ -1045,7 +1619,7 @@
  1.1712  						break;
  1.1713  					case QMessageBox::Cancel:
  1.1714  						// do nothing
  1.1715 -						return;
  1.1716 +						return aborted;
  1.1717  						break;
  1.1718  				}
  1.1719  			}
  1.1720 @@ -1074,13 +1648,12 @@
  1.1721  		// from command line
  1.1722  		if (!QFile(fn).exists() )
  1.1723  		{
  1.1724 -			QMessageBox mb( "VYM",
  1.1725 -				tr("The map") + fn + 
  1.1726 -				tr(" does not exist.\n Do you want to create a new one?"),
  1.1727 +			QMessageBox mb( __VYM,
  1.1728 +				tr("This map does not exist:\n  %1\nDo you want to create a new one?").arg(fn),
  1.1729  				QMessageBox::Question,
  1.1730  				QMessageBox::Yes ,
  1.1731  				QMessageBox::Cancel | QMessageBox::Default,
  1.1732 -				QMessageBox::QMessageBox::NoButton );
  1.1733 +				QMessageBox::NoButton );
  1.1734  
  1.1735  			mb.setButtonText( QMessageBox::Yes, tr("Create"));
  1.1736  			mb.setButtonText( QMessageBox::No, tr("Cancel"));
  1.1737 @@ -1092,13 +1665,13 @@
  1.1738  					tabWidget->setTabLabel (currentMapEditor(),
  1.1739  						currentMapEditor()->getFileName() );
  1.1740  					statusBar()->message( "Created " + fn , statusbarTime );
  1.1741 -					return;
  1.1742 +					return success;
  1.1743  						
  1.1744  				case QMessageBox::Cancel:
  1.1745  					// don't create new map
  1.1746  					statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
  1.1747  					fileCloseMap();
  1.1748 -					return;
  1.1749 +					return aborted;
  1.1750  			}
  1.1751  		}	
  1.1752  
  1.1753 @@ -1112,130 +1685,101 @@
  1.1754  		QString tmpMapDir=mkdtemp(tmpdir1);
  1.1755  
  1.1756  		// Try to unzip file
  1.1757 -		Process *zipProc=new Process ();
  1.1758 -		zipProc->clearArguments();
  1.1759 -		zipProc->setWorkingDirectory (QDir(tmpMapDir));
  1.1760 -		zipProc->addArgument ("unzip");
  1.1761 -		zipProc->addArgument (fn );
  1.1762 -		zipProc->addArgument ("-d");
  1.1763 -		zipProc->addArgument (tmpMapDir);
  1.1764 -
  1.1765 -		if (!zipProc->start() )
  1.1766 +		err=unzipDir (tmpMapDir,fn);
  1.1767 +		if (err==nozip)
  1.1768  		{
  1.1769 -			QMessageBox::critical( 0, tr( "Critical Load Error" ),
  1.1770 -						   tr("Couldn't start unzip to decompress data."));
  1.1771 -			err=aborted;
  1.1772 -			
  1.1773 +			mapfile=fn;
  1.1774 +			me->setZipped(false);
  1.1775  		} else
  1.1776  		{
  1.1777 -			zipProc->waitFinished();
  1.1778 -			if (!zipProc->normalExit() )
  1.1779 +			me->setZipped(true);
  1.1780 +			
  1.1781 +			// Look for mapname.xml
  1.1782 +			mapfile= fn.left(fn.findRev(".",-1,true));
  1.1783 +			mapfile=mapfile.section( '/', -1 );
  1.1784 +			QFile file( tmpMapDir + "/" + mapfile + ".xml");
  1.1785 +			if (!file.exists() )
  1.1786  			{
  1.1787 -				QMessageBox::critical( 0, tr( "Critical Load Error" ),
  1.1788 -							   tr("unzip didn't exit normally") +
  1.1789 -							   zipProc->getErrout() );
  1.1790 -				err=aborted;
  1.1791 -			} else
  1.1792 -			{
  1.1793 -				if (zipProc->exitStatus()>0)
  1.1794 +				// mapname.xml does not exist, well, 
  1.1795 +				// maybe some renamed the mapname.vym file...
  1.1796 +				// Try to find any .xml in the toplevel 
  1.1797 +				// directory of the .vym file
  1.1798 +				QStringList flist=QDir (tmpMapDir).entryList("*.xml");
  1.1799 +				if (flist.count()==1) 
  1.1800  				{
  1.1801 -					if (zipProc->exitStatus()==9)
  1.1802 -					{
  1.1803 -						// no zipped file, but maybe .xml or old version? Try again.
  1.1804 -						mapfile=fn;
  1.1805 -						me->setZipped(false);
  1.1806 -					}	
  1.1807 -					else	
  1.1808 -					{
  1.1809 -						QMessageBox::critical( 0, tr( "Critical Load Error" ),
  1.1810 -									   QString("unzip exit code:  %1").arg(zipProc->exitStatus() ) +
  1.1811 -									   zipProc->getErrout() );
  1.1812 -						err=aborted;
  1.1813 -					}
  1.1814 +					// Only one entry, take this one
  1.1815 +					mapfile=tmpMapDir + "/"+flist.first();
  1.1816  				} else
  1.1817 -				{	// Uncompressing was successfull,
  1.1818 -					// load from uncompressed temporary directory
  1.1819 -
  1.1820 -					me->setZipped(true);
  1.1821 -
  1.1822 +				{
  1.1823 +					for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
  1.1824 +						*it=tmpMapDir + "/" + *it;
  1.1825 +					// TODO Multiple entries, load all (but only the first one into this ME)
  1.1826 +					//mainWindow->fileLoadFromTmp (flist);
  1.1827 +					//returnCode=1;	// Silently forget this attempt to load
  1.1828 +					qWarning ("MainWindow::load (fn)  multimap found...");
  1.1829 +				}	
  1.1830  					
  1.1831 -					// Look for mapname.xml
  1.1832 -					mapfile= fn.left(fn.findRev(".",-1,true));
  1.1833 -					mapfile=mapfile.section( '/', -1 );
  1.1834 -					QFile file( tmpMapDir + "/" + mapfile + ".xml");
  1.1835 -					if (!file.exists() )
  1.1836 -					{
  1.1837 -						// mapname.xml does not exist, well, 
  1.1838 -						// maybe some renamed the mapname.vym file...
  1.1839 -						// Try to find any .xml in the toplevel 
  1.1840 -						// directory of the .vym file
  1.1841 -						QStringList flist=QDir (tmpMapDir).entryList("*.xml");
  1.1842 -						if (flist.count()==1) 
  1.1843 -						{
  1.1844 -							// Only one entry, take this one
  1.1845 -							mapfile=tmpMapDir + "/"+flist.first();
  1.1846 -						} else
  1.1847 -						{
  1.1848 -							for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
  1.1849 -								*it=tmpMapDir + "/" + *it;
  1.1850 -							// FIXME	
  1.1851 -							// Multiple entries, load all (but only the first one into this ME)
  1.1852 -							//mainWindow->fileLoadFromTmp (flist);
  1.1853 -							//returnCode=1;	// Silently forget this attempt to load
  1.1854 -							qWarning ("MainWindow::load (fn)  multimap found...");
  1.1855 -						}	
  1.1856 -							
  1.1857 -						if (flist.isEmpty() )
  1.1858 -						{
  1.1859 -							QMessageBox::critical( 0, tr( "Critical Load Error" ),
  1.1860 -									   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
  1.1861 -							err=aborted;				   
  1.1862 -						}	
  1.1863 -					} //file doesn't exist	
  1.1864 -					else
  1.1865 -						mapfile=file.name();
  1.1866 -				} // Uncompressing successfull
  1.1867 -			}
  1.1868 +				if (flist.isEmpty() )
  1.1869 +				{
  1.1870 +					QMessageBox::critical( 0, tr( "Critical Load Error" ),
  1.1871 +							   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
  1.1872 +					err=aborted;				   
  1.1873 +				}	
  1.1874 +			} //file doesn't exist	
  1.1875 +			else
  1.1876 +				mapfile=file.name();
  1.1877  		}
  1.1878  
  1.1879 -		// Finally load map into mapEditor
  1.1880 -		me->setFilePath (mapfile,fn);
  1.1881 -		if (me->load(mapfile,lmode))
  1.1882 -			err=aborted;
  1.1883 +		if (err!=aborted)
  1.1884 +		{
  1.1885 +			// Save existing filename in case  we import
  1.1886 +			QString fn_org=me->getFilePath();
  1.1887  
  1.1888 -		// Delete tmpDir
  1.1889 -		system ( "rm -rf "+tmpMapDir);
  1.1890 +			// Finally load map into mapEditor
  1.1891 +			me->setFilePath (mapfile,fn);
  1.1892 +			err=me->load(mapfile,lmode);
  1.1893  
  1.1894 -		// Check for errors
  1.1895 -		if (err==success) 
  1.1896 +			// Restore old (maybe empty) filepath, if this is an import
  1.1897 +			if (lmode!=NewMap)
  1.1898 +				me->setFilePath (fn_org);
  1.1899 +		}	
  1.1900 +
  1.1901 +		// Finally check for errors and go home
  1.1902 +		if (err==aborted) 
  1.1903 +		{
  1.1904 +			if (lmode==NewMap) fileCloseMap();
  1.1905 +			statusBar()->message( "Could not load " + fn, statusbarTime );
  1.1906 +		} else 
  1.1907  		{
  1.1908  			if (lmode==NewMap)
  1.1909  			{
  1.1910  				me->setFilePath (fn);
  1.1911  				tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
  1.1912 -				lastMaps.prepend(me->getFilePath() );
  1.1913 -				setupLastMapsMenu();
  1.1914 +				if (fn.left(9)!="/tmp/vym-")
  1.1915 +				{
  1.1916 +					// Only append to lastMaps if not loaded from a tmpDir
  1.1917 +					// e.g. imported bookmarks are in a tmpDir
  1.1918 +					lastMaps.prepend(me->getFilePath() );
  1.1919 +					setupLastMapsMenu();
  1.1920 +				}
  1.1921  				actionFilePrint->setEnabled (true);
  1.1922  			}	
  1.1923  			statusBar()->message( "Loaded " + fn, statusbarTime );
  1.1924 -			return;
  1.1925 -		} else 
  1.1926 -		{
  1.1927 -			if (lmode==NewMap)
  1.1928 -				fileCloseMap();
  1.1929  		}	
  1.1930  
  1.1931 -
  1.1932 +		// Delete tmpDir
  1.1933 +		removeDir (QDir(tmpMapDir));
  1.1934  	}
  1.1935 -	statusBar()->message( "Could not load " + fn, statusbarTime );
  1.1936 +	return err;
  1.1937  }
  1.1938  
  1.1939  
  1.1940  void Main::fileLoad(const LoadMode &lmode)
  1.1941  {
  1.1942 -	QFileDialog *fd=new QFileDialog( this);
  1.1943 +	Q3FileDialog *fd=new Q3FileDialog( this);
  1.1944  	if (!lastFileDir.isEmpty()) 
  1.1945  		fd->setDir (lastFileDir);
  1.1946 +	fd->setMode (Q3FileDialog::ExistingFiles);
  1.1947  	fd->addFilter ("XML (*.xml)");
  1.1948  	fd->addFilter ("VYM map (*.vym *.vyp)");
  1.1949  	switch (lmode)
  1.1950 @@ -1256,9 +1800,16 @@
  1.1951  	if ( fd->exec() == QDialog::Accepted )
  1.1952  	{
  1.1953  		lastFileDir=fd->dirPath();
  1.1954 -        fn = fd->selectedFile();
  1.1955 -		fileLoad(fn, lmode);				   
  1.1956 +	    QStringList flist = fd->selectedFiles();
  1.1957 +		QStringList::Iterator it = flist.begin();
  1.1958 +		while( it != flist.end() ) 
  1.1959 +		{
  1.1960 +			fn = *it;
  1.1961 +			fileLoad(*it, lmode);				   
  1.1962 +			++it;
  1.1963 +		}
  1.1964  	}
  1.1965 +	delete (fd);
  1.1966  }
  1.1967  
  1.1968  void Main::fileLoad()
  1.1969 @@ -1268,7 +1819,7 @@
  1.1970  
  1.1971  void Main::fileLoadLast(int i)
  1.1972  {
  1.1973 -	fileLoad(*lastMaps.at(lastMapsMenu->indexOf (i) ),NewMap);			   
  1.1974 +	fileLoad(QString(*lastMaps.at(lastMapsMenu->indexOf (i)) ),NewMap);			   
  1.1975  }
  1.1976  
  1.1977  void Main::fileSave(const SaveMode &savemode)
  1.1978 @@ -1277,16 +1828,16 @@
  1.1979  	QString tmpMapDir;
  1.1980  	
  1.1981  	// Error codes
  1.1982 -	enum errorCode {success,aborted};
  1.1983 -	errorCode err=success;
  1.1984 +	ErrorCode err=success;
  1.1985  	
  1.1986  	QString safeFilePath;
  1.1987  
  1.1988  	bool saveZipped=currentMapEditor()->saveZipped();
  1.1989  
  1.1990 -	if (currentMapEditor())
  1.1991 +	MapEditor *	me=currentMapEditor();
  1.1992 +	if (me)
  1.1993  	{
  1.1994 -		QString fn=currentMapEditor()->getFilePath();
  1.1995 +		QString fn=me->getFilePath();
  1.1996  		// filename=unnamed, filepath="" in constructor...
  1.1997  		if ( !fn.isEmpty() ) 
  1.1998  		{	
  1.1999 @@ -1302,12 +1853,11 @@
  1.2000  			// Look, if we should zip the data:
  1.2001  			if (!saveZipped)
  1.2002  			{
  1.2003 -				QMessageBox mb( "VYM",
  1.2004 -					tr("The map ") + fn + 
  1.2005 -					tr ("\ndid not use the compressed "
  1.2006 +				QMessageBox mb( __VYM,
  1.2007 +					tr("The map %1\ndid not use the compressed "
  1.2008  					"vym file format.\nWriting it uncompressed will also write images \n"
  1.2009  					"and flags and thus may overwrite files in the "
  1.2010 -					"given directory\n\nDo you want to write the map"),
  1.2011 +					"given directory\n\nDo you want to write the map").arg(fn),
  1.2012  					QMessageBox::Warning,
  1.2013  					QMessageBox::Yes | QMessageBox::Default,
  1.2014  					QMessageBox::No ,
  1.2015 @@ -1337,57 +1887,22 @@
  1.2016  				char tmpdir1[]="/tmp/vym-XXXXXX";	
  1.2017  				tmpMapDir=mkdtemp(tmpdir1);
  1.2018  			
  1.2019 -				safeFilePath=currentMapEditor()->getFilePath();
  1.2020 -				currentMapEditor()->setFilePath (tmpMapDir+"/"+
  1.2021 -					currentMapEditor()->getMapName()+ ".xml",
  1.2022 +				safeFilePath=me->getFilePath();
  1.2023 +				me->setFilePath (tmpMapDir+"/"+
  1.2024 +					me->getMapName()+ ".xml",
  1.2025  					safeFilePath);
  1.2026 -				currentMapEditor()->save (savemode);
  1.2027 -				currentMapEditor()->setFilePath (safeFilePath);
  1.2028 +				me->save (savemode);
  1.2029 +				me->setFilePath (safeFilePath);
  1.2030  				
  1.2031 -				// zip the temporary directory
  1.2032 -				Process *zipProc=new Process ();
  1.2033 -				zipProc->clearArguments();
  1.2034 -				zipProc->setWorkingDirectory (QDir(tmpMapDir));
  1.2035 -				zipProc->addArgument ("zip");
  1.2036 -				zipProc->addArgument ("-r");
  1.2037 -				zipProc->addArgument (fn);
  1.2038 -				zipProc->addArgument (".");
  1.2039 -
  1.2040 -				if (!zipProc->start() )
  1.2041 -				{	
  1.2042 -					// zip could not be started
  1.2043 -					QMessageBox::critical( 0, tr( "Critical Save Error" ),
  1.2044 -								   tr("Couldn't start zip to compress data."));
  1.2045 -					err=aborted;
  1.2046 -				} else
  1.2047 -				{
  1.2048 -					// zip could be started
  1.2049 -					zipProc->waitFinished();
  1.2050 -					if (!zipProc->normalExit() )
  1.2051 -					{
  1.2052 -						QMessageBox::critical( 0, tr( "Critical Save Error" ),
  1.2053 -									   tr("zip didn't exit normally")+
  1.2054 -									   "\n" + zipProc->getErrout());
  1.2055 -						err=aborted;
  1.2056 -					} else
  1.2057 -					{
  1.2058 -						if (zipProc->exitStatus()>0)
  1.2059 -						{
  1.2060 -							QMessageBox::critical( 0, tr( "Critical Save Error" ),
  1.2061 -									   QString("zip exit code:  %1").arg(zipProc->exitStatus() )+
  1.2062 -									   "\n" + zipProc->getErrout() );
  1.2063 -							err=aborted;
  1.2064 -						}
  1.2065 -					}
  1.2066 -				}	// zip could be started
  1.2067 +				zipDir (tmpMapDir,fn);
  1.2068  			} // save zipped
  1.2069  			else
  1.2070  			{
  1.2071  				// Save unzipped. 
  1.2072 -				safeFilePath=currentMapEditor()->getFilePath();
  1.2073 -				currentMapEditor()->setFilePath (fn, safeFilePath);
  1.2074 -				currentMapEditor()->save (savemode);
  1.2075 -				currentMapEditor()->setFilePath (safeFilePath);
  1.2076 +				safeFilePath=me->getFilePath();
  1.2077 +				me->setFilePath (fn, safeFilePath);
  1.2078 +				me->save (savemode);
  1.2079 +				me->setFilePath (safeFilePath);
  1.2080  			} // save zipped 	
  1.2081  		} // filepath available
  1.2082  		else
  1.2083 @@ -1399,19 +1914,20 @@
  1.2084  		}
  1.2085      }
  1.2086  
  1.2087 -	if (currentMapEditor()->saveZipped())
  1.2088 -	{
  1.2089 +	if (saveZipped && !tmpMapDir.isEmpty())
  1.2090  		// Delete tmpDir
  1.2091 -		system ( "rm -rf "+ tmpMapDir );
  1.2092 -	} 
  1.2093 +		removeDir (QDir(tmpMapDir));
  1.2094  
  1.2095  	if (err==success)
  1.2096 +	{
  1.2097  		statusBar()->message( 
  1.2098 -			tr("Saved")+" " + currentMapEditor()->getFilePath(), 
  1.2099 +			tr("Saved  %1").arg(me->getFilePath()), 
  1.2100  			statusbarTime );
  1.2101 -	else		
  1.2102 +		lastMaps.prepend(me->getFilePath() );
  1.2103 +		setupLastMapsMenu();
  1.2104 +	} else		
  1.2105  		statusBar()->message( 
  1.2106 -			tr("Couldn't save")+" " + currentMapEditor()->getFilePath(), 
  1.2107 +			tr("Couldn't save ").arg(me->getFilePath()), 
  1.2108  			statusbarTime );
  1.2109  }
  1.2110  
  1.2111 @@ -1422,26 +1938,25 @@
  1.2112  
  1.2113  void Main::fileSaveAs(const SaveMode& savemode)
  1.2114  {
  1.2115 -	QString tmpMapDir;
  1.2116  	QString fn;
  1.2117  
  1.2118  	if (currentMapEditor())
  1.2119  	{
  1.2120  		if (savemode==CompleteMap)
  1.2121 -			fn = QFileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
  1.2122 +			fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
  1.2123  		else		
  1.2124 -			fn = QFileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
  1.2125 +			fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
  1.2126  		if ( !fn.isEmpty() ) 
  1.2127  		{
  1.2128  			// Check for existing file
  1.2129  			if (QFile (fn).exists())
  1.2130  			{
  1.2131 -				QMessageBox mb( "VYM",
  1.2132 -					tr("The file ") + fn + tr ("\nexists already. Do you want to"),
  1.2133 +				QMessageBox mb( __VYM,
  1.2134 +					tr("The file %1\nexists already. Do you want to").arg(fn),
  1.2135  					QMessageBox::Warning,
  1.2136  					QMessageBox::Yes | QMessageBox::Default,
  1.2137  					QMessageBox::Cancel | QMessageBox::Escape,
  1.2138 -					QMessageBox::QMessageBox::NoButton);
  1.2139 +					QMessageBox::NoButton);
  1.2140  				mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  1.2141  				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
  1.2142  				switch( mb.exec() ) 
  1.2143 @@ -1477,8 +1992,9 @@
  1.2144  			fileSave(savemode);
  1.2145  
  1.2146  			// Set name of tab
  1.2147 -			tabWidget->setTabLabel (currentMapEditor(),
  1.2148 -				currentMapEditor()->getFileName() );
  1.2149 +			if (savemode==CompleteMap)
  1.2150 +				tabWidget->setTabLabel (currentMapEditor(),
  1.2151 +					currentMapEditor()->getFileName() );
  1.2152  			return;
  1.2153  		} 
  1.2154  	}
  1.2155 @@ -1489,6 +2005,73 @@
  1.2156  	fileSaveAs (CompleteMap);
  1.2157  }
  1.2158  
  1.2159 +void Main::fileImportKDEBookmarks()
  1.2160 +{
  1.2161 +	ImportKDEBookmarks im;
  1.2162 +	im.transform();
  1.2163 +	if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
  1.2164 +		currentMapEditor()->setFilePath ("");
  1.2165 +}
  1.2166 +
  1.2167 +void Main::fileImportFirefoxBookmarks()
  1.2168 +{
  1.2169 +	Q3FileDialog *fd=new Q3FileDialog( this);
  1.2170 +	fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox");
  1.2171 +	fd->setMode (Q3FileDialog::ExistingFiles);
  1.2172 +	fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)");
  1.2173 +	fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks"));
  1.2174 +	fd->show();
  1.2175 +
  1.2176 +	if ( fd->exec() == QDialog::Accepted )
  1.2177 +	{
  1.2178 +		ImportFirefoxBookmarks im;
  1.2179 +	    QStringList flist = fd->selectedFiles();
  1.2180 +		QStringList::Iterator it = flist.begin();
  1.2181 +		while( it != flist.end() ) 
  1.2182 +		{
  1.2183 +			im.setFile (*it);
  1.2184 +			if (im.transform() && 
  1.2185 +				success==fileLoad (im.getTransformedFile(),NewMap) && 
  1.2186 +				currentMapEditor() )
  1.2187 +				currentMapEditor()->setFilePath ("");
  1.2188 +			++it;
  1.2189 +		}
  1.2190 +	}
  1.2191 +	delete (fd);
  1.2192 +}
  1.2193 +
  1.2194 +void Main::fileImportMM()
  1.2195 +{
  1.2196 +	ImportMM im;
  1.2197 +
  1.2198 +	Q3FileDialog *fd=new Q3FileDialog( this);
  1.2199 +	if (!lastFileDir.isEmpty()) 
  1.2200 +		fd->setDir (lastFileDir);
  1.2201 +	fd->setMode (Q3FileDialog::ExistingFiles);
  1.2202 +	fd->addFilter ("Mind Manager (*.mmap)");
  1.2203 +	fd->setCaption(tr("Import")+" "+"Mind Manager");
  1.2204 +	fd->show();
  1.2205 +
  1.2206 +	if ( fd->exec() == QDialog::Accepted )
  1.2207 +	{
  1.2208 +		lastFileDir=fd->dirPath();
  1.2209 +	    QStringList flist = fd->selectedFiles();
  1.2210 +		QStringList::Iterator it = flist.begin();
  1.2211 +		while( it != flist.end() ) 
  1.2212 +		{
  1.2213 +			im.setFile (*it);
  1.2214 +			if (im.transform() && 
  1.2215 +				success==fileLoad (im.getTransformedFile(),NewMap) && 
  1.2216 +				currentMapEditor() )
  1.2217 +				currentMapEditor()->setFilePath ("");
  1.2218 +
  1.2219 +			++it;
  1.2220 +		}
  1.2221 +	}
  1.2222 +	delete (fd);
  1.2223 +
  1.2224 +}
  1.2225 +
  1.2226  void Main::fileImportDir()
  1.2227  {
  1.2228  	if (currentMapEditor())
  1.2229 @@ -1505,32 +2088,16 @@
  1.2230  	}	
  1.2231  }
  1.2232  
  1.2233 -void Main::fileExportHTML()
  1.2234 -{
  1.2235 -	if (currentMapEditor())
  1.2236 -	{
  1.2237 -		ExportHTMLDialog dia(this);
  1.2238 -		
  1.2239 -		if (dia.exec()==QDialog::Accepted)
  1.2240 -		{
  1.2241 -			QString dir=dia.getDir();
  1.2242 -			if (reallyWriteDirectory(dir) )
  1.2243 -			{
  1.2244 -				currentMapEditor()->exportXML (dia.getDir() );
  1.2245 -				dia.doExport(currentMapEditor()->getMapName() );
  1.2246 -			}	
  1.2247 -		}
  1.2248 -	}	
  1.2249 -}
  1.2250  
  1.2251  void Main::fileExportXHTML()
  1.2252  {
  1.2253 +	MapEditor *me=currentMapEditor();
  1.2254  	QString dir;
  1.2255 -	if (currentMapEditor())
  1.2256 +	if (me)
  1.2257  	{
  1.2258  		ExportXHTMLDialog dia(this);
  1.2259 -		dia.setFilePath (currentMapEditor()->getFilePath() );
  1.2260 -		dia.setMapName (currentMapEditor()->getMapName() );
  1.2261 +		dia.setFilePath (me->getFilePath() );
  1.2262 +		dia.setMapName (me->getMapName() );
  1.2263  		dia.readSettings();
  1.2264  		
  1.2265  		if (dia.exec()==QDialog::Accepted)
  1.2266 @@ -1546,10 +2113,10 @@
  1.2267  
  1.2268  			if (ok)
  1.2269  			{
  1.2270 -				currentMapEditor()->exportXML (dia.getDir() );
  1.2271 -				dia.doExport(currentMapEditor()->getMapName() );
  1.2272 +				me->exportXML (dia.getDir() );
  1.2273 +				dia.doExport(me->getMapName() );
  1.2274  				if (dia.hasChanged())
  1.2275 -					currentMapEditor()->setChanged();
  1.2276 +					me->setChanged();
  1.2277  			}	
  1.2278  		}
  1.2279  	}	
  1.2280 @@ -1557,23 +2124,103 @@
  1.2281  
  1.2282  void Main::fileExportImage(int item)
  1.2283  {
  1.2284 -	if (currentMapEditor())
  1.2285 +	MapEditor *me=currentMapEditor();
  1.2286 +	if (me)
  1.2287  	{
  1.2288 -		QString fn = QFileDialog::getSaveFileName( QString::null, "Image  (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
  1.2289 +		QString fn = Q3FileDialog::getSaveFileName( QString::null, "Image  (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
  1.2290  							   this );
  1.2291  		if ( !fn.isEmpty() ) 
  1.2292 -		{
  1.2293 -			currentMapEditor()->exportImage(fn,item);
  1.2294 -		} else {
  1.2295 -			statusBar()->message( tr("Couldn't save") + fn, statusbarTime );
  1.2296 -		}
  1.2297 +			me->exportImage(fn,item);
  1.2298 +		else 
  1.2299 +			statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime );
  1.2300 +		
  1.2301  	}
  1.2302  }
  1.2303  
  1.2304  void Main::fileExportASCII()
  1.2305  {
  1.2306 -	if (currentMapEditor())
  1.2307 -		currentMapEditor()->exportASCII();	
  1.2308 +	MapEditor *me=currentMapEditor();
  1.2309 +	if (me)
  1.2310 +	{
  1.2311 +		ExportASCII ex;
  1.2312 +		ex.setMapCenter(me->getMapCenter());
  1.2313 +		ex.addFilter ("TXT (*.txt)");
  1.2314 +		ex.setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
  1.2315 +		if (ex.execDialog() ) 
  1.2316 +		{
  1.2317 +			me->setExportMode(true);
  1.2318 +			ex.doExport();
  1.2319 +			me->setExportMode(false);
  1.2320 +		}
  1.2321 +	}
  1.2322 +}
  1.2323 +
  1.2324 +void Main::fileExportLaTeX()
  1.2325 +{
  1.2326 +	MapEditor *me=currentMapEditor();
  1.2327 +	if (me)
  1.2328 +	{
  1.2329 +		ExportLaTeX ex;
  1.2330 +		ex.setMapCenter(me->getMapCenter());
  1.2331 +		ex.addFilter ("Tex (*.tex)");
  1.2332 +		ex.setCaption(__VYM " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
  1.2333 +		if (ex.execDialog() ) 
  1.2334 +		{
  1.2335 +			me->setExportMode(true);
  1.2336 +			ex.doExport();
  1.2337 +			me->setExportMode(false);
  1.2338 +		}
  1.2339 +	}
  1.2340 +}
  1.2341 +
  1.2342 +void Main::fileExportKDEBookmarks()
  1.2343 +{
  1.2344 +	ExportKDEBookmarks ex;
  1.2345 +	MapEditor *me=currentMapEditor();
  1.2346 +	if (me)
  1.2347 +	{
  1.2348 +		ex.setMapCenter (me->getMapCenter() );
  1.2349 +		ex.doExport();
  1.2350 +	}	
  1.2351 +}
  1.2352 +
  1.2353 +void Main::fileExportTaskjuggler()
  1.2354 +{
  1.2355 +	ExportTaskjuggler ex;
  1.2356 +	MapEditor *me=currentMapEditor();
  1.2357 +	if (me)
  1.2358 +	{
  1.2359 +		ex.setMapCenter (me->getMapCenter() );
  1.2360 +		ex.setCaption ( __VYM " - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
  1.2361 +		ex.addFilter ("Taskjuggler (*.tjp)");
  1.2362 +		if (ex.execDialog() ) 
  1.2363 +		{
  1.2364 +			me->setExportMode(true);
  1.2365 +			ex.doExport();
  1.2366 +			me->setExportMode(false);
  1.2367 +		}
  1.2368 +	}	
  1.2369 +}
  1.2370 +
  1.2371 +void Main::fileExportOOPresentation()
  1.2372 +{
  1.2373 +	ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office");
  1.2374 +	// FIXME add extra info in dialog
  1.2375 +	//ImagePreview *p =new ImagePreview (fd);
  1.2376 +	//fd->setContentsPreviewEnabled( TRUE );
  1.2377 +	//fd->setContentsPreview( p, p );
  1.2378 +	//fd->setPreviewMode( QFileDialog::Contents );
  1.2379 +	fd->setCaption(__VYM " - " +tr("Export to")+" Open Office");
  1.2380 +	//fd->setDir (lastImageDir);
  1.2381 +	fd->show();
  1.2382 +
  1.2383 +	if ( fd->exec() == QDialog::Accepted )
  1.2384 +	{
  1.2385 +		QString fn=fd->selectedFile();
  1.2386 +		//lastImageDir=fn.left(fn.findRev ("/"));
  1.2387 +		if (currentMapEditor())
  1.2388 +			currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());	
  1.2389 +	}
  1.2390  }
  1.2391  
  1.2392  void Main::fileCloseMap()
  1.2393 @@ -1582,9 +2229,8 @@
  1.2394  	{
  1.2395  		if (currentMapEditor()->hasChanged())
  1.2396  		{
  1.2397 -			QMessageBox mb( "VYM",
  1.2398 -				tr("The map ") + currentMapEditor()->getFileName() +
  1.2399 -				tr(" has been modified but not saved yet. Do you want to"),
  1.2400 +			QMessageBox mb( __VYM,
  1.2401 +				tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
  1.2402  				QMessageBox::Warning,
  1.2403  				QMessageBox::Yes | QMessageBox::Default,
  1.2404  				QMessageBox::No,
  1.2405 @@ -1632,7 +2278,7 @@
  1.2406  		if (me->isUnsaved())
  1.2407  		{
  1.2408  			tabWidget->setCurrentPage(i);
  1.2409 -			QMessageBox mb( "VYM",
  1.2410 +			QMessageBox mb( __VYM,
  1.2411  				tr("This map is not saved yet. Do you want to"),
  1.2412  				QMessageBox::Warning,
  1.2413  				QMessageBox::Yes | QMessageBox::Default,
  1.2414 @@ -1641,12 +2287,6 @@
  1.2415  			mb.setButtonText( QMessageBox::Yes, tr("Save map") );
  1.2416  			mb.setButtonText( QMessageBox::No, tr("Discard changes") );
  1.2417  			mb.show();
  1.2418 -			// Call undocumented function: setActiveWindow is only
  1.2419 -			// possible, if widget is visible. This depends on
  1.2420 -			// windowmanager...
  1.2421 -#if defined(Q_OS_LINUX)
  1.2422 -			qt_wait_for_window_manager( this);
  1.2423 -#endif			
  1.2424  			mb.setActiveWindow();
  1.2425  			switch( mb.exec() ) {
  1.2426  				case QMessageBox::Yes:
  1.2427 @@ -1671,8 +2311,10 @@
  1.2428  		currentMapEditor()->undo();
  1.2429  }
  1.2430  
  1.2431 -void Main::editRedo()	    // TODO
  1.2432 +void Main::editRedo()	   
  1.2433  {
  1.2434 +	if (currentMapEditor())
  1.2435 +		currentMapEditor()->redo();
  1.2436  }
  1.2437  
  1.2438  void Main::editCopy()
  1.2439 @@ -1697,13 +2339,6 @@
  1.2440  {
  1.2441  	findWindow->popup();
  1.2442  	findWindow->raise();
  1.2443 -
  1.2444 -	// Call undocumented function: setActiveWindow is only
  1.2445 -	// possible, if widget is visible. This depends on
  1.2446 -	// windowmanager...
  1.2447 -#if defined(Q_OS_LINUX)
  1.2448 -	qt_wait_for_window_manager( this);
  1.2449 -#endif	
  1.2450  	findWindow->setActiveWindow();
  1.2451  }
  1.2452  
  1.2453 @@ -1717,8 +2352,7 @@
  1.2454  	} else
  1.2455  	{
  1.2456  		QMessageBox::information( findWindow, tr( "VYM -Information:" ),
  1.2457 -							   tr("No matches found for ")+
  1.2458 -							   "'<b>"+s+"</b>'");
  1.2459 +							   tr("No matches found for \"%1\"").arg(s));
  1.2460  	}	
  1.2461  }
  1.2462  
  1.2463 @@ -1729,8 +2363,70 @@
  1.2464  
  1.2465  void Main::editOpenURL()
  1.2466  {
  1.2467 +	// Open new browser
  1.2468  	if (currentMapEditor())
  1.2469 -	    currentMapEditor()->openURL();
  1.2470 +	{	
  1.2471 +	    QString url=currentMapEditor()->getURL();
  1.2472 +		if (url=="") return;
  1.2473 +		QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
  1.2474 +		procBrowser = new Q3Process( this );
  1.2475 +
  1.2476 +		procBrowser->addArgument( browser);
  1.2477 +		procBrowser->addArgument( url);
  1.2478 +
  1.2479 +		if ( !procBrowser->start() ) 
  1.2480 +		{
  1.2481 +			// try to set path to browser
  1.2482 +			QMessageBox::warning(0, 
  1.2483 +				tr("Warning"),
  1.2484 +				tr("Couldn't find a viewer to open %1.\n").arg(url)+
  1.2485 +				tr("Please use Settings->")+tr("Set application to open an URL"));
  1.2486 +			settingsURL() ; 
  1.2487 +		}	
  1.2488 +	}	
  1.2489 +}
  1.2490 +void Main::editOpenURLTab()
  1.2491 +{
  1.2492 +	if (currentMapEditor())
  1.2493 +	{	
  1.2494 +	    QString url=currentMapEditor()->getURL();
  1.2495 +		if (url=="") return;
  1.2496 +		QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
  1.2497 +		if (procBrowser && procBrowser->isRunning())
  1.2498 +		{
  1.2499 +			if (browser.contains("konqueror"))
  1.2500 +			{
  1.2501 +				// Try to open new tab in existing konqueror started previously by vym
  1.2502 +				Q3Process *p=new Q3Process (this);
  1.2503 +				p->addArgument ("dcop");
  1.2504 +				p->addArgument (QString("konqueror-%1").arg(procBrowser->processIdentifier()));
  1.2505 +				p->addArgument ("konqueror-mainwindow#1");
  1.2506 +				p->addArgument ("newTab");
  1.2507 +				p->addArgument (url);
  1.2508 +				if ( !p->start() ) 
  1.2509 +					// try to set browser
  1.2510 +					QMessageBox::warning(0, 
  1.2511 +						tr("Warning"),
  1.2512 +						tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
  1.2513 +				return;		
  1.2514 +			} else if (browser.contains ("firefox") || browser.contains ("mozilla") )
  1.2515 +			{
  1.2516 +				// Try to open new tab in firefox
  1.2517 +				Q3Process *p=new Q3Process (this);
  1.2518 +				p->addArgument (browser);
  1.2519 +				p->addArgument ("-remote");
  1.2520 +				p->addArgument (QString("openurl(%1,new-tab)").arg(url));
  1.2521 +				if ( !p->start() ) 
  1.2522 +					// try to set browser
  1.2523 +					QMessageBox::warning(0, 
  1.2524 +						tr("Warning"),
  1.2525 +						tr("Couldn't start %1 to open a new tab").arg(browser));
  1.2526 +				return;		
  1.2527 +			}
  1.2528 +		}
  1.2529 +		// Open new browser
  1.2530 +		editOpenURL();
  1.2531 +	}	
  1.2532  }
  1.2533  
  1.2534  void Main::editURL()
  1.2535 @@ -1751,6 +2447,12 @@
  1.2536  	    currentMapEditor()->editBugzilla2URL();
  1.2537  }
  1.2538  
  1.2539 +void Main::editFATE2URL()
  1.2540 +{
  1.2541 +	if (currentMapEditor())
  1.2542 +	    currentMapEditor()->editFATE2URL();
  1.2543 +}
  1.2544 +
  1.2545  void Main::editOpenVymLink()
  1.2546  {
  1.2547  	// Get current path to map
  1.2548 @@ -1776,7 +2478,7 @@
  1.2549  		{
  1.2550  			if (!QFile(currentVymLink).exists() )
  1.2551  				QMessageBox::critical( 0, tr( "Critical Error" ),
  1.2552 -				   tr("Couldn't open map " +currentVymLink)+".");
  1.2553 +				   tr("Couldn't open map %1").arg(currentVymLink));
  1.2554  			else
  1.2555  			{
  1.2556  				fileLoad (currentVymLink, NewMap);
  1.2557 @@ -1800,6 +2502,12 @@
  1.2558  		currentMapEditor()->deleteVymLink();	
  1.2559  }
  1.2560  
  1.2561 +void Main::editToggleHideExport()
  1.2562 +{
  1.2563 +	if (currentMapEditor())
  1.2564 +		currentMapEditor()->toggleHideExport();	
  1.2565 +}
  1.2566 +
  1.2567  void Main::editMapInfo()
  1.2568  {
  1.2569  	if (currentMapEditor())
  1.2570 @@ -1846,6 +2554,12 @@
  1.2571  		currentMapEditor()->addNewBranch(0);
  1.2572  }
  1.2573  
  1.2574 +void Main::editNewBranchHere()
  1.2575 +{
  1.2576 +	if (currentMapEditor())
  1.2577 +		currentMapEditor()->addNewBranchHere();
  1.2578 +}
  1.2579 +
  1.2580  void Main::editNewBranchAbove()
  1.2581  {
  1.2582  	if (currentMapEditor())
  1.2583 @@ -1873,9 +2587,21 @@
  1.2584  	fileSaveAs (PartOfMap);
  1.2585  }
  1.2586  
  1.2587 +void Main::editRemoveBranchKeepChilds()
  1.2588 +{
  1.2589 +	if (currentMapEditor())
  1.2590 +		currentMapEditor()->removeBranchKeepChilds();
  1.2591 +}
  1.2592 +
  1.2593 +void Main::editRemoveChilds()
  1.2594 +{
  1.2595 +	if (currentMapEditor())
  1.2596 +		currentMapEditor()->removeChilds();
  1.2597 +}
  1.2598 +
  1.2599  void Main::editDeleteSelection()
  1.2600  {
  1.2601 -	if (currentMapEditor())
  1.2602 +	if (currentMapEditor() && actionSettingsUseDelKey->isOn())
  1.2603  		currentMapEditor()->deleteSelection();
  1.2604  }
  1.2605  
  1.2606 @@ -1927,10 +2653,16 @@
  1.2607  		currentMapEditor()->saveFloatImage(item);
  1.2608  }
  1.2609  
  1.2610 -void Main::editToggleFloatExport()
  1.2611 +void Main::editFollowXLink(int item)
  1.2612  {
  1.2613  	if (currentMapEditor())
  1.2614 -		currentMapEditor()->toggleFloatExport();
  1.2615 +		currentMapEditor()->followXLink(branchLinksContextMenu->indexOf(item));
  1.2616 +}
  1.2617 +
  1.2618 +void Main::editEditXLink(int item)
  1.2619 +{
  1.2620 +	if (currentMapEditor())
  1.2621 +		currentMapEditor()->editXLink(branchLinksContextMenuDup->indexOf(item));
  1.2622  }
  1.2623  
  1.2624  void Main::formatSelectColor()
  1.2625 @@ -2022,11 +2754,29 @@
  1.2626  		currentMapEditor()->setFrame(Rectangle);
  1.2627  }
  1.2628  
  1.2629 +void Main::formatIncludeImagesVer()
  1.2630 +{
  1.2631 +	if (currentMapEditor())
  1.2632 +		currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn());
  1.2633 +}
  1.2634 +
  1.2635 +void Main::formatIncludeImagesHor()
  1.2636 +{
  1.2637 +	if (currentMapEditor())
  1.2638 +		currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
  1.2639 +}
  1.2640 +
  1.2641 +void Main::formatHideLinkUnselected()
  1.2642 +{
  1.2643 +	if (currentMapEditor())
  1.2644 +		currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
  1.2645 +}
  1.2646 +
  1.2647  void Main::viewZoomReset()
  1.2648  {
  1.2649  	if (currentMapEditor())
  1.2650  	{
  1.2651 -		QWMatrix m;
  1.2652 +		QMatrix m;
  1.2653  		m.reset();
  1.2654  		currentMapEditor()->setWorldMatrix( m );
  1.2655  		currentMapEditor()->setViewCenter();
  1.2656 @@ -2038,7 +2788,7 @@
  1.2657  {
  1.2658  	if (currentMapEditor())
  1.2659  	{
  1.2660 -		QWMatrix m = currentMapEditor()->worldMatrix();
  1.2661 +		QMatrix m = currentMapEditor()->worldMatrix();
  1.2662  		m.scale( 1.25, 1.25 );
  1.2663  		currentMapEditor()->setWorldMatrix( m );
  1.2664  		currentMapEditor()->setViewCenter();
  1.2665 @@ -2050,19 +2800,28 @@
  1.2666  {
  1.2667  	if (currentMapEditor())
  1.2668  	{
  1.2669 -		QWMatrix m = currentMapEditor()->worldMatrix();
  1.2670 +		QMatrix m = currentMapEditor()->worldMatrix();
  1.2671  		m.scale( 0.8, 0.8 );
  1.2672  		currentMapEditor()->setWorldMatrix( m );
  1.2673  		currentMapEditor()->setViewCenter();
  1.2674  		currentMapEditor()->adjustCanvasSize();
  1.2675  	}	
  1.2676  }
  1.2677 +
  1.2678 +void Main::modModeColor()
  1.2679 +{
  1.2680 +}
  1.2681 +
  1.2682 +void Main::modModeLink()
  1.2683 +{
  1.2684 +}
  1.2685 +
  1.2686  bool Main::settingsPDF()
  1.2687  {
  1.2688  	// Default browser is set in constructor
  1.2689  	bool ok;
  1.2690  	QString text = QInputDialog::getText(
  1.2691 -		"VYM", tr("Enter path for pdf reader:"), QLineEdit::Normal,
  1.2692 +		"VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
  1.2693  		settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this );
  1.2694  	if (ok)
  1.2695  		settings.writeEntry ("/vym/mainwindow/readerPDF",text);
  1.2696 @@ -2075,7 +2834,7 @@
  1.2697  	// Default browser is set in constructor
  1.2698  	bool ok;
  1.2699  	QString text = QInputDialog::getText(
  1.2700 -		"VYM", tr("Enter path for application to open an URL:"), QLineEdit::Normal,
  1.2701 +		"VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
  1.2702  		settings.readEntry("/vym/mainwindow/readerURL")
  1.2703  		, &ok, this );
  1.2704  	if (ok)
  1.2705 @@ -2083,6 +2842,17 @@
  1.2706  	return ok;
  1.2707  }
  1.2708  
  1.2709 +void Main::settingsToggleDelKey()
  1.2710 +{
  1.2711 +	if (actionSettingsUseDelKey->isOn())
  1.2712 +	{
  1.2713 +		actionEditDelete->setAccel (QKeySequence (Qt::Key_Delete));
  1.2714 +	} else
  1.2715 +	{
  1.2716 +		actionEditDelete->setAccel (QKeySequence (""));
  1.2717 +	}
  1.2718 +}
  1.2719 +
  1.2720  void Main::windowToggleNoteEditor()
  1.2721  {
  1.2722  	if (textEditor->showWithMain() )
  1.2723 @@ -2091,6 +2861,18 @@
  1.2724  		windowShowNoteEditor();
  1.2725  }
  1.2726  
  1.2727 +void Main::windowToggleHistory()
  1.2728 +{
  1.2729 +	if (currentMapEditor())
  1.2730 +		currentMapEditor()->toggleHistoryWindow();
  1.2731 +}
  1.2732 +
  1.2733 +void Main::updateNoteFlag()
  1.2734 +{
  1.2735 +	if (currentMapEditor())
  1.2736 +		currentMapEditor()->updateNoteFlag();
  1.2737 +}
  1.2738 +
  1.2739  void Main::windowShowNoteEditor()
  1.2740  {
  1.2741  	textEditor->setShowWithMain(true);
  1.2742 @@ -2124,20 +2906,18 @@
  1.2743  
  1.2744  void Main::testFunction()
  1.2745  {
  1.2746 -	//textEditor->stackUnder(this);
  1.2747  	currentMapEditor()->testFunction();
  1.2748  }
  1.2749  
  1.2750 -void Main::testShowClipboard()
  1.2751 -{
  1.2752 -	clipboardME->show();
  1.2753 -}
  1.2754 -
  1.2755  void Main::helpDoc()
  1.2756  {
  1.2757  	QString docpath;
  1.2758 -	// default path in SUSE LINUX
  1.2759 -	docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
  1.2760 +	#if defined(Q_OS_MACX)
  1.2761 +		docpath="./vym.app/Contents/vym.pdf";
  1.2762 +	#else
  1.2763 +		// default path in SUSE LINUX
  1.2764 +		docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
  1.2765 +	#endif
  1.2766  
  1.2767  	if (!QFile (docpath).exists() )
  1.2768  	{
  1.2769 @@ -2149,11 +2929,16 @@
  1.2770  			docpath="doc/tex/vym.pdf";
  1.2771  			if (!QFile (docpath).exists() )
  1.2772  			{
  1.2773 -				QMessageBox::critical(0, 
  1.2774 -				tr("Critcal error"),
  1.2775 -				tr("Couldn't find the documentation\n"
  1.2776 -				"vym.pdf in various places."));
  1.2777 -				return;
  1.2778 +				// Try yet another one for Knoppix
  1.2779 +				docpath="/usr/share/doc/packages/vym/vym.pdf";
  1.2780 +				if (!QFile (docpath).exists() )
  1.2781 +				{
  1.2782 +					QMessageBox::critical(0, 
  1.2783 +					tr("Critcal error"),
  1.2784 +					tr("Couldn't find the documentation\n"
  1.2785 +					"vym.pdf in various places."));
  1.2786 +					return;
  1.2787 +				}	
  1.2788  			}	
  1.2789  		}
  1.2790  	}
  1.2791 @@ -2166,10 +2951,11 @@
  1.2792  	if ( !pdfProc->start() ) 
  1.2793  	{
  1.2794  		// error handling
  1.2795 -		QMessageBox::critical(0, 
  1.2796 -		tr("Critcal error"),
  1.2797 -		tr("Couldn't find a viewer to read vym.pdf.\n"
  1.2798 -		"Please use Settings->")+tr("Set application to open pdf files"));
  1.2799 +		QMessageBox::warning(0, 
  1.2800 +			tr("Warning"),
  1.2801 +			tr("Couldn't find a viewer to open %1.\n").arg("vym.pdf")+
  1.2802 +			tr("Please use Settings->")+tr("Set application to open PDF files"));
  1.2803 +		settingsPDF();	
  1.2804  		return;
  1.2805  	}
  1.2806  }
  1.2807 @@ -2177,33 +2963,11 @@
  1.2808  
  1.2809  void Main::helpAbout()
  1.2810  {
  1.2811 -    static QMessageBox* about = new QMessageBox( "VYM",
  1.2812 -			"<h3>VYM - View Your Mind </h3>"
  1.2813 -			"<p> A tool to put the things you have got in your mind into a map.</p>"
  1.2814 -			"<ul>"
  1.2815 -				"<li> (c) by Uwe Drechsel (vym@InSilmaril.de)</li>"
  1.2816 -				"<li> vym is released under the GPL (Gnu General Public License)"
  1.2817 -				", with one exception (see the file \"LICENSE\"which "
  1.2818 -				"comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.</li>"
  1.2819 -				"<li> Project homepage <a href=\"http:/www.InSilmaril.de/vym\">"
  1.2820 -    					"http:/www.InSilmaril.de/vym</a></li>"
  1.2821 -			"<li> Credits " 
  1.2822 -				"<ul>"
  1.2823 -					"<li>Thomas Schraitle for the stylesheet  used for XHTML-export </li>"
  1.2824 -					"<li>Clemens Kraus for stylesheets and script used for HTML-export "
  1.2825 -					"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
  1.2826 -					"<li>Alexander Johannesen for providing stylesheets from his xsiteable project " 
  1.2827 -					"<a href=\"http://www.shelter.nu/xsiteable/xsiteable.html\">(www.shelter.nu/xsiteable/xsiteable.html)</a>. </li>"
  1.2828 -					"<li>Ken Wimer and Olaf Hering for Mac support</li>"
  1.2829 -				"</ul>"
  1.2830 -			"</li>"
  1.2831 -			"<li> Version "  __VYM_VERSION__  "</li>"
  1.2832 -				"<li> Build date "  __BUILD_DATE__"</li>"
  1.2833 -			"</ul>", QMessageBox::Information, 1, 0, 0, this, 0, FALSE );
  1.2834 -    about->setButtonText( 1, "Dismiss" );
  1.2835 -    about->setMinimumSize(QSize(300,300));
  1.2836 -	about->setIconPixmap (QPixmap(vym_logo_xpm));
  1.2837 -    about->show();
  1.2838 +	AboutDialog ad;
  1.2839 +	ad.setName ("aboutwindow");
  1.2840 +	ad.setMinimumSize(500,500);
  1.2841 +	ad.resize (QSize (500,500));
  1.2842 +	ad.exec();
  1.2843  }
  1.2844  
  1.2845  void Main::helpAboutQT()