mainwindow.cpp
author insilmaril
Mon, 16 Oct 2006 12:42:54 +0000
changeset 391 59106708b5b5
parent 390 0e1aeb21cb78
child 393 053b8645e3e9
permissions -rw-r--r--
Code simplifications
     1 #include "mainwindow.h"
     2 
     3 #include <QtGui>
     4 
     5 #include <q3filedialog.h>
     6 #include <Q3StrList>
     7 #include <Q3PtrList>
     8 
     9 #include <iostream>
    10 #include <cstdlib>
    11 #include <typeinfo>
    12 
    13 #include "aboutdialog.h"
    14 #include "exportoofiledialog.h"
    15 #include "exports.h"
    16 #include "exportxhtmldialog.h"
    17 #include "file.h"
    18 #include "flagrowobj.h"
    19 #include "historywindow.h"
    20 #include "imports.h"
    21 #include "mapeditor.h"
    22 #include "misc.h"
    23 #include "options.h"
    24 #include "process.h"
    25 #include "settings.h"
    26 #include "texteditor.h"
    27 #include "version.h"
    28 
    29 extern TextEditor *textEditor;
    30 extern Main *mainWindow;
    31 extern QString tmpVymDir;
    32 extern QString clipboardDir;
    33 extern bool clipboardEmpty;
    34 extern int statusbarTime;
    35 extern FlagRowObj* standardFlagsDefault;
    36 extern FlagRowObj* systemFlagsDefault;
    37 
    38 QMenu* branchContextMenu;
    39 QMenu* branchAddContextMenu;
    40 QMenu* branchRemoveContextMenu;
    41 QMenu* branchLinksContextMenu;
    42 QMenu* branchXLinksContextMenuEdit;
    43 QMenu* branchXLinksContextMenuFollow;
    44 QMenu* floatimageContextMenu;
    45 QMenu* canvasContextMenu;
    46 QMenu* fileLastMapsMenu;
    47 QMenu* fileImportMenu;
    48 QMenu* fileExportMenu;
    49 
    50 
    51 extern Settings settings;
    52 extern Options options;
    53 extern ImageIO imageIO;
    54 
    55 extern QDir vymBaseDir;
    56 extern QDir lastImageDir;
    57 extern QDir lastFileDir;
    58 extern QString iconPath;
    59 extern QString flagsPath;
    60 
    61 Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
    62     QMainWindow(parent,name,f)
    63 {
    64 	mainWindow=this;
    65 
    66 	setCaption ("VYM - View Your Mind");
    67 
    68 	// Load window settings
    69 	resize (settings.value( "/mainwindow/geometry/size",QSize (800,600)).toSize());
    70 	move   (settings.value( "/mainwindow/geometry/pos", QPoint(300,100)).toPoint());
    71 
    72 
    73 	// Create unique temporary directory
    74 	bool ok;
    75 	tmpVymDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX");
    76 	if (!ok)
    77 	{
    78 		qWarning ("Mainwindow: Could not create temporary directory, failed to start vym");
    79 		exit (1);
    80 	}
    81 
    82 	// Create direcctory for clipboard
    83 	clipboardDir=tmpVymDir+"/clipboard";
    84 	QDir d(clipboardDir);
    85 	d.mkdir (clipboardDir,true);
    86 	makeSubDirs (clipboardDir);
    87 	clipboardEmpty=true;
    88 
    89 	procBrowser=NULL;
    90 
    91 	// FIXME not used currently
    92 	// Set random seed (random used for object IDs)
    93     // QTime t = QTime::currentTime();		// set random seed
    94     // srand( t.hour()*12+t.minute()*60+t.second()*60 );
    95 
    96 
    97 	// Initialize some settings, which are platform dependant
    98 	QString p,s;
    99 
   100 		// application to open URLs
   101 		p="/mainwindow/readerURL";
   102 		#if defined(Q_OS_LINUX)
   103 			s=settings.value (p,"konqueror").toString();
   104 		#else
   105 			#if defined(Q_OS_MACX)
   106 				s=settings.value (p,"/usr/bin/open").toString();
   107 			#else
   108 				s=settings.value (p,"mozilla");
   109 			#endif
   110 		#endif
   111 		settings.setValue( p,s);
   112 
   113 		// application to open PDFs
   114 		p="/mainwindow/readerPDF";
   115 		#if defined(Q_OS_LINUX)
   116 			s=settings.value (p,"acroread").toString();
   117 		#else
   118 			#if defined(Q_OS_MACX)
   119 				s=settings.value (p,"/usr/bin/open").toString();
   120 			#else
   121 				s=settings.value (p,"acroread").toString();
   122 			#endif
   123 		#endif
   124 		settings.setValue( p,s);
   125 
   126 	
   127 	maxLastMaps=9;
   128 
   129 	// Create tab widget which holds the maps
   130 	tabWidget= new QTabWidget (this);
   131 	connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ), 
   132 		this, SLOT( editorChanged( QWidget * ) ) );
   133 
   134 	lineedit=new QLineEdit (this);
   135 	lineedit->hide();
   136 
   137 	setCentralWidget(tabWidget);	
   138 
   139     setupFileActions();
   140     setupEditActions();
   141     setupFormatActions();
   142     setupViewActions();
   143     setupModeActions();
   144 	setupFlagActions();
   145     setupSettingsActions();
   146 	setupContextMenus();
   147     if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions();
   148     setupHelpActions();
   149     
   150     statusBar();
   151 
   152 	restoreState (settings.value("/mainwindow/state",0).toByteArray());
   153 
   154 	// Initialize Find window
   155 	findWindow=new FindWindow(NULL);
   156 	findWindow->move (x(),y()+70);
   157 	connect (findWindow, SIGNAL( findButton(QString) ), 
   158 		this, SLOT(editFind(QString) ) );	
   159 	connect (findWindow, SIGNAL( somethingChanged() ), 
   160 		this, SLOT(editFindChanged() ) );	
   161 
   162 	// Connect TextEditor, so that we can update flags if text changes
   163 	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
   164 	connect (textEditor, SIGNAL (textClosed() ), this, SLOT (updateActions()));
   165 
   166 	updateGeometry();
   167 }
   168 
   169 Main::~Main()
   170 {
   171 	// Save Settings
   172 	settings.setValue ( "/mainwindow/geometry/size", size() );
   173 	settings.setValue ( "/mainwindow/geometry/pos", pos() );
   174 
   175 	settings.setValue ("/mainwindow/state",saveState(0));
   176 
   177 	settings.setValue( "/version/version", __VYM_VERSION );
   178 	settings.setValue( "/version/builddate", __BUILD_DATE );
   179 
   180 	settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoSelectHeading->isOn() );
   181 	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() );
   182 	settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoEdit->isOn() );
   183 	settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
   184 	settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
   185 	settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
   186 
   187 	QString s;
   188 	int maps=lastMaps.count();
   189 	settings.setValue( "/lastMaps/number",maps );
   190 	for (int i=1;i<=maps;i++)
   191 	{
   192 		s=QString("/lastMaps/map-%1").arg(i);
   193 		if (!s.isEmpty() && i<=maxLastMaps) 
   194 			settings.setValue (s, lastMaps.at(i-1));
   195 	}
   196 
   197 
   198 	// To make the texteditor save its settings, call the destructor
   199 	delete (textEditor);
   200 
   201 	// Remove temporary directory
   202 	removeDir (QDir(tmpVymDir));
   203 }
   204 
   205 void Main::loadCmdLine()
   206 {
   207 	/* TODO draw some kind of splashscreen while loading...
   208 	if (qApp->argc()>1)
   209 	{
   210 	}
   211 	*/
   212 	
   213 	QStringList flist=options.getFileList();
   214 	QStringList::Iterator it=flist.begin();
   215 
   216 	while (it !=flist.end() )
   217 	{
   218 		fileLoad (*it, NewMap);
   219 		*it++;
   220 	}	
   221 }
   222 
   223 
   224 void Main::statusMessage(const QString &s)
   225 {
   226 	statusBar()->message (s);
   227 }
   228 
   229 void Main::closeEvent (QCloseEvent* )
   230 {
   231 	fileExitVYM();
   232 }
   233 
   234 // File Actions
   235 void Main::setupFileActions()
   236 {
   237 	QMenu *fileMenu = menuBar()->addMenu ( tr ("&Map") );
   238     QToolBar *tb = addToolBar( tr ("&Map") );
   239 	tb->setObjectName ("mapTB");
   240 
   241     QAction *a;
   242     a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
   243 	a->setStatusTip ( tr( "New map","File menu" ) );
   244 	a->setShortcut ( Qt::CTRL + Qt::Key_N );
   245     a->addTo( tb );
   246 	fileMenu->addAction (a);
   247     connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) );
   248 	
   249     a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ),this);
   250 	a->setStatusTip (tr( "Open","File menu" ) );
   251 	a->setShortcut ( Qt::CTRL + Qt::Key_O );
   252     a->addTo( tb );
   253 	fileMenu->addAction (a);
   254     connect( a, SIGNAL( triggered() ), this, SLOT( fileLoad() ) );
   255 	
   256 	fileLastMapsMenu = fileMenu->addMenu (tr("Open Recent"));
   257 	fileMenu->addSeparator();
   258 	
   259     a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), this);
   260 	a->setStatusTip ( tr( "Save" ));
   261 	a->setShortcut (Qt::CTRL + Qt::Key_S );
   262     a->addTo( tb );
   263 	fileMenu->addAction (a);
   264     connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) );
   265 	actionFileSave=a;
   266 	
   267     a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this);
   268 	a->setStatusTip (tr( "Save &As" ) );
   269 	fileMenu->addAction (a);
   270     connect( a, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) );
   271 
   272 	fileMenu->addSeparator();
   273 
   274 	fileImportMenu = fileMenu->addMenu (tr("Import"));
   275 
   276 	a = new QAction(tr("KDE Bookmarks"), this);
   277 	a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" ));
   278 	a->addTo (fileImportMenu);
   279 	connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDEBookmarks() ) );
   280 
   281     if (settings.value( "/mainwindow/showTestMenu",false).toBool()) 
   282 	{
   283 		a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this);
   284 		a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) );
   285 		a->addTo (fileImportMenu);
   286 		connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFirefoxBookmarks() ) );
   287 	}	
   288 
   289 	a = new QAction("Mind Manager...",this);
   290 	a->setStatusTip ( tr( "Import")+" Mind Manager"  );
   291 	fileImportMenu->addAction (a);
   292 	connect( a, SIGNAL( triggered() ), this, SLOT( fileImportMM() ) );
   293 
   294     a = new QAction( tr( "Import Dir"+QString("...") ), this);
   295 	a->setStatusTip (tr( "Import directory structure (experimental)" ) );
   296 	fileImportMenu->addAction (a);
   297     connect( a, SIGNAL( triggered() ), this, SLOT( fileImportDir() ) );
   298 
   299 	fileExportMenu = fileMenu->addMenu (tr("Export"));
   300 
   301 	a = new QAction( tr("Image")+QString("..."), this);
   302 	a->setStatusTip( tr( "Export map as image" ));
   303 	connect( a, SIGNAL( triggered() ), this, SLOT( fileExportImage() ) );
   304 	fileExportMenu->addAction (a);
   305 
   306 	a = new QAction( "Open Office"+QString("..."), this);
   307 	a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " ));
   308 	connect( a, SIGNAL( triggered() ), this, SLOT( fileExportOOPresentation() ) );
   309 	fileExportMenu->addAction (a);
   310 
   311 	a = new QAction(  "Webpage (XHTML)...",this );
   312 	a->setShortcut (Qt::ALT + Qt::Key_X);
   313 	a->setStatusTip ( tr( "Export as")+" webpage (XHTML)");
   314     connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXHTML() ) );
   315 	fileExportMenu->addAction (a);
   316 
   317     a = new QAction( "Text (ASCII)...", this);
   318 	a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ));
   319     connect( a, SIGNAL( triggered() ), this, SLOT( fileExportASCII() ) );
   320 	fileExportMenu->addAction (a);
   321 
   322 	a = new QAction( tr("KDE Bookmarks"), this);
   323 	a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" ));
   324 	connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDEBookmarks() ) );
   325 	fileExportMenu->addAction (a);
   326 
   327     a = new QAction( "Taskjuggler...", this );
   328     a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ));
   329     connect( a, SIGNAL( triggered() ), this, SLOT( fileExportTaskjuggler() ) );
   330 	fileExportMenu->addAction (a);
   331 
   332     a = new QAction( "LaTeX...", this);
   333     a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ));
   334     connect( a, SIGNAL( triggered() ), this, SLOT( fileExportLaTeX() ) );
   335 	fileExportMenu->addAction (a);
   336 
   337 	a = new QAction( "XML..." , this );
   338 	a->setStatusTip (tr( "Export as")+" XML");
   339     connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXML() ) );
   340 	fileExportMenu->addAction (a);
   341 
   342 	fileMenu->addSeparator();
   343 
   344     a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this);
   345 	a->setStatusTip ( tr( "Print" ) );
   346 	a->setShortcut (Qt::CTRL + Qt::Key_P );
   347     a->addTo( tb );
   348 	fileMenu->addAction (a);
   349     connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) );
   350 	actionFilePrint=a;
   351 
   352     a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this);
   353 	a->setStatusTip (tr( "Close Map" ) );
   354 	a->setShortcut (Qt::ALT + Qt::Key_C );
   355 	fileMenu->addAction (a);
   356     connect( a, SIGNAL( triggered() ), this, SLOT( fileCloseMap() ) );
   357 
   358     a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, this);
   359 	a->setStatusTip ( tr( "Exit")+" "+__VYM );
   360 	a->setShortcut (Qt::CTRL + Qt::Key_Q );
   361 	fileMenu->addAction (a);
   362     connect( a, SIGNAL( triggered() ), this, SLOT( fileExitVYM() ) );
   363 }
   364 
   365 
   366 //Edit Actions
   367 void Main::setupEditActions()
   368 {
   369     QToolBar *tb = addToolBar( tr ("&Actions") );
   370     tb->setLabel( "Edit Actions" );
   371 	tb->setObjectName ("actionsTB");
   372     QMenu *editMenu = menuBar()->addMenu( tr("&Edit") );
   373 
   374     QAction *a;
   375 	QAction *alt;
   376     a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo" ),this);
   377     connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) );
   378 	a->setStatusTip (tr( "Undo" ) );
   379 	a->setShortcut ( Qt::CTRL + Qt::Key_Z );
   380 	a->setEnabled (false);
   381     tb->addAction (a);
   382 	editMenu->addAction (a);
   383 	actionEditUndo=a;
   384     
   385 	a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this); 
   386 	a->setStatusTip (tr( "Redo" ));
   387 	a->setShortcut (Qt::CTRL + Qt::Key_Y );
   388     tb->addAction (a);
   389 	editMenu->addAction (a);
   390 	connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) );
   391 	actionEditRedo=a;
   392    
   393 	editMenu->addSeparator();
   394     a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), this);
   395 	a->setStatusTip ( tr( "Copy" ) );
   396 	a->setShortcut (Qt::CTRL + Qt::Key_C );
   397 	a->setEnabled (false);
   398     tb->addAction (a);
   399 	editMenu->addAction (a);
   400     connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) );
   401 	actionEditCopy=a;
   402 	
   403     a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t" ), this);
   404 	a->setStatusTip ( tr( "Cut" ) );
   405 	a->setShortcut (Qt::CTRL + Qt::Key_X );
   406 	a->setEnabled (false);
   407     tb->addAction (a);
   408 	editMenu->addAction (a);
   409 	actionEditCut=a;
   410     connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) );
   411 	
   412     a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ),this);
   413     connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) );
   414 	a->setStatusTip ( tr( "Paste" ) );
   415 	a->setShortcut ( Qt::CTRL + Qt::Key_V );
   416 	a->setEnabled (false);
   417     tb->addAction (a);
   418 	editMenu->addAction (a);
   419 	actionEditPaste=a;
   420 
   421     // Shortcuts to modify heading:
   422     a = new QAction(tr( "Edit heading" ),this);
   423 	a->setStatusTip ( tr( "edit Heading" ));
   424 	a->setShortcut ( Qt::Key_Enter);
   425 //	a->setShortcutContext (Qt::WindowShortcut);
   426 	addAction (a);
   427     connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
   428 	actionListBranches.append(a);
   429     a = new QAction( tr( "Edit heading" ), this);
   430 	a->setStatusTip (tr( "edit Heading" ));
   431 	a->setShortcut (Qt::Key_Return );
   432 	//a->setShortcutContext (Qt::WindowShortcut);
   433 	addAction (a);
   434     connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
   435 	actionListBranches.append(a);
   436 	editMenu->addAction (a);
   437 	actionEditHeading=a;
   438     a = new QAction( tr( "Edit heading" ), this);
   439 	a->setStatusTip (tr( "edit Heading" ));
   440 	a->setShortcut ( Qt::Key_F2 );
   441 	a->setShortcutContext (Qt::WindowShortcut);
   442 	addAction (a);
   443     connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
   444 	actionListBranches.append(a);
   445     
   446     // Shortcut to delete selection
   447     a = new QAction( tr( "Delete Selection" ),this);
   448 	a->setStatusTip (tr( "Delete Selection" ));
   449 	a->setShortcut ( Qt::Key_Delete);
   450 	a->setShortcutContext (Qt::WindowShortcut);
   451 	addAction (a);
   452     connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) );
   453 	actionEditDelete=a;
   454     
   455     // Shortcut to add branch
   456 	alt = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child" ), this);
   457 	alt->setStatusTip ( tr( "Add a branch as child of selection" ));
   458 	alt->setShortcut (Qt::Key_A);
   459 	alt->setShortcutContext (Qt::WindowShortcut);
   460 	addAction (alt);
   461 	connect( alt, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) );
   462 	a = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child" ), this);
   463 	a->setStatusTip ( tr( "Add a branch as child of selection" ));
   464 	a->setShortcut (Qt::Key_Insert);	
   465 	connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) );
   466 	actionListBranches.append(a);
   467 	#if defined (Q_OS_MACX)
   468 		// In OSX show different shortcut in menues, the keys work indepently always			
   469 		actionEditAddBranch=alt;
   470 	#else	
   471 		actionEditAddBranch=a;
   472 	#endif	
   473 	editMenu->addAction (actionEditAddBranch);
   474 	tb->addAction (actionEditAddBranch);
   475 
   476 
   477     // Add branch by inserting it at selection
   478 	a = new QAction(tr( "Add branch (insert)" ), this);
   479 	a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
   480 	a->setShortcut (Qt::ALT + Qt::Key_Insert );
   481 	a->setShortcutContext (Qt::WindowShortcut);
   482 	addAction (a);
   483     connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchHere() ) );
   484 	a->setEnabled (false);
   485 	actionListBranches.append(a);
   486 	actionEditAddBranchHere=a;
   487 	a = new QAction(tr( "Add branch (insert)" ),this);
   488 	a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
   489 	a->setShortcut ( Qt::ALT + Qt::Key_A );
   490 	a->setShortcutContext (Qt::WindowShortcut);
   491 	addAction (a);
   492     connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchHere() ) );
   493 	actionListBranches.append(a);
   494 
   495 	// Add branch above
   496     a = new QAction(tr( "Add branch above" ), this);
   497 	a->setStatusTip ( tr( "Add a branch above selection" ));
   498 	a->setShortcut (Qt::SHIFT+Qt::Key_Insert );
   499 	a->setShortcutContext (Qt::WindowShortcut);
   500 	addAction (a);
   501     connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) );
   502 	a->setEnabled (false);
   503 	actionListBranches.append(a);
   504 	actionEditAddBranchAbove=a;
   505     a = new QAction(tr( "Add branch above" ), this);
   506 	a->setStatusTip ( tr( "Add a branch above selection" ));
   507 	a->setShortcut (Qt::SHIFT+Qt::Key_A );
   508 	a->setShortcutContext (Qt::WindowShortcut);
   509 	addAction (a);
   510     connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) );
   511 	actionListBranches.append(a);
   512 
   513 	// Add branch below 
   514     a = new QAction(tr( "Add branch below" ), this);
   515 	a->setStatusTip ( tr( "Add a branch below selection" ));
   516 	a->setShortcut (Qt::CTRL +Qt::Key_Insert );
   517 	a->setShortcutContext (Qt::WindowShortcut);
   518 	addAction (a);
   519     connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) );
   520 	a->setEnabled (false);
   521 	actionListBranches.append(a);
   522 	actionEditAddBranchBelow=a;
   523     a = new QAction(tr( "Add branch below" ), this);
   524 	a->setStatusTip ( tr( "Add a branch below selection" ));
   525 	a->setShortcut (Qt::CTRL +Qt::Key_A );
   526 	a->setShortcutContext (Qt::WindowShortcut);
   527 	addAction (a);
   528     connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) );
   529 	actionListBranches.append(a);
   530 
   531     a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up" ), this);
   532 	a->setStatusTip ( tr( "Move branch up" ) );
   533 	a->setShortcut (Qt::Key_PageUp );
   534 	a->setEnabled (false);
   535     tb->addAction (a);
   536 	editMenu->addAction (a);
   537     connect( a, SIGNAL( triggered() ), this, SLOT( editMoveUp() ) );
   538 	actionEditMoveUp=a;
   539 
   540     a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down" ),this);
   541     connect( a, SIGNAL( triggered() ), this, SLOT( editMoveDown() ) );
   542 	a->setStatusTip (tr( "Move branch down" ) );
   543 	a->setShortcut ( Qt::Key_PageDown );
   544 	a->setEnabled (false);
   545     tb->addAction (a);
   546 	editMenu->addAction (a);
   547 	actionEditMoveDown=a;
   548 	
   549 
   550 	a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ),this);
   551 	a->setShortcut ( Qt::Key_ScrollLock );
   552 	a->setStatusTip (tr( "Scroll branch" ) );
   553     connect( a, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) );
   554 
   555 	alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), this);
   556 	alt->setShortcut ( Qt::Key_S );
   557 	alt->setStatusTip (tr( "Scroll branch" )); 
   558     connect( alt, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) );
   559 	#if defined(Q_OS_MACX)
   560 		actionEditToggleScroll=alt;
   561 	#else	
   562 		actionEditToggleScroll=a;
   563 	#endif	
   564 	actionEditToggleScroll->setEnabled (false);
   565 	actionEditToggleScroll->setToggleAction(true);
   566     tb->addAction (actionEditToggleScroll);
   567     editMenu->addAction ( actionEditToggleScroll);
   568 	editMenu->addAction (actionEditToggleScroll);
   569 	addAction (a);
   570 	addAction (alt);
   571 	actionListBranches.append(actionEditToggleScroll);
   572 	
   573     a = new QAction( tr( "Unscroll all scrolled branches" ), this);
   574 	a->setStatusTip (tr( "Unscroll all" ));
   575 	editMenu->addAction (a);
   576     connect( a, SIGNAL( triggered() ), this, SLOT( editUnScrollAll() ) );
   577 	
   578 	editMenu->addSeparator();
   579 
   580 	a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), this);
   581 	a->setStatusTip (tr( "Find" ) );
   582 	a->setShortcut (Qt::CTRL + Qt::Key_F );
   583 	editMenu->addAction (a);
   584     connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWindow() ) );
   585     
   586 	editMenu->addSeparator();
   587 
   588 	a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), this);
   589 	a->setShortcut (Qt::CTRL + Qt::Key_U );
   590 	a->setShortcut (tr( "Open URL" ));
   591     tb->addAction (a);
   592 	addAction(a);
   593     connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURL() ) );
   594 	actionEditOpenURL=a;
   595 
   596 	a = new QAction( tr( "Open URL in new tab" ), this);
   597 	a->setStatusTip (tr( "Open URL in new tab" ));
   598 	a->setShortcut (Qt::CTRL+Qt::Key_U );
   599 	addAction(a);
   600     connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) );
   601 	actionEditOpenURLTab=a;
   602 
   603 	a = new QAction( tr( "Open all URLs in subtree" ), this);
   604 	a->setStatusTip (tr( "Open all URLs in subtree" ));
   605 	addAction(a);
   606 	actionListBranches.append(a);
   607     connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) );
   608 	actionEditOpenMultipleURLTabs=a;
   609 
   610 	a = new QAction(QPixmap(), tr( "Edit URL"+QString("...") ), this);
   611 	a->setStatusTip ( tr( "Edit URL" ) );
   612 	a->setShortcut (Qt::SHIFT + Qt::CTRL + Qt::Key_U );
   613 	//a->setShortcut ( Qt::Key_U );
   614 	a->setShortcutContext (Qt::WindowShortcut);
   615 	actionListBranches.append(a);
   616 	addAction(a);
   617     connect( a, SIGNAL( triggered() ), this, SLOT( editURL() ) );
   618 	actionEditURL=a;
   619 	
   620 	a = new QAction( tr( "Use heading for URL" ), this);
   621 	a->setStatusTip ( tr( "Use heading of selected branch as URL" ));
   622 	a->setEnabled (false);
   623 	actionListBranches.append(a);
   624     connect( a, SIGNAL( triggered() ), this, SLOT( editHeading2URL() ) );
   625 	actionEditHeading2URL=a;
   626     
   627 	a = new QAction(tr( "Create URL to Bugzilla" ), this);
   628 	a->setStatusTip ( tr( "Create URL to Bugzilla" ));
   629 	a->setEnabled (false);
   630 	actionListBranches.append(a);
   631     connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) );
   632 	actionEditBugzilla2URL=a;
   633     
   634 	a = new QAction(tr( "Create URL to FATE" ), this);
   635 	a->setStatusTip ( tr( "Create URL to FATE" ));
   636 	a->setEnabled (false);
   637 	actionListBranches.append(a);
   638     connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) );
   639 	actionEditFATE2URL=a;
   640 	
   641     a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Open xlinked map" ), this);
   642 	a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
   643     tb->addAction (a);
   644 	a->setEnabled (false);
   645     connect( a, SIGNAL( triggered() ), this, SLOT( editOpenVymLink() ) );
   646 	actionEditOpenVymLink=a;
   647 	
   648     a = new QAction(QPixmap(), tr( "Open all vym links in subtree" ), this);
   649 	a->setStatusTip ( tr( "Open all vym links in subtree" ));
   650 	a->setEnabled (false);
   651 	actionListBranches.append(a);
   652     connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVymLinks() ) );
   653 	actionEditOpenMultipleVymLinks=a;
   654 	
   655 
   656     a = new QAction(tr( "Edit vym link"+QString("...") ), this);
   657 	a->setEnabled (false);
   658 	a->setStatusTip ( tr( "Edit link to another vym map" ));
   659     connect( a, SIGNAL( triggered() ), this, SLOT( editVymLink() ) );
   660 	actionListBranches.append(a);
   661 	actionEditVymLink=a;
   662 
   663     a = new QAction(tr( "Delete vym link" ),this);
   664 	a->setStatusTip ( tr( "Delete link to another vym map" ));
   665 	a->setEnabled (false);
   666     connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteVymLink() ) );
   667 	actionEditDeleteVymLink=a;
   668 
   669     a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), this);
   670 	a->setStatusTip ( tr( "Hide object in exports" ) );
   671 	a->setShortcut (Qt::Key_H );
   672 	a->setToggleAction(true);
   673     tb->addAction (a);
   674 	a->setEnabled (false);
   675     connect( a, SIGNAL( triggered() ), this, SLOT( editToggleHideExport() ) );
   676 	actionEditToggleHideExport=a;
   677 
   678     a = new QAction(tr( "Edit Map Info"+QString("...") ),this);
   679 	a->setStatusTip ( tr( "Edit Map Info" ));
   680 	a->setEnabled (true);
   681     connect( a, SIGNAL( triggered() ), this, SLOT( editMapInfo() ) );
   682 	actionEditMapInfo=a;
   683 
   684 	editMenu->addSeparator();
   685 
   686 	// Import at selection (adding to selection)
   687     a = new QAction( tr( "Add map (insert)" ),this);
   688 	a->setStatusTip (tr( "Add map at selection" ));
   689     connect( a, SIGNAL( triggered() ), this, SLOT( editImportAdd() ) );
   690 	a->setEnabled (false);
   691 	actionListBranches.append(a);
   692 	actionEditImportAdd=a;
   693 
   694 	// Import at selection (replacing selection)
   695     a = new QAction( tr( "Add map (replace)" ), this);
   696 	a->setStatusTip (tr( "Replace selection with map" ));
   697     connect( a, SIGNAL( triggered() ), this, SLOT( editImportReplace() ) );
   698 	a->setEnabled (false);
   699 	actionListBranches.append(a);
   700 	actionEditImportReplace=a;
   701 
   702 	// Save selection 
   703     a = new QAction( tr( "Save selection" ), this);
   704 	a->setStatusTip (tr( "Save selection" ));
   705     connect( a, SIGNAL( triggered() ), this, SLOT( editSaveBranch() ) );
   706 	a->setEnabled (false);
   707 	actionListBranches.append(a);
   708 	actionEditSaveBranch=a;
   709 
   710 	// Only remove branch, not its childs
   711     a = new QAction(tr( "Remove only branch " ), this);
   712 	a->setStatusTip ( tr( "Remove only branch and keep its childs" ));
   713 	a->setShortcut (Qt::ALT + Qt::Key_Delete );
   714     connect( a, SIGNAL( triggered() ), this, SLOT( editRemoveBranchKeepChilds() ) );
   715 	a->setEnabled (false);
   716 	addAction (a);
   717 	actionListBranches.append(a);
   718 	actionEditRemoveBranchKeepChilds=a;
   719 
   720 	// Only remove childs of a branch
   721     a = new QAction( tr( "Remove childs" ), this);
   722 	a->setStatusTip (tr( "Remove childs of branch" ));
   723 	a->setShortcut (Qt::SHIFT + Qt::Key_Delete );
   724     connect( a, SIGNAL( triggered() ), this, SLOT( editRemoveChilds() ) );
   725 	a->setEnabled (false);
   726 	actionListBranches.append(a);
   727 	actionEditRemoveChilds=a;
   728 
   729     // Shortcuts for navigating with cursor:
   730     a = new QAction(tr( "Select upper branch" ), this);
   731 	a->setStatusTip ( tr( "Select upper branch" ));
   732 	a->setShortcut (Qt::Key_Up );
   733 	a->setShortcutContext (Qt::WindowShortcut);
   734 	addAction (a);
   735     connect( a, SIGNAL( triggered() ), this, SLOT( editUpperBranch() ) );
   736     a = new QAction( tr( "Select lower branch" ),this);
   737 	a->setStatusTip (tr( "Select lower branch" ));
   738 	a->setShortcut ( Qt::Key_Down );
   739 	a->setShortcutContext (Qt::WindowShortcut);
   740 	addAction (a);
   741     connect( a, SIGNAL( triggered() ), this, SLOT( editLowerBranch() ) );
   742     a = new QAction(tr( "Select left branch" ), this);
   743 	a->setStatusTip ( tr( "Select left branch" ));
   744 	a->setShortcut (Qt::Key_Left );
   745 	a->setShortcutContext (Qt::WindowShortcut);
   746 	addAction (a);
   747     connect( a, SIGNAL( triggered() ), this, SLOT( editLeftBranch() ) );
   748     a = new QAction( tr( "Select child branch" ), this);
   749 	a->setStatusTip (tr( "Select right branch" ));
   750 	a->setShortcut (Qt::Key_Right);
   751 	a->setShortcutContext (Qt::WindowShortcut);
   752 	addAction (a);
   753     connect( a, SIGNAL( triggered() ), this, SLOT( editRightBranch() ) );
   754     a = new QAction( tr( "Select first branch" ), this);
   755 	a->setStatusTip (tr( "Select first branch" ));
   756 	a->setShortcut (Qt::Key_Home );
   757 	a->setShortcutContext (Qt::WindowShortcut);
   758 	addAction (a);
   759 	a->setEnabled (false);
   760 	editMenu->addAction (a);
   761 	actionListBranches.append(a);
   762 	actionEditSelectFirst=a;
   763     connect( a, SIGNAL( triggered() ), this, SLOT( editFirstBranch() ) );
   764     a = new QAction( tr( "Select last branch" ),this);
   765 	a->setStatusTip (tr( "Select last branch" ));
   766 	a->setShortcut ( Qt::Key_End );
   767 	a->setShortcutContext (Qt::WindowShortcut);
   768 	addAction (a);
   769     connect( a, SIGNAL( triggered() ), this, SLOT( editLastBranch() ) );
   770 	a->setEnabled (false);
   771 	editMenu->addAction (a);
   772 	actionListBranches.append(a);
   773 	actionEditSelectLast=a;
   774 
   775     a = new QAction( tr( "Add Image" )+QString("..."), this);
   776 	a->setStatusTip (tr( "Add Image" ));
   777     connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) );
   778 	actionEditLoadImage=a;
   779 
   780 }
   781 
   782 // Format Actions
   783 void Main::setupFormatActions()
   784 {
   785     QMenu *formatMenu = menuBar()->addMenu (tr ("F&ormat"));
   786 
   787     QToolBar *tb = addToolBar( tr("Format Actions","Toolbars"));
   788 	tb->setObjectName ("formatTB");
   789     QAction *a;
   790     QPixmap pix( 16,16);
   791     pix.fill (Qt::black);
   792     a= new QAction(pix, tr( "Set &Color" )+QString("..."), this);
   793 	a->setStatusTip ( tr( "Set Color" ));
   794     connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectColor() ) );
   795     a->addTo( tb );
   796 	formatMenu->addAction (a);
   797 	actionFormatColor=a;
   798     a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), this);
   799 	a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) );
   800 	a->setShortcut (Qt::CTRL + Qt::Key_K );
   801     connect( a, SIGNAL( triggered() ), this, SLOT( formatPickColor() ) );
   802 	a->setEnabled (false);
   803     a->addTo( tb );
   804 	formatMenu->addAction (a);
   805 	actionListBranches.append(a);
   806 	actionFormatPickColor=a;
   807 
   808     a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), this);
   809 	a->setStatusTip ( tr( "Color branch" ) );
   810 	a->setShortcut (Qt::CTRL + Qt::Key_I);
   811     connect( a, SIGNAL( triggered() ), this, SLOT( formatColorItem() ) );
   812 	a->setEnabled (false);
   813     a->addTo( tb );
   814 	formatMenu->addAction (a);
   815 	actionListBranches.append(a);
   816 	actionFormatColorBranch=a;
   817 
   818     a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), this);
   819 	a->setStatusTip ( tr( "Color Subtree" ));
   820 	a->setShortcut (Qt::CTRL + Qt::Key_T);
   821     connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) );
   822 	a->setEnabled (false);
   823 	formatMenu->addAction (a);
   824     a->addTo( tb );
   825 	actionListBranches.append(a);
   826 	actionFormatColorSubtree=a;
   827 
   828 	formatMenu->addSeparator();
   829 	actionGroupFormatLinkStyles=new QActionGroup ( this);
   830 	actionGroupFormatLinkStyles->setExclusive (true);
   831     a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
   832 	a->setStatusTip (tr( "Line" ));
   833 	a->setToggleAction(true);
   834     connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleLine() ) );
   835 	formatMenu->addAction (a);
   836 	actionFormatLinkStyleLine=a;
   837     a= new QAction( tr( "Linkstyle Parabel" ), actionGroupFormatLinkStyles);
   838 	a->setStatusTip (tr( "Line" ));
   839 	a->setToggleAction(true);
   840     connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleParabel() ) );
   841 	formatMenu->addAction (a);
   842 	actionFormatLinkStyleParabel=a;
   843     a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles );
   844 	a->setStatusTip (tr( "PolyLine" ));
   845 	a->setToggleAction(true);
   846     connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyLine() ) );
   847 	formatMenu->addAction (a);
   848 	actionFormatLinkStylePolyLine=a;
   849     a= new QAction( tr( "Linkstyle Thick Parabel" ), actionGroupFormatLinkStyles);
   850 	a->setStatusTip (tr( "PolyParabel" ) );
   851 	a->setToggleAction(true);
   852 	a->setChecked (true);
   853     connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyParabel() ) );
   854 	formatMenu->addAction (a);
   855 	actionFormatLinkStylePolyParabel=a;
   856 	
   857 	actionGroupFormatFrameTypes=new QActionGroup ( this);
   858 	actionGroupFormatFrameTypes->setExclusive (true);
   859     a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes );
   860 	a->setStatusTip (tr("No Frame"));
   861 	a->setToggleAction(true);
   862     connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameNone() ) );
   863 	actionFormatFrameNone=a;
   864     a = new QAction( tr( "Rectangle" ), actionGroupFormatFrameTypes);
   865 	a->setStatusTip (tr( "Rectangle" ));
   866 	a->setToggleAction(true);
   867     connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameRectangle() ) );
   868 	actionFormatFrameRectangle=a;
   869 
   870     a = new QAction( tr( "Include images vertically" ),  this);
   871 	a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
   872 	a->setToggleAction(true);
   873     connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesVer() ) );
   874 	actionFormatIncludeImagesVer=a;
   875 
   876     a = new QAction( tr( "Include images horizontally" ),  this);
   877 	a->setStatusTip ( tr ("Include left and right position of images into branch"));
   878 	a->setToggleAction(true);
   879     connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesHor() ) );
   880 	actionFormatIncludeImagesHor=a;
   881 
   882     a = new QAction( tr( "Hide link if object is not selected" ), this);
   883 	a->setStatusTip (tr( "Hide link" ));
   884 	a->setToggleAction(true);
   885     connect( a, SIGNAL( triggered() ), this, SLOT( formatHideLinkUnselected() ) );
   886 	actionFormatHideLinkUnselected=a;
   887 
   888 	formatMenu->addSeparator();
   889     a= new QAction( tr( "&Use color of heading for link" ),  this);
   890 	a->setStatusTip (tr( "Use same color for links and headings" ));
   891 	a->setToggleAction(true);
   892     connect( a, SIGNAL( triggered() ), this, SLOT( formatToggleLinkColorHint() ) );
   893 	formatMenu->addAction (a);
   894 	actionFormatLinkColorHint=a;
   895 
   896     pix.fill (Qt::white);
   897     a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this  );
   898 	a->setStatusTip (tr( "Set Link Color" ));
   899 	formatMenu->addAction (a);
   900     connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectLinkColor() ) );
   901     actionFormatLinkColor=a;
   902 
   903     a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this );
   904 	a->setStatusTip (tr( "Set Background Color" ));
   905 	formatMenu->addAction (a);
   906     connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackColor() ) );
   907     actionFormatBackColor=a;
   908 }
   909 
   910 // View Actions
   911 void Main::setupViewActions()
   912 {
   913     QToolBar *tb = addToolBar( tr("View Actions","Toolbars") );
   914     tb->setLabel( "View Actions" );
   915 	tb->setObjectName ("viewTB");
   916     QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" ));
   917 
   918     QAction *a;
   919     a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), this);
   920 	a->setStatusTip ( tr( "Zoom reset" ) );
   921 	a->setShortcut (Qt::CTRL + Qt::Key_0 );
   922     a->addTo( tb );
   923 	viewMenu->addAction (a);
   924     connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomReset() ) );
   925 	
   926     a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in" ), this);
   927 	a->setStatusTip (tr( "Zoom in" ));
   928 	a->setShortcut (Qt::CTRL + Qt::Key_Plus);
   929     a->addTo( tb );
   930 	viewMenu->addAction (a);
   931     connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomIn() ) );
   932 	
   933     a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out" ), this);
   934 	a->setStatusTip (tr( "Zoom out" ));
   935 	a->setShortcut (Qt::CTRL + Qt::Key_Minus );
   936     a->addTo( tb );
   937 	viewMenu->addAction (a);
   938     connect( a, SIGNAL( triggered() ), this, SLOT( viewZoomOut() ) );
   939 
   940 
   941     a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ),this);
   942 	a->setStatusTip ( tr( "Show Note Editor" ));
   943 	a->setShortcut ( Qt::CTRL + Qt::Key_E );
   944 	a->setToggleAction(true);
   945 	if (textEditor->showWithMain())
   946 		a->setOn(true);
   947 	else	
   948 		a->setOn(false);
   949     a->addTo( tb );
   950 	viewMenu->addAction (a);
   951     connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) );
   952 	actionViewToggleNoteEditor=a;
   953 
   954     a = new QAction(  tr( "Show history window" ),this );
   955 	a->setStatusTip ( tr( "Show history window" ));
   956 	a->setShortcut ( Qt::CTRL + Qt::Key_H  );
   957 	a->setToggleAction(false);
   958 	viewMenu->addAction (a);
   959     connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) );
   960 	actionViewToggleHistoryWindow=a;
   961 
   962     a = new QAction(tr( "Next Window" ), this);
   963 	a->setStatusTip ( tr( "&Next Window" ) );
   964 	a->setShortcut (Qt::ALT + Qt::Key_N );
   965 	viewMenu->addAction (a);
   966     connect( a, SIGNAL( triggered() ), this, SLOT(windowNextEditor() ) );
   967 
   968     a = new QAction (tr( "Previous Window" ), this );
   969 	a->setStatusTip (tr( "&Previous Window" ));
   970 	a->setShortcut (Qt::ALT + Qt::Key_P );
   971 	viewMenu->addAction (a);
   972     connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) );
   973 }
   974 
   975 // Mode Actions
   976 void Main::setupModeActions()
   977 {
   978     //QPopupMenu *menu = new QPopupMenu( this );
   979     //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
   980 
   981     QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Toolbars") );
   982 	tb->setObjectName ("modesTB");
   983     QAction *a;
   984 	actionGroupModModes=new QActionGroup ( this);
   985 	actionGroupModModes->setExclusive (true);
   986     a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes);
   987 	a->setShortcut (Qt::Key_J);
   988     a->setStatusTip ( tr( "Use modifier to color branches" ));
   989 	a->setToggleAction(true);
   990 	a->addTo (tb);
   991 	a->setOn(true);
   992 	actionModModeColor=a;
   993 	
   994     a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy" ), actionGroupModModes );
   995 	a->setShortcut( Qt::Key_K); 
   996     a->setStatusTip( tr( "Use modifier to copy" ));
   997 	a->setToggleAction(true);
   998 	a->addTo (tb);
   999 	actionModModeCopy=a;
  1000 
  1001     a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks" ), actionGroupModModes );
  1002 	a->setShortcut (Qt::Key_L);
  1003     a->setStatusTip( tr( "Use modifier to draw xLinks" ));
  1004 	a->setToggleAction(true);
  1005 	a->addTo (tb);
  1006 	actionModModeXLink=a;
  1007 }
  1008 
  1009 // Flag Actions
  1010 void Main::setupFlagActions()
  1011 {
  1012 	// Create System Flags
  1013 	systemFlagsDefault = new FlagRowObj ();
  1014 	systemFlagsDefault->setVisibility (false);
  1015 	systemFlagsDefault->setName ("systemFlagsDef");
  1016 
  1017 	FlagObj *fo = new FlagObj ();
  1018 	fo->load(QPixmap(flagsPath+"flag-note.png"));
  1019 	fo->setName("note");
  1020 	fo->setToolTip(tr("Note","Systemflag"));
  1021 	systemFlagsDefault->addFlag (fo);	// makes deep copy
  1022 
  1023 	fo->load(QPixmap(flagsPath+"flag-url.png"));
  1024 	fo->setName("url");
  1025 	fo->setToolTip(tr("WWW Document (external)","Systemflag"));
  1026 	systemFlagsDefault->addFlag (fo);
  1027 	
  1028 	fo->load(QPixmap(flagsPath+"flag-vymlink.png"));
  1029 	fo->setName("vymLink");
  1030 	fo->setToolTip(tr("Link to another vym map","Systemflag"));
  1031 	systemFlagsDefault->addFlag (fo);	
  1032 
  1033 	fo->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
  1034 	fo->setName("scrolledright");
  1035 	fo->setToolTip(tr("subtree is scrolled","Systemflag"));
  1036 	systemFlagsDefault->addFlag (fo);
  1037 	
  1038 	fo->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
  1039 	fo->setName("tmpUnscrolledright");
  1040 	fo->setToolTip(tr("subtree is temporary scrolled","Systemflag"));
  1041 	systemFlagsDefault->addFlag (fo);
  1042 
  1043 	fo->load(QPixmap(flagsPath+"flag-hideexport.png"));
  1044 	fo->setName("hideInExport");
  1045 	fo->setToolTip(tr("Hide object in exported maps","Systemflag"));
  1046 	systemFlagsDefault->addFlag (fo);
  1047 
  1048 	// Create Standard Flags
  1049 	QToolBar *tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar"));
  1050 	tb->setObjectName ("standardFlagTB");
  1051 
  1052 	standardFlagsDefault = new FlagRowObj ();
  1053 	standardFlagsDefault->setVisibility (false);
  1054 	standardFlagsDefault->setName ("standardFlagsDef");
  1055 	standardFlagsDefault->setToolBar (tb);
  1056 
  1057 	fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
  1058 	fo->setName ("exclamationmark");
  1059 	fo->setGroup("standard-mark");
  1060 	QAction *a=new QAction (fo->getPixmap(),fo->getName(),this);
  1061 	tb->addAction (a);
  1062 	fo->setAction (a);
  1063 	a->setCheckable(true);
  1064 	a->setObjectName(fo->getName());
  1065 	a->setToolTip(tr("Take care!","Standardflag"));
  1066 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1067 	standardFlagsDefault->addFlag (fo);	// makes deep copy
  1068 	
  1069 	fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
  1070 	fo->setName("questionmark");
  1071 	fo->setGroup("standard-mark");
  1072 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1073 	tb->addAction (a);
  1074 	fo->setAction (a);
  1075 	a->setCheckable(true);
  1076 	a->setObjectName(fo->getName());
  1077 	a->setToolTip(tr("Really?","Standardflag"));
  1078 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1079 	standardFlagsDefault->addFlag (fo);	
  1080 
  1081 	fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
  1082 	fo->setName("hook-green");
  1083 	fo->setGroup("standard-hook");
  1084 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1085 	tb->addAction (a);
  1086 	fo->setAction (a);
  1087 	a->setCheckable(true);
  1088 	a->setObjectName(fo->getName());
  1089 	a->setToolTip(tr("ok!","Standardflag"));
  1090 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1091 	standardFlagsDefault->addFlag (fo);	
  1092 
  1093 	fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
  1094 	fo->setName("cross-red");
  1095 	fo->setGroup("standard-hook");
  1096 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1097 	tb->addAction (a);
  1098 	fo->setAction (a);
  1099 	a->setCheckable(true);
  1100 	a->setObjectName(fo->getName());
  1101 	a->setToolTip(tr("Not ok!","Standardflag"));
  1102 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1103 	standardFlagsDefault->addFlag (fo);	
  1104 
  1105 	fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
  1106 	fo->setName("stopsign");
  1107 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1108 	tb->addAction (a);
  1109 	fo->setAction (a);
  1110 	a->setCheckable(true);
  1111 	a->setObjectName(fo->getName());
  1112 	a->setToolTip(tr("This won't work!","Standardflag"));
  1113 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1114 	standardFlagsDefault->addFlag (fo);	
  1115 
  1116 	fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
  1117 	fo->setName("smiley-good");
  1118 	fo->setGroup("standard-smiley");
  1119 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1120 	tb->addAction (a);
  1121 	fo->setAction (a);
  1122 	a->setCheckable(true);
  1123 	a->setObjectName(fo->getName());
  1124 	a->setToolTip(tr("Good","Standardflag"));
  1125 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1126 	standardFlagsDefault->addFlag (fo);	
  1127 
  1128 	fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
  1129 	fo->setName("smiley-sad");
  1130 	fo->setGroup("standard-smiley");
  1131 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1132 	tb->addAction (a);
  1133 	fo->setAction (a);
  1134 	a->setCheckable(true);
  1135 	a->setObjectName(fo->getName());
  1136 	a->setToolTip(tr("Bad","Standardflag"));
  1137 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1138 	standardFlagsDefault->addFlag (fo);	
  1139 
  1140 	fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
  1141 	// Original omg.png (in KDE emoticons)
  1142 	fo->setName("smiley-omg");
  1143 	fo->setGroup("standard-smiley");
  1144 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1145 	tb->addAction (a);
  1146 	fo->setAction (a);
  1147 	a->setCheckable(true);
  1148 	a->setObjectName(fo->getName());
  1149 	a->setToolTip(tr("Oh no!","Standardflag"));
  1150 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1151 	standardFlagsDefault->addFlag (fo);	
  1152 
  1153 	fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
  1154 	fo->setName("clock");
  1155 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1156 	tb->addAction (a);
  1157 	fo->setAction (a);
  1158 	a->setCheckable(true);
  1159 	a->setObjectName(fo->getName());
  1160 	a->setToolTip(tr("Time critical","Standardflag"));
  1161 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1162 	standardFlagsDefault->addFlag (fo);	
  1163 
  1164 	fo->load(QPixmap(flagsPath+"flag-phone.png"));
  1165 	fo->setName("phone");
  1166 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1167 	tb->addAction (a);
  1168 	fo->setAction (a);
  1169 	a->setCheckable(true);
  1170 	a->setObjectName(fo->getName());
  1171 	a->setToolTip(tr("Call...","Standardflag"));
  1172 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1173 	standardFlagsDefault->addFlag (fo);	
  1174 
  1175 	fo->load(QPixmap(flagsPath+"flag-lamp.png"));
  1176 	fo->setName("lamp");
  1177 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1178 	tb->addAction (a);
  1179 	fo->setAction (a);
  1180 	a->setCheckable(true);
  1181 	a->setObjectName(fo->getName());
  1182 	a->setToolTip(tr("Idea!","Standardflag"));
  1183 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1184 	standardFlagsDefault->addFlag (fo);	
  1185 
  1186 	fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
  1187 	fo->setName("arrow-up");
  1188 	fo->setGroup("standard-arrow");
  1189 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1190 	tb->addAction (a);
  1191 	fo->setAction (a);
  1192 	a->setCheckable(true);
  1193 	a->setObjectName(fo->getName());
  1194 	a->setToolTip(tr("Important","Standardflag"));
  1195 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1196 	standardFlagsDefault->addFlag (fo);	
  1197 
  1198 	fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
  1199 	fo->setName("arrow-down");
  1200 	fo->setGroup("standard-arrow");
  1201 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1202 	tb->addAction (a);
  1203 	fo->setAction (a);
  1204 	a->setCheckable(true);
  1205 	a->setObjectName(fo->getName());
  1206 	a->setToolTip(tr("Unimportant","Standardflag"));
  1207 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1208 	standardFlagsDefault->addFlag (fo);	
  1209 
  1210 	fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
  1211 	fo->setName("2arrow-up");
  1212 	fo->setGroup("standard-arrow");
  1213 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1214 	tb->addAction (a);
  1215 	fo->setAction (a);
  1216 	a->setCheckable(true);
  1217 	a->setObjectName(fo->getName());
  1218 	a->setToolTip(tr("Very important!","Standardflag"));
  1219 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1220 	standardFlagsDefault->addFlag (fo);	
  1221 
  1222 	fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
  1223 	fo->setName("2arrow-down");
  1224 	fo->setGroup("standard-arrow");
  1225 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1226 	tb->addAction (a);
  1227 	fo->setAction (a);
  1228 	a->setCheckable(true);
  1229 	a->setObjectName(fo->getName());
  1230 	a->setToolTip(tr("Very unimportant!","Standardflag"));
  1231 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1232 	standardFlagsDefault->addFlag (fo);	
  1233 
  1234 	fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
  1235 	fo->setName("thumb-up");
  1236 	fo->setGroup("standard-thumb");
  1237 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1238 	tb->addAction (a);
  1239 	fo->setAction (a);
  1240 	a->setCheckable(true);
  1241 	a->setObjectName(fo->getName());
  1242 	a->setToolTip(tr("I like this","Standardflag"));
  1243 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1244 	standardFlagsDefault->addFlag (fo);	
  1245 
  1246 	fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
  1247 	fo->setName("thumb-down");
  1248 	fo->setGroup("standard-thumb");
  1249 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1250 	tb->addAction (a);
  1251 	fo->setAction (a);
  1252 	a->setCheckable(true);
  1253 	a->setObjectName(fo->getName());
  1254 	a->setToolTip(tr("I do not like this","Standardflag"));
  1255 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1256 	standardFlagsDefault->addFlag (fo);	
  1257 	
  1258 	fo->load(QPixmap(flagsPath+"flag-rose.png"));
  1259 	fo->setName("rose");
  1260 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1261 	tb->addAction (a);
  1262 	fo->setAction (a);
  1263 	a->setCheckable(true);
  1264 	a->setObjectName(fo->getName());
  1265 	a->setToolTip(tr("Rose","Standardflag"));
  1266 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1267 	standardFlagsDefault->addFlag (fo);	
  1268 
  1269 	fo->load(QPixmap(flagsPath+"flag-heart.png"));
  1270 	fo->setName("heart");
  1271 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1272 	tb->addAction (a);
  1273 	a->setCheckable(true);
  1274 	a->setObjectName(fo->getName());
  1275 	a->setToolTip(tr("I just love... ","Standardflag"));
  1276 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1277 	standardFlagsDefault->addFlag (fo);	
  1278 
  1279 	fo->load(QPixmap(flagsPath+"flag-present.png"));
  1280 	fo->setName("present");
  1281 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1282 	tb->addAction (a);
  1283 	fo->setAction (a);
  1284 	a->setCheckable(true);
  1285 	a->setObjectName(fo->getName());
  1286 	a->setToolTip(tr("Surprise!","Standardflag"));
  1287 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1288 	standardFlagsDefault->addFlag (fo);	
  1289 
  1290 	fo->load(QPixmap(flagsPath+"flag-flash.png"));
  1291 	fo->setName("flash");
  1292 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1293 	tb->addAction (a);
  1294 	fo->setAction (a);
  1295 	a->setCheckable(true);
  1296 	a->setObjectName(fo->getName());
  1297 	a->setToolTip(tr("Dangerous","Standardflag"));
  1298 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1299 	standardFlagsDefault->addFlag (fo);	
  1300 	
  1301 	fo->load(QPixmap(flagsPath+"flag-info.png"));
  1302 	// Original: xsldbg_output.png
  1303 	fo->setName("info");
  1304 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1305 	tb->addAction (a);
  1306 	fo->setAction (a);
  1307 	a->setCheckable(true);
  1308 	a->setObjectName(fo->getName());
  1309 	a->setToolTip(tr("Info","Standardflag"));
  1310 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1311 	standardFlagsDefault->addFlag (fo);	
  1312 
  1313 	fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
  1314 	// Original khelpcenter.png
  1315 	fo->setName("lifebelt");
  1316 	a=new QAction (fo->getPixmap(),fo->getName(),this);
  1317 	tb->addAction (a);
  1318 	fo->setAction (a);
  1319 	a->setCheckable(true);
  1320 	a->setObjectName(fo->getName());
  1321 	a->setToolTip(tr("This will help","Standardflag"));
  1322 	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
  1323 	standardFlagsDefault->addFlag (fo);	
  1324 
  1325 	delete (fo);
  1326 }
  1327 
  1328 // Settings Actions
  1329 void Main::setupSettingsActions()
  1330 {
  1331     QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" ));
  1332 
  1333 	QAction *a;
  1334 
  1335     a = new QAction( tr( "Set application to open pdf files"), this);
  1336     a->setStatusTip ( tr( "Set application to open pdf files"));
  1337     connect( a, SIGNAL( triggered() ), this, SLOT( settingsPDF() ) );
  1338 	settingsMenu->addAction (a);
  1339 
  1340     a = new QAction( tr( "Set application to open external links"), this);
  1341     a->setStatusTip( tr( "Set application to open external links"));
  1342     connect( a, SIGNAL( triggered() ), this, SLOT( settingsURL() ) );
  1343 	settingsMenu->addAction (a);
  1344 
  1345 	settingsMenu->addSeparator();
  1346     a = new QAction( tr( "Edit branch after adding it" ), this );
  1347     a->setStatusTip( tr( "Edit branch after adding it" ));
  1348 	a->setToggleAction(true);
  1349 	a->setOn ( settings.value ("/mapeditor/editmode/autoEdit",true).toBool());
  1350 	settingsMenu->addAction (a);
  1351 	actionSettingsAutoEdit=a;
  1352 
  1353     a= new QAction( tr( "Select branch after adding it" ), this );
  1354     a->setStatusTip( tr( "Select branch after adding it" ));
  1355 	a->setToggleAction(true);
  1356 	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectHeading",false).toBool() );
  1357 	settingsMenu->addAction (a);
  1358 	actionSettingsAutoSelectHeading=a;
  1359 	
  1360     a= new QAction(tr( "Select existing heading" ), this);
  1361     a->setStatusTip( tr( "Select heading before editing" ));
  1362 	a->setToggleAction(true);
  1363 	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
  1364 	settingsMenu->addAction (a);
  1365 	actionSettingsAutoSelectText=a;
  1366 	
  1367     a= new QAction( tr( "Delete key" ), this);
  1368     a->setStatusTip( tr( "Delete key for deleting branches" ));
  1369 	a->setToggleAction(true);
  1370 	a->setOn ( settings.value ("/mapeditor/editmode/useDelKey",false).toBool() );
  1371 	settingsMenu->addAction (a);
  1372     connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleDelKey() ) );
  1373 	actionSettingsUseDelKey=a;
  1374 
  1375     a= new QAction( tr( "Exclusive flags" ), this);
  1376     a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
  1377 	a->setToggleAction(true);
  1378 	a->setOn ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() );
  1379 	settingsMenu->addAction (a);
  1380 	actionSettingsUseFlagGroups=a;
  1381 	
  1382     a= new QAction( tr( "Use hide flags" ), this);
  1383     a->setStatusTip( tr( "Use hide flag during exports " ));
  1384 	a->setToggleAction(true);
  1385 	a->setOn ( settings.value ("/export/useHideExport",true).toBool() );
  1386 	settingsMenu->addAction (a);
  1387 	actionSettingsUseHideExport=a;
  1388 }
  1389 
  1390 // Test Actions
  1391 void Main::setupTestActions()
  1392 {
  1393     QMenu *testMenu = menuBar()->addMenu( tr( "&Test" ));
  1394 
  1395     QAction *a;
  1396     a = new QAction( tr( "test flag" ), this);
  1397     a->setStatusTip( tr( "Call test function" ));
  1398     connect( a, SIGNAL( triggered() ), this, SLOT( testFunction() ) );
  1399 	testMenu->addAction (a);
  1400 }
  1401 
  1402 // Help Actions
  1403 void Main::setupHelpActions()
  1404 {
  1405     QMenu *helpMenu = menuBar()->addMenu ( tr( "&Help" ));
  1406 
  1407     QAction *a;
  1408     a = new QAction(  tr( "Open VYM Documentation (pdf) " ), this );
  1409     a->setStatusTip( tr( "Open VYM Documentation (pdf)" ));
  1410     connect( a, SIGNAL( triggered() ), this, SLOT( helpDoc() ) );
  1411 	helpMenu->addAction (a);
  1412 
  1413     a = new QAction( tr( "About VYM" ), this);
  1414     a->setStatusTip( tr( "About VYM")+" "__VYM);
  1415     connect( a, SIGNAL( triggered() ), this, SLOT( helpAbout() ) );
  1416 	helpMenu->addAction (a);
  1417 
  1418     a = new QAction( tr( "About QT" ), this);
  1419     a->setStatusTip( tr( "Information about QT toolkit" ));
  1420     connect( a, SIGNAL( triggered() ), this, SLOT( helpAboutQT() ) );
  1421 	helpMenu->addAction (a);
  1422 }
  1423 
  1424 // Context Menus
  1425 void Main::setupContextMenus()
  1426 {
  1427 	QAction*a;
  1428 
  1429 	// Context Menu for branch or mapcenter
  1430 	branchContextMenu =new QMenu (this);
  1431 
  1432 		// Submenu "Add"
  1433 		branchAddContextMenu =branchContextMenu->addMenu (tr("Add"));
  1434 		branchAddContextMenu->addAction (actionEditPaste );
  1435 		branchAddContextMenu->addAction ( actionEditAddBranch );
  1436 		branchAddContextMenu->addAction ( actionEditAddBranchHere );
  1437 		branchAddContextMenu->addAction ( actionEditAddBranchAbove);
  1438 		branchAddContextMenu->addAction ( actionEditAddBranchBelow );
  1439 		branchAddContextMenu->addSeparator();	
  1440 		branchAddContextMenu->addAction ( actionEditLoadImage);
  1441 		branchAddContextMenu->addSeparator();	
  1442 		branchAddContextMenu->addAction ( actionEditImportAdd );
  1443 		branchAddContextMenu->addAction ( actionEditImportReplace );
  1444 
  1445 		// Submenu "Remove"
  1446 		branchRemoveContextMenu =branchContextMenu->addMenu (tr ("Remove"));
  1447 		branchRemoveContextMenu->addAction (actionEditCut);
  1448 		branchRemoveContextMenu->addAction ( actionEditDelete );
  1449 		branchRemoveContextMenu->addAction ( actionEditRemoveBranchKeepChilds );
  1450 		branchRemoveContextMenu->addAction ( actionEditRemoveChilds );
  1451 		
  1452 
  1453 	actionEditSaveBranch->addTo( branchContextMenu );
  1454 
  1455 	branchContextMenu->addSeparator();	
  1456 	branchContextMenu->addAction ( actionFormatFrameNone );
  1457 	branchContextMenu->addAction ( actionFormatFrameRectangle);
  1458 
  1459 	branchContextMenu->addSeparator();	
  1460 	branchContextMenu->addAction ( actionFormatIncludeImagesVer );
  1461 	branchContextMenu->addAction ( actionFormatIncludeImagesHor );
  1462 	branchContextMenu->addAction ( actionFormatHideLinkUnselected );
  1463 
  1464 	// Submenu for Links (URLs, vymLinks)
  1465 	branchLinksContextMenu =new QMenu (this);
  1466 
  1467 		branchContextMenu->addSeparator();	
  1468 		branchLinksContextMenu=branchContextMenu->addMenu(tr("URLs and vymLinks"));	
  1469 		branchLinksContextMenu->addAction ( actionEditOpenURL );
  1470 		branchLinksContextMenu->addAction ( actionEditOpenURLTab );
  1471 		branchLinksContextMenu->addAction ( actionEditOpenMultipleURLTabs );
  1472 		branchLinksContextMenu->addAction ( actionEditURL );
  1473 		branchLinksContextMenu->addAction ( actionEditHeading2URL );
  1474 		branchLinksContextMenu->addAction ( actionEditBugzilla2URL );
  1475 		if (settings.value( "/mainwindow/showTestMenu",true).toBool() )
  1476 		{
  1477 			branchLinksContextMenu->addAction ( actionEditFATE2URL );
  1478 		}	
  1479 		branchLinksContextMenu->addSeparator();	
  1480 		branchLinksContextMenu->addAction ( actionEditOpenVymLink );
  1481 		branchLinksContextMenu->addAction ( actionEditOpenMultipleVymLinks );
  1482 		branchLinksContextMenu->addAction ( actionEditVymLink );
  1483 		branchLinksContextMenu->addAction ( actionEditDeleteVymLink );
  1484 		
  1485 
  1486 	// Context Menu for XLinks in a branch menu
  1487 	// This will be populated "on demand" in MapEditor::updateActions
  1488 	branchContextMenu->addSeparator();	
  1489 	branchXLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink"));
  1490 	branchXLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink"));
  1491 	connect( branchXLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) );
  1492 	connect( branchXLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) );
  1493  	
  1494 	
  1495 	// Context menu for floatimage
  1496 	floatimageContextMenu =new QMenu (this);
  1497 	a= new QAction (tr ("Save image"),this);
  1498 	connect (a, SIGNAL (triggered()), this, SLOT (editSaveImage()));
  1499 	floatimageContextMenu->addAction (a);
  1500 
  1501 	floatimageContextMenu->addSeparator();	
  1502 	actionEditCopy->addTo( floatimageContextMenu );
  1503 	actionEditCut->addTo( floatimageContextMenu );
  1504 
  1505 	floatimageContextMenu->addSeparator();	
  1506 	floatimageContextMenu->addAction ( actionFormatHideLinkUnselected );
  1507 
  1508 	
  1509 	// Context menu for canvas
  1510 	canvasContextMenu =new QMenu (this);
  1511 	actionEditMapInfo->addTo( canvasContextMenu );
  1512 	canvasContextMenu->insertSeparator();	
  1513 	actionGroupFormatLinkStyles->addTo( canvasContextMenu );
  1514 	canvasContextMenu->insertSeparator();	
  1515 	actionFormatLinkColorHint->addTo( canvasContextMenu );
  1516 	actionFormatLinkColor->addTo( canvasContextMenu );
  1517 	actionFormatBackColor->addTo( canvasContextMenu );
  1518 
  1519 	// Menu for last opened files
  1520 	// Read settings initially
  1521 	QString s;
  1522 	int j=settings.readNumEntry( "/lastMaps/number",0);
  1523 	for (int i=1;i<=j;i++)
  1524 	{
  1525 		s=settings.value(QString("/lastMaps/map-%1").arg(i),"").toString();
  1526 		if (!s.isEmpty() && j<=maxLastMaps) 
  1527 			lastMaps.append(s);
  1528 	}
  1529 	setupLastMapsMenu();
  1530 	connect( fileLastMapsMenu, SIGNAL( triggered(QAction *) ), this, SLOT( fileLoadLast(QAction*) ) );
  1531 }
  1532 
  1533 void Main::setupLastMapsMenu()
  1534 {
  1535 	// Remove double entries
  1536 	QStringList::Iterator it=lastMaps.begin();
  1537 	QStringList::Iterator jt;
  1538 	while (it!=lastMaps.end() )
  1539 	{
  1540 		jt=it;
  1541 		++jt;
  1542 		while (jt!=lastMaps.end() )
  1543 		{
  1544 			if (*it == *jt)		
  1545 				jt=lastMaps.remove(jt);
  1546 			else	
  1547 				jt++;
  1548 		}
  1549 		it++;
  1550 	}	
  1551 
  1552 	// Limit length of list to maxLastMaps
  1553 	while ((int)(lastMaps.count()) > maxLastMaps) lastMaps.pop_back();
  1554 	
  1555 	// build Menu from lastMaps string list
  1556 	fileLastMapsMenu->clear();
  1557 	for (it = lastMaps.begin(); it != lastMaps.end(); ++it ) 
  1558 		fileLastMapsMenu->addAction (*it );
  1559 }
  1560 
  1561 void Main::hideEvent (QHideEvent * )
  1562 {
  1563 	if (!textEditor->isMinimized() ) textEditor->hide();
  1564 }
  1565 
  1566 void Main::showEvent (QShowEvent * )
  1567 {
  1568 	if (textEditor->showWithMain()) textEditor->showNormal();
  1569 }
  1570 
  1571 bool Main::reallyWriteDirectory(const QString &dir)
  1572 {
  1573 	QStringList eList = QDir(dir).entryList();
  1574 	if (eList.first() ==".")  eList.pop_front();	// remove "."
  1575 	if (eList.first() =="..") eList.pop_front();	// remove "."
  1576 	if (!eList.isEmpty())
  1577 	{
  1578 		QMessageBox mb( __VYM,
  1579 			tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?").arg(dir),
  1580 		QMessageBox::Warning,
  1581 		QMessageBox::Yes ,
  1582 		QMessageBox::Cancel | QMessageBox::Default,
  1583 		QMessageBox::QMessageBox::NoButton );
  1584 
  1585 		mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  1586 		mb.setButtonText( QMessageBox::No, tr("Cancel"));
  1587 		switch( mb.exec() ) 
  1588 		{
  1589 			case QMessageBox::Yes:
  1590 				// save 
  1591 				return true;
  1592 			case QMessageBox::Cancel:
  1593 				// do nothing
  1594 				return false;
  1595 		}
  1596 	}
  1597 	return true;
  1598 }
  1599 
  1600 QString Main::browseDirectory (const QString &caption)
  1601 {
  1602 	Q3FileDialog fd(this,caption);
  1603 	fd.setMode (Q3FileDialog::DirectoryOnly);
  1604 	fd.setCaption(__VYM " - "+caption);
  1605 	fd.show();
  1606 	
  1607 	if ( fd.exec() == QDialog::Accepted )
  1608 		return fd.selectedFile();
  1609 	else
  1610 		return "";
  1611 }
  1612 
  1613 MapEditor* Main::currentMapEditor() const
  1614 {
  1615     if ( tabWidget->currentPage() &&
  1616 	 tabWidget->currentPage()->inherits( "MapEditor" ) )
  1617 		return (MapEditor*)tabWidget->currentPage();
  1618     return NULL;	
  1619 }
  1620 
  1621 //TODO not used now, maybe use this for overview window later
  1622 void Main::newView() 
  1623 {
  1624     // Open a new view... have it delete when closed.
  1625     Main *m = new Main(0, 0, Qt::WDestructiveClose);
  1626     qApp->setMainWidget(m);
  1627     m->show();
  1628     qApp->setMainWidget(0);
  1629 }
  1630 
  1631 void Main::editorChanged(QWidget *)
  1632 {
  1633 	// Unselect all possibly selected objects
  1634 	// (Important to update note editor)
  1635 	int i;
  1636 	MapEditor *me;
  1637 	for (i=0;i<=tabWidget->count() -1;i++)
  1638 	{
  1639 		
  1640 		me=(MapEditor*)tabWidget->page(i);
  1641 		me->unselect();
  1642 	}	
  1643 	currentMapEditor()->reselect();
  1644 
  1645 	// Update actions to in menus and toolbars according to editor
  1646 	currentMapEditor()->updateActions();
  1647 }
  1648 
  1649 void Main::fileNew()
  1650 {
  1651 	QString fn="unnamed";
  1652 	MapEditor* medit = new MapEditor ( NULL);
  1653 	tabWidget->addTab (medit,fn);
  1654 	tabWidget->showPage(medit);
  1655 	medit->viewport()->setFocus();
  1656 	// For the very first map we do not have flagrows yet...
  1657 	medit->select("mc:");
  1658 }
  1659 
  1660 ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
  1661 {
  1662 	ErrorCode err=success;
  1663 	
  1664 	// fn is usually the archive, mapfile the file after uncompressing
  1665 	QString mapfile;
  1666 
  1667 	// Make fn absolute (needed for unzip)
  1668 	fn=QDir (fn).absPath();
  1669 
  1670 	MapEditor *me;
  1671 
  1672 	if (lmode==NewMap)
  1673 	{
  1674 		// Check, if map is already loaded
  1675 		int i=0;
  1676 		while (i<=tabWidget->count() -1)
  1677 		{
  1678 			me=(MapEditor*)tabWidget->page(i);
  1679 			if (me->getFilePath() == fn)
  1680 			{
  1681 				// Already there, ask for confirmation
  1682 				QMessageBox mb( __VYM,
  1683 					tr("The map %1\nis already opened."
  1684 					"Opening the same map in multiple editors may lead \n"
  1685 					"to confusion when finishing working with vym."
  1686 					"Do you want to").arg(fn),
  1687 					QMessageBox::Warning,
  1688 					QMessageBox::Yes | QMessageBox::Default,
  1689 					QMessageBox::Cancel | QMessageBox::Escape,
  1690 					QMessageBox::NoButton);
  1691 				mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
  1692 				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
  1693 				switch( mb.exec() ) 
  1694 				{
  1695 					case QMessageBox::Yes:
  1696 						// load anyway
  1697 						i=tabWidget->count();
  1698 						break;
  1699 					case QMessageBox::Cancel:
  1700 						// do nothing
  1701 						return aborted;
  1702 						break;
  1703 				}
  1704 			}
  1705 			i++;
  1706 		}
  1707 	}
  1708 
  1709 
  1710 	// Try to load map
  1711     if ( !fn.isEmpty() )
  1712 	{
  1713 		me = currentMapEditor();
  1714 		int tabIndex=tabWidget->currentPageIndex();
  1715 		// Check first, if mapeditor exists
  1716 		// If it is not default AND we want a new map, 
  1717 		// create a new mapeditor in a new tab
  1718 		if ( lmode==NewMap && (!me || !me->isDefault() ) )
  1719 		{
  1720 			me= new MapEditor ( NULL);
  1721 			tabWidget->addTab (me,fn);
  1722 			tabIndex=tabWidget->indexOf (me);
  1723 			tabWidget->setCurrentPage (tabIndex);
  1724 		}
  1725 		
  1726 		// Check, if file exists (important for creating new files
  1727 		// from command line
  1728 		if (!QFile(fn).exists() )
  1729 		{
  1730 			QMessageBox mb( __VYM,
  1731 				tr("This map does not exist:\n  %1\nDo you want to create a new one?").arg(fn),
  1732 				QMessageBox::Question,
  1733 				QMessageBox::Yes ,
  1734 				QMessageBox::Cancel | QMessageBox::Default,
  1735 				QMessageBox::NoButton );
  1736 
  1737 			mb.setButtonText( QMessageBox::Yes, tr("Create"));
  1738 			mb.setButtonText( QMessageBox::No, tr("Cancel"));
  1739 			switch( mb.exec() ) 
  1740 			{
  1741 				case QMessageBox::Yes:
  1742 					// Create new map
  1743 					currentMapEditor()->setFilePath(fn);
  1744 					tabWidget->setTabLabel (currentMapEditor(),
  1745 						currentMapEditor()->getFileName() );
  1746 					statusBar()->message( "Created " + fn , statusbarTime );
  1747 					return success;
  1748 						
  1749 				case QMessageBox::Cancel:
  1750 					// don't create new map
  1751 					statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
  1752 					fileCloseMap();
  1753 					return aborted;
  1754 			}
  1755 		}	
  1756 
  1757 
  1758 		//tabWidget->currentPage() won't be NULL here, because of above...
  1759 		tabWidget->showPage(me);
  1760 		me->viewport()->setFocus();
  1761 
  1762 		// Create temporary directory for packing
  1763 		bool ok;
  1764 		QString tmpMapDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX");
  1765 		if (!ok)
  1766 		{
  1767 			QMessageBox::critical( 0, tr( "Critical Load Error" ),
  1768 			   tr("Couldn't create temporary directory before load\n"));
  1769 			return aborted; 
  1770 		}
  1771 
  1772 		// Try to unzip file
  1773 		err=unzipDir (tmpMapDir,fn);
  1774 		if (err==nozip)
  1775 		{
  1776 			mapfile=fn;
  1777 			me->setZipped(false);
  1778 		} else
  1779 		{
  1780 			me->setZipped(true);
  1781 			
  1782 			// Look for mapname.xml
  1783 			mapfile= fn.left(fn.findRev(".",-1,true));
  1784 			mapfile=mapfile.section( '/', -1 );
  1785 			QFile file( tmpMapDir + "/" + mapfile + ".xml");
  1786 			if (!file.exists() )
  1787 			{
  1788 				// mapname.xml does not exist, well, 
  1789 				// maybe some renamed the mapname.vym file...
  1790 				// Try to find any .xml in the toplevel 
  1791 				// directory of the .vym file
  1792 				QStringList flist=QDir (tmpMapDir).entryList("*.xml");
  1793 				if (flist.count()==1) 
  1794 				{
  1795 					// Only one entry, take this one
  1796 					mapfile=tmpMapDir + "/"+flist.first();
  1797 				} else
  1798 				{
  1799 					for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
  1800 						*it=tmpMapDir + "/" + *it;
  1801 					// TODO Multiple entries, load all (but only the first one into this ME)
  1802 					//mainWindow->fileLoadFromTmp (flist);
  1803 					//returnCode=1;	// Silently forget this attempt to load
  1804 					qWarning ("MainWindow::load (fn)  multimap found...");
  1805 				}	
  1806 					
  1807 				if (flist.isEmpty() )
  1808 				{
  1809 					QMessageBox::critical( 0, tr( "Critical Load Error" ),
  1810 							   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
  1811 					err=aborted;				   
  1812 				}	
  1813 			} //file doesn't exist	
  1814 			else
  1815 				mapfile=file.name();
  1816 		}
  1817 
  1818 		if (err!=aborted)
  1819 		{
  1820 			// Save existing filename in case  we import
  1821 			QString fn_org=me->getFilePath();
  1822 
  1823 			// Finally load map into mapEditor
  1824 			me->setFilePath (mapfile,fn);
  1825 			err=me->load(mapfile,lmode);
  1826 
  1827 			// Restore old (maybe empty) filepath, if this is an import
  1828 			if (lmode!=NewMap)
  1829 				me->setFilePath (fn_org);
  1830 		}	
  1831 
  1832 		// Finally check for errors and go home
  1833 		if (err==aborted) 
  1834 		{
  1835 			if (lmode==NewMap) fileCloseMap();
  1836 			statusBar()->message( "Could not load " + fn, statusbarTime );
  1837 		} else 
  1838 		{
  1839 			if (lmode==NewMap)
  1840 			{
  1841 				me->setFilePath (fn);
  1842 				tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
  1843 				if (fn.left(9)!="/tmp/vym-")
  1844 				{
  1845 					// Only append to lastMaps if not loaded from a tmpDir
  1846 					// e.g. imported bookmarks are in a tmpDir
  1847 					lastMaps.prepend(me->getFilePath() );
  1848 					setupLastMapsMenu();
  1849 				}
  1850 				actionFilePrint->setEnabled (true);
  1851 			}	
  1852 			statusBar()->message( "Loaded " + fn, statusbarTime );
  1853 		}	
  1854 
  1855 		// Delete tmpDir
  1856 		removeDir (QDir(tmpMapDir));
  1857 	}
  1858 	return err;
  1859 }
  1860 
  1861 
  1862 void Main::fileLoad(const LoadMode &lmode)
  1863 {
  1864 	QStringList filters;
  1865 	filters <<"VYM map (*.vym *.vyp)"<<"XML (*.xml)";
  1866 	QFileDialog *fd=new QFileDialog( this);
  1867 	fd->setDir (lastFileDir);
  1868 	fd->setFileMode (QFileDialog::ExistingFiles);
  1869 	fd->setFilters (filters);
  1870 	switch (lmode)
  1871 	{
  1872 		case NewMap:
  1873 			fd->setCaption(__VYM " - " +tr("Load vym map"));
  1874 			break;
  1875 		case ImportAdd:
  1876 			fd->setCaption(__VYM " - " +tr("Import: Add vym map to selection"));
  1877 			break;
  1878 		case ImportReplace:
  1879 			fd->setCaption(__VYM " - " +tr("Import: Replace selection with vym map"));
  1880 			break;
  1881 	}
  1882 	fd->show();
  1883 
  1884 	QString fn;
  1885 	if ( fd->exec() == QDialog::Accepted )
  1886 	{
  1887 		lastFileDir=fd->directory().path();
  1888 	    QStringList flist = fd->selectedFiles();
  1889 		QStringList::Iterator it = flist.begin();
  1890 		while( it != flist.end() ) 
  1891 		{
  1892 			fn = *it;
  1893 			fileLoad(*it, lmode);				   
  1894 			++it;
  1895 		}
  1896 	}
  1897 	delete (fd);
  1898 }
  1899 
  1900 void Main::fileLoad()
  1901 {
  1902 	fileLoad (NewMap);
  1903 }
  1904 
  1905 void Main::fileLoadLast(QAction *a)
  1906 {
  1907 	fileLoad(lastMaps.at(fileLastMapsMenu->actions().indexOf(a)) ,NewMap);
  1908 }
  1909 
  1910 void Main::fileSave(const SaveMode &savemode)
  1911 {
  1912 	// tmp dir for zipping 
  1913 	QString tmpMapDir;
  1914 	
  1915 	// Error codes
  1916 	ErrorCode err=success;
  1917 	
  1918 	QString safeFilePath;
  1919 
  1920 	bool saveZipped=currentMapEditor()->saveZipped();
  1921 
  1922 	MapEditor *	me=currentMapEditor();
  1923 	if (me)
  1924 	{
  1925 		QString fn=me->getFilePath();
  1926 		// filename=unnamed, filepath="" in constructor...
  1927 		if ( !fn.isEmpty() ) 
  1928 		{	
  1929 			// We have a filepath, go on saving			
  1930 			// First remove existing file, we 
  1931 			// don't want to add to old zip archives
  1932 			QFile f(fn);
  1933 			if (f.exists() ) 
  1934 				if (!f.remove())
  1935 					QMessageBox::warning( 0, tr( "Save Error" ),
  1936 						fn+   tr("\ncould not be removed before saving"));
  1937 
  1938 			// Look, if we should zip the data:
  1939 			if (!saveZipped)
  1940 			{
  1941 				QMessageBox mb( __VYM,
  1942 					tr("The map %1\ndid not use the compressed "
  1943 					"vym file format.\nWriting it uncompressed will also write images \n"
  1944 					"and flags and thus may overwrite files in the "
  1945 					"given directory\n\nDo you want to write the map").arg(fn),
  1946 					QMessageBox::Warning,
  1947 					QMessageBox::Yes | QMessageBox::Default,
  1948 					QMessageBox::No ,
  1949 					QMessageBox::Cancel | QMessageBox::Escape);
  1950 				mb.setButtonText( QMessageBox::Yes, tr("compressed (vym default)") );
  1951 				mb.setButtonText( QMessageBox::No, tr("uncompressed") );
  1952 				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
  1953 				switch( mb.exec() ) 
  1954 				{
  1955 					case QMessageBox::Yes:
  1956 						// save compressed (default file format)
  1957 						saveZipped=true;
  1958 						break;
  1959 					case QMessageBox::No:
  1960 						// save uncompressed
  1961 						saveZipped=false;
  1962 						break;
  1963 					case QMessageBox::Cancel:
  1964 						// do nothing
  1965 						return;
  1966 						break;
  1967 				}
  1968 			}
  1969 
  1970 			if (saveZipped)
  1971 			{
  1972 				// Create temporary directory for packing
  1973 				bool ok;
  1974 				QString tmpMapDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX");
  1975 				if (!ok)
  1976 				{
  1977 					QMessageBox::critical( 0, tr( "Critical Load Error" ),
  1978 					   tr("Couldn't create temporary directory before save\n"));
  1979 					return; 
  1980 				}
  1981 
  1982 				safeFilePath=me->getFilePath();
  1983 				me->setFilePath (tmpMapDir+"/"+
  1984 					me->getMapName()+ ".xml",
  1985 					safeFilePath);
  1986 				me->save (savemode);
  1987 				me->setFilePath (safeFilePath);
  1988 				
  1989 				zipDir (tmpMapDir,fn);
  1990 			} // save zipped
  1991 			else
  1992 			{
  1993 				// Save unzipped. 
  1994 				safeFilePath=me->getFilePath();
  1995 				me->setFilePath (fn, safeFilePath);
  1996 				me->save (savemode);
  1997 				me->setFilePath (safeFilePath);
  1998 			} // save zipped 	
  1999 		} // filepath available
  2000 		else
  2001 		{
  2002 			// We have  no filepath yet,
  2003 			// call fileSaveAs() now, this will call fileSave() 
  2004 			// again.
  2005 			fileSaveAs(savemode);
  2006 		}
  2007     }
  2008 
  2009 	if (saveZipped && !tmpMapDir.isEmpty())
  2010 		// Delete tmpDir
  2011 		removeDir (QDir(tmpMapDir));
  2012 
  2013 	if (err==success)
  2014 	{
  2015 		statusBar()->message( 
  2016 			tr("Saved  %1").arg(me->getFilePath()), 
  2017 			statusbarTime );
  2018 		lastMaps.prepend(me->getFilePath() );
  2019 		setupLastMapsMenu();
  2020 	} else		
  2021 		statusBar()->message( 
  2022 			tr("Couldn't save ").arg(me->getFilePath()), 
  2023 			statusbarTime );
  2024 }
  2025 
  2026 void Main::fileSave()
  2027 {
  2028 	fileSave (CompleteMap);
  2029 }
  2030 
  2031 void Main::fileSaveAs(const SaveMode& savemode)
  2032 {
  2033 	QString fn;
  2034 
  2035 	if (currentMapEditor())
  2036 	{
  2037 		if (savemode==CompleteMap)
  2038 			fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
  2039 		else		
  2040 			fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
  2041 		if ( !fn.isEmpty() ) 
  2042 		{
  2043 			// Check for existing file
  2044 			if (QFile (fn).exists())
  2045 			{
  2046 				QMessageBox mb( __VYM,
  2047 					tr("The file %1\nexists already. Do you want to").arg(fn),
  2048 					QMessageBox::Warning,
  2049 					QMessageBox::Yes | QMessageBox::Default,
  2050 					QMessageBox::Cancel | QMessageBox::Escape,
  2051 					QMessageBox::NoButton);
  2052 				mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  2053 				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
  2054 				switch( mb.exec() ) 
  2055 				{
  2056 					case QMessageBox::Yes:
  2057 						// save 
  2058 						break;
  2059 					case QMessageBox::Cancel:
  2060 						// do nothing
  2061 						return;
  2062 						break;
  2063 				}
  2064 			} else
  2065 			{
  2066 				// New file, add extension to filename, if missing
  2067 				// This is always .vym or .vyp, depending on savemode
  2068 				if (savemode==CompleteMap)
  2069 				{
  2070 					if (!fn.contains (".vym") && !fn.contains (".xml"))
  2071 						fn +=".vym";
  2072 				} else		
  2073 				{
  2074 					if (!fn.contains (".vyp") && !fn.contains (".xml"))
  2075 						fn +=".vyp";
  2076 				}
  2077 			}
  2078 	
  2079 
  2080 
  2081 
  2082 			// Save now
  2083 			currentMapEditor()->setFilePath(fn);
  2084 			fileSave(savemode);
  2085 
  2086 			// Set name of tab
  2087 			if (savemode==CompleteMap)
  2088 				tabWidget->setTabLabel (currentMapEditor(),
  2089 					currentMapEditor()->getFileName() );
  2090 			return;
  2091 		} 
  2092 	}
  2093 }
  2094 
  2095 void Main::fileSaveAs()
  2096 {
  2097 	fileSaveAs (CompleteMap);
  2098 }
  2099 
  2100 void Main::fileImportKDEBookmarks()
  2101 {
  2102 	ImportKDEBookmarks im;
  2103 	im.transform();
  2104 	if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
  2105 		currentMapEditor()->setFilePath ("");
  2106 }
  2107 
  2108 void Main::fileImportFirefoxBookmarks()
  2109 {
  2110 	Q3FileDialog *fd=new Q3FileDialog( this);
  2111 	fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox");
  2112 	fd->setMode (Q3FileDialog::ExistingFiles);
  2113 	fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)");
  2114 	fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks"));
  2115 	fd->show();
  2116 
  2117 	if ( fd->exec() == QDialog::Accepted )
  2118 	{
  2119 		ImportFirefoxBookmarks im;
  2120 	    QStringList flist = fd->selectedFiles();
  2121 		QStringList::Iterator it = flist.begin();
  2122 		while( it != flist.end() ) 
  2123 		{
  2124 			im.setFile (*it);
  2125 			if (im.transform() && 
  2126 				success==fileLoad (im.getTransformedFile(),NewMap) && 
  2127 				currentMapEditor() )
  2128 				currentMapEditor()->setFilePath ("");
  2129 			++it;
  2130 		}
  2131 	}
  2132 	delete (fd);
  2133 }
  2134 
  2135 void Main::fileImportMM()
  2136 {
  2137 	ImportMM im;
  2138 
  2139 	Q3FileDialog *fd=new Q3FileDialog( this);
  2140 	fd->setDir (lastFileDir);
  2141 	fd->setMode (Q3FileDialog::ExistingFiles);
  2142 	fd->addFilter ("Mind Manager (*.mmap)");
  2143 	fd->setCaption(tr("Import")+" "+"Mind Manager");
  2144 	fd->show();
  2145 
  2146 	if ( fd->exec() == QDialog::Accepted )
  2147 	{
  2148 		lastFileDir=fd->dirPath();
  2149 	    QStringList flist = fd->selectedFiles();
  2150 		QStringList::Iterator it = flist.begin();
  2151 		while( it != flist.end() ) 
  2152 		{
  2153 			im.setFile (*it);
  2154 			if (im.transform() && 
  2155 				success==fileLoad (im.getTransformedFile(),NewMap) && 
  2156 				currentMapEditor() )
  2157 				currentMapEditor()->setFilePath ("");
  2158 
  2159 			++it;
  2160 		}
  2161 	}
  2162 	delete (fd);
  2163 
  2164 }
  2165 
  2166 void Main::fileImportDir()
  2167 {
  2168 	if (currentMapEditor())
  2169 		currentMapEditor()->importDir();	
  2170 }
  2171 
  2172 void Main::fileExportXML()
  2173 {
  2174 	if (currentMapEditor())
  2175 	{
  2176 		QString dir=browseDirectory(tr("Export XML to directory"));
  2177 		if (dir !="" && reallyWriteDirectory(dir) )
  2178 			currentMapEditor()->exportXML(dir);
  2179 	}	
  2180 }
  2181 
  2182 
  2183 void Main::fileExportXHTML()
  2184 {
  2185 	MapEditor *me=currentMapEditor();
  2186 	QString dir;
  2187 	if (me)
  2188 	{
  2189 		ExportXHTMLDialog dia(this);
  2190 		dia.setFilePath (me->getFilePath() );
  2191 		dia.setMapName (me->getMapName() );
  2192 		dia.readSettings();
  2193 		
  2194 		if (dia.exec()==QDialog::Accepted)
  2195 		{
  2196 			QString dir=dia.getDir();
  2197 			// Check, if warnings should be used before overwriting
  2198 			// the output directory
  2199 			bool ok;
  2200 			if (dia.warnings()) 
  2201 				ok=reallyWriteDirectory(dir);
  2202 			else
  2203 				ok=true;
  2204 
  2205 			if (ok)
  2206 			{
  2207 				me->exportXML (dia.getDir() );
  2208 				dia.doExport(me->getMapName() );
  2209 				if (dia.hasChanged())
  2210 					me->setChanged();
  2211 			}	
  2212 		}
  2213 	}	
  2214 }
  2215 
  2216 void Main::fileExportImage()
  2217 {
  2218 	MapEditor *me=currentMapEditor();
  2219 	if (me)
  2220 	{
  2221 		QStringList fl;
  2222 		QFileDialog *fd=new QFileDialog (this);
  2223 		fd->setCaption (tr("Export map as image"));
  2224 		fd->setFileMode(QFileDialog::AnyFile);
  2225 		fd->setFilters  (imageIO.getFilters() );
  2226 		fd->setDirectory (lastImageDir);
  2227 		if (fd->exec())
  2228 		{
  2229 			fl=fd->selectedFiles();
  2230 			qWarning ("Selected "+fl.first()+"  filter: "+fd->selectedFilter());
  2231 			me->exportImage (fl.first(), imageIO.getType (fd->selectedFilter() ) );
  2232 		} 
  2233 	}
  2234 }
  2235 
  2236 void Main::fileExportASCII()
  2237 {
  2238 	MapEditor *me=currentMapEditor();
  2239 	if (me)
  2240 	{
  2241 		ExportASCII ex;
  2242 		ex.setMapCenter(me->getMapCenter());
  2243 		ex.addFilter ("TXT (*.txt)");
  2244 		ex.setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
  2245 		if (ex.execDialog() ) 
  2246 		{
  2247 			me->setExportMode(true);
  2248 			ex.doExport();
  2249 			me->setExportMode(false);
  2250 		}
  2251 	}
  2252 }
  2253 
  2254 void Main::fileExportLaTeX()
  2255 {
  2256 	MapEditor *me=currentMapEditor();
  2257 	if (me)
  2258 	{
  2259 		ExportLaTeX ex;
  2260 		ex.setMapCenter(me->getMapCenter());
  2261 		ex.addFilter ("Tex (*.tex)");
  2262 		ex.setCaption(__VYM " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
  2263 		if (ex.execDialog() ) 
  2264 		{
  2265 			me->setExportMode(true);
  2266 			ex.doExport();
  2267 			me->setExportMode(false);
  2268 		}
  2269 	}
  2270 }
  2271 
  2272 void Main::fileExportKDEBookmarks()
  2273 {
  2274 	ExportKDEBookmarks ex;
  2275 	MapEditor *me=currentMapEditor();
  2276 	if (me)
  2277 	{
  2278 		ex.setMapCenter (me->getMapCenter() );
  2279 		ex.doExport();
  2280 	}	
  2281 }
  2282 
  2283 void Main::fileExportTaskjuggler()
  2284 {
  2285 	ExportTaskjuggler ex;
  2286 	MapEditor *me=currentMapEditor();
  2287 	if (me)
  2288 	{
  2289 		ex.setMapCenter (me->getMapCenter() );
  2290 		ex.setCaption ( __VYM " - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
  2291 		ex.addFilter ("Taskjuggler (*.tjp)");
  2292 		if (ex.execDialog() ) 
  2293 		{
  2294 			me->setExportMode(true);
  2295 			ex.doExport();
  2296 			me->setExportMode(false);
  2297 		}
  2298 	}	
  2299 }
  2300 
  2301 void Main::fileExportOOPresentation()
  2302 {
  2303 	ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office");
  2304 	// TODO add preview in dialog
  2305 	//ImagePreview *p =new ImagePreview (fd);
  2306 	//fd->setContentsPreviewEnabled( TRUE );
  2307 	//fd->setContentsPreview( p, p );
  2308 	//fd->setPreviewMode( QFileDialog::Contents );
  2309 	fd->setCaption(__VYM " - " +tr("Export to")+" Open Office");
  2310 	fd->setDir (QDir().current());
  2311 	if (fd->foundConfig())
  2312 	{
  2313 		fd->show();
  2314 
  2315 		if ( fd->exec() == QDialog::Accepted )
  2316 		{
  2317 			QString fn=fd->selectedFile();
  2318 			if (!fn.contains (".odp"))
  2319 				fn +=".odp";
  2320 
  2321 			//lastImageDir=fn.left(fn.findRev ("/"));
  2322 			if (currentMapEditor())
  2323 				currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());	
  2324 		}
  2325 	} else
  2326 	{
  2327 		QMessageBox::warning(0, 
  2328 		tr("Warning"),
  2329 		tr("Couldn't find configuration for export to Open Office\n"));
  2330 	}
  2331 }
  2332 
  2333 void Main::fileCloseMap()
  2334 {
  2335 	if (currentMapEditor())
  2336 	{
  2337 		if (currentMapEditor()->hasChanged())
  2338 		{
  2339 			QMessageBox mb( __VYM,
  2340 				tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
  2341 				QMessageBox::Warning,
  2342 				QMessageBox::Yes | QMessageBox::Default,
  2343 				QMessageBox::No,
  2344 				QMessageBox::Cancel | QMessageBox::Escape );
  2345 			mb.setButtonText( QMessageBox::Yes, tr("Save modified map before closing it") );
  2346 			mb.setButtonText( QMessageBox::No, tr("Discard changes"));
  2347 			switch( mb.exec() ) 
  2348 			{
  2349 				case QMessageBox::Yes:
  2350 					// save and close
  2351 					fileSave(CompleteMap);
  2352 					break;
  2353 				case QMessageBox::No:
  2354 				// close  without saving
  2355 					break;
  2356 				case QMessageBox::Cancel:
  2357 					// do nothing
  2358 				return;
  2359 			}
  2360 		} 
  2361 		currentMapEditor()->closeMap();
  2362 		tabWidget->removePage(currentMapEditor());
  2363 		if (tabWidget->count()==0)
  2364 			actionFilePrint->setEnabled (false);
  2365 	}	
  2366 }
  2367 
  2368 void Main::filePrint()
  2369 {
  2370 	if (currentMapEditor())
  2371 		currentMapEditor()->print();
  2372 }
  2373 
  2374 void Main::fileExitVYM()
  2375 {
  2376 	// Check if one or more editors have changed
  2377 	MapEditor *me;
  2378 	int i;
  2379 	for (i=0;i<=tabWidget->count() -1;i++)
  2380 	{
  2381 		
  2382 		me=(MapEditor*)tabWidget->page(i);
  2383 
  2384 		// If something changed, ask what to do
  2385 		if (me->isUnsaved())
  2386 		{
  2387 			tabWidget->setCurrentPage(i);
  2388 			QMessageBox mb( __VYM,
  2389 				tr("This map is not saved yet. Do you want to"),
  2390 				QMessageBox::Warning,
  2391 				QMessageBox::Yes | QMessageBox::Default,
  2392 				QMessageBox::No,
  2393 				QMessageBox::Cancel | QMessageBox::Escape );
  2394 			mb.setButtonText( QMessageBox::Yes, tr("Save map") );
  2395 			mb.setButtonText( QMessageBox::No, tr("Discard changes") );
  2396 			mb.setModal (true);
  2397 			mb.show();
  2398 			mb.setActiveWindow();
  2399 			switch( mb.exec() ) {
  2400 				case QMessageBox::Yes:
  2401 					// save (the changed editors) and exit
  2402 					fileSave(CompleteMap);
  2403 					break;
  2404 				case QMessageBox::No:
  2405 					// exit without saving
  2406 					break;
  2407 				case QMessageBox::Cancel:
  2408 					// don't save and don't exit
  2409 				return;
  2410 			}
  2411 		}
  2412 	} // loop over all MEs	
  2413     qApp->quit();
  2414 }
  2415 
  2416 void Main::editUndo()
  2417 {
  2418 	if (currentMapEditor())
  2419 		currentMapEditor()->undo();
  2420 }
  2421 
  2422 void Main::editRedo()	   
  2423 {
  2424 	if (currentMapEditor())
  2425 		currentMapEditor()->redo();
  2426 }
  2427 
  2428 void Main::editCopy()
  2429 {
  2430 	if (currentMapEditor())
  2431 		currentMapEditor()->copy();
  2432 }
  2433 
  2434 void Main::editPaste()
  2435 {
  2436 	if (currentMapEditor())
  2437 		currentMapEditor()->paste();
  2438 }
  2439 
  2440 void Main::editCut()
  2441 {
  2442 	if (currentMapEditor())
  2443 		currentMapEditor()->cut();
  2444 }
  2445 
  2446 void Main::editOpenFindWindow()
  2447 {
  2448 	findWindow->popup();
  2449 	findWindow->raise();
  2450 	findWindow->setActiveWindow();
  2451 }
  2452 
  2453 void Main::editFind(QString s)
  2454 {
  2455 	bool cs=false;
  2456 	BranchObj *bo=currentMapEditor()->findText(s, cs);
  2457 	if (bo)
  2458 	{	
  2459 		statusBar()->message( "Found: " + bo->getHeading(), statusbarTime );
  2460 	} else
  2461 	{
  2462 		QMessageBox::information( findWindow, tr( "VYM -Information:" ),
  2463 							   tr("No matches found for \"%1\"").arg(s));
  2464 	}	
  2465 }
  2466 
  2467 void Main::editFindChanged()
  2468 {	// Notify editor, to abort the current find process
  2469 	currentMapEditor()->findReset();
  2470 }
  2471 
  2472 void Main::openTabs(QStringList urls)
  2473 {
  2474 	if (!urls.isEmpty())
  2475 	{	
  2476 		bool success=true;
  2477 		QStringList args;
  2478 		QString browser=settings.value("/mainwindow/readerURL" ).toString();
  2479 		QProcess *p;
  2480 		if (!procBrowser ||  procBrowser->state()!=QProcess::Running)
  2481 		{
  2482 			QString u=urls.takeFirst();
  2483 			procBrowser = new QProcess( this );
  2484 			args<<u;
  2485 			procBrowser->start(browser,args);
  2486 			if ( !procBrowser->waitForStarted())
  2487 			{
  2488 				// try to set path to browser
  2489 				QMessageBox::warning(0, 
  2490 					tr("Warning"),
  2491 					tr("Couldn't find a viewer to open %1.\n").arg(u)+
  2492 					tr("Please use Settings->")+tr("Set application to open an URL"));
  2493 				return;
  2494 			}
  2495 			sleep (3);
  2496 		}
  2497 		if (browser.contains("konqueror"))
  2498 		{
  2499 			for (int i=0; i<urls.size(); i++)
  2500 			{
  2501 				// Open new browser
  2502 				// Try to open new tab in existing konqueror started previously by vym
  2503 				p=new QProcess (this);
  2504 				args.clear();
  2505 				args<< QString("konqueror-%1").arg(procBrowser->pid())<< 
  2506 					"konqueror-mainwindow#1"<< 
  2507 					"newTab" << 
  2508 					urls.at(i);
  2509 				p->start ("dcop",args);
  2510 				if ( !p->waitForStarted() ) success=false;
  2511 			}
  2512 			if (!success)
  2513 				QMessageBox::warning(0, 
  2514 					tr("Warning"),
  2515 					tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
  2516 			return;		
  2517 		} else if (browser.contains ("firefox") || browser.contains ("mozilla") )
  2518 		{
  2519 			for (int i=0; i<urls.size(); i++)
  2520 			{
  2521 				// Try to open new tab in firefox
  2522 				p=new QProcess (this);
  2523 				args<< "-remote"<< QString("openurl(%1,new-tab)").arg(urls.at(i));
  2524 				p->start (browser,args);
  2525 				if ( !p->waitForStarted() ) success=false;
  2526 			}			
  2527 			if (!success)
  2528 				QMessageBox::warning(0, 
  2529 					tr("Warning"),
  2530 					tr("Couldn't start %1 to open a new tab").arg(browser));
  2531 			return;		
  2532 		}			
  2533 		QMessageBox::warning(0, 
  2534 			tr("Warning"),
  2535 			tr("Sorry, currently only Konqueror and Mozilla support tabbed browsing."));
  2536 	}	
  2537 }
  2538 
  2539 void Main::editOpenURL()
  2540 {
  2541 	// Open new browser
  2542 	if (currentMapEditor())
  2543 	{	
  2544 	    QString url=currentMapEditor()->getURL();
  2545 		QStringList args;
  2546 		if (url=="") return;
  2547 		QString browser=settings.value("/mainwindow/readerURL" ).toString();
  2548 		procBrowser = new QProcess( this );
  2549 		args<<url;
  2550 		procBrowser->start(browser,args);
  2551 		if ( !procBrowser->waitForStarted())
  2552 		{
  2553 			// try to set path to browser
  2554 			QMessageBox::warning(0, 
  2555 				tr("Warning"),
  2556 				tr("Couldn't find a viewer to open %1.\n").arg(url)+
  2557 				tr("Please use Settings->")+tr("Set application to open an URL"));
  2558 			settingsURL() ; 
  2559 		}	
  2560 	}	
  2561 }
  2562 void Main::editOpenURLTab()
  2563 {
  2564 	if (currentMapEditor())
  2565 	{	
  2566 	    QStringList urls;
  2567 		urls.append(currentMapEditor()->getURL());
  2568 		openTabs (urls);
  2569 	}	
  2570 }
  2571 void Main::editOpenMultipleURLTabs()
  2572 {
  2573 	if (currentMapEditor())
  2574 	{	
  2575 	    QStringList urls;
  2576 		urls=currentMapEditor()->getURLs();
  2577 		openTabs (urls);
  2578 	}	
  2579 }
  2580 
  2581 
  2582 void Main::editURL()
  2583 {
  2584 	if (currentMapEditor())
  2585 	    currentMapEditor()->editURL();
  2586 }
  2587 
  2588 void Main::editHeading2URL()
  2589 {
  2590 	if (currentMapEditor())
  2591 	    currentMapEditor()->editHeading2URL();
  2592 }
  2593 
  2594 void Main::editBugzilla2URL()
  2595 {
  2596 	if (currentMapEditor())
  2597 	    currentMapEditor()->editBugzilla2URL();
  2598 }
  2599 
  2600 void Main::editFATE2URL()
  2601 {
  2602 	if (currentMapEditor())
  2603 	    currentMapEditor()->editFATE2URL();
  2604 }
  2605 
  2606 void Main::editHeading()
  2607 {
  2608 	if (lineedit->isVisible())
  2609 	{
  2610 		if (currentMapEditor())
  2611 		{	
  2612 			MapEditor *me=currentMapEditor();
  2613 			QString oldSel=me->getSelectString();
  2614 			if (me->select (editSel))
  2615 				me->setHeading(lineedit->text());
  2616 			me->select (oldSel);
  2617 		}	
  2618 		lineedit->releaseKeyboard();
  2619 		lineedit->hide();
  2620 		setFocus();
  2621 	} else
  2622 	{
  2623 		if (currentMapEditor())
  2624 		{
  2625 			bool ok;
  2626 			QPoint p;
  2627 			QString s=currentMapEditor()->getHeading(ok,p);
  2628 
  2629 			if (ok)
  2630 			{
  2631 #if defined(Q_OS_MACX)
  2632 				p = currentMapEditor()->mapToGlobal( currentMapEditor()->worldMatrix().map( p));
  2633 				QDialog *d =new QDialog(NULL);
  2634 				QLineEdit *le=new QLineEdit (d);
  2635 				d->setWindowFlags (Qt::FramelessWindowHint);
  2636 				d->setGeometry(p.x(),p.y(),200,25);
  2637 				le->resize (d->size());
  2638 				le->setText (s);
  2639 				le->selectAll();
  2640 				connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
  2641 				d->activateWindow();
  2642 				d->exec();
  2643 				currentMapEditor()->setHeading (le->text());
  2644 #else
  2645 				p = currentMapEditor()->mapTo(this, currentMapEditor()->worldMatrix().map( p));
  2646 				lineedit->setGeometry(p.x(),p.y(),200,25);
  2647 				lineedit->setText(s);
  2648 				lineedit->setCursorPosition(1);
  2649 				lineedit->selectAll();
  2650 				lineedit->show();
  2651 				lineedit->grabKeyboard();
  2652 				lineedit->setFocus();
  2653 
  2654 				editSel=currentMapEditor()->getSelectString();
  2655 #endif
  2656 
  2657 			}
  2658 		}
  2659 	}
  2660 }
  2661 
  2662 void Main::openVymLinks(const QStringList &vl)
  2663 {
  2664 	for (int j=0; j<vl.size(); j++)
  2665 	{
  2666 		// compare path with already loaded maps
  2667 		int index=-1;
  2668 		int i;
  2669 		MapEditor *me;
  2670 		for (i=0;i<=tabWidget->count() -1;i++)
  2671 		{
  2672 			me=(MapEditor*)tabWidget->page(i);
  2673 			if (vl.at(j)==me->getFilePath() )
  2674 			{
  2675 				index=i;
  2676 				break;
  2677 			}
  2678 		}	
  2679 		if (index<0)
  2680 		// Load map
  2681 		{
  2682 			if (!QFile(vl.at(j)).exists() )
  2683 				QMessageBox::critical( 0, tr( "Critical Error" ),
  2684 				   tr("Couldn't open map %1").arg(vl.at(j)));
  2685 			else
  2686 			{
  2687 				fileLoad (vl.at(j), NewMap);
  2688 				tabWidget->setCurrentPage (tabWidget->count()-1);	
  2689 			}
  2690 		} else
  2691 			// Go to tab containing the map
  2692 			tabWidget->setCurrentPage (index);	
  2693 	}
  2694 }
  2695 
  2696 void Main::editOpenVymLink()
  2697 {
  2698 	if (currentMapEditor())
  2699 	{
  2700 		QStringList vl;
  2701 		vl.append(currentMapEditor()->getVymLink());	
  2702 		openVymLinks (vl);
  2703 	}
  2704 }
  2705 
  2706 void Main::editOpenMultipleVymLinks()
  2707 {
  2708 	QString currentVymLink;
  2709 	if (currentMapEditor())
  2710 	{
  2711 		QStringList vl=currentMapEditor()->getVymLinks();
  2712 		openVymLinks (vl);
  2713 	}
  2714 }
  2715 
  2716 void Main::editVymLink()
  2717 {
  2718 	if (currentMapEditor())
  2719 		currentMapEditor()->editVymLink();	
  2720 }
  2721 
  2722 void Main::editDeleteVymLink()
  2723 {
  2724 	if (currentMapEditor())
  2725 		currentMapEditor()->deleteVymLink();	
  2726 }
  2727 
  2728 void Main::editToggleHideExport()
  2729 {
  2730 	if (currentMapEditor())
  2731 		currentMapEditor()->toggleHideExport();	
  2732 }
  2733 
  2734 void Main::editMapInfo()
  2735 {
  2736 	if (currentMapEditor())
  2737 		currentMapEditor()->editMapInfo();	
  2738 }
  2739 
  2740 void Main::editMoveUp()
  2741 {
  2742 	if (currentMapEditor())
  2743 	    currentMapEditor()->moveBranchUp();
  2744 }
  2745 
  2746 void Main::editMoveDown()
  2747 {
  2748 	if (currentMapEditor())
  2749 		currentMapEditor()->moveBranchDown();
  2750 }
  2751 
  2752 void Main::editToggleScroll()
  2753 {
  2754 	if (currentMapEditor())
  2755 	{
  2756 		currentMapEditor()->toggleScroll();	
  2757 	}	
  2758 }
  2759 
  2760 void Main::editUnScrollAll()
  2761 {
  2762 	if (currentMapEditor())
  2763 	{
  2764 		currentMapEditor()->unScrollAll();	
  2765 	}	
  2766 }
  2767 
  2768 void Main::editNewBranch()
  2769 {
  2770 
  2771 	if (!lineedit->isVisible() && currentMapEditor())
  2772 		currentMapEditor()->addNewBranch(0);
  2773 }
  2774 
  2775 void Main::editNewBranchHere()
  2776 {
  2777 	if (currentMapEditor())
  2778 		currentMapEditor()->addNewBranchHere();
  2779 }
  2780 
  2781 void Main::editNewBranchAbove()
  2782 {
  2783 	if (currentMapEditor())
  2784 		currentMapEditor()->addNewBranch(-1);
  2785 }
  2786 
  2787 void Main::editNewBranchBelow()
  2788 {
  2789 	if (currentMapEditor())
  2790 		currentMapEditor()->addNewBranch(1);
  2791 }
  2792 
  2793 void Main::editImportAdd()
  2794 {
  2795 	fileLoad (ImportAdd);
  2796 }
  2797 
  2798 void Main::editImportReplace()
  2799 {
  2800 	fileLoad (ImportReplace);
  2801 }
  2802 
  2803 void Main::editSaveBranch()
  2804 {
  2805 	fileSaveAs (PartOfMap);
  2806 }
  2807 
  2808 void Main::editRemoveBranchKeepChilds()
  2809 {
  2810 	if (currentMapEditor())
  2811 		currentMapEditor()->removeBranchKeepChilds();
  2812 }
  2813 
  2814 void Main::editRemoveChilds()
  2815 {
  2816 	if (currentMapEditor())
  2817 		currentMapEditor()->removeChilds();
  2818 }
  2819 
  2820 void Main::editDeleteSelection()
  2821 {
  2822 	if (currentMapEditor() && actionSettingsUseDelKey->isOn())
  2823 		currentMapEditor()->deleteSelection();
  2824 }
  2825 
  2826 void Main::editUpperBranch()
  2827 {
  2828 	if (currentMapEditor())
  2829 		currentMapEditor()->selectUpperBranch();
  2830 }
  2831 
  2832 void Main::editLowerBranch()
  2833 {
  2834 	if (currentMapEditor())
  2835 		currentMapEditor()->selectLowerBranch();
  2836 }
  2837 
  2838 void Main::editLeftBranch()
  2839 {
  2840 	if (currentMapEditor())
  2841 		currentMapEditor()->selectLeftBranch();
  2842 }
  2843 
  2844 void Main::editRightBranch()
  2845 {
  2846 	if (currentMapEditor())
  2847 		currentMapEditor()->selectRightBranch();
  2848 }
  2849 
  2850 void Main::editFirstBranch()
  2851 {
  2852 	if (currentMapEditor())
  2853 		currentMapEditor()->selectFirstBranch();
  2854 }
  2855 
  2856 void Main::editLastBranch()
  2857 {
  2858 	if (currentMapEditor())
  2859 		currentMapEditor()->selectLastBranch();
  2860 }
  2861 
  2862 void Main::editLoadImage()
  2863 {
  2864 	if (currentMapEditor())
  2865 		currentMapEditor()->loadFloatImage();
  2866 }
  2867 
  2868 void Main::editSaveImage()
  2869 {
  2870 	if (currentMapEditor())
  2871 		currentMapEditor()->saveFloatImage();
  2872 }
  2873 
  2874 void Main::editFollowXLink(QAction *a)
  2875 {
  2876 
  2877 	if (currentMapEditor())
  2878 		currentMapEditor()->followXLink(branchXLinksContextMenuFollow->actions().indexOf(a));
  2879 }
  2880 
  2881 void Main::editEditXLink(QAction *a)
  2882 {
  2883 	if (currentMapEditor())
  2884 		currentMapEditor()->editXLink(branchXLinksContextMenuEdit->actions().indexOf(a));
  2885 }
  2886 
  2887 void Main::formatSelectColor()
  2888 {
  2889 	if (currentMapEditor())
  2890 	{
  2891 		QColor col = QColorDialog::getColor( currentMapEditor()->getColor(), this );
  2892 		if ( !col.isValid() ) return;
  2893 		currentMapEditor()->setColor( col );
  2894 		colorChanged( col );
  2895 	}	
  2896 }
  2897 
  2898 void Main::formatPickColor()
  2899 {
  2900 	if (currentMapEditor())
  2901 		colorChanged( currentMapEditor()->pickColor() );
  2902 }
  2903 
  2904 void Main::colorChanged(QColor c)
  2905 {
  2906     QPixmap pix( 16, 16 );
  2907     pix.fill( c );
  2908     actionFormatColor->setIconSet( pix );
  2909 }
  2910 
  2911 void Main::formatColorItem()
  2912 {
  2913 	if (currentMapEditor())
  2914 		currentMapEditor()->colorItem();
  2915 }
  2916 
  2917 void Main::formatColorBranch()
  2918 {
  2919 	if (currentMapEditor())
  2920 		currentMapEditor()->colorBranch();
  2921 }
  2922 
  2923 void Main::formatLinkStyleLine()
  2924 {
  2925 	if (currentMapEditor())
  2926 		currentMapEditor()->setLinkStyle(StyleLine);
  2927 }
  2928 
  2929 void Main::formatLinkStyleParabel()
  2930 {
  2931 	if (currentMapEditor())
  2932 		currentMapEditor()->setLinkStyle(StyleParabel);
  2933 }
  2934 
  2935 void Main::formatLinkStylePolyLine()
  2936 {
  2937 	if (currentMapEditor())
  2938 		currentMapEditor()->setLinkStyle(StylePolyLine);
  2939 }
  2940 
  2941 void Main::formatLinkStylePolyParabel()
  2942 {
  2943 	if (currentMapEditor())
  2944 		currentMapEditor()->setLinkStyle(StylePolyParabel);
  2945 }
  2946 
  2947 void Main::formatSelectBackColor()
  2948 {
  2949 	if (currentMapEditor())
  2950 		currentMapEditor()->selectBackgroundColor();
  2951 }
  2952 
  2953 void Main::formatSelectLinkColor()
  2954 {
  2955 	if (currentMapEditor())
  2956 		currentMapEditor()->selectLinkColor();
  2957 }
  2958 
  2959 void Main::formatToggleLinkColorHint()
  2960 {
  2961 	currentMapEditor()->toggleLinkColorHint();
  2962 }
  2963 
  2964 void Main::formatFrameNone()
  2965 {
  2966 	if (currentMapEditor())
  2967 		currentMapEditor()->setFrame(NoFrame);
  2968 }
  2969 
  2970 void Main::formatFrameRectangle()
  2971 {
  2972 	if (currentMapEditor())
  2973 		currentMapEditor()->setFrame(Rectangle);
  2974 }
  2975 
  2976 void Main::formatIncludeImagesVer()
  2977 {
  2978 	if (currentMapEditor())
  2979 		currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn());
  2980 }
  2981 
  2982 void Main::formatIncludeImagesHor()
  2983 {
  2984 	if (currentMapEditor())
  2985 		currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
  2986 }
  2987 
  2988 void Main::formatHideLinkUnselected()
  2989 {
  2990 	if (currentMapEditor())
  2991 		currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
  2992 }
  2993 
  2994 void Main::viewZoomReset()
  2995 {
  2996 	if (currentMapEditor())
  2997 	{
  2998 		QMatrix m;
  2999 		m.reset();
  3000 		currentMapEditor()->setWorldMatrix( m );
  3001 		currentMapEditor()->setViewCenter();
  3002 		currentMapEditor()->adjustCanvasSize();
  3003 	}	
  3004 }
  3005 
  3006 void Main::viewZoomIn()
  3007 {
  3008 	if (currentMapEditor())
  3009 	{
  3010 		QMatrix m = currentMapEditor()->worldMatrix();
  3011 		m.scale( 1.25, 1.25 );
  3012 		currentMapEditor()->setWorldMatrix( m );
  3013 		currentMapEditor()->setViewCenter();
  3014 		currentMapEditor()->adjustCanvasSize();
  3015 	}	
  3016 }
  3017 
  3018 void Main::viewZoomOut()
  3019 {
  3020 	if (currentMapEditor())
  3021 	{
  3022 		QMatrix m = currentMapEditor()->worldMatrix();
  3023 		m.scale( 0.8, 0.8 );
  3024 		currentMapEditor()->setWorldMatrix( m );
  3025 		currentMapEditor()->setViewCenter();
  3026 		currentMapEditor()->adjustCanvasSize();
  3027 	}	
  3028 }
  3029 
  3030 bool Main::settingsPDF()
  3031 {
  3032 	// Default browser is set in constructor
  3033 	bool ok;
  3034 	QString text = QInputDialog::getText(
  3035 		"VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
  3036 		settings.value("/mainwindow/readerPDF").toString(), &ok, this );
  3037 	if (ok)
  3038 		settings.setValue ("/mainwindow/readerPDF",text);
  3039 	return ok;
  3040 }
  3041 
  3042 
  3043 bool Main::settingsURL()
  3044 {
  3045 	// Default browser is set in constructor
  3046 	bool ok;
  3047 	QString text = QInputDialog::getText(
  3048 		"VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
  3049 		settings.value("/mainwindow/readerURL").toString()
  3050 		, &ok, this );
  3051 	if (ok)
  3052 		settings.setValue ("/mainwindow/readerURL",text);
  3053 	return ok;
  3054 }
  3055 
  3056 void Main::settingsToggleDelKey()
  3057 {
  3058 	if (actionSettingsUseDelKey->isOn())
  3059 	{
  3060 		actionEditDelete->setAccel (QKeySequence (Qt::Key_Delete));
  3061 	} else
  3062 	{
  3063 		actionEditDelete->setAccel (QKeySequence (""));
  3064 	}
  3065 }
  3066 
  3067 void Main::windowToggleNoteEditor()
  3068 {
  3069 	if (textEditor->showWithMain() )
  3070 		windowHideNoteEditor();
  3071 	else	
  3072 		windowShowNoteEditor();
  3073 }
  3074 
  3075 void Main::windowToggleHistory()
  3076 {
  3077 	if (currentMapEditor())
  3078 		currentMapEditor()->toggleHistoryWindow();
  3079 }
  3080 
  3081 void Main::updateNoteFlag()
  3082 {
  3083 	if (currentMapEditor())
  3084 		currentMapEditor()->updateNoteFlag();
  3085 }
  3086 
  3087 void Main::updateActions()
  3088 {
  3089 	MapEditor *me=currentMapEditor();
  3090 	if (!me) return;
  3091 
  3092 	// updateActions is also called when NoteEditor is closed
  3093 	actionViewToggleNoteEditor->setOn (textEditor->isVisible());
  3094 
  3095 	QAction *a;
  3096 	if (me->getLinkColorHint()==HeadingColor) 
  3097 		actionFormatLinkColorHint->setOn(true);
  3098 	else	
  3099 		actionFormatLinkColorHint->setOn(false);
  3100 
  3101 	switch (me->getLinkStyle())
  3102 	{
  3103 		case StyleLine: 
  3104 			actionFormatLinkStyleLine->setOn(true);
  3105 			break;
  3106 		case StyleParabel:
  3107 			actionFormatLinkStyleParabel->setOn(true);
  3108 			break;
  3109 		case StylePolyLine:	
  3110 			actionFormatLinkStylePolyLine->setOn(true);
  3111 			break;
  3112 		case StylePolyParabel:	
  3113 			actionFormatLinkStylePolyParabel->setOn(true);
  3114 			break;
  3115 		default:
  3116 			break;
  3117 	}	
  3118 
  3119 	QPixmap pix( 16, 16 );
  3120     pix.fill( me->getBackgroundColor() );
  3121     actionFormatBackColor->setIconSet( pix );
  3122     pix.fill( me->getDefLinkColor() );
  3123     actionFormatLinkColor->setIconSet( pix );
  3124 
  3125 	actionFileSave->setEnabled( me->isUnsaved() );
  3126 	if (me->isUndoAvailable())
  3127 		actionEditUndo->setEnabled( true);
  3128 	else	
  3129 		actionEditUndo->setEnabled( false);
  3130 
  3131 	if (me->isRedoAvailable())
  3132 		actionEditRedo->setEnabled( true);
  3133 	else	
  3134 		actionEditRedo->setEnabled( false);
  3135 
  3136 	LinkableMapObj *selection=me->getSelection();
  3137 	if (selection)
  3138 	{
  3139 		if ( (typeid(*selection) == typeid(BranchObj)) || 
  3140 			(typeid(*selection) == typeid(MapCenterObj))  )
  3141 		{
  3142 			BranchObj *bo=(BranchObj*)selection;
  3143 			// Take care of links
  3144 			if (bo->countXLinks()==0)
  3145 			{
  3146 				branchXLinksContextMenuEdit->clear();
  3147 				branchXLinksContextMenuFollow->clear();
  3148 			} else
  3149 			{
  3150 				BranchObj *bot;
  3151 				QString s;
  3152 				branchXLinksContextMenuEdit->clear();
  3153 				branchXLinksContextMenuFollow->clear();
  3154 				for (int i=0; i<=bo->countXLinks();i++)
  3155 				{
  3156 					bot=bo->XLinkTargetAt(i);
  3157 					if (bot)
  3158 					{
  3159 						s=bot->getHeading();
  3160 						if (s.length()>25)
  3161 							s=s.left(25)+"...";
  3162 						branchXLinksContextMenuFollow->addAction (s);
  3163 						branchXLinksContextMenuEdit->addAction (s);
  3164 					}	
  3165 				}
  3166 			}
  3167 
  3168 			standardFlagsDefault->setEnabled (true);
  3169 
  3170 			actionEditToggleScroll->setEnabled (true);
  3171 			if ( bo->isScrolled() )
  3172 				actionEditToggleScroll->setOn(true);
  3173 			else	
  3174 				actionEditToggleScroll->setOn(false);
  3175 
  3176 			if ( bo->getURL().isEmpty() )
  3177 			{
  3178 				actionEditOpenURL->setEnabled (false);
  3179 				actionEditOpenURLTab->setEnabled (false);
  3180 			}	
  3181 			else	
  3182 			{
  3183 				actionEditOpenURL->setEnabled (true);
  3184 				actionEditOpenURLTab->setEnabled (true);
  3185 			}
  3186 			if ( bo->getVymLink().isEmpty() )
  3187 			{
  3188 				actionEditOpenVymLink->setEnabled (false);
  3189 				actionEditDeleteVymLink->setEnabled (false);
  3190 			} else	
  3191 			{
  3192 				actionEditOpenVymLink->setEnabled (true);
  3193 				actionEditDeleteVymLink->setEnabled (true);
  3194 			}	
  3195 
  3196 			if (bo->canMoveBranchUp()) 
  3197 				actionEditMoveUp->setEnabled (true);
  3198 			else	
  3199 				actionEditMoveUp->setEnabled (false);
  3200 			if (bo->canMoveBranchDown()) 
  3201 				actionEditMoveDown->setEnabled (true);
  3202 			else	
  3203 				actionEditMoveDown->setEnabled (false);
  3204 
  3205 
  3206 			actionEditToggleHideExport->setEnabled (true);	
  3207 			actionEditToggleHideExport->setOn (bo->hideInExport() );	
  3208 
  3209 			actionEditCopy->setEnabled (true);	
  3210 			actionEditCut->setEnabled (true);	
  3211 			if (!clipboardEmpty)
  3212 				actionEditPaste->setEnabled (true);	
  3213 			else	
  3214 				actionEditPaste->setEnabled (false);	
  3215 			for (a=actionListBranches.first();a;a=actionListBranches.next())
  3216 				a->setEnabled(true);
  3217 			actionEditDelete->setEnabled (true);
  3218 			switch (selection->getFrameType())
  3219 			{
  3220 				case NoFrame: 
  3221 					actionFormatFrameNone->setOn(true);
  3222 					break;
  3223 				case Rectangle:
  3224 					actionFormatFrameRectangle->setOn(true);
  3225 					break;
  3226 				default:
  3227 					break;
  3228 			}	
  3229 			actionFormatIncludeImagesVer->setOn
  3230 				( ((BranchObj*)selection)->getIncludeImagesVer());
  3231 			actionFormatIncludeImagesHor->setOn
  3232 				( ((BranchObj*)selection)->getIncludeImagesHor());
  3233 			actionFormatHideLinkUnselected->setOn
  3234 				(selection->getHideLinkUnselected());
  3235 		}
  3236 		if ( (typeid(*selection) == typeid(FloatImageObj)) )
  3237 		{
  3238 			FloatObj *fo=(FloatImageObj*)selection;
  3239 //FIXME do this in mainwindow					standardFlagsDefault->setEnabled (false);
  3240 
  3241 			actionEditOpenURL->setEnabled (false);
  3242 			actionEditOpenVymLink->setEnabled (false);
  3243 			actionEditDeleteVymLink->setEnabled (false);	
  3244 			actionEditToggleHideExport->setEnabled (true);	
  3245 			actionEditToggleHideExport->setOn (fo->hideInExport() );	
  3246 
  3247 
  3248 			actionEditCopy->setEnabled (true);
  3249 			actionEditCut->setEnabled (true);	
  3250 			actionEditPaste->setEnabled (false);
  3251 			for (a=actionListBranches.first();a;a=actionListBranches.next())
  3252 				a->setEnabled(false);
  3253 			actionEditDelete->setEnabled (true);
  3254 			actionFormatHideLinkUnselected->setOn
  3255 				( selection->getHideLinkUnselected());
  3256 			actionEditMoveUp->setEnabled (false);
  3257 			actionEditMoveDown->setEnabled (false);
  3258 		}
  3259 
  3260 	} else
  3261 	{
  3262 		actionEditCopy->setEnabled (false);	
  3263 		actionEditCut->setEnabled (false);	
  3264 		actionEditPaste->setEnabled (false);	
  3265 		for (a=actionListBranches.first();a;a=actionListBranches.next())
  3266 			a->setEnabled(false);
  3267 
  3268 		actionEditToggleScroll->setEnabled (false);
  3269 		actionEditOpenURL->setEnabled (false);
  3270 		actionEditOpenVymLink->setEnabled (false);
  3271 		actionEditDeleteVymLink->setEnabled (false);	
  3272 		actionEditHeading2URL->setEnabled (false);	
  3273 		actionEditDelete->setEnabled (false);
  3274 		actionEditMoveUp->setEnabled (false);
  3275 		actionEditMoveDown->setEnabled (false);
  3276 		actionEditToggleHideExport->setEnabled (false);	
  3277 	}	
  3278 }
  3279 
  3280 ModMode Main::getModMode()
  3281 {
  3282 	if (actionModModeColor->isOn()) return ModModeColor;
  3283 	if (actionModModeCopy->isOn()) return ModModeCopy;
  3284 	if (actionModModeXLink->isOn()) return ModModeXLink;
  3285 	return ModModeNone;
  3286 }
  3287 
  3288 bool Main::autoEdit()
  3289 {
  3290 	return actionSettingsAutoEdit->isOn();
  3291 }
  3292 
  3293 bool Main::autoSelectHeading()
  3294 {
  3295 	return actionSettingsAutoSelectHeading->isOn();
  3296 }
  3297 
  3298 bool Main::useFlagGroups()
  3299 {
  3300 	return actionSettingsUseFlagGroups->isOn();
  3301 }
  3302 
  3303 void Main::windowShowNoteEditor()
  3304 {
  3305 	textEditor->setShowWithMain(true);
  3306 	textEditor->show();
  3307 	actionViewToggleNoteEditor->setOn (true);
  3308 }
  3309 
  3310 void Main::windowHideNoteEditor()
  3311 {
  3312 	textEditor->setShowWithMain(false);
  3313 	textEditor->hide();
  3314 	actionViewToggleNoteEditor->setOn (false);
  3315 }
  3316 
  3317 void Main::windowNextEditor()
  3318 {
  3319 	if (tabWidget->currentPageIndex() < tabWidget->count())
  3320 		tabWidget->setCurrentPage (tabWidget->currentPageIndex() +1);
  3321 }
  3322 
  3323 void Main::windowPreviousEditor()
  3324 {
  3325 	if (tabWidget->currentPageIndex() >0)
  3326 		tabWidget->setCurrentPage (tabWidget->currentPageIndex() -1);
  3327 }
  3328 
  3329 void Main::standardFlagChanged()
  3330 {
  3331 	currentMapEditor()->toggleStandardFlag(sender()->name());
  3332 }
  3333 
  3334 void Main::testFunction()
  3335 {
  3336 	currentMapEditor()->testFunction();
  3337 }
  3338 
  3339 void Main::helpDoc()
  3340 {
  3341 	QString docpath;
  3342 	#if defined(Q_OS_MACX)
  3343 		docpath="./vym.app/Contents/vym.pdf";
  3344 	#else
  3345 		// default path in SUSE LINUX
  3346 		docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
  3347 	#endif
  3348 
  3349 	if (!QFile (docpath).exists() )
  3350 	{
  3351 		// relative path for easy testing in tarball
  3352 		docpath="doc/vym.pdf";
  3353 		if (!QFile (docpath).exists() )
  3354 		{
  3355 			// relative path for testing while still writing vym.tex
  3356 			docpath="doc/tex/vym.pdf";
  3357 			if (!QFile (docpath).exists() )
  3358 			{
  3359 				// Try yet another one for Knoppix
  3360 				docpath="/usr/share/doc/packages/vym/vym.pdf";
  3361 				if (!QFile (docpath).exists() )
  3362 				{
  3363 					QMessageBox::critical(0, 
  3364 					tr("Critcal error"),
  3365 					tr("Couldn't find the documentation\n"
  3366 					"vym.pdf in various places."));
  3367 					return;
  3368 				}	
  3369 			}	
  3370 		}
  3371 	}
  3372 	
  3373 	Process *pdfProc = new Process();
  3374 	pdfProc->clearArguments();
  3375 	pdfProc->addArgument( settings.value("/mainwindow/readerPDF").toString());
  3376 	pdfProc->addArgument( docpath);
  3377 
  3378 	if ( !pdfProc->start() ) 
  3379 	{
  3380 		// error handling
  3381 		QMessageBox::warning(0, 
  3382 			tr("Warning"),
  3383 			tr("Couldn't find a viewer to open %1.\n").arg("vym.pdf")+
  3384 			tr("Please use Settings->")+tr("Set application to open PDF files"));
  3385 		settingsPDF();	
  3386 		return;
  3387 	}
  3388 }
  3389 
  3390 
  3391 void Main::helpAbout()
  3392 {
  3393 	AboutDialog ad;
  3394 	ad.setName ("aboutwindow");
  3395 	ad.setMinimumSize(500,500);
  3396 	ad.resize (QSize (500,500));
  3397 	ad.exec();
  3398 }
  3399 
  3400 void Main::helpAboutQT()
  3401 {
  3402 	QMessageBox::aboutQt( this, "Qt Application Example" );
  3403 }
  3404