1 #include "mainwindow.h"
3 #include <QtDBus/QtDBus>
9 #include "aboutdialog.h"
10 #include "branchpropwindow.h"
11 #include "branchitem.h"
12 #include "exportoofiledialog.h"
16 #include "historywindow.h"
18 #include "mapeditor.h"
23 #include "texteditor.h"
24 #include "warningdialog.h"
26 #if defined(Q_OS_WIN32)
27 // Define only this structure as opposed to
28 // including full 'windows.h'. FindWindow
29 // clashes with the one in Win32 API.
30 typedef struct _PROCESS_INFORMATION
36 } PROCESS_INFORMATION, *LPPROCESS_INFORMATION;
39 extern TextEditor *textEditor;
40 extern Main *mainWindow;
41 extern QString tmpVymDir;
42 extern QString clipboardDir;
43 extern QString clipboardFile;
44 extern bool clipboardEmpty;
45 extern int statusbarTime;
46 extern FlagRow *standardFlagsMaster;
47 extern FlagRow *systemFlagsMaster;
48 extern QString vymName;
49 extern QString vymVersion;
50 extern QString vymBuildDate;
53 QMenu* branchContextMenu;
54 QMenu* branchAddContextMenu;
55 QMenu* branchRemoveContextMenu;
56 QMenu* branchLinksContextMenu;
57 QMenu* branchXLinksContextMenuEdit;
58 QMenu* branchXLinksContextMenuFollow;
59 QMenu* floatimageContextMenu;
60 QMenu* canvasContextMenu;
61 QMenu* fileLastMapsMenu;
62 QMenu* fileImportMenu;
63 QMenu* fileExportMenu;
66 extern Settings settings;
67 extern Options options;
68 extern ImageIO imageIO;
70 extern QDir vymBaseDir;
71 extern QDir lastImageDir;
72 extern QDir lastFileDir;
73 #if defined(Q_OS_WIN32)
74 extern QDir vymInstallDir;
76 extern QString iconPath;
77 extern QString flagsPath;
80 Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
81 QMainWindow(parent,name,f)
85 setCaption ("VYM - View Your Mind");
87 // Load window settings
88 #if defined(Q_OS_WIN32)
89 if (settings.value("/mainwindow/geometry/maximized", false).toBool())
91 setWindowState(Qt::WindowMaximized);
96 resize (settings.value("/mainwindow/geometry/size", QSize (800,600)).toSize());
97 move (settings.value("/mainwindow/geometry/pos", QPoint(300,100)).toPoint());
100 // Sometimes we may need to remember old selections
104 currentColor=Qt::black;
106 // Create unique temporary directory
108 tmpVymDir=makeTmpDir (ok,"vym");
111 qWarning ("Mainwindow: Could not create temporary directory, failed to start vym");
114 if (debug) qDebug (QString("vym tmpDir=%1").arg(tmpVymDir) );
116 // Create direcctory for clipboard
117 clipboardDir=tmpVymDir+"/clipboard";
118 clipboardFile="map.xml";
119 QDir d(clipboardDir);
120 d.mkdir (clipboardDir,true);
121 makeSubDirs (clipboardDir);
126 // Satellite windows //////////////////////////////////////////
128 historyWindow=new HistoryWindow();
129 connect (historyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
132 branchPropertyWindow = new BranchPropertyWindow();
133 connect (branchPropertyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
135 // Connect TextEditor, so that we can update flags if text changes
136 connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
137 connect (textEditor, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
139 // Connect HistoryWindow, so that we can update flags
140 connect (historyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
143 // Initialize script editor
144 scriptEditor = new SimpleScriptEditor();
145 scriptEditor->move (50,50);
147 connect( scriptEditor, SIGNAL( runScript ( QString ) ),
148 this, SLOT( runScript( QString ) ) );
151 // Initialize Find window
152 findWindow=new FindWindow(NULL);
153 findWindow->move (x(),y()+70);
154 connect (findWindow, SIGNAL( findButton(QString) ),
155 this, SLOT(editFind(QString) ) );
156 connect (findWindow, SIGNAL( somethingChanged() ),
157 this, SLOT(editFindChanged() ) );
159 // Initialize some settings, which are platform dependant
162 // application to open URLs
163 p="/mainwindow/readerURL";
164 #if defined(Q_OS_LINUX)
165 s=settings.value (p,"xdg-open").toString();
167 #if defined(Q_OS_MACX)
168 s=settings.value (p,"/usr/bin/open").toString();
171 #if defined(Q_OS_WIN32)
172 // Assume that system has been set up so that
173 // Explorer automagically opens up the URL
174 // in the user's preferred browser.
175 s=settings.value (p,"explorer").toString();
177 s=settings.value (p,"mozilla").toString();
181 settings.setValue( p,s);
183 // application to open PDFs
184 p="/mainwindow/readerPDF";
185 #if defined(Q_OS_LINUX)
186 s=settings.value (p,"xdg-open").toString();
188 #if defined(Q_OS_MACX)
189 s=settings.value (p,"/usr/bin/open").toString();
190 #elif defined(Q_OS_WIN32)
191 s=settings.value (p,"acrord32").toString();
193 s=settings.value (p,"acroread").toString();
196 settings.setValue( p,s);
198 // width of xLinksMenu
201 // Create tab widget which holds the maps
202 tabWidget= new QTabWidget (this);
203 connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ),
204 this, SLOT( editorChanged( QWidget * ) ) );
206 setCentralWidget(tabWidget);
210 setupFormatActions();
214 setupNetworkActions();
215 setupSettingsActions();
218 if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions();
221 // Status bar and progress bar there
224 progressBar=new QProgressBar;
226 statusBar()->addPermanentWidget(progressBar);
228 restoreState (settings.value("/mainwindow/state",0).toByteArray());
237 #if defined(Q_OS_WIN32)
238 settings.setValue ("/mainwindow/geometry/maximized", isMaximized());
240 settings.setValue ("/mainwindow/geometry/size", size());
241 settings.setValue ("/mainwindow/geometry/pos", pos());
242 settings.setValue ("/mainwindow/state",saveState(0));
244 settings.setValue ("/mainwindow/view/AntiAlias",actionViewToggleAntiAlias->isOn());
245 settings.setValue ("/mainwindow/view/SmoothPixmapTransform",actionViewToggleSmoothPixmapTransform->isOn());
246 settings.setValue( "/version/version", vymVersion );
247 settings.setValue( "/version/builddate", vymBuildDate );
249 settings.setValue( "/mainwindow/autosave/use",actionSettingsAutosaveToggle->isOn() );
250 settings.setValue( "/mapeditor/editmode/autoSelectNewBranch",actionSettingsAutoSelectNewBranch->isOn() );
251 settings.setValue( "/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() );
252 settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() );
253 settings.setValue( "/mapeditor/editmode/autoEditNewBranch",actionSettingsAutoEditNewBranch->isOn() );
254 settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
255 settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
256 settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
258 //TODO save scriptEditor settings
260 // call the destructors
262 delete historyWindow;
263 delete branchPropertyWindow;
266 // Remove temporary directory
267 removeDir (QDir(tmpVymDir));
270 void Main::loadCmdLine()
272 /* TODO draw some kind of splashscreen while loading...
278 QStringList flist=options.getFileList();
279 QStringList::Iterator it=flist.begin();
281 while (it !=flist.end() )
283 fileLoad (*it, NewMap);
289 void Main::statusMessage(const QString &s)
291 // Surpress messages while progressbar during
293 if (progressMin==progressMax)
294 statusBar()->message( s);
297 void Main::setProgressMinimum (int min)
299 progressBar->setMinimum(min);
303 void Main::setProgressMaximum (int max)
305 progressBar->setMaximum(max);
309 statusBar()->addPermanentWidget(progressBar);
314 void Main::setProgressValue (int v)
316 progressBar->setValue (v);
319 void Main::removeProgressBar()
322 statusBar()->removeWidget(progressBar);
323 progressMax=progressMin=0;
326 void Main::closeEvent (QCloseEvent* )
332 void Main::setupFileActions()
334 QMenu *fileMenu = menuBar()->addMenu ( tr ("&Map") );
335 QToolBar *tb = addToolBar( tr ("&Map") );
336 tb->setObjectName ("mapTB");
339 a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New map","File menu" ),this);
340 a->setStatusTip ( tr( "New map","Status tip File menu" ) );
341 a->setShortcut ( Qt::CTRL + Qt::Key_N ); //New map
343 fileMenu->addAction (a);
344 connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) );
346 a = new QAction(QPixmap( iconPath+"filenewcopy.png"), tr( "&Copy to new map","File menu" ),this);
347 a->setStatusTip ( tr( "Copy selection to mapcenter of a new map","Status tip File menu" ) );
348 a->setShortcut ( Qt::CTRL +Qt::SHIFT + Qt::Key_N ); //New map
349 fileMenu->addAction (a);
350 connect( a, SIGNAL( triggered() ), this, SLOT( fileNewCopy() ) );
353 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ,"File menu"),this);
354 a->setStatusTip (tr( "Open","Status tip File menu" ) );
355 a->setShortcut ( Qt::CTRL + Qt::Key_O ); //Open map
357 fileMenu->addAction (a);
358 connect( a, SIGNAL( triggered() ), this, SLOT( fileLoad() ) );
360 fileLastMapsMenu = fileMenu->addMenu (tr("Open Recent","File menu"));
361 fileMenu->addSeparator();
363 a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save...","File menu" ), this);
364 a->setStatusTip ( tr( "Save","Status tip file menu" ));
365 a->setShortcut (Qt::CTRL + Qt::Key_S ); //Save map
367 fileMenu->addAction (a);
368 connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) );
371 a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As...","File menu" ), this);
372 a->setStatusTip (tr( "Save &As","Status tip file menu" ) );
373 fileMenu->addAction (a);
374 connect( a, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) );
376 fileMenu->addSeparator();
378 fileImportMenu = fileMenu->addMenu (tr("Import","File menu"));
380 a = new QAction(tr("KDE 3 Bookmarks"), this);
381 a->setStatusTip ( tr( "Import %1","Status tip file menu" ).arg(tr("KDE 3 bookmarks")));
382 a->addTo (fileImportMenu);
383 connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDE3Bookmarks() ) );
385 a = new QAction(tr("KDE 4 Bookmarks"), this);
386 a->setStatusTip ( tr( "Import %1","Status tip file menu" ).arg(tr("KDE 4 bookmarks")));
387 a->addTo (fileImportMenu);
388 connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDE4Bookmarks() ) );
390 if (settings.value( "/mainwindow/showTestMenu",false).toBool())
392 a = new QAction( QPixmap(), tr("Firefox Bookmarks","File menu"),this);
393 a->setStatusTip (tr( "Import %1","Status tip file menu").arg(tr("Firefox Bookmarks" ) ));
394 a->addTo (fileImportMenu);
395 connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFirefoxBookmarks() ) );
398 a = new QAction("Freemind...",this);
399 a->setStatusTip ( tr( "Import %1","status tip file menu").arg(" Freemind") );
400 fileImportMenu->addAction (a);
401 connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFreemind() ) );
403 a = new QAction("Mind Manager...",this);
404 a->setStatusTip ( tr( "Import %1","status tip file menu").arg(" Mind Manager") );
405 fileImportMenu->addAction (a);
406 connect( a, SIGNAL( triggered() ), this, SLOT( fileImportMM() ) );
408 a = new QAction( tr( "Import Dir%1","File menu").arg("..."), this);
409 a->setStatusTip (tr( "Import directory structure (experimental)","status tip file menu" ) );
410 fileImportMenu->addAction (a);
411 connect( a, SIGNAL( triggered() ), this, SLOT( fileImportDir() ) );
413 fileExportMenu = fileMenu->addMenu (tr("Export","File menu"));
415 a = new QAction( tr("Image%1","File export menu").arg("..."), this);
416 a->setStatusTip( tr( "Export map as image","status tip file menu" ));
417 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportImage() ) );
418 fileExportMenu->addAction (a);
420 a = new QAction( "Open Office...", this);
421 a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office ","status tip file menu" ));
422 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportOOPresentation() ) );
423 fileExportMenu->addAction (a);
425 a = new QAction( "Webpage (XHTML)...",this );
426 a->setShortcut (Qt::ALT + Qt::Key_X); //Export XHTML
427 a->setStatusTip ( tr( "Export as %1","status tip file menu").arg(tr(" webpage (XHTML)","status tip file menu")));
428 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXHTML() ) );
429 fileExportMenu->addAction (a);
431 a = new QAction( "Text (ASCII)...", this);
432 a->setStatusTip ( tr( "Export as %1").arg("ASCII "+tr("(still experimental)" )));
433 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportASCII() ) );
434 fileExportMenu->addAction (a);
436 a = new QAction( "Spreadsheet (CSV)...", this);
437 a->setStatusTip ( tr( "Export as %1").arg("CSV "+tr("(still experimental)" )));
438 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportCSV() ) );
439 fileExportMenu->addAction (a);
441 a = new QAction( tr("KDE 3 Bookmarks","File menu"), this);
442 a->setStatusTip( tr( "Export as %1").arg(tr("KDE 3 Bookmarks" )));
443 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDE3Bookmarks() ) );
444 fileExportMenu->addAction (a);
446 a = new QAction( tr("KDE 4 Bookmarks","File menu"), this);
447 a->setStatusTip( tr( "Export as %1").arg(tr("KDE 4 Bookmarks" )));
448 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDE4Bookmarks() ) );
449 fileExportMenu->addAction (a);
451 a = new QAction( "Taskjuggler...", this );
452 a->setStatusTip( tr( "Export as %1").arg("Taskjuggler "+tr("(still experimental)" )));
453 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportTaskjuggler() ) );
454 fileExportMenu->addAction (a);
456 a = new QAction( "LaTeX...", this);
457 a->setStatusTip( tr( "Export as %1").arg("LaTeX "+tr("(still experimental)" )));
458 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportLaTeX() ) );
459 fileExportMenu->addAction (a);
461 a = new QAction( "XML..." , this );
462 a->setStatusTip (tr( "Export as %1").arg("XML"));
463 connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXML() ) );
464 fileExportMenu->addAction (a);
466 fileMenu->addSeparator();
468 a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this);
469 a->setStatusTip ( tr( "Print" ,"File menu") );
470 a->setShortcut (Qt::CTRL + Qt::Key_P ); //Print map
472 fileMenu->addAction (a);
473 connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) );
476 a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map","File menu" ), this);
477 a->setStatusTip (tr( "Close Map" ) );
478 a->setShortcut (Qt::CTRL + Qt::Key_W ); //Close map
479 fileMenu->addAction (a);
480 connect( a, SIGNAL( triggered() ), this, SLOT( fileCloseMap() ) );
482 a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit","File menu")+" "+vymName, this);
483 a->setStatusTip ( tr( "Exit")+" "+vymName );
484 a->setShortcut (Qt::CTRL + Qt::Key_Q ); //Quit vym
485 fileMenu->addAction (a);
486 connect( a, SIGNAL( triggered() ), this, SLOT( fileExitVYM() ) );
491 void Main::setupEditActions()
493 QToolBar *tb = addToolBar( tr ("&Actions toolbar","Toolbar name") );
494 tb->setLabel( "Edit Actions" );
495 tb->setObjectName ("actionsTB");
496 QMenu *editMenu = menuBar()->addMenu( tr("&Edit","Edit menu") );
500 a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo","Edit menu" ),this);
501 connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) );
502 a->setStatusTip (tr( "Undo" ) );
503 a->setShortcut ( Qt::CTRL + Qt::Key_Z ); //Undo last action
504 a->setEnabled (false);
506 editMenu->addAction (a);
509 a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo","Edit menu" ), this);
510 a->setStatusTip (tr( "Redo" ));
511 a->setShortcut (Qt::CTRL + Qt::Key_Y ); //Redo last action
513 editMenu->addAction (a);
514 connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) );
517 editMenu->addSeparator();
518 a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy","Edit menu" ), this);
519 a->setStatusTip ( tr( "Copy" ) );
520 a->setShortcut (Qt::CTRL + Qt::Key_C ); //Copy
521 a->setEnabled (false);
523 editMenu->addAction (a);
524 connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) );
527 a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t","Edit menu" ), this);
528 a->setStatusTip ( tr( "Cut" ) );
529 a->setShortcut (Qt::CTRL + Qt::Key_X ); //Cut
530 a->setEnabled (false);
532 editMenu->addAction (a);
534 connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) );
536 a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste","Edit menu" ),this);
537 connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) );
538 a->setStatusTip ( tr( "Paste" ) );
539 a->setShortcut ( Qt::CTRL + Qt::Key_V ); //Paste
540 a->setEnabled (false);
542 editMenu->addAction (a);
545 // Shortcut to delete selection
546 a = new QAction( tr( "Delete Selection","Edit menu" ),this);
547 a->setStatusTip (tr( "Delete Selection" ));
548 a->setShortcut ( Qt::Key_Delete); //Delete selection
549 a->setShortcutContext (Qt::WindowShortcut);
551 connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) );
554 // Shortcut to add mapcenter
555 a= new QAction(QPixmap(iconPath+"newmapcenter.png"),tr( "Add mapcenter","Canvas context menu" ), this);
556 a->setShortcut ( Qt::Key_M);
557 a->setShortcutContext (Qt::WindowShortcut);
558 connect( a, SIGNAL( triggered() ), this, SLOT( editAddMapCenter() ) );
559 //actionListBranches.append(a);
561 actionAddMapCenter = a;
564 // Shortcut to add branch
565 alt = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child","Edit menu" ), this);
566 alt->setStatusTip ( tr( "Add a branch as child of selection" ));
567 alt->setShortcut (Qt::Key_A); //Add branch
568 alt->setShortcutContext (Qt::WindowShortcut);
570 connect( alt, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) );
571 a = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child","Edit menu" ), this);
572 a->setStatusTip ( tr( "Add a branch as child of selection" ));
573 a->setShortcut (Qt::Key_Insert); //Add branch
574 connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) );
575 actionListBranches.append(a);
576 #if defined (Q_OS_MACX)
577 // In OSX show different shortcut in menues, the keys work indepently always
582 editMenu->addAction (actionAddBranch);
583 tb->addAction (actionAddBranch);
586 // Add branch by inserting it at selection
587 a = new QAction(tr( "Add branch (insert)","Edit menu" ), this);
588 a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
589 a->setShortcut (Qt::ALT + Qt::Key_Insert ); //Insert branch
590 a->setShortcutContext (Qt::WindowShortcut);
592 connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBefore() ) );
593 a->setEnabled (false);
594 actionListBranches.append(a);
595 actionAddBranchBefore=a;
596 a = new QAction(tr( "Add branch (insert)","Edit menu" ),this);
597 a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
598 a->setShortcut ( Qt::ALT + Qt::Key_A ); //Insert branch
599 a->setShortcutContext (Qt::WindowShortcut);
601 connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBefore() ) );
602 actionListBranches.append(a);
605 a = new QAction(tr( "Add branch above","Edit menu" ), this);
606 a->setStatusTip ( tr( "Add a branch above selection" ));
607 a->setShortcut (Qt::SHIFT+Qt::Key_Insert ); //Add branch above
608 a->setShortcutContext (Qt::WindowShortcut);
610 connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) );
611 a->setEnabled (false);
612 actionListBranches.append(a);
613 actionAddBranchAbove=a;
614 a = new QAction(tr( "Add branch above","Edit menu" ), this);
615 a->setStatusTip ( tr( "Add a branch above selection" ));
616 a->setShortcut (Qt::SHIFT+Qt::Key_A ); //Add branch above
617 a->setShortcutContext (Qt::WindowShortcut);
619 connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) );
620 actionListBranches.append(a);
623 a = new QAction(tr( "Add branch below","Edit menu" ), this);
624 a->setStatusTip ( tr( "Add a branch below selection" ));
625 a->setShortcut (Qt::CTRL +Qt::Key_Insert ); //Add branch below
626 a->setShortcutContext (Qt::WindowShortcut);
628 connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) );
629 a->setEnabled (false);
630 actionListBranches.append(a);
631 actionAddBranchBelow=a;
632 a = new QAction(tr( "Add branch below","Edit menu" ), this);
633 a->setStatusTip ( tr( "Add a branch below selection" ));
634 a->setShortcut (Qt::CTRL +Qt::Key_A ); // Add branch below
635 a->setShortcutContext (Qt::WindowShortcut);
637 connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) );
638 actionListBranches.append(a);
640 a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up","Edit menu" ), this);
641 a->setStatusTip ( tr( "Move branch up" ) );
642 a->setShortcut (Qt::Key_PageUp ); // Move branch up
643 a->setEnabled (false);
645 editMenu->addAction (a);
646 connect( a, SIGNAL( triggered() ), this, SLOT( editMoveUp() ) );
649 a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down","Edit menu" ),this);
650 connect( a, SIGNAL( triggered() ), this, SLOT( editMoveDown() ) );
651 a->setStatusTip (tr( "Move branch down" ) );
652 a->setShortcut ( Qt::Key_PageDown ); // Move branch down
653 a->setEnabled (false);
655 editMenu->addAction (a);
658 a = new QAction( QPixmap(iconPath+"editsort.png" ), tr( "Sort children","Edit menu" ), this );
659 connect( a, SIGNAL( activated() ), this, SLOT( editSortChildren() ) );
660 a->setEnabled (true);
662 editMenu->addAction (a);
663 actionSortChildren=a;
665 alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch","Edit menu" ), this);
666 alt->setShortcut ( Qt::Key_S ); // Scroll branch
667 alt->setStatusTip (tr( "Scroll branch" ));
668 connect( alt, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) );
669 #if defined(Q_OS_MACX)
670 actionToggleScroll=alt;
672 actionToggleScroll=a;
674 actionToggleScroll->setEnabled (false);
675 actionToggleScroll->setToggleAction(true);
676 tb->addAction (actionToggleScroll);
677 editMenu->addAction ( actionToggleScroll);
678 editMenu->addAction (actionToggleScroll);
681 actionListBranches.append(actionToggleScroll);
683 a = new QAction( QPixmap(), tr( "Expand all branches","Edit menu" ), this);
684 a->setShortcut ( Qt::SHIFT + Qt::Key_X ); // Expand all branches
685 a->setStatusTip (tr( "Expand all branches" ));
686 connect( a, SIGNAL( triggered() ), this, SLOT( editExpandAll() ) );
688 actionExpandAll->setEnabled (false);
689 actionExpandAll->setToggleAction(false);
690 //tb->addAction (actionExpandAll);
691 editMenu->addAction ( actionExpandAll);
693 actionListBranches.append(actionExpandAll);
696 a = new QAction( tr( "Unscroll children","Edit menu" ), this);
697 a->setStatusTip (tr( "Unscroll all scrolled branches in selected subtree" ));
698 editMenu->addAction (a);
699 connect( a, SIGNAL( triggered() ), this, SLOT( editUnscrollChildren() ) );
701 editMenu->addSeparator();
703 a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find...","Edit menu"), this);
704 a->setStatusTip (tr( "Find" ) );
705 a->setShortcut (Qt::CTRL + Qt::Key_F ); //Find
706 editMenu->addAction (a);
707 connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWindow() ) );
709 editMenu->addSeparator();
711 a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL","Edit menu" ), this);
712 a->setShortcut (Qt::CTRL + Qt::Key_U );
713 a->setShortcut (tr( "Open URL" ));
716 connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURL() ) );
719 a = new QAction( tr( "Open URL in new tab","Edit menu" ), this);
720 a->setStatusTip (tr( "Open URL in new tab" ));
721 //a->setShortcut (Qt::CTRL+Qt::Key_U );
723 connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) );
726 a = new QAction( tr( "Open all URLs in subtree","Edit menu" ), this);
727 a->setStatusTip (tr( "Open all URLs in subtree" ));
729 actionListBranches.append(a);
730 connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) );
731 actionOpenMultipleURLTabs=a;
733 a = new QAction(QPixmap(), tr( "Edit URL...","Edit menu"), this);
734 a->setStatusTip ( tr( "Edit URL" ) );
735 a->setShortcut ( Qt::Key_U );
736 a->setShortcutContext (Qt::WindowShortcut);
737 actionListBranches.append(a);
739 connect( a, SIGNAL( triggered() ), this, SLOT( editURL() ) );
742 a = new QAction(QPixmap(), tr( "Edit local URL...","Edit menu"), this);
743 a->setStatusTip ( tr( "Edit local URL" ) );
744 a->setShortcut (Qt::SHIFT + Qt::Key_U );
745 a->setShortcutContext (Qt::WindowShortcut);
746 actionListBranches.append(a);
748 connect( a, SIGNAL( triggered() ), this, SLOT( editLocalURL() ) );
751 a = new QAction( tr( "Use heading for URL","Edit menu" ), this);
752 a->setStatusTip ( tr( "Use heading of selected branch as URL" ));
753 a->setEnabled (false);
754 actionListBranches.append(a);
755 connect( a, SIGNAL( triggered() ), this, SLOT( editHeading2URL() ) );
758 a = new QAction(tr( "Create URL to Novell Bugzilla","Edit menu" ), this);
759 a->setStatusTip ( tr( "Create URL to Novell Bugzilla" ));
760 a->setEnabled (false);
761 actionListBranches.append(a);
762 connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) );
763 actionBugzilla2URL=a;
765 a = new QAction(tr( "Create URL to Novell FATE","Edit menu" ), this);
766 a->setStatusTip ( tr( "Create URL to Novell FATE" ));
767 a->setEnabled (false);
768 actionListBranches.append(a);
769 connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) );
772 a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Open linked map","Edit menu" ), this);
773 a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
775 a->setEnabled (false);
776 connect( a, SIGNAL( triggered() ), this, SLOT( editOpenVymLink() ) );
779 a = new QAction(QPixmap(), tr( "Open all vym links in subtree","Edit menu" ), this);
780 a->setStatusTip ( tr( "Open all vym links in subtree" ));
781 a->setEnabled (false);
782 actionListBranches.append(a);
783 connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVymLinks() ) );
784 actionOpenMultipleVymLinks=a;
787 a = new QAction(tr( "Edit vym link...","Edit menu" ), this);
788 a->setEnabled (false);
789 a->setStatusTip ( tr( "Edit link to another vym map" ));
790 connect( a, SIGNAL( triggered() ), this, SLOT( editVymLink() ) );
791 actionListBranches.append(a);
794 a = new QAction(tr( "Delete vym link","Edit menu" ),this);
795 a->setStatusTip ( tr( "Delete link to another vym map" ));
796 a->setEnabled (false);
797 connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteVymLink() ) );
798 actionDeleteVymLink=a;
800 a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports","Edit menu" ), this);
801 a->setStatusTip ( tr( "Hide object in exports" ) );
802 a->setShortcut (Qt::Key_H );
803 a->setToggleAction(true);
805 a->setEnabled (false);
806 connect( a, SIGNAL( triggered() ), this, SLOT( editToggleHideExport() ) );
807 actionToggleHideExport=a;
809 a = new QAction(tr( "Edit Map Info...","Edit menu" ),this);
810 a->setStatusTip ( tr( "Edit Map Info" ));
811 a->setEnabled (true);
812 connect( a, SIGNAL( triggered() ), this, SLOT( editMapInfo() ) );
815 // Import at selection (adding to selection)
816 a = new QAction( tr( "Add map (insert)","Edit menu" ),this);
817 a->setStatusTip (tr( "Add map at selection" ));
818 connect( a, SIGNAL( triggered() ), this, SLOT( editImportAdd() ) );
819 a->setEnabled (false);
820 actionListBranches.append(a);
823 // Import at selection (replacing selection)
824 a = new QAction( tr( "Add map (replace)","Edit menu" ), this);
825 a->setStatusTip (tr( "Replace selection with map" ));
826 connect( a, SIGNAL( triggered() ), this, SLOT( editImportReplace() ) );
827 a->setEnabled (false);
828 actionListBranches.append(a);
829 actionImportReplace=a;
832 a = new QAction( tr( "Save selection","Edit menu" ), this);
833 a->setStatusTip (tr( "Save selection" ));
834 connect( a, SIGNAL( triggered() ), this, SLOT( editSaveBranch() ) );
835 a->setEnabled (false);
836 actionListBranches.append(a);
839 // Only remove branch, not its children
840 a = new QAction(tr( "Remove only branch ","Edit menu" ), this);
841 a->setStatusTip ( tr( "Remove only branch and keep its children" ));
842 a->setShortcut (Qt::ALT + Qt::Key_Delete );
843 connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteKeepChildren() ) );
844 a->setEnabled (false);
846 actionListBranches.append(a);
847 actionDeleteKeepChildren=a;
849 // Only remove children of a branch
850 a = new QAction( tr( "Remove children","Edit menu" ), this);
851 a->setStatusTip (tr( "Remove children of branch" ));
852 a->setShortcut (Qt::SHIFT + Qt::Key_Delete );
853 connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteChildren() ) );
854 a->setEnabled (false);
855 actionListBranches.append(a);
856 actionDeleteChildren=a;
858 a = new QAction( tr( "Add Image...","Edit menu" ), this);
859 a->setStatusTip (tr( "Add Image" ));
860 connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) );
863 a = new QAction( tr( "Property window","Dialog to edit properties of selection" )+QString ("..."), this);
864 a->setStatusTip (tr( "Set properties for selection" ));
865 a->setShortcut ( Qt::CTRL + Qt::Key_I ); //Property window
866 a->setShortcutContext (Qt::WindowShortcut);
867 a->setToggleAction (true);
869 connect( a, SIGNAL( triggered() ), this, SLOT( windowToggleProperty() ) );
870 actionViewTogglePropertyWindow=a;
874 void Main::setupFormatActions()
876 QMenu *formatMenu = menuBar()->addMenu (tr ("F&ormat","Format menu"));
878 QToolBar *tb = addToolBar( tr("Format Actions","Format Toolbar name"));
879 tb->setObjectName ("formatTB");
882 pix.fill (Qt::black);
883 a= new QAction(pix, tr( "Set &Color" )+QString("..."), this);
884 a->setStatusTip ( tr( "Set Color" ));
885 connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectColor() ) );
887 formatMenu->addAction (a);
889 a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color","Edit menu" ), this);
890 a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) );
891 a->setShortcut (Qt::CTRL + Qt::Key_K );
892 connect( a, SIGNAL( triggered() ), this, SLOT( formatPickColor() ) );
893 a->setEnabled (false);
895 formatMenu->addAction (a);
896 actionListBranches.append(a);
897 actionFormatPickColor=a;
899 a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color &branch","Edit menu" ), this);
900 a->setStatusTip ( tr( "Color branch" ) );
901 a->setShortcut (Qt::CTRL + Qt::Key_B);
902 connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) );
903 a->setEnabled (false);
905 formatMenu->addAction (a);
906 actionListBranches.append(a);
907 actionFormatColorSubtree=a;
909 a= new QAction(QPixmap(iconPath+"formatcolorsubtree.png"), tr( "Color sub&tree","Edit menu" ), this);
910 a->setStatusTip ( tr( "Color Subtree" ));
911 a->setShortcut (Qt::CTRL + Qt::Key_T);
912 connect( a, SIGNAL( triggered() ), this, SLOT( formatColorSubtree() ) );
913 a->setEnabled (false);
914 formatMenu->addAction (a);
916 actionListBranches.append(a);
917 actionFormatColorSubtree=a;
919 formatMenu->addSeparator();
920 actionGroupFormatLinkStyles=new QActionGroup ( this);
921 actionGroupFormatLinkStyles->setExclusive (true);
922 a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
923 a->setStatusTip (tr( "Line" ));
924 a->setToggleAction(true);
925 connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleLine() ) );
926 formatMenu->addAction (a);
927 actionFormatLinkStyleLine=a;
928 a= new QAction( tr( "Linkstyle Curve" ), actionGroupFormatLinkStyles);
929 a->setStatusTip (tr( "Line" ));
930 a->setToggleAction(true);
931 connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleParabel() ) );
932 formatMenu->addAction (a);
933 actionFormatLinkStyleParabel=a;
934 a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles );
935 a->setStatusTip (tr( "PolyLine" ));
936 a->setToggleAction(true);
937 connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyLine() ) );
938 formatMenu->addAction (a);
939 actionFormatLinkStylePolyLine=a;
940 a= new QAction( tr( "Linkstyle Thick Curve" ), actionGroupFormatLinkStyles);
941 a->setStatusTip (tr( "PolyParabel" ) );
942 a->setToggleAction(true);
943 a->setChecked (true);
944 connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyParabel() ) );
945 formatMenu->addAction (a);
946 actionFormatLinkStylePolyParabel=a;
948 a = new QAction( tr( "Hide link if object is not selected","Branch attribute" ), this);
949 a->setStatusTip (tr( "Hide link" ));
950 a->setToggleAction(true);
951 connect( a, SIGNAL( triggered() ), this, SLOT( formatHideLinkUnselected() ) );
952 actionFormatHideLinkUnselected=a;
954 formatMenu->addSeparator();
955 a= new QAction( tr( "&Use color of heading for link","Branch attribute" ), this);
956 a->setStatusTip (tr( "Use same color for links and headings" ));
957 a->setToggleAction(true);
958 connect( a, SIGNAL( triggered() ), this, SLOT( formatToggleLinkColorHint() ) );
959 formatMenu->addAction (a);
960 actionFormatLinkColorHint=a;
962 pix.fill (Qt::white);
963 a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this );
964 a->setStatusTip (tr( "Set Link Color" ));
965 formatMenu->addAction (a);
966 connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectLinkColor() ) );
967 actionFormatLinkColor=a;
969 a= new QAction( pix, tr( "Set &Selection Color"+QString("...") ), this );
970 a->setStatusTip (tr( "Set Selection Color" ));
971 formatMenu->addAction (a);
972 connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectSelectionColor() ) );
973 actionFormatSelectionColor=a;
975 a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this );
976 a->setStatusTip (tr( "Set Background Color" ));
977 formatMenu->addAction (a);
978 connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackColor() ) );
979 actionFormatBackColor=a;
981 a= new QAction( pix, tr( "Set &Background image" )+QString("..."), this );
982 a->setStatusTip (tr( "Set Background image" ));
983 formatMenu->addAction (a);
984 connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackImage() ) );
985 actionFormatBackImage=a;
989 void Main::setupViewActions()
991 QToolBar *tb = addToolBar( tr("View Actions","View Toolbar name") );
992 tb->setLabel( "View Actions" );
993 tb->setObjectName ("viewTB");
994 QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" ));
997 a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom","View action" ), this);
998 a->setStatusTip ( tr( "Zoom reset" ) );
999 a->setShortcut (Qt::CTRL + Qt::Key_0 );
1001 viewMenu->addAction (a);
1002 connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomReset() ) );
1004 a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in","View action" ), this);
1005 a->setStatusTip (tr( "Zoom in" ));
1006 a->setShortcut (Qt::CTRL + Qt::Key_Plus);
1008 viewMenu->addAction (a);
1009 connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomIn() ) );
1011 a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out","View action" ), this);
1012 a->setStatusTip (tr( "Zoom out" ));
1013 a->setShortcut (Qt::CTRL + Qt::Key_Minus );
1015 viewMenu->addAction (a);
1016 connect( a, SIGNAL( triggered() ), this, SLOT( viewZoomOut() ) );
1018 a = new QAction( QPixmap(iconPath+"viewshowsel.png"), tr( "Show selection","View action" ), this);
1019 a->setStatusTip (tr( "Show selection" ));
1020 a->setShortcut (Qt::Key_Period);
1022 viewMenu->addAction (a);
1023 connect( a, SIGNAL( triggered() ), this, SLOT( viewCenter() ) );
1025 viewMenu->addSeparator();
1027 a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor","View action" ),this);
1028 a->setStatusTip ( tr( "Show Note Editor" ));
1029 a->setShortcut ( Qt::CTRL + Qt::Key_E );
1030 a->setToggleAction(true);
1032 viewMenu->addAction (a);
1033 connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) );
1034 actionViewToggleNoteEditor=a;
1036 a = new QAction(QPixmap(iconPath+"history.png"), tr( "History Window","View action" ),this );
1037 a->setStatusTip ( tr( "Show History Window" ));
1038 a->setShortcut ( Qt::CTRL + Qt::Key_H );
1039 a->setToggleAction(true);
1041 viewMenu->addAction (a);
1042 connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) );
1043 actionViewToggleHistoryWindow=a;
1045 viewMenu->addAction (actionViewTogglePropertyWindow);
1047 viewMenu->addSeparator();
1049 a = new QAction(tr( "Antialiasing","View action" ),this );
1050 a->setStatusTip ( tr( "Antialiasing" ));
1051 a->setToggleAction(true);
1052 a->setOn (settings.value("/mainwindow/view/AntiAlias",true).toBool());
1053 viewMenu->addAction (a);
1054 connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleAntiAlias() ) );
1055 actionViewToggleAntiAlias=a;
1057 a = new QAction(tr( "Smooth pixmap transformations","View action" ),this );
1058 a->setStatusTip (a->text());
1059 a->setToggleAction(true);
1060 a->setOn (settings.value("/mainwindow/view/SmoothPixmapTransformation",true).toBool());
1061 viewMenu->addAction (a);
1062 connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleSmoothPixmap() ) );
1063 actionViewToggleSmoothPixmapTransform=a;
1065 a = new QAction(tr( "Next Map","View action" ), this);
1066 a->setStatusTip (a->text());
1067 a->setShortcut (Qt::ALT + Qt::Key_N );
1068 viewMenu->addAction (a);
1069 connect( a, SIGNAL( triggered() ), this, SLOT(windowNextEditor() ) );
1071 a = new QAction (tr( "Previous Map","View action" ), this );
1072 a->setStatusTip (a->text());
1073 a->setShortcut (Qt::ALT + Qt::Key_P );
1074 viewMenu->addAction (a);
1075 connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) );
1079 void Main::setupModeActions()
1081 //QPopupMenu *menu = new QPopupMenu( this );
1082 //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
1084 QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Modifier Toolbar name") );
1085 tb->setObjectName ("modesTB");
1087 actionGroupModModes=new QActionGroup ( this);
1088 actionGroupModModes->setExclusive (true);
1089 a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches","Mode modifier" ), actionGroupModModes);
1090 a->setShortcut (Qt::Key_J);
1091 a->setStatusTip ( tr( "Use modifier to color branches" ));
1092 a->setToggleAction(true);
1095 actionModModeColor=a;
1097 a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy","Mode modifier" ), actionGroupModModes );
1098 a->setShortcut( Qt::Key_K);
1099 a->setStatusTip( tr( "Use modifier to copy" ));
1100 a->setToggleAction(true);
1102 actionModModeCopy=a;
1104 a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks","Mode modifier" ), actionGroupModModes );
1105 a->setShortcut (Qt::Key_L);
1106 a->setStatusTip( tr( "Use modifier to draw xLinks" ));
1107 a->setToggleAction(true);
1109 actionModModeXLink=a;
1113 void Main::setupFlagActions()
1115 // Create System Flags
1118 Flag *flag=new Flag;;
1119 flag->setVisible(true);
1121 flag->load(QPixmap(flagsPath+"flag-note.png"));
1122 setupFlag (flag,tb,"system-note",tr("Note","SystemFlag"));
1124 flag->load(QPixmap(flagsPath+"flag-url.png"));
1125 setupFlag (flag,tb,"system-url",tr("URL to Document ","SystemFlag"));
1127 flag->load(QPixmap(flagsPath+"flag-vymlink.png"));
1128 setupFlag (flag,tb,"system-vymLink",tr("Link to another vym map","SystemFlag"));
1130 flag->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
1131 setupFlag (flag,tb,"system-scrolledright",tr("subtree is scrolled","SystemFlag"));
1133 flag->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
1134 setupFlag (flag,tb,"system-tmpUnscrolledright",tr("subtree is temporary scrolled","SystemFlag"));
1136 flag->load(QPixmap(flagsPath+"flag-hideexport.png"));
1137 setupFlag (flag,tb,"system-hideInExport",tr("Hide object in exported maps","SystemFlag"));
1139 // Create Standard Flags
1140 tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar"));
1141 tb->setObjectName ("standardFlagTB");
1142 standardFlagsMaster->setToolBar (tb);
1144 flag->load(flagsPath+"flag-exclamationmark.png");
1145 flag->setGroup("standard-mark");
1146 setupFlag (flag,tb,"exclamationmark",tr("Take care!","Standardflag"));
1148 flag->load(flagsPath+"flag-questionmark.png");
1149 flag->setGroup("standard-mark");
1150 setupFlag (flag,tb,"questionmark",tr("Really?","Standardflag"));
1152 flag->load(flagsPath+"flag-hook-green.png");
1153 flag->setGroup("standard-hook");
1154 setupFlag (flag,tb,"hook-green",tr("ok!","Standardflag"));
1156 flag->load(flagsPath+"flag-cross-red.png");
1157 flag->setGroup("standard-hook");
1158 setupFlag (flag,tb,"cross-red",tr("Not ok!","Standardflag"));
1161 flag->load(flagsPath+"flag-stopsign.png");
1162 setupFlag (flag,tb,"stopsign",tr("This won't work!","Standardflag"));
1164 flag->load(flagsPath+"flag-smiley-good.png");
1165 flag->setGroup("standard-smiley");
1166 setupFlag (flag,tb,"smiley-good",tr("Good","Standardflag"));
1168 flag->load(flagsPath+"flag-smiley-sad.png");
1169 flag->setGroup("standard-smiley");
1170 setupFlag (flag,tb,"smiley-sad",tr("Bad","Standardflag"));
1172 flag->load(flagsPath+"flag-smiley-omg.png");
1173 flag->setGroup("standard-smiley");
1174 setupFlag (flag,tb,"smiley-omb",tr("Oh no!","Standardflag"));
1175 // Original omg.png (in KDE emoticons)
1178 flag->load(flagsPath+"flag-kalarm.png");
1179 setupFlag (flag,tb,"clock",tr("Time critical","Standardflag"));
1181 flag->load(flagsPath+"flag-phone.png");
1182 setupFlag (flag,tb,"phone",tr("Call...","Standardflag"));
1184 flag->load(flagsPath+"flag-lamp.png");
1185 setupFlag (flag,tb,"lamp",tr("Idea!","Standardflag"));
1187 flag->load(flagsPath+"flag-arrow-up.png");
1188 flag->setGroup("standard-arrow");
1189 setupFlag (flag,tb,"arrow-up",tr("Important","Standardflag"));
1191 flag->load(flagsPath+"flag-arrow-down.png");
1192 flag->setGroup("standard-arrow");
1193 setupFlag (flag,tb,"arrow-down",tr("Unimportant","Standardflag"));
1195 flag->load(flagsPath+"flag-arrow-2up.png");
1196 flag->setGroup("standard-arrow");
1197 setupFlag (flag,tb,"2arrow-up",tr("Very important!","Standardflag"));
1199 flag->load(flagsPath+"flag-arrow-2down.png");
1200 flag->setGroup("standard-arrow");
1201 setupFlag (flag,tb,"2arrow-down",tr("Very unimportant!","Standardflag"));
1204 flag->load(flagsPath+"flag-thumb-up.png");
1205 flag->setGroup("standard-thumb");
1206 setupFlag (flag,tb,"thumb-up",tr("I like this","Standardflag"));
1208 flag->load(flagsPath+"flag-thumb-down.png");
1209 flag->setGroup("standard-thumb");
1210 setupFlag (flag,tb,"thumb-down",tr("I do not like this","Standardflag"));
1213 flag->load(flagsPath+"flag-rose.png");
1214 setupFlag (flag,tb,"rose",tr("Rose","Standardflag"));
1216 flag->load(flagsPath+"flag-heart.png");
1217 setupFlag (flag,tb,"heart",tr("I just love...","Standardflag"));
1219 flag->load(flagsPath+"flag-present.png");
1220 setupFlag (flag,tb,"present",tr("Surprise!","Standardflag"));
1222 flag->load(flagsPath+"flag-flash.png");
1223 setupFlag (flag,tb,"flash",tr("Dangerous","Standardflag"));
1225 // Original: xsldbg_output.png
1226 flag->load(flagsPath+"flag-info.png");
1227 setupFlag (flag,tb,"inflag",tr("Info","Standardflag"));
1229 // Original khelpcenter.png
1230 flag->load(flagsPath+"flag-lifebelt.png");
1231 setupFlag (flag,tb,"lifebelt",tr("This will help","Standardflag"));
1234 flag->setVisible(false);
1235 flag->load(flagsPath+"freemind/warning.png");
1236 setupFlag (flag,tb, "freemind-warning",tr("Important","Freemind-Flag"));
1238 for (int i=1; i<8; i++)
1240 flag->load(flagsPath+QString("freemind/priority-%1.png").arg(i));
1241 setupFlag (flag,tb, QString("freemind-priority-%1").arg(i),tr("Priority","Freemind-Flag"));
1244 flag->load(flagsPath+"freemind/back.png");
1245 setupFlag (flag,tb,"freemind-back",tr("Back","Freemind-Flag"));
1247 flag->load(flagsPath+"freemind/forward.png");
1248 setupFlag (flag,tb,"freemind-forward",tr("forward","Freemind-Flag"));
1250 flag->load(flagsPath+"freemind/attach.png");
1251 setupFlag (flag,tb,"freemind-attach",tr("Look here","Freemind-Flag"));
1253 flag->load(flagsPath+"freemind/clanbomber.png");
1254 setupFlag (flag,tb,"freemind-clanbomber",tr("Dangerous","Freemind-Flag"));
1256 flag->load(flagsPath+"freemind/desktopnew.png");
1257 setupFlag (flag,tb,"freemind-desktopnew",tr("Don't flagrget","Freemind-Flag"));
1259 flag->load(flagsPath+"freemind/flag.png");
1260 setupFlag (flag,tb,"freemind-flag",tr("Flag","Freemind-Flag"));
1263 flag->load(flagsPath+"freemind/gohome.png");
1264 setupFlag (flag,tb,"freemind-gohome",tr("Home","Freemind-Flag"));
1267 flag->load(flagsPath+"freemind/kaddressbook.png");
1268 setupFlag (flag,tb,"freemind-kaddressbook",tr("Telephone","Freemind-Flag"));
1270 flag->load(flagsPath+"freemind/knotify.png");
1271 setupFlag (flag,tb,"freemind-knotify",tr("Music","Freemind-Flag"));
1273 flag->load(flagsPath+"freemind/korn.png");
1274 setupFlag (flag,tb,"freemind-korn",tr("Mailbox","Freemind-Flag"));
1276 flag->load(flagsPath+"freemind/mail.png");
1277 setupFlag (flag,tb,"freemind-mail",tr("Maix","Freemind-Flag"));
1279 flag->load(flagsPath+"freemind/password.png");
1280 setupFlag (flag,tb,"freemind-password",tr("Password","Freemind-Flag"));
1282 flag->load(flagsPath+"freemind/pencil.png");
1283 setupFlag (flag,tb,"freemind-pencil",tr("To be improved","Freemind-Flag"));
1285 flag->load(flagsPath+"freemind/stop.png");
1286 setupFlag (flag,tb,"freemind-stop",tr("Stop","Freemind-Flag"));
1288 flag->load(flagsPath+"freemind/wizard.png");
1289 setupFlag (flag,tb,"freemind-wizard",tr("Magic","Freemind-Flag"));
1291 flag->load(flagsPath+"freemind/xmag.png");
1292 setupFlag (flag,tb,"freemind-xmag",tr("To be discussed","Freemind-Flag"));
1294 flag->load(flagsPath+"freemind/bell.png");
1295 setupFlag (flag,tb,"freemind-bell",tr("Reminder","Freemind-Flag"));
1297 flag->load(flagsPath+"freemind/bookmark.png");
1298 setupFlag (flag,tb,"freemind-bookmark",tr("Excellent","Freemind-Flag"));
1300 flag->load(flagsPath+"freemind/penguin.png");
1301 setupFlag (flag,tb,"freemind-penguin",tr("Linux","Freemind-Flag"));
1303 flag->load(flagsPath+"freemind/licq.png");
1304 setupFlag (flag,tb,"freemind-licq",tr("Sweet","Freemind-Flag"));
1307 void Main::setupFlag (Flag *flag, QToolBar *tb, const QString &name, const QString &tooltip)
1309 flag->setName(name);
1310 flag->setToolTip (tooltip);
1314 a=new QAction (flag->getPixmap(),name,this);
1317 flag->setAction (a);
1318 a->setVisible (flag->isVisible());
1319 a->setCheckable(true);
1320 a->setObjectName(name);
1321 a->setToolTip(tooltip);
1322 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
1323 standardFlagsMaster->addFlag (flag);
1327 systemFlagsMaster->addFlag (flag);
1332 void Main::setupNetworkActions()
1334 if (!settings.value( "/mainwindow/showTestMenu",false).toBool() )
1336 QMenu *netMenu = menuBar()->addMenu( "Network" );
1340 a = new QAction( "Start TCPserver for MapEditor",this);
1341 //a->setStatusTip ( "Set application to open pdf files"));
1342 a->setShortcut ( Qt::Key_T ); //New TCP server
1343 connect( a, SIGNAL( triggered() ), this, SLOT( networkStartServer() ) );
1344 netMenu->addAction (a);
1346 a = new QAction( "Connect MapEditor to server",this);
1347 //a->setStatusTip ( "Set application to open pdf files"));
1348 a->setShortcut ( Qt::Key_C ); // Connect to server
1349 connect( a, SIGNAL( triggered() ), this, SLOT( networkConnect() ) );
1350 netMenu->addAction (a);
1354 void Main::setupSettingsActions()
1356 QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" ));
1360 a = new QAction( tr( "Set application to open pdf files","Settings action"), this);
1361 a->setStatusTip ( tr( "Set application to open pdf files"));
1362 connect( a, SIGNAL( triggered() ), this, SLOT( settingsPDF() ) );
1363 settingsMenu->addAction (a);
1365 a = new QAction( tr( "Set application to open external links","Settings action"), this);
1366 a->setStatusTip( tr( "Set application to open external links"));
1367 connect( a, SIGNAL( triggered() ), this, SLOT( settingsURL() ) );
1368 settingsMenu->addAction (a);
1370 a = new QAction( tr( "Set path for macros","Settings action")+"...", this);
1371 a->setStatusTip( tr( "Set path for macros"));
1372 connect( a, SIGNAL( triggered() ), this, SLOT( settingsMacroDir() ) );
1373 settingsMenu->addAction (a);
1375 a = new QAction( tr( "Set number of undo levels","Settings action")+"...", this);
1376 a->setStatusTip( tr( "Set number of undo levels"));
1377 connect( a, SIGNAL( triggered() ), this, SLOT( settingsUndoLevels() ) );
1378 settingsMenu->addAction (a);
1380 settingsMenu->addSeparator();
1382 a = new QAction( tr( "Autosave","Settings action"), this);
1383 a->setStatusTip( tr( "Autosave"));
1384 a->setToggleAction(true);
1385 a->setOn ( settings.value ("/mainwindow/autosave/use",false).toBool());
1386 connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveToggle() ) );
1387 settingsMenu->addAction (a);
1388 actionSettingsAutosaveToggle=a;
1390 a = new QAction( tr( "Autosave time","Settings action")+"...", this);
1391 a->setStatusTip( tr( "Autosave time"));
1392 connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveTime() ) );
1393 settingsMenu->addAction (a);
1394 actionSettingsAutosaveTime=a;
1396 a = new QAction( tr( "Write backup file on save","Settings action"), this);
1397 a->setStatusTip( tr( "Write backup file on save"));
1398 a->setToggleAction(true);
1399 a->setOn ( settings.value ("/mainwindow/writeBackupFile",false).toBool());
1400 connect( a, SIGNAL( triggered() ), this, SLOT( settingsWriteBackupFileToggle() ) );
1401 settingsMenu->addAction (a);
1402 actionSettingsWriteBackupFile=a;
1404 settingsMenu->addSeparator();
1406 a = new QAction( tr( "Edit branch after adding it","Settings action" ), this );
1407 a->setStatusTip( tr( "Edit branch after adding it" ));
1408 a->setToggleAction(true);
1409 a->setOn ( settings.value ("/mapeditor/editmode/autoEditNewBranch",true).toBool());
1410 settingsMenu->addAction (a);
1411 actionSettingsAutoEditNewBranch=a;
1413 a= new QAction( tr( "Select branch after adding it","Settings action" ), this );
1414 a->setStatusTip( tr( "Select branch after adding it" ));
1415 a->setToggleAction(true);
1416 a->setOn ( settings.value ("/mapeditor/editmode/autoSelectNewBranch",false).toBool() );
1417 settingsMenu->addAction (a);
1418 actionSettingsAutoSelectNewBranch=a;
1420 a= new QAction(tr( "Select existing heading","Settings action" ), this);
1421 a->setStatusTip( tr( "Select heading before editing" ));
1422 a->setToggleAction(true);
1423 a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
1424 settingsMenu->addAction (a);
1425 actionSettingsAutoSelectText=a;
1427 a= new QAction( tr( "Delete key","Settings action" ), this);
1428 a->setStatusTip( tr( "Delete key for deleting branches" ));
1429 a->setToggleAction(true);
1430 a->setOn ( settings.value ("/mapeditor/editmode/useDelKey",true).toBool() );
1431 settingsMenu->addAction (a);
1432 connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleDelKey() ) );
1433 actionSettingsUseDelKey=a;
1435 a= new QAction( tr( "Exclusive flags","Settings action" ), this);
1436 a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
1437 a->setToggleAction(true);
1438 a->setOn ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() );
1439 settingsMenu->addAction (a);
1440 actionSettingsUseFlagGroups=a;
1442 a= new QAction( tr( "Use hide flags","Settings action" ), this);
1443 a->setStatusTip( tr( "Use hide flag during exports " ));
1444 a->setToggleAction(true);
1445 a->setOn ( settings.value ("/export/useHideExport",true).toBool() );
1446 settingsMenu->addAction (a);
1447 actionSettingsUseHideExport=a;
1449 a = new QAction( tr( "Animation","Settings action"), this);
1450 a->setStatusTip( tr( "Animation"));
1451 a->setToggleAction(true);
1452 a->setOn (settings.value("/animation/use",false).toBool() );
1453 connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleAnimation() ) );
1454 settingsMenu->addAction (a);
1455 actionSettingsUseAnimation=a;
1459 void Main::setupTestActions()
1461 QMenu *testMenu = menuBar()->addMenu( tr( "&Test" ));
1464 a = new QAction( "Test function 1" , this);
1465 a->setStatusTip( "Call test function 1" );
1466 testMenu->addAction (a);
1467 connect( a, SIGNAL( triggered() ), this, SLOT( testFunction1() ) );
1469 a = new QAction( "Test function 2" , this);
1470 a->setStatusTip( "Call test function 2" );
1471 testMenu->addAction (a);
1472 connect( a, SIGNAL( triggered() ), this, SLOT( testFunction2() ) );
1474 a = new QAction( "Command" , this);
1475 a->setStatusTip( "Enter command to call in editor" );
1476 connect( a, SIGNAL( triggered() ), this, SLOT( testCommand() ) );
1477 testMenu->addAction (a);
1481 void Main::setupHelpActions()
1483 QMenu *helpMenu = menuBar()->addMenu ( tr( "&Help","Help menubar entry" ));
1486 a = new QAction( tr( "Open VYM Documentation (pdf) ","Help action" ), this );
1487 a->setStatusTip( tr( "Open VYM Documentation (pdf)" ));
1488 connect( a, SIGNAL( triggered() ), this, SLOT( helpDoc() ) );
1489 helpMenu->addAction (a);
1491 a = new QAction( tr( "Open VYM example maps ","Help action" ), this );
1492 a->setStatusTip( tr( "Open VYM example maps " ));
1493 connect( a, SIGNAL( triggered() ), this, SLOT( helpDemo() ) );
1494 helpMenu->addAction (a);
1496 a = new QAction( tr( "About VYM","Help action" ), this);
1497 a->setStatusTip( tr( "About VYM")+vymName);
1498 connect( a, SIGNAL( triggered() ), this, SLOT( helpAbout() ) );
1499 helpMenu->addAction (a);
1501 a = new QAction( tr( "About QT","Help action" ), this);
1502 a->setStatusTip( tr( "Information about QT toolkit" ));
1503 connect( a, SIGNAL( triggered() ), this, SLOT( helpAboutQT() ) );
1504 helpMenu->addAction (a);
1508 void Main::setupContextMenus()
1512 // Context Menu for branch or mapcenter
1513 branchContextMenu =new QMenu (this);
1514 branchContextMenu->addAction (actionViewTogglePropertyWindow);
1515 branchContextMenu->addSeparator();
1518 branchAddContextMenu =branchContextMenu->addMenu (tr("Add"));
1519 branchAddContextMenu->addAction (actionPaste );
1520 branchAddContextMenu->addAction ( actionAddMapCenter );
1521 branchAddContextMenu->addAction ( actionAddBranch );
1522 branchAddContextMenu->addAction ( actionAddBranchBefore );
1523 branchAddContextMenu->addAction ( actionAddBranchAbove);
1524 branchAddContextMenu->addAction ( actionAddBranchBelow );
1525 branchAddContextMenu->addSeparator();
1526 branchAddContextMenu->addAction ( actionImportAdd );
1527 branchAddContextMenu->addAction ( actionImportReplace );
1530 branchRemoveContextMenu =branchContextMenu->addMenu (tr ("Remove","Context menu name"));
1531 branchRemoveContextMenu->addAction (actionCut);
1532 branchRemoveContextMenu->addAction ( actionDelete );
1533 branchRemoveContextMenu->addAction ( actionDeleteKeepChildren );
1534 branchRemoveContextMenu->addAction ( actionDeleteChildren );
1537 actionSaveBranch->addTo( branchContextMenu );
1538 actionFileNewCopy->addTo (branchContextMenu );
1540 branchContextMenu->addSeparator();
1541 branchContextMenu->addAction ( actionLoadImage);
1543 // Submenu for Links (URLs, vymLinks)
1544 branchLinksContextMenu =new QMenu (this);
1546 branchContextMenu->addSeparator();
1547 branchLinksContextMenu=branchContextMenu->addMenu(tr("References (URLs, vymLinks, ...)","Context menu name"));
1548 branchLinksContextMenu->addAction ( actionOpenURL );
1549 branchLinksContextMenu->addAction ( actionOpenURLTab );
1550 branchLinksContextMenu->addAction ( actionOpenMultipleURLTabs );
1551 branchLinksContextMenu->addAction ( actionURL );
1552 branchLinksContextMenu->addAction ( actionLocalURL );
1553 branchLinksContextMenu->addAction ( actionHeading2URL );
1554 branchLinksContextMenu->addAction ( actionBugzilla2URL );
1555 if (settings.value( "/mainwindow/showTestMenu",false).toBool() )
1557 branchLinksContextMenu->addAction ( actionFATE2URL );
1559 branchLinksContextMenu->addSeparator();
1560 branchLinksContextMenu->addAction ( actionOpenVymLink );
1561 branchLinksContextMenu->addAction ( actionOpenMultipleVymLinks );
1562 branchLinksContextMenu->addAction ( actionVymLink );
1563 branchLinksContextMenu->addAction ( actionDeleteVymLink );
1566 // Context Menu for XLinks in a branch menu
1567 // This will be populated "on demand" in MapEditor::updateActions
1568 branchContextMenu->addSeparator();
1569 branchXLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink","Context menu name"));
1570 branchXLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink","Context menu name"));
1571 connect( branchXLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) );
1572 connect( branchXLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) );
1575 // Context menu for floatimage
1576 floatimageContextMenu =new QMenu (this);
1577 a= new QAction (tr ("Save image","Context action"),this);
1578 connect (a, SIGNAL (triggered()), this, SLOT (editSaveImage()));
1579 floatimageContextMenu->addAction (a);
1581 floatimageContextMenu->addSeparator();
1582 actionCopy->addTo( floatimageContextMenu );
1583 actionCut->addTo( floatimageContextMenu );
1585 floatimageContextMenu->addSeparator();
1586 floatimageContextMenu->addAction ( actionFormatHideLinkUnselected );
1589 // Context menu for canvas
1590 canvasContextMenu =new QMenu (this);
1591 actionAddMapCenter->addTo( canvasContextMenu );
1592 actionMapInfo->addTo( canvasContextMenu );
1593 canvasContextMenu->insertSeparator();
1594 actionGroupFormatLinkStyles->addTo( canvasContextMenu );
1595 canvasContextMenu->insertSeparator();
1596 actionFormatLinkColorHint->addTo( canvasContextMenu );
1597 actionFormatLinkColor->addTo( canvasContextMenu );
1598 actionFormatSelectionColor->addTo( canvasContextMenu );
1599 actionFormatBackColor->addTo( canvasContextMenu );
1600 // actionFormatBackImage->addTo( canvasContextMenu ); //FIXME-4 makes vym too slow: postponed for later version
1602 // Menu for last opened files
1604 for (int i = 0; i < MaxRecentFiles; ++i)
1606 recentFileActions[i] = new QAction(this);
1607 recentFileActions[i]->setVisible(false);
1608 fileLastMapsMenu->addAction(recentFileActions[i]);
1609 connect(recentFileActions[i], SIGNAL(triggered()),
1610 this, SLOT(fileLoadRecent()));
1612 setupRecentMapsMenu();
1615 void Main::setupRecentMapsMenu()
1617 QStringList files = settings.value("/mainwindow/recentFileList").toStringList();
1619 int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
1621 for (int i = 0; i < numRecentFiles; ++i) {
1622 QString text = tr("&%1 %2").arg(i + 1).arg(files[i]);
1623 recentFileActions[i]->setText(text);
1624 recentFileActions[i]->setData(files[i]);
1625 recentFileActions[i]->setVisible(true);
1627 for (int j = numRecentFiles; j < MaxRecentFiles; ++j)
1628 recentFileActions[j]->setVisible(false);
1631 void Main::setupMacros()
1633 for (int i = 0; i <= 11; i++)
1635 macroActions[i] = new QAction(this);
1636 macroActions[i]->setData(i);
1637 addAction (macroActions[i]);
1638 connect(macroActions[i], SIGNAL(triggered()),
1639 this, SLOT(callMacro()));
1641 macroActions[0]->setShortcut ( Qt::Key_F1 );
1642 macroActions[1]->setShortcut ( Qt::Key_F2 );
1643 macroActions[2]->setShortcut ( Qt::Key_F3 );
1644 macroActions[3]->setShortcut ( Qt::Key_F4 );
1645 macroActions[4]->setShortcut ( Qt::Key_F5 );
1646 macroActions[5]->setShortcut ( Qt::Key_F6 );
1647 macroActions[6]->setShortcut ( Qt::Key_F7 );
1648 macroActions[7]->setShortcut ( Qt::Key_F8 );
1649 macroActions[8]->setShortcut ( Qt::Key_F9 );
1650 macroActions[9]->setShortcut ( Qt::Key_F10 );
1651 macroActions[10]->setShortcut ( Qt::Key_F11 );
1652 macroActions[11]->setShortcut ( Qt::Key_F12 );
1655 void Main::hideEvent (QHideEvent * )
1657 if (!textEditor->isMinimized() ) textEditor->hide();
1660 void Main::showEvent (QShowEvent * )
1662 if (actionViewToggleNoteEditor->isOn()) textEditor->showNormal();
1666 MapEditor* Main::currentMapEditor() const
1668 if ( tabWidget->currentPage())
1669 return vymViews.at(tabWidget->currentIndex())->getMapEditor();
1673 VymModel* Main::currentModel() const
1675 if ( tabWidget->currentPage())
1676 return vymViews.at(tabWidget->currentIndex())->getModel();
1681 void Main::editorChanged(QWidget *)
1683 // Unselect all possibly selected objects
1684 // (Important to update note editor)
1686 for (int i=0;i<=tabWidget->count() -1;i++)
1688 m= vymViews.at(tabWidget->currentIndex())->getModel();
1689 if (m) m->unselect();
1692 if (m) m->reselect();
1694 // Update actions to in menus and toolbars according to editor
1698 void Main::fileNew()
1700 VymModel *vm=new VymModel;
1702 VymView *vv=new VymView (vm);
1703 vymViews.append (vv);
1704 tabWidget->addTab (vv,tr("unnamed","MainWindow: name for new and empty file"));
1705 tabWidget->setCurrentIndex (vymViews.count() );
1709 // For the very first map we do not have flagrows yet...
1713 void Main::fileNewCopy()
1715 QString fn="unnamed";
1716 VymModel *srcModel=currentModel();
1721 VymModel *dstModel=vymViews.last()->getModel();
1722 dstModel->select("mc:");
1723 dstModel->load (clipboardDir+"/"+clipboardFile,ImportReplace, VymMap);
1727 ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode, const FileType &ftype)
1729 ErrorCode err=success;
1731 // fn is usually the archive, mapfile the file after uncompressing
1734 // Make fn absolute (needed for unzip)
1735 fn=QDir (fn).absPath();
1741 // Check, if map is already loaded
1743 while (i<=tabWidget->count() -1)
1745 if (vymViews.at(i)->getModel()->getFilePath() == fn)
1747 // Already there, ask for confirmation
1748 QMessageBox mb( vymName,
1749 tr("The map %1\nis already opened."
1750 "Opening the same map in multiple editors may lead \n"
1751 "to confusion when finishing working with vym."
1752 "Do you want to").arg(fn),
1753 QMessageBox::Warning,
1754 QMessageBox::Yes | QMessageBox::Default,
1755 QMessageBox::Cancel | QMessageBox::Escape,
1756 QMessageBox::NoButton);
1757 mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
1758 mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
1761 case QMessageBox::Yes:
1762 // end loop and load anyway
1763 i=tabWidget->count();
1765 case QMessageBox::Cancel:
1775 int tabIndex=tabWidget->currentPageIndex();
1778 if ( !fn.isEmpty() )
1780 vm = currentModel();
1781 // Check first, if mapeditor exists
1782 // If it is not default AND we want a new map,
1783 // create a new mapeditor in a new tab
1784 if ( lmode==NewMap && (!vm || !vm->isDefault() ) )
1787 VymView *vv=new VymView (vm);
1788 vymViews.append (vv);
1789 tabWidget->addTab (vv,fn);
1790 tabIndex=tabWidget->count()-1;
1791 tabWidget->setCurrentPage (tabIndex);
1795 // Check, if file exists (important for creating new files
1796 // from command line
1797 if (!QFile(fn).exists() )
1799 QMessageBox mb( vymName,
1800 tr("This map does not exist:\n %1\nDo you want to create a new one?").arg(fn),
1801 QMessageBox::Question,
1803 QMessageBox::Cancel | QMessageBox::Default,
1804 QMessageBox::NoButton );
1806 mb.setButtonText( QMessageBox::Yes, tr("Create"));
1807 mb.setButtonText( QMessageBox::No, tr("Cancel"));
1810 case QMessageBox::Yes:
1812 currentMapEditor()->getModel()->setFilePath(fn);
1813 tabWidget->setTabText (tabIndex,
1814 currentMapEditor()->getModel()->getFileName() );
1815 statusBar()->message( "Created " + fn , statusbarTime );
1818 case QMessageBox::Cancel:
1819 // don't create new map
1820 statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
1827 //tabWidget->currentPage() won't be NULL here, because of above...
1828 tabWidget->setCurrentIndex (tabIndex);
1829 //FIXME-3 no me anymore... me->viewport()->setFocus();
1833 // Save existing filename in case we import
1834 QString fn_org=vm->getFilePath();
1836 // Finally load map into mapEditor
1837 vm->setFilePath (fn);
1838 err=vm->load(fn,lmode,ftype);
1840 // Restore old (maybe empty) filepath, if this is an import
1842 vm->setFilePath (fn_org);
1845 // Finally check for errors and go home
1848 if (lmode==NewMap) fileCloseMap();
1849 statusBar()->message( "Could not load " + fn, statusbarTime );
1854 vm->setFilePath (fn);
1855 tabWidget->setTabText (tabIndex, vm->getFileName());
1856 if (!isInTmpDir (fn))
1858 // Only append to lastMaps if not loaded from a tmpDir
1859 // e.g. imported bookmarks are in a tmpDir
1860 addRecentMap(vm->getFilePath() );
1862 actionFilePrint->setEnabled (true);
1864 statusBar()->message( "Loaded " + fn, statusbarTime );
1871 void Main::fileLoad(const LoadMode &lmode)
1873 QStringList filters;
1874 filters <<"VYM map (*.vym *.vyp)"<<"XML (*.xml)";
1875 QFileDialog *fd=new QFileDialog( this);
1876 fd->setDir (lastFileDir);
1877 fd->setFileMode (QFileDialog::ExistingFiles);
1878 fd->setFilters (filters);
1882 fd->setCaption(vymName+ " - " +tr("Load vym map"));
1885 fd->setCaption(vymName+ " - " +tr("Import: Add vym map to selection"));
1888 fd->setCaption(vymName+ " - " +tr("Import: Replace selection with vym map"));
1894 if ( fd->exec() == QDialog::Accepted )
1896 lastFileDir=fd->directory().path();
1897 QStringList flist = fd->selectedFiles();
1898 QStringList::Iterator it = flist.begin();
1899 while( it != flist.end() )
1902 fileLoad(*it, lmode);
1909 void Main::fileLoad()
1914 void Main::fileLoadRecent()
1916 QAction *action = qobject_cast<QAction *>(sender());
1918 fileLoad (action->data().toString(), NewMap);
1921 void Main::addRecentMap (const QString &fileName)
1924 QStringList files = settings.value("/mainwindow/recentFileList").toStringList();
1925 files.removeAll(fileName);
1926 files.prepend(fileName);
1927 while (files.size() > MaxRecentFiles)
1930 settings.setValue("/mainwindow/recentFileList", files);
1932 setupRecentMapsMenu();
1935 void Main::fileSave(VymModel *m, const SaveMode &savemode)
1939 if ( m->getFilePath().isEmpty() )
1941 // We have no filepath yet,
1942 // call fileSaveAs() now, this will call fileSave()
1944 // First switch to editor
1945 //FIXME-3 needed??? tabWidget->setCurrentWidget (m->getMapEditor());
1946 fileSaveAs(savemode);
1949 if (m->save (savemode)==success)
1951 statusBar()->message(
1952 tr("Saved %1").arg(m->getFilePath()),
1954 addRecentMap (m->getFilePath() );
1956 statusBar()->message(
1957 tr("Couldn't save ").arg(m->getFilePath()),
1961 void Main::fileSave()
1963 fileSave (currentModel(), CompleteMap);
1966 void Main::fileSave(VymModel *m)
1968 fileSave (m,CompleteMap);
1971 void Main::fileSaveAs(const SaveMode& savemode)
1975 if (currentMapEditor())
1977 if (savemode==CompleteMap)
1978 fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
1980 fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
1981 if ( !fn.isEmpty() )
1983 // Check for existing file
1984 if (QFile (fn).exists())
1986 QMessageBox mb( vymName,
1987 tr("The file %1\nexists already. Do you want to").arg(fn),
1988 QMessageBox::Warning,
1989 QMessageBox::Yes | QMessageBox::Default,
1990 QMessageBox::Cancel | QMessageBox::Escape,
1991 QMessageBox::NoButton);
1992 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
1993 mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
1996 case QMessageBox::Yes:
1999 case QMessageBox::Cancel:
2006 // New file, add extension to filename, if missing
2007 // This is always .vym or .vyp, depending on savemode
2008 if (savemode==CompleteMap)
2010 if (!fn.contains (".vym") && !fn.contains (".xml"))
2014 if (!fn.contains (".vyp") && !fn.contains (".xml"))
2023 VymModel *m=currentModel();
2025 fileSave(m, savemode);
2027 // Set name of tab, assuming current tab is the one we just saved
2028 if (savemode==CompleteMap)
2029 tabWidget->setTabText (tabWidget->currentIndex(), m->getFileName() );
2035 void Main::fileSaveAs()
2037 fileSaveAs (CompleteMap);
2040 void Main::fileImportKDE3Bookmarks()
2042 ImportKDE3Bookmarks im;
2044 if (aborted!=fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
2045 currentMapEditor()->getModel()->setFilePath ("");
2048 void Main::fileImportKDE4Bookmarks()
2050 ImportKDE4Bookmarks im;
2052 if (aborted!=fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
2053 currentMapEditor()->getModel()->setFilePath ("");
2056 void Main::fileImportFirefoxBookmarks()
2058 Q3FileDialog *fd=new Q3FileDialog( this);
2059 fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox");
2060 fd->setMode (Q3FileDialog::ExistingFiles);
2061 fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)");
2062 fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks"));
2065 if ( fd->exec() == QDialog::Accepted )
2067 ImportFirefoxBookmarks im;
2068 QStringList flist = fd->selectedFiles();
2069 QStringList::Iterator it = flist.begin();
2070 while( it != flist.end() )
2073 if (im.transform() &&
2074 aborted!=fileLoad (im.getTransformedFile(),NewMap,FreemindMap) &&
2075 currentMapEditor() )
2076 currentMapEditor()->getModel()->setFilePath ("");
2083 void Main::fileImportFreemind()
2085 QStringList filters;
2086 filters <<"Freemind map (*.mm)"<<"All files (*)";
2087 QFileDialog *fd=new QFileDialog( this);
2088 fd->setDir (lastFileDir);
2089 fd->setFileMode (QFileDialog::ExistingFiles);
2090 fd->setFilters (filters);
2091 fd->setCaption(vymName+ " - " +tr("Load Freemind map"));
2095 if ( fd->exec() == QDialog::Accepted )
2097 lastFileDir=fd->directory().path();
2098 QStringList flist = fd->selectedFiles();
2099 QStringList::Iterator it = flist.begin();
2100 while( it != flist.end() )
2103 if ( fileLoad (fn,NewMap, FreemindMap) )
2105 currentMapEditor()->getModel()->setFilePath ("");
2114 void Main::fileImportMM()
2118 Q3FileDialog *fd=new Q3FileDialog( this);
2119 fd->setDir (lastFileDir);
2120 fd->setMode (Q3FileDialog::ExistingFiles);
2121 fd->addFilter ("Mind Manager (*.mmap)");
2122 fd->setCaption(tr("Import")+" "+"Mind Manager");
2125 if ( fd->exec() == QDialog::Accepted )
2127 lastFileDir=fd->dirPath();
2128 QStringList flist = fd->selectedFiles();
2129 QStringList::Iterator it = flist.begin();
2130 while( it != flist.end() )
2133 if (im.transform() &&
2134 success==fileLoad (im.getTransformedFile(),NewMap) &&
2135 currentMapEditor() )
2136 currentMapEditor()->getModel()->setFilePath ("");
2143 void Main::fileImportDir()
2145 VymModel *m=currentModel();
2146 if (m) m->importDir();
2149 void Main::fileExportXML()
2151 VymModel *m=currentModel();
2152 if (m) m->exportXML();
2156 void Main::fileExportXHTML()
2158 VymModel *m=currentModel();
2159 if (m) m->exportXHTML();
2162 void Main::fileExportImage()
2164 VymModel *m=currentModel();
2165 if (m) m->exportImage();
2168 void Main::fileExportASCII()
2170 VymModel *m=currentModel();
2171 if (m) m->exportASCII();
2174 void Main::fileExportCSV() //FIXME-3 not scriptable yet
2176 VymModel *m=currentModel();
2181 ex.addFilter ("CSV (*.csv)");
2182 ex.setDir(lastImageDir);
2183 ex.setCaption(vymName+ " -" +tr("Export as CSV")+" "+tr("(still experimental)"));
2184 if (ex.execDialog() )
2186 m->setExportMode(true);
2188 m->setExportMode(false);
2193 void Main::fileExportLaTeX() //FIXME-3 not scriptable yet
2195 VymModel *m=currentModel();
2200 ex.addFilter ("Tex (*.tex)");
2201 ex.setDir(lastImageDir);
2202 ex.setCaption(vymName+ " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
2203 if (ex.execDialog() )
2205 m->setExportMode(true);
2207 m->setExportMode(false);
2212 void Main::fileExportKDE3Bookmarks() //FIXME-3 not scriptable yet
2214 ExportKDE3Bookmarks ex;
2215 VymModel *m=currentModel();
2223 void Main::fileExportKDE4Bookmarks() //FIXME-3 not scriptable yet
2225 ExportKDE4Bookmarks ex;
2226 VymModel *m=currentModel();
2234 void Main::fileExportTaskjuggler() //FIXME-3 not scriptable yet
2236 ExportTaskjuggler ex;
2237 VymModel *m=currentModel();
2241 ex.setCaption ( vymName+" - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
2242 ex.setDir(lastImageDir);
2243 ex.addFilter ("Taskjuggler (*.tjp)");
2244 if (ex.execDialog() )
2246 m->setExportMode(true);
2248 m->setExportMode(false);
2253 void Main::fileExportOOPresentation() //FIXME-3 not scriptable yet
2255 ExportOOFileDialog *fd=new ExportOOFileDialog( this,vymName+" - "+tr("Export to")+" Open Office");
2256 // TODO add preview in dialog
2257 //ImagePreview *p =new ImagePreview (fd);
2258 //fd->setContentsPreviewEnabled( TRUE );
2259 //fd->setContentsPreview( p, p );
2260 //fd->setPreviewMode( QFileDialog::Contents );
2261 fd->setCaption(vymName+" - " +tr("Export to")+" Open Office");
2262 fd->setDir (QDir().current());
2263 if (fd->foundConfig())
2267 if ( fd->exec() == QDialog::Accepted )
2269 QString fn=fd->selectedFile();
2270 if (!fn.contains (".odp"))
2273 //lastImageDir=fn.left(fn.findRev ("/"));
2274 VymModel *m=currentModel();
2275 if (m) m->exportOOPresentation(fn,fd->selectedConfig());
2279 QMessageBox::warning(0,
2281 tr("Couldn't find configuration for export to Open Office\n"));
2285 void Main::fileCloseMap()
2287 VymModel *m=currentModel();
2290 if (m->hasChanged())
2292 QMessageBox mb( vymName,
2293 tr("The map %1 has been modified but not saved yet. Do you want to").arg(m->getFileName()),
2294 QMessageBox::Warning,
2295 QMessageBox::Yes | QMessageBox::Default,
2297 QMessageBox::Cancel | QMessageBox::Escape );
2298 mb.setButtonText( QMessageBox::Yes, tr("Save modified map before closing it") );
2299 mb.setButtonText( QMessageBox::No, tr("Discard changes"));
2302 case QMessageBox::Yes:
2304 fileSave(m, CompleteMap);
2306 case QMessageBox::No:
2307 // close without saving
2309 case QMessageBox::Cancel:
2314 // And here comes the segfault, because removeTab triggers
2315 // currentChanged->Main::editorChanged -> updateActions and VM is not NULL yet...
2316 vymViews.removeAt (tabWidget->currentIndex() );
2317 tabWidget->removeTab (tabWidget->currentIndex() );
2319 // Remove mapEditor/model FIXME-5
2320 // Better would be delete (me), but then we could have a Qt error:
2321 // "QObject: Do not delete object, 'MapEditor', during its event handler!"
2322 // So we only remove data now and call deconstructor when vym closes later
2323 // this needs to be moved to vymview... me->clear();
2324 // some model->clear is needed to free up memory ...
2330 void Main::filePrint()
2332 if (currentMapEditor())
2333 currentMapEditor()->print();
2336 void Main::fileExitVYM()
2338 // Check if one or more editors have changed
2340 for (i=0;i<=vymViews.count() -1;i++)
2342 // If something changed, ask what to do
2343 if (vymViews.at(i)->getModel()->hasChanged())
2345 tabWidget->setCurrentPage(i);
2346 QMessageBox mb( vymName,
2347 tr("This map is not saved yet. Do you want to"),
2348 QMessageBox::Warning,
2349 QMessageBox::Yes | QMessageBox::Default,
2351 QMessageBox::Cancel | QMessageBox::Escape );
2352 mb.setButtonText( QMessageBox::Yes, tr("Save map") );
2353 mb.setButtonText( QMessageBox::No, tr("Discard changes") );
2356 mb.setActiveWindow();
2357 switch( mb.exec() ) {
2358 case QMessageBox::Yes:
2359 // save (the changed editors) and exit
2360 fileSave(currentModel(), CompleteMap);
2362 case QMessageBox::No:
2363 // exit without saving
2365 case QMessageBox::Cancel:
2366 // don't save and don't exit
2370 } // loop over all MEs
2374 void Main::editUndo()
2376 VymModel *m=currentModel();
2380 void Main::editRedo()
2382 VymModel *m=currentModel();
2386 void Main::gotoHistoryStep (int i)
2388 VymModel *m=currentModel();
2389 if (m) m->gotoHistoryStep(i);
2392 void Main::editCopy()
2394 VymModel *m=currentModel();
2398 void Main::editPaste()
2400 VymModel *m=currentModel();
2404 void Main::editCut()
2406 VymModel *m=currentModel();
2410 void Main::editOpenFindWindow()
2412 findWindow->popup();
2413 findWindow->raise();
2414 findWindow->setActiveWindow();
2417 void Main::editFind(QString s)
2419 VymModel *m=currentModel();
2423 BranchItem *bi=m->findText(s, cs);
2426 statusBar()->message( "Found: " + bi->getHeading(), statusbarTime );
2429 QMessageBox::information( findWindow, tr( "VYM -Information:" ),
2430 tr("No matches found for \"%1\"").arg(s));
2435 void Main::editFindChanged()
2436 { // Notify editor, to abort the current find process
2437 VymModel *m=currentModel();
2438 if (m) m->findReset();
2441 void Main::openTabs(QStringList urls)
2443 if (!urls.isEmpty())
2447 QString browser=settings.value("/mainwindow/readerURL" ).toString();
2449 if (!procBrowser || procBrowser->state()!=QProcess::Running)
2451 QString u=urls.takeFirst();
2452 procBrowser = new QProcess( this );
2454 procBrowser->start(browser,args);
2455 if ( !procBrowser->waitForStarted())
2457 // try to set path to browser
2458 QMessageBox::warning(0,
2460 tr("Couldn't find a viewer to open %1.\n").arg(u)+
2461 tr("Please use Settings->")+tr("Set application to open an URL"));
2464 #if defined(Q_OS_WIN32)
2465 // There's no sleep in VCEE, replace it with Qt's QThread::wait().
2466 this->thread()->wait(3000);
2471 if (browser.contains("konqueror"))
2473 for (int i=0; i<urls.size(); i++)
2476 // Try to open new tab in existing konqueror started previously by vym
2477 p=new QProcess (this);
2479 #if defined(Q_OS_WIN32)
2480 // In Win32, pid is not a longlong, but a pointer to a _PROCESS_INFORMATION structure.
2481 // Redundant change in Win32, as there's no konqueror, but I wanted to follow the original logic.
2482 args<< QString("konqueror-%1").arg(procBrowser->pid()->dwProcessId)<<
2483 "konqueror-mainwindow#1"<<
2487 args<< QString("konqueror-%1").arg(procBrowser->pid())<<
2488 "konqueror-mainwindow#1"<<
2492 p->start ("dcop",args);
2493 if (debug) cout << "MainWindo::openURLs args="<<args.join(" ").toStdString()<<endl;
2494 if ( !p->waitForStarted() ) success=false;
2497 QMessageBox::warning(0,
2499 tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
2501 } else if (browser.contains ("firefox") || browser.contains ("mozilla") )
2503 for (int i=0; i<urls.size(); i++)
2505 // Try to open new tab in firefox
2506 p=new QProcess (this);
2507 args<< "-remote"<< QString("openurl(%1,new-tab)").arg(urls.at(i));
2508 p->start (browser,args);
2509 if ( !p->waitForStarted() ) success=false;
2512 QMessageBox::warning(0,
2514 tr("Couldn't start %1 to open a new tab").arg(browser));
2517 QMessageBox::warning(0,
2519 tr("Sorry, currently only Konqueror and Mozilla support tabbed browsing."));
2523 void Main::editOpenURL()
2526 VymModel *m=currentModel();
2529 QString url=m->getURL();
2531 if (url=="") return;
2532 QString browser=settings.value("/mainwindow/readerURL" ).toString();
2533 procBrowser = new QProcess( this );
2535 procBrowser->start(browser,args);
2536 if ( !procBrowser->waitForStarted())
2538 // try to set path to browser
2539 QMessageBox::warning(0,
2541 tr("Couldn't find a viewer to open %1.\n").arg(url)+
2542 tr("Please use Settings->")+tr("Set application to open an URL"));
2547 void Main::editOpenURLTab()
2549 VymModel *m=currentModel();
2553 urls.append(m->getURL());
2557 void Main::editOpenMultipleURLTabs()
2559 VymModel *m=currentModel();
2569 void Main::editURL()
2571 VymModel *m=currentModel();
2572 if (m) m->editURL();
2575 void Main::editLocalURL()
2577 VymModel *m=currentModel();
2578 if (m) m->editLocalURL();
2581 void Main::editHeading2URL()
2583 VymModel *m=currentModel();
2584 if (m) m->editHeading2URL();
2587 void Main::editBugzilla2URL()
2589 VymModel *m=currentModel();
2590 if (m) m->editBugzilla2URL();
2593 void Main::editFATE2URL()
2595 VymModel *m=currentModel();
2596 if (m) m->editFATE2URL();
2599 void Main::editHeadingFinished(VymModel *m)
2603 if (!actionSettingsAutoSelectNewBranch->isOn() &&
2604 !prevSelection.isEmpty())
2605 m->select(prevSelection);
2610 void Main::openVymLinks(const QStringList &vl)
2612 for (int j=0; j<vl.size(); j++)
2614 // compare path with already loaded maps
2617 for (i=0;i<=vymViews.count() -1;i++)
2619 if (vl.at(j)==vymViews.at(i)->getModel()->getFilePath() )
2628 if (!QFile(vl.at(j)).exists() )
2629 QMessageBox::critical( 0, tr( "Critical Error" ),
2630 tr("Couldn't open map %1").arg(vl.at(j)));
2633 fileLoad (vl.at(j), NewMap);
2634 tabWidget->setCurrentIndex (tabWidget->count()-1);
2637 // Go to tab containing the map
2638 tabWidget->setCurrentIndex (index);
2642 void Main::editOpenVymLink()
2644 VymModel *m=currentModel();
2648 vl.append(m->getVymLink());
2653 void Main::editOpenMultipleVymLinks()
2655 QString currentVymLink;
2656 VymModel *m=currentModel();
2659 QStringList vl=m->getVymLinks();
2664 void Main::editVymLink()
2666 VymModel *m=currentModel();
2671 void Main::editDeleteVymLink()
2673 VymModel *m=currentModel();
2674 if (m) m->deleteVymLink();
2677 void Main::editToggleHideExport()
2679 VymModel *m=currentModel();
2680 if (m) m->toggleHideExport();
2683 void Main::editMapInfo()
2685 VymModel *m=currentModel();
2687 ExtraInfoDialog dia;
2688 dia.setMapName (m->getFileName() );
2689 dia.setAuthor (m->getAuthor() );
2690 dia.setComment(m->getComment() );
2694 /* FIXME-2 no stats at the moment (view dependent...)
2695 stats+=tr("%1 items on map\n","Info about map").arg (mapScene->items().size(),6);
2705 if (!bo->getNote().isEmpty() ) n++;
2706 f+= bo->countFloatImages();
2708 xl+=bo->countXLinks();
2711 stats+=QString ("%1 xLinks \n").arg (xl,6);
2712 stats+=QString ("%1 notes\n").arg (n,6);
2713 stats+=QString ("%1 images\n").arg (f,6);
2715 stats+=QString ("%1 branches\n").arg (m->branchCount(),6);
2716 dia.setStats (stats);
2718 // Finally show dialog
2719 if (dia.exec() == QDialog::Accepted)
2721 m->setAuthor (dia.getAuthor() );
2722 m->setComment (dia.getComment() );
2726 void Main::editMoveUp()
2728 VymModel *m=currentModel();
2732 void Main::editMoveDown()
2734 VymModel *m=currentModel();
2735 if (m) m->moveDown();
2738 void Main::editSortChildren()
2740 VymModel *m=currentModel();
2741 if (m) m->sortChildren();
2744 void Main::editToggleScroll()
2746 VymModel *m=currentModel();
2747 if (m) m->toggleScroll();
2750 void Main::editExpandAll()
2752 VymModel *m=currentModel();
2753 if (m) m->emitExpandAll();
2756 void Main::editUnscrollChildren()
2758 VymModel *m=currentModel();
2759 if (m) m->unscrollChildren();
2762 void Main::editAddMapCenter()
2764 VymModel *m=currentModel();
2765 if (m) m->addMapCenter ();
2768 void Main::editNewBranch()
2770 VymModel *m=currentModel();
2773 BranchItem *bi=m->createBranch();
2780 if (actionSettingsAutoEditNewBranch->isOn())
2782 currentMapEditor()->editHeading();
2785 if (!prevSelection.isEmpty())
2787 m->select(prevSelection);
2793 void Main::editNewBranchBefore()
2795 VymModel *m=currentModel();
2798 BranchItem *bi=m->addNewBranchBefore();
2805 if (actionSettingsAutoEditNewBranch->isOn())
2807 if (!actionSettingsAutoSelectNewBranch->isOn())
2808 prevSelection=m->getSelectString(bi);
2809 currentMapEditor()->editHeading();
2814 void Main::editNewBranchAbove()
2816 VymModel *m=currentModel();
2819 BranchItem *bi=m->addNewBranch (-1);
2827 if (actionSettingsAutoEditNewBranch->isOn())
2829 if (!actionSettingsAutoSelectNewBranch->isOn())
2830 prevSelection=m->getSelectString (bi);
2831 currentMapEditor()->editHeading();
2836 void Main::editNewBranchBelow()
2838 VymModel *m=currentModel();
2841 BranchItem *bi=m->addNewBranch (1);
2848 if (actionSettingsAutoEditNewBranch->isOn())
2850 if (!actionSettingsAutoSelectNewBranch->isOn())
2851 prevSelection=m->getSelectString(bi);
2852 currentMapEditor()->editHeading();
2857 void Main::editImportAdd()
2859 fileLoad (ImportAdd);
2862 void Main::editImportReplace()
2864 fileLoad (ImportReplace);
2867 void Main::editSaveBranch()
2869 fileSaveAs (PartOfMap);
2872 void Main::editDeleteKeepChildren()
2874 VymModel *m=currentModel();
2875 if (m) m->deleteKeepChildren();
2878 void Main::editDeleteChildren()
2880 VymModel *m=currentModel();
2881 if (m) m->deleteChildren();
2884 void Main::editDeleteSelection()
2886 VymModel *m=currentModel();
2887 if (m && actionSettingsUseDelKey->isOn())
2888 m->deleteSelection();
2891 void Main::editLoadImage()
2893 VymModel *m=currentModel();
2894 if (m) m->loadFloatImage();
2897 void Main::editSaveImage()
2899 VymModel *m=currentModel();
2900 if (m) m->saveFloatImage();
2903 void Main::editFollowXLink(QAction *a)
2906 VymModel *m=currentModel();
2908 m->followXLink(branchXLinksContextMenuFollow->actions().indexOf(a));
2911 void Main::editEditXLink(QAction *a)
2913 VymModel *m=currentModel();
2915 m->editXLink(branchXLinksContextMenuEdit->actions().indexOf(a));
2918 void Main::formatSelectColor()
2920 QColor col = QColorDialog::getColor((currentColor ), this );
2921 if ( !col.isValid() ) return;
2922 colorChanged( col );
2925 void Main::formatPickColor()
2927 VymModel *m=currentModel();
2929 colorChanged( m->getCurrentHeadingColor() );
2932 void Main::colorChanged(QColor c)
2934 QPixmap pix( 16, 16 );
2936 actionFormatColor->setIconSet( pix );
2940 void Main::formatColorBranch()
2942 VymModel *m=currentModel();
2943 if (m) m->colorBranch(currentColor);
2946 void Main::formatColorSubtree()
2948 VymModel *m=currentModel();
2949 if (m) m->colorSubtree (currentColor);
2952 void Main::formatLinkStyleLine()
2954 VymModel *m=currentModel();
2957 m->setMapLinkStyle("StyleLine");
2958 actionFormatLinkStyleLine->setOn(true);
2962 void Main::formatLinkStyleParabel()
2964 VymModel *m=currentModel();
2967 m->setMapLinkStyle("StyleParabel");
2968 actionFormatLinkStyleParabel->setOn(true);
2972 void Main::formatLinkStylePolyLine()
2974 VymModel *m=currentModel();
2977 m->setMapLinkStyle("StylePolyLine");
2978 actionFormatLinkStylePolyLine->setOn(true);
2982 void Main::formatLinkStylePolyParabel()
2984 VymModel *m=currentModel();
2987 m->setMapLinkStyle("StylePolyParabel");
2988 actionFormatLinkStylePolyParabel->setOn(true);
2992 void Main::formatSelectBackColor()
2994 VymModel *m=currentModel();
2995 if (m) m->selectMapBackgroundColor();
2998 void Main::formatSelectBackImage()
3000 VymModel *m=currentModel();
3002 m->selectMapBackgroundImage();
3005 void Main::formatSelectLinkColor()
3007 VymModel *m=currentModel();
3010 QColor col = QColorDialog::getColor( m->getMapDefLinkColor(), this );
3011 m->setMapDefLinkColor( col );
3015 void Main::formatSelectSelectionColor()
3017 VymModel *m=currentModel();
3020 QColor col = QColorDialog::getColor( m->getMapDefLinkColor(), this );
3021 m->setSelectionColor (col);
3026 void Main::formatToggleLinkColorHint()
3028 VymModel *m=currentModel();
3029 if (m) m->toggleMapLinkColorHint();
3033 void Main::formatHideLinkUnselected() //FIXME-3 get rid of this with imagepropertydialog
3035 VymModel *m=currentModel();
3037 m->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
3040 void Main::viewZoomReset()
3042 MapEditor *me=currentMapEditor();
3043 if (me) me->setZoomFactorTarget (1);
3046 void Main::viewZoomIn()
3048 MapEditor *me=currentMapEditor();
3049 if (me) me->setZoomFactorTarget (me->getZoomFactorTarget()*1.25);
3052 void Main::viewZoomOut()
3054 MapEditor *me=currentMapEditor();
3055 if (me) me->setZoomFactorTarget (me->getZoomFactorTarget()*0.75);
3058 void Main::viewCenter()
3060 VymModel *m=currentModel();
3061 if (m) m->emitShowSelection();
3064 void Main::networkStartServer()
3066 VymModel *m=currentModel();
3067 if (m) m->newServer();
3070 void Main::networkConnect()
3072 VymModel *m=currentModel();
3073 if (m) m->connectToServer();
3076 bool Main::settingsPDF()
3078 // Default browser is set in constructor
3080 QString text = QInputDialog::getText(
3081 "VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
3082 settings.value("/mainwindow/readerPDF").toString(), &ok, this );
3084 settings.setValue ("/mainwindow/readerPDF",text);
3089 bool Main::settingsURL()
3091 // Default browser is set in constructor
3093 QString text = QInputDialog::getText(
3094 "VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
3095 settings.value("/mainwindow/readerURL").toString()
3098 settings.setValue ("/mainwindow/readerURL",text);
3102 void Main::settingsMacroDir()
3104 QDir defdir(vymBaseDir.path() + "/macros");
3105 if (!defdir.exists())
3107 QDir dir=QFileDialog::getExistingDirectory (
3109 tr ("Directory with vym macros:"),
3110 settings.value ("/macros/macroDir",defdir.path()).toString()
3113 settings.setValue ("/macros/macroDir",dir.absolutePath());
3116 void Main::settingsUndoLevels()
3119 int i = QInputDialog::getInteger(
3121 tr("QInputDialog::getInteger()"),
3122 tr("Number of undo/redo levels:"), settings.value("/mapeditor/stepsTotal").toInt(), 0, 1000, 1, &ok);
3125 settings.setValue ("/mapeditor/stepsTotal",i);
3126 QMessageBox::information( this, tr( "VYM -Information:" ),
3127 tr("Settings have been changed. The next map opened will have \"%1\" undo/redo levels").arg(i));
3131 void Main::settingsAutosaveToggle()
3133 settings.setValue ("/mainwindow/autosave/use",actionSettingsAutosaveToggle->isOn() );
3136 void Main::settingsAutosaveTime()
3139 int i = QInputDialog::getInteger(
3141 tr("QInputDialog::getInteger()"),
3142 tr("Number of seconds before autosave:"), settings.value("/mainwindow/autosave/ms").toInt() / 1000, 10, 10000, 1, &ok);
3144 settings.setValue ("/mainwindow/autosave/ms",i * 1000);
3147 void Main::settingsWriteBackupFileToggle()
3149 settings.setValue ("/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() );
3152 void Main::settingsToggleAnimation()
3154 settings.setValue ("/animation/use",actionSettingsUseAnimation->isOn() );
3157 void Main::settingsToggleDelKey()
3159 if (actionSettingsUseDelKey->isOn())
3161 actionDelete->setAccel (QKeySequence (Qt::Key_Delete));
3164 actionDelete->setAccel (QKeySequence (""));
3168 void Main::windowToggleNoteEditor()
3170 if (textEditor->isVisible() )
3171 windowHideNoteEditor();
3173 windowShowNoteEditor();
3176 void Main::windowToggleHistory()
3178 if (historyWindow->isVisible())
3179 historyWindow->hide();
3181 historyWindow->show();
3185 void Main::windowToggleProperty()
3187 if (branchPropertyWindow->isVisible())
3188 branchPropertyWindow->hide();
3190 branchPropertyWindow->show();
3191 branchPropertyWindow->setModel (currentModel() );
3194 void Main::windowToggleAntiAlias()
3196 bool b=actionViewToggleAntiAlias->isOn();
3198 for (int i=0;i<vymViews.count();i++)
3200 me=vymViews.at(i)->getMapEditor();
3201 if (me) me->setAntiAlias(b);
3206 bool Main::isAliased()
3208 return actionViewToggleAntiAlias->isOn();
3211 bool Main::hasSmoothPixmapTransform()
3213 return actionViewToggleSmoothPixmapTransform->isOn();
3216 void Main::windowToggleSmoothPixmap()
3218 bool b=actionViewToggleSmoothPixmapTransform->isOn();
3220 for (int i=0;i<vymViews.count();i++)
3223 me=vymViews.at(i)->getMapEditor();
3224 if (me) me->setSmoothPixmap(b);
3228 void Main::updateHistory(SimpleSettings &undoSet)
3230 historyWindow->update (undoSet);
3233 void Main::updateNoteFlag()
3235 // this slot is connected to TextEditor::textHasChanged()
3237 VymModel *m=currentModel();
3238 if (m) m->updateNoteFlag();
3241 void Main::updateNoteEditor(QModelIndex index )
3243 TreeItem *ti=((VymModel*)sender())->getItem(index);
3245 cout << "Main::updateNoteEditor model="<<sender();
3246 cout << " item="<<ti->headingStd()<<" ("<<ti<<")"<<endl;
3248 textEditor->setNote (ti->getNoteObj() );
3251 void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel)
3253 //branchPropertyWindow->setModel (model ); //FIXME-2 this used to be called from BranchObj::select(). Maybe use signal now...
3255 if (model && model==currentModel() )
3259 if (!oldsel.indexes().isEmpty() )
3261 ti=model->getItem(oldsel.indexes().first());
3263 // Don't update note if both treeItem and textEditor are empty
3264 //if (! (ti->hasEmptyNote() && textEditor->isEmpty() ))
3265 // ti->setNoteObj (textEditor->getNoteObj(),false );
3267 if (!newsel.indexes().isEmpty() )
3269 ti=model->getItem(newsel.indexes().first());
3270 if (!ti->hasEmptyNote() )
3271 textEditor->setNote(ti->getNoteObj() );
3273 textEditor->setNote(NoteObj() ); //FIXME-4 maybe add a clear() to TE
3275 // Show URL and link in statusbar
3277 QString s=ti->getURL();
3278 if (!s.isEmpty() ) status+="URL: "+s+" ";
3280 if (!s.isEmpty() ) status+="Link: "+s;
3281 if (!status.isEmpty() ) statusMessage (status);
3284 textEditor->setInactive();
3290 void Main::updateActions()
3292 VymModel *m =currentModel();
3296 actionFilePrint->setEnabled (true);
3298 // Link style in context menu
3299 switch (m->getMapLinkStyle())
3301 case LinkableMapObj::Line:
3302 actionFormatLinkStyleLine->setOn(true);
3304 case LinkableMapObj::Parabel:
3305 actionFormatLinkStyleParabel->setOn(true);
3307 case LinkableMapObj::PolyLine:
3308 actionFormatLinkStylePolyLine->setOn(true);
3310 case LinkableMapObj::PolyParabel:
3311 actionFormatLinkStylePolyParabel->setOn(true);
3318 QPixmap pix( 16, 16 );
3319 pix.fill( m->getMapBackgroundColor() );
3320 actionFormatBackColor->setIconSet( pix );
3321 pix.fill( m->getSelectionColor() );
3322 actionFormatSelectionColor->setIconSet( pix );
3323 pix.fill( m->getMapDefLinkColor() );
3324 actionFormatLinkColor->setIconSet( pix );
3327 historyWindow->setCaption (vymName + " - " +tr("History for %1","Window Caption").arg(m->getFileName()));
3332 actionFilePrint->setEnabled (false);
3335 // updateActions is also called when NoteEditor is closed
3336 actionViewToggleNoteEditor->setOn (textEditor->isVisible());
3337 actionViewToggleHistoryWindow->setOn (historyWindow->isVisible());
3338 actionViewTogglePropertyWindow->setOn (branchPropertyWindow->isVisible());
3340 if (m && m->getMapLinkColorHint()==LinkableMapObj::HeadingColor)
3341 actionFormatLinkColorHint->setOn(true);
3343 actionFormatLinkColorHint->setOn(false);
3346 if (m && m->hasChanged() )
3347 actionFileSave->setEnabled( true);
3349 actionFileSave->setEnabled( true);
3350 if (m && m->isUndoAvailable())
3351 actionUndo->setEnabled( true);
3353 actionUndo->setEnabled( false);
3355 if (m && m->isRedoAvailable())
3356 actionRedo->setEnabled( true);
3358 actionRedo->setEnabled( false);
3362 TreeItem *selti=m->getSelectedItem();
3363 BranchItem *selbi=m->getSelectedBranchItem();
3368 // Take care of links // FIXME-1
3370 if (bo->countXLinks()==0)
3372 branchXLinksContextMenuEdit->clear();
3373 branchXLinksContextMenuFollow->clear();
3378 branchXLinksContextMenuEdit->clear();
3379 branchXLinksContextMenuFollow->clear();
3380 for (int i=0; i<=bo->countXLinks();i++)
3382 bot=bo->XLinkTargetAt(i);
3385 s=bot->getHeading();
3386 if (s.length()>xLinkMenuWidth)
3387 s=s.left(xLinkMenuWidth)+"...";
3388 branchXLinksContextMenuFollow->addAction (s);
3389 branchXLinksContextMenuEdit->addAction (s);
3395 standardFlagsMaster->updateToolBar (selbi->activeStandardFlagNames() );
3398 actionToggleScroll->setEnabled (true);
3399 if ( selbi->isScrolled() )
3400 actionToggleScroll->setOn(true);
3402 actionToggleScroll->setOn(false);
3404 if ( selti->getURL().isEmpty() )
3406 actionOpenURL->setEnabled (false);
3407 actionOpenURLTab->setEnabled (false);
3411 actionOpenURL->setEnabled (true);
3412 actionOpenURLTab->setEnabled (true);
3414 if ( selti->getVymLink().isEmpty() )
3416 actionOpenVymLink->setEnabled (false);
3417 actionDeleteVymLink->setEnabled (false);
3420 actionOpenVymLink->setEnabled (true);
3421 actionDeleteVymLink->setEnabled (true);
3424 if (selbi->canMoveUp())
3425 actionMoveUp->setEnabled (true);
3427 actionMoveUp->setEnabled (false);
3428 if (selbi->canMoveDown())
3429 actionMoveDown->setEnabled (true);
3431 actionMoveDown->setEnabled (false);
3433 actionSortChildren->setEnabled (true);
3435 actionToggleHideExport->setEnabled (true);
3436 actionToggleHideExport->setOn (selbi->hideInExport() );
3438 actionFileSave->setEnabled (true);
3439 actionCopy->setEnabled (true);
3440 actionCut->setEnabled (true);
3441 if (!clipboardEmpty)
3442 actionPaste->setEnabled (true);
3444 actionPaste->setEnabled (false);
3445 for (int i=0; i<actionListBranches.size(); ++i)
3446 actionListBranches.at(i)->setEnabled(true);
3447 actionDelete->setEnabled (true);
3448 //FIXME-2 actionFormatHideLinkUnselected->setOn (selection->getHideLinkUnselected());
3450 if ( selti->getType()==TreeItem::Image)
3453 FloatObj *fo=(FloatImageObj*)selection;
3455 actionOpenURL->setEnabled (false);
3456 actionOpenVymLink->setEnabled (false);
3457 actionDeleteVymLink->setEnabled (false);
3458 actionToggleHideExport->setEnabled (true);
3459 actionToggleHideExport->setOn (fo->hideInExport() );
3462 actionCopy->setEnabled (true);
3463 actionCut->setEnabled (true);
3464 actionPaste->setEnabled (false); //FIXME-4 why not allowing copy of images?
3465 for (int i=0; i<actionListBranches.size(); ++i)
3466 actionListBranches.at(i)->setEnabled(false);
3467 actionDelete->setEnabled (true);
3468 actionFormatHideLinkUnselected->setOn
3469 ( selection->getHideLinkUnselected());
3470 actionMoveUp->setEnabled (false);
3471 actionMoveDown->setEnabled (false);
3477 actionFileSave->setEnabled (false);
3478 actionCopy->setEnabled (false);
3479 actionCut->setEnabled (false);
3480 actionPaste->setEnabled (false);
3481 for (int i=0; i<actionListBranches.size(); ++i)
3482 actionListBranches.at(i)->setEnabled(false);
3484 actionToggleScroll->setEnabled (false);
3485 actionOpenURL->setEnabled (false);
3486 actionOpenVymLink->setEnabled (false);
3487 actionDeleteVymLink->setEnabled (false);
3488 actionHeading2URL->setEnabled (false);
3489 actionDelete->setEnabled (false);
3490 actionMoveUp->setEnabled (false);
3491 actionMoveDown->setEnabled (false);
3492 actionSortChildren->setEnabled (false);
3493 actionToggleHideExport->setEnabled (false);
3498 Main::ModMode Main::getModMode()
3500 if (actionModModeColor->isOn()) return ModModeColor;
3501 if (actionModModeCopy->isOn()) return ModModeCopy;
3502 if (actionModModeXLink->isOn()) return ModModeXLink;
3506 bool Main::autoEditNewBranch()
3508 return actionSettingsAutoEditNewBranch->isOn();
3511 bool Main::autoSelectNewBranch()
3513 return actionSettingsAutoSelectNewBranch->isOn();
3516 void Main::windowShowNoteEditor()
3518 textEditor->setShowWithMain(true);
3520 actionViewToggleNoteEditor->setOn (true);
3523 void Main::windowHideNoteEditor()
3525 textEditor->setShowWithMain(false);
3527 actionViewToggleNoteEditor->setOn (false);
3530 void Main::setScript (const QString &script)
3532 scriptEditor->setScript (script);
3535 void Main::runScript (const QString &script)
3537 VymModel *m=currentModel();
3538 if (m) m->runScript (script);
3541 void Main::runScriptEverywhere (const QString &script)
3544 for (int i=0;i<=tabWidget->count() -1;i++)
3546 me=(MapEditor*)tabWidget->page(i);
3547 if (me) me->getModel()->runScript (script);
3551 void Main::windowNextEditor()
3553 if (tabWidget->currentIndex() < tabWidget->count())
3554 tabWidget->setCurrentIndex (tabWidget->currentIndex() +1);
3557 void Main::windowPreviousEditor()
3559 if (tabWidget->currentIndex() >0)
3560 tabWidget->setCurrentIndex (tabWidget->currentIndex() -1);
3563 void Main::standardFlagChanged()
3567 if ( actionSettingsUseFlagGroups->isOn() )
3568 currentModel()->toggleStandardFlag(sender()->name(),standardFlagsMaster);
3570 currentModel()->toggleStandardFlag(sender()->name());
3575 void Main::testFunction1()
3577 if (!currentMapEditor()) return;
3578 currentMapEditor()->testFunction1();
3581 void Main::testFunction2()
3583 if (!currentMapEditor()) return;
3584 currentMapEditor()->setFocus();
3587 void Main::testCommand()
3589 if (!currentMapEditor()) return;
3590 scriptEditor->show();
3593 QString com = QInputDialog::getText(
3594 vymName, "Enter Command:", QLineEdit::Normal,"command", &ok, this );
3595 if (ok) currentMapEditor()->parseAtom(com);
3599 void Main::helpDoc()
3601 QString locale = QLocale::system().name();
3603 if (locale.left(2)=="es")
3604 docname="vym_es.pdf";
3608 QStringList searchList;
3610 #if defined(Q_OS_MACX)
3611 searchList << "./vym.app/Contents/Resources/doc";
3612 #elif defined(Q_OS_WIN32)
3613 searchList << vymInstallDir.path() + "/share/doc/packages/vym";
3615 #if defined(VYM_DOCDIR)
3616 searchList << VYM_DOCDIR;
3618 // default path in SUSE LINUX
3619 searchList << "/usr/share/doc/packages/vym";
3622 searchList << "doc"; // relative path for easy testing in tarball
3623 searchList << "doc/tex"; // Easy testing working on vym.tex
3624 searchList << "/usr/share/doc/vym"; // Debian
3625 searchList << "/usr/share/doc/packages";// Knoppix
3629 for (int i=0; i<searchList.count(); ++i)
3631 docfile.setFileName(searchList.at(i)+"/"+docname);
3632 if (docfile.exists())
3641 QMessageBox::critical(0,
3642 tr("Critcal error"),
3643 tr("Couldn't find the documentation %1 in:\n%2").arg(searchList.join("\n")));
3648 Process *pdfProc = new Process();
3649 args << QDir::toNativeSeparators(docfile.fileName());
3651 pdfProc->start( settings.value("/mainwindow/readerPDF").toString(),args);
3652 if ( !pdfProc->waitForStarted() )
3655 QMessageBox::warning(0,
3657 tr("Couldn't find a viewer to open %1.\n").arg(docfile.fileName())+
3658 tr("Please use Settings->")+tr("Set application to open PDF files"));
3665 void Main::helpDemo()
3667 QStringList filters;
3668 filters <<"VYM example map (*.vym)";
3669 QFileDialog *fd=new QFileDialog( this);
3670 #if defined(Q_OS_MACX)
3671 fd->setDir (QDir("./vym.app/Contents/Resources/demos"));
3673 // default path in SUSE LINUX
3674 fd->setDir (QDir(vymBaseDir.path()+"/demos"));
3677 fd->setFileMode (QFileDialog::ExistingFiles);
3678 fd->setFilters (filters);
3679 fd->setCaption(vymName+ " - " +tr("Load vym example map"));
3683 if ( fd->exec() == QDialog::Accepted )
3685 lastFileDir=fd->directory().path();
3686 QStringList flist = fd->selectedFiles();
3687 QStringList::Iterator it = flist.begin();
3688 while( it != flist.end() )
3691 fileLoad(*it, NewMap);
3699 void Main::helpAbout()
3702 ad.setName ("aboutwindow");
3703 ad.setMinimumSize(500,500);
3704 ad.resize (QSize (500,500));
3708 void Main::helpAboutQT()
3710 QMessageBox::aboutQt( this, "Qt Application Example" );
3713 void Main::callMacro ()
3715 QAction *action = qobject_cast<QAction *>(sender());
3719 i=action->data().toInt();
3720 QString mDir (settings.value ("macros/macroDir").toString() );
3722 QString fn=mDir + QString("/macro-%1.vys").arg(i+1);
3724 if ( !f.open( QIODevice::ReadOnly ) )
3726 QMessageBox::warning(0,
3728 tr("Couldn't find a macro at %1.\n").arg(fn)+
3729 tr("Please use Settings->")+tr("Set directory for vym macros"));
3733 QTextStream ts( &f );
3734 QString macro= ts.read();
3736 if (! macro.isEmpty())
3738 VymModel *m=currentModel();
3739 if (m) m->runScript(macro);