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 if (settings.value( "/mainwindow/showTestMenu",false).toBool() )
1456 settingsMenu->addAction (a);
1458 actionSettingsUseAnimation=a;
1462 void Main::setupTestActions()
1464 QMenu *testMenu = menuBar()->addMenu( tr( "&Test" ));
1467 a = new QAction( "Test function 1" , this);
1468 a->setStatusTip( "Call test function 1" );
1469 testMenu->addAction (a);
1470 connect( a, SIGNAL( triggered() ), this, SLOT( testFunction1() ) );
1472 a = new QAction( "Test function 2" , this);
1473 a->setStatusTip( "Call test function 2" );
1474 testMenu->addAction (a);
1475 connect( a, SIGNAL( triggered() ), this, SLOT( testFunction2() ) );
1477 a = new QAction( "Command" , this);
1478 a->setStatusTip( "Enter command to call in editor" );
1479 connect( a, SIGNAL( triggered() ), this, SLOT( testCommand() ) );
1480 testMenu->addAction (a);
1484 void Main::setupHelpActions()
1486 QMenu *helpMenu = menuBar()->addMenu ( tr( "&Help","Help menubar entry" ));
1489 a = new QAction( tr( "Open VYM Documentation (pdf) ","Help action" ), this );
1490 a->setStatusTip( tr( "Open VYM Documentation (pdf)" ));
1491 connect( a, SIGNAL( triggered() ), this, SLOT( helpDoc() ) );
1492 helpMenu->addAction (a);
1494 a = new QAction( tr( "Open VYM example maps ","Help action" ), this );
1495 a->setStatusTip( tr( "Open VYM example maps " ));
1496 connect( a, SIGNAL( triggered() ), this, SLOT( helpDemo() ) );
1497 helpMenu->addAction (a);
1499 a = new QAction( tr( "About VYM","Help action" ), this);
1500 a->setStatusTip( tr( "About VYM")+vymName);
1501 connect( a, SIGNAL( triggered() ), this, SLOT( helpAbout() ) );
1502 helpMenu->addAction (a);
1504 a = new QAction( tr( "About QT","Help action" ), this);
1505 a->setStatusTip( tr( "Information about QT toolkit" ));
1506 connect( a, SIGNAL( triggered() ), this, SLOT( helpAboutQT() ) );
1507 helpMenu->addAction (a);
1511 void Main::setupContextMenus()
1515 // Context Menu for branch or mapcenter
1516 branchContextMenu =new QMenu (this);
1517 branchContextMenu->addAction (actionViewTogglePropertyWindow);
1518 branchContextMenu->addSeparator();
1521 branchAddContextMenu =branchContextMenu->addMenu (tr("Add"));
1522 branchAddContextMenu->addAction (actionPaste );
1523 branchAddContextMenu->addAction ( actionAddMapCenter );
1524 branchAddContextMenu->addAction ( actionAddBranch );
1525 branchAddContextMenu->addAction ( actionAddBranchBefore );
1526 branchAddContextMenu->addAction ( actionAddBranchAbove);
1527 branchAddContextMenu->addAction ( actionAddBranchBelow );
1528 branchAddContextMenu->addSeparator();
1529 branchAddContextMenu->addAction ( actionImportAdd );
1530 branchAddContextMenu->addAction ( actionImportReplace );
1533 branchRemoveContextMenu =branchContextMenu->addMenu (tr ("Remove","Context menu name"));
1534 branchRemoveContextMenu->addAction (actionCut);
1535 branchRemoveContextMenu->addAction ( actionDelete );
1536 branchRemoveContextMenu->addAction ( actionDeleteKeepChildren );
1537 branchRemoveContextMenu->addAction ( actionDeleteChildren );
1540 actionSaveBranch->addTo( branchContextMenu );
1541 actionFileNewCopy->addTo (branchContextMenu );
1543 branchContextMenu->addSeparator();
1544 branchContextMenu->addAction ( actionLoadImage);
1546 // Submenu for Links (URLs, vymLinks)
1547 branchLinksContextMenu =new QMenu (this);
1549 branchContextMenu->addSeparator();
1550 branchLinksContextMenu=branchContextMenu->addMenu(tr("References (URLs, vymLinks, ...)","Context menu name"));
1551 branchLinksContextMenu->addAction ( actionOpenURL );
1552 branchLinksContextMenu->addAction ( actionOpenURLTab );
1553 branchLinksContextMenu->addAction ( actionOpenMultipleURLTabs );
1554 branchLinksContextMenu->addAction ( actionURL );
1555 branchLinksContextMenu->addAction ( actionLocalURL );
1556 branchLinksContextMenu->addAction ( actionHeading2URL );
1557 branchLinksContextMenu->addAction ( actionBugzilla2URL );
1558 if (settings.value( "/mainwindow/showTestMenu",false).toBool() )
1560 branchLinksContextMenu->addAction ( actionFATE2URL );
1562 branchLinksContextMenu->addSeparator();
1563 branchLinksContextMenu->addAction ( actionOpenVymLink );
1564 branchLinksContextMenu->addAction ( actionOpenMultipleVymLinks );
1565 branchLinksContextMenu->addAction ( actionVymLink );
1566 branchLinksContextMenu->addAction ( actionDeleteVymLink );
1569 // Context Menu for XLinks in a branch menu
1570 // This will be populated "on demand" in MapEditor::updateActions
1571 branchContextMenu->addSeparator();
1572 branchXLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink","Context menu name"));
1573 branchXLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink","Context menu name"));
1574 connect( branchXLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) );
1575 connect( branchXLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) );
1578 // Context menu for floatimage
1579 floatimageContextMenu =new QMenu (this);
1580 a= new QAction (tr ("Save image","Context action"),this);
1581 connect (a, SIGNAL (triggered()), this, SLOT (editSaveImage()));
1582 floatimageContextMenu->addAction (a);
1584 floatimageContextMenu->addSeparator();
1585 actionCopy->addTo( floatimageContextMenu );
1586 actionCut->addTo( floatimageContextMenu );
1588 floatimageContextMenu->addSeparator();
1589 floatimageContextMenu->addAction ( actionFormatHideLinkUnselected );
1592 // Context menu for canvas
1593 canvasContextMenu =new QMenu (this);
1594 actionAddMapCenter->addTo( canvasContextMenu );
1595 actionMapInfo->addTo( canvasContextMenu );
1596 canvasContextMenu->insertSeparator();
1597 actionGroupFormatLinkStyles->addTo( canvasContextMenu );
1598 canvasContextMenu->insertSeparator();
1599 actionFormatLinkColorHint->addTo( canvasContextMenu );
1600 actionFormatLinkColor->addTo( canvasContextMenu );
1601 actionFormatSelectionColor->addTo( canvasContextMenu );
1602 actionFormatBackColor->addTo( canvasContextMenu );
1603 // actionFormatBackImage->addTo( canvasContextMenu ); //FIXME-4 makes vym too slow: postponed for later version
1605 // Menu for last opened files
1607 for (int i = 0; i < MaxRecentFiles; ++i)
1609 recentFileActions[i] = new QAction(this);
1610 recentFileActions[i]->setVisible(false);
1611 fileLastMapsMenu->addAction(recentFileActions[i]);
1612 connect(recentFileActions[i], SIGNAL(triggered()),
1613 this, SLOT(fileLoadRecent()));
1615 setupRecentMapsMenu();
1618 void Main::setupRecentMapsMenu()
1620 QStringList files = settings.value("/mainwindow/recentFileList").toStringList();
1622 int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
1624 for (int i = 0; i < numRecentFiles; ++i) {
1625 QString text = tr("&%1 %2").arg(i + 1).arg(files[i]);
1626 recentFileActions[i]->setText(text);
1627 recentFileActions[i]->setData(files[i]);
1628 recentFileActions[i]->setVisible(true);
1630 for (int j = numRecentFiles; j < MaxRecentFiles; ++j)
1631 recentFileActions[j]->setVisible(false);
1634 void Main::setupMacros()
1636 for (int i = 0; i <= 11; i++)
1638 macroActions[i] = new QAction(this);
1639 macroActions[i]->setData(i);
1640 addAction (macroActions[i]);
1641 connect(macroActions[i], SIGNAL(triggered()),
1642 this, SLOT(callMacro()));
1644 macroActions[0]->setShortcut ( Qt::Key_F1 );
1645 macroActions[1]->setShortcut ( Qt::Key_F2 );
1646 macroActions[2]->setShortcut ( Qt::Key_F3 );
1647 macroActions[3]->setShortcut ( Qt::Key_F4 );
1648 macroActions[4]->setShortcut ( Qt::Key_F5 );
1649 macroActions[5]->setShortcut ( Qt::Key_F6 );
1650 macroActions[6]->setShortcut ( Qt::Key_F7 );
1651 macroActions[7]->setShortcut ( Qt::Key_F8 );
1652 macroActions[8]->setShortcut ( Qt::Key_F9 );
1653 macroActions[9]->setShortcut ( Qt::Key_F10 );
1654 macroActions[10]->setShortcut ( Qt::Key_F11 );
1655 macroActions[11]->setShortcut ( Qt::Key_F12 );
1658 void Main::hideEvent (QHideEvent * )
1660 if (!textEditor->isMinimized() ) textEditor->hide();
1663 void Main::showEvent (QShowEvent * )
1665 if (actionViewToggleNoteEditor->isOn()) textEditor->showNormal();
1669 MapEditor* Main::currentMapEditor() const
1671 if ( tabWidget->currentPage())
1672 return vymViews.at(tabWidget->currentIndex())->getMapEditor();
1676 VymModel* Main::currentModel() const
1678 if ( tabWidget->currentPage())
1679 return vymViews.at(tabWidget->currentIndex())->getModel();
1684 void Main::editorChanged(QWidget *)
1686 // Unselect all possibly selected objects
1687 // (Important to update note editor)
1689 for (int i=0;i<=tabWidget->count() -1;i++)
1691 m= vymViews.at(tabWidget->currentIndex())->getModel();
1692 if (m) m->unselect();
1695 if (m) m->reselect();
1697 // Update actions to in menus and toolbars according to editor
1701 void Main::fileNew()
1703 VymModel *vm=new VymModel;
1705 VymView *vv=new VymView (vm);
1706 vymViews.append (vv);
1707 tabWidget->addTab (vv,tr("unnamed","MainWindow: name for new and empty file"));
1708 tabWidget->setCurrentIndex (vymViews.count() );
1712 // For the very first map we do not have flagrows yet...
1716 void Main::fileNewCopy()
1718 QString fn="unnamed";
1719 VymModel *srcModel=currentModel();
1724 VymModel *dstModel=vymViews.last()->getModel();
1725 dstModel->select("mc:");
1726 dstModel->load (clipboardDir+"/"+clipboardFile,ImportReplace, VymMap);
1730 ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode, const FileType &ftype)
1732 ErrorCode err=success;
1734 // fn is usually the archive, mapfile the file after uncompressing
1737 // Make fn absolute (needed for unzip)
1738 fn=QDir (fn).absPath();
1744 // Check, if map is already loaded
1746 while (i<=tabWidget->count() -1)
1748 if (vymViews.at(i)->getModel()->getFilePath() == fn)
1750 // Already there, ask for confirmation
1751 QMessageBox mb( vymName,
1752 tr("The map %1\nis already opened."
1753 "Opening the same map in multiple editors may lead \n"
1754 "to confusion when finishing working with vym."
1755 "Do you want to").arg(fn),
1756 QMessageBox::Warning,
1757 QMessageBox::Yes | QMessageBox::Default,
1758 QMessageBox::Cancel | QMessageBox::Escape,
1759 QMessageBox::NoButton);
1760 mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
1761 mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
1764 case QMessageBox::Yes:
1765 // end loop and load anyway
1766 i=tabWidget->count();
1768 case QMessageBox::Cancel:
1778 int tabIndex=tabWidget->currentPageIndex();
1781 if ( !fn.isEmpty() )
1783 vm = currentModel();
1784 // Check first, if mapeditor exists
1785 // If it is not default AND we want a new map,
1786 // create a new mapeditor in a new tab
1787 if ( lmode==NewMap && (!vm || !vm->isDefault() ) )
1790 VymView *vv=new VymView (vm);
1791 vymViews.append (vv);
1792 tabWidget->addTab (vv,fn);
1793 tabIndex=tabWidget->count()-1;
1794 tabWidget->setCurrentPage (tabIndex);
1798 // Check, if file exists (important for creating new files
1799 // from command line
1800 if (!QFile(fn).exists() )
1802 QMessageBox mb( vymName,
1803 tr("This map does not exist:\n %1\nDo you want to create a new one?").arg(fn),
1804 QMessageBox::Question,
1806 QMessageBox::Cancel | QMessageBox::Default,
1807 QMessageBox::NoButton );
1809 mb.setButtonText( QMessageBox::Yes, tr("Create"));
1810 mb.setButtonText( QMessageBox::No, tr("Cancel"));
1813 case QMessageBox::Yes:
1815 currentMapEditor()->getModel()->setFilePath(fn);
1816 tabWidget->setTabText (tabIndex,
1817 currentMapEditor()->getModel()->getFileName() );
1818 statusBar()->message( "Created " + fn , statusbarTime );
1821 case QMessageBox::Cancel:
1822 // don't create new map
1823 statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
1830 //tabWidget->currentPage() won't be NULL here, because of above...
1831 tabWidget->setCurrentIndex (tabIndex);
1832 //FIXME-3 no me anymore... me->viewport()->setFocus();
1836 // Save existing filename in case we import
1837 QString fn_org=vm->getFilePath();
1839 // Finally load map into mapEditor
1840 vm->setFilePath (fn);
1841 err=vm->load(fn,lmode,ftype);
1843 // Restore old (maybe empty) filepath, if this is an import
1845 vm->setFilePath (fn_org);
1848 // Finally check for errors and go home
1851 if (lmode==NewMap) fileCloseMap();
1852 statusBar()->message( "Could not load " + fn, statusbarTime );
1857 vm->setFilePath (fn);
1858 tabWidget->setTabText (tabIndex, vm->getFileName());
1859 if (!isInTmpDir (fn))
1861 // Only append to lastMaps if not loaded from a tmpDir
1862 // e.g. imported bookmarks are in a tmpDir
1863 addRecentMap(vm->getFilePath() );
1865 actionFilePrint->setEnabled (true);
1867 statusBar()->message( "Loaded " + fn, statusbarTime );
1874 void Main::fileLoad(const LoadMode &lmode)
1876 QStringList filters;
1877 filters <<"VYM map (*.vym *.vyp)"<<"XML (*.xml)";
1878 QFileDialog *fd=new QFileDialog( this);
1879 fd->setDir (lastFileDir);
1880 fd->setFileMode (QFileDialog::ExistingFiles);
1881 fd->setFilters (filters);
1885 fd->setCaption(vymName+ " - " +tr("Load vym map"));
1888 fd->setCaption(vymName+ " - " +tr("Import: Add vym map to selection"));
1891 fd->setCaption(vymName+ " - " +tr("Import: Replace selection with vym map"));
1897 if ( fd->exec() == QDialog::Accepted )
1899 lastFileDir=fd->directory().path();
1900 QStringList flist = fd->selectedFiles();
1901 QStringList::Iterator it = flist.begin();
1902 while( it != flist.end() )
1905 fileLoad(*it, lmode);
1912 void Main::fileLoad()
1917 void Main::fileLoadRecent()
1919 QAction *action = qobject_cast<QAction *>(sender());
1921 fileLoad (action->data().toString(), NewMap);
1924 void Main::addRecentMap (const QString &fileName)
1927 QStringList files = settings.value("/mainwindow/recentFileList").toStringList();
1928 files.removeAll(fileName);
1929 files.prepend(fileName);
1930 while (files.size() > MaxRecentFiles)
1933 settings.setValue("/mainwindow/recentFileList", files);
1935 setupRecentMapsMenu();
1938 void Main::fileSave(VymModel *m, const SaveMode &savemode)
1942 if ( m->getFilePath().isEmpty() )
1944 // We have no filepath yet,
1945 // call fileSaveAs() now, this will call fileSave()
1947 // First switch to editor
1948 //FIXME-3 needed??? tabWidget->setCurrentWidget (m->getMapEditor());
1949 fileSaveAs(savemode);
1952 if (m->save (savemode)==success)
1954 statusBar()->message(
1955 tr("Saved %1").arg(m->getFilePath()),
1957 addRecentMap (m->getFilePath() );
1959 statusBar()->message(
1960 tr("Couldn't save ").arg(m->getFilePath()),
1964 void Main::fileSave()
1966 fileSave (currentModel(), CompleteMap);
1969 void Main::fileSave(VymModel *m)
1971 fileSave (m,CompleteMap);
1974 void Main::fileSaveAs(const SaveMode& savemode)
1978 if (currentMapEditor())
1980 if (savemode==CompleteMap)
1981 fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
1983 fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
1984 if ( !fn.isEmpty() )
1986 // Check for existing file
1987 if (QFile (fn).exists())
1989 QMessageBox mb( vymName,
1990 tr("The file %1\nexists already. Do you want to").arg(fn),
1991 QMessageBox::Warning,
1992 QMessageBox::Yes | QMessageBox::Default,
1993 QMessageBox::Cancel | QMessageBox::Escape,
1994 QMessageBox::NoButton);
1995 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
1996 mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
1999 case QMessageBox::Yes:
2002 case QMessageBox::Cancel:
2009 // New file, add extension to filename, if missing
2010 // This is always .vym or .vyp, depending on savemode
2011 if (savemode==CompleteMap)
2013 if (!fn.contains (".vym") && !fn.contains (".xml"))
2017 if (!fn.contains (".vyp") && !fn.contains (".xml"))
2026 VymModel *m=currentModel();
2028 fileSave(m, savemode);
2030 // Set name of tab, assuming current tab is the one we just saved
2031 if (savemode==CompleteMap)
2032 tabWidget->setTabText (tabWidget->currentIndex(), m->getFileName() );
2038 void Main::fileSaveAs()
2040 fileSaveAs (CompleteMap);
2043 void Main::fileImportKDE3Bookmarks()
2045 ImportKDE3Bookmarks im;
2047 if (aborted!=fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
2048 currentMapEditor()->getModel()->setFilePath ("");
2051 void Main::fileImportKDE4Bookmarks()
2053 ImportKDE4Bookmarks im;
2055 if (aborted!=fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
2056 currentMapEditor()->getModel()->setFilePath ("");
2059 void Main::fileImportFirefoxBookmarks()
2061 Q3FileDialog *fd=new Q3FileDialog( this);
2062 fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox");
2063 fd->setMode (Q3FileDialog::ExistingFiles);
2064 fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)");
2065 fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks"));
2068 if ( fd->exec() == QDialog::Accepted )
2070 ImportFirefoxBookmarks im;
2071 QStringList flist = fd->selectedFiles();
2072 QStringList::Iterator it = flist.begin();
2073 while( it != flist.end() )
2076 if (im.transform() &&
2077 aborted!=fileLoad (im.getTransformedFile(),NewMap,FreemindMap) &&
2078 currentMapEditor() )
2079 currentMapEditor()->getModel()->setFilePath ("");
2086 void Main::fileImportFreemind()
2088 QStringList filters;
2089 filters <<"Freemind map (*.mm)"<<"All files (*)";
2090 QFileDialog *fd=new QFileDialog( this);
2091 fd->setDir (lastFileDir);
2092 fd->setFileMode (QFileDialog::ExistingFiles);
2093 fd->setFilters (filters);
2094 fd->setCaption(vymName+ " - " +tr("Load Freemind map"));
2098 if ( fd->exec() == QDialog::Accepted )
2100 lastFileDir=fd->directory().path();
2101 QStringList flist = fd->selectedFiles();
2102 QStringList::Iterator it = flist.begin();
2103 while( it != flist.end() )
2106 if ( fileLoad (fn,NewMap, FreemindMap) )
2108 currentMapEditor()->getModel()->setFilePath ("");
2117 void Main::fileImportMM()
2121 Q3FileDialog *fd=new Q3FileDialog( this);
2122 fd->setDir (lastFileDir);
2123 fd->setMode (Q3FileDialog::ExistingFiles);
2124 fd->addFilter ("Mind Manager (*.mmap)");
2125 fd->setCaption(tr("Import")+" "+"Mind Manager");
2128 if ( fd->exec() == QDialog::Accepted )
2130 lastFileDir=fd->dirPath();
2131 QStringList flist = fd->selectedFiles();
2132 QStringList::Iterator it = flist.begin();
2133 while( it != flist.end() )
2136 if (im.transform() &&
2137 success==fileLoad (im.getTransformedFile(),NewMap) &&
2138 currentMapEditor() )
2139 currentMapEditor()->getModel()->setFilePath ("");
2146 void Main::fileImportDir()
2148 VymModel *m=currentModel();
2149 if (m) m->importDir();
2152 void Main::fileExportXML()
2154 VymModel *m=currentModel();
2155 if (m) m->exportXML();
2159 void Main::fileExportXHTML()
2161 VymModel *m=currentModel();
2162 if (m) m->exportXHTML();
2165 void Main::fileExportImage()
2167 VymModel *m=currentModel();
2168 if (m) m->exportImage();
2171 void Main::fileExportASCII()
2173 VymModel *m=currentModel();
2174 if (m) m->exportASCII();
2177 void Main::fileExportCSV() //FIXME-3 not scriptable yet
2179 VymModel *m=currentModel();
2184 ex.addFilter ("CSV (*.csv)");
2185 ex.setDir(lastImageDir);
2186 ex.setCaption(vymName+ " -" +tr("Export as CSV")+" "+tr("(still experimental)"));
2187 if (ex.execDialog() )
2189 m->setExportMode(true);
2191 m->setExportMode(false);
2196 void Main::fileExportLaTeX() //FIXME-3 not scriptable yet
2198 VymModel *m=currentModel();
2203 ex.addFilter ("Tex (*.tex)");
2204 ex.setDir(lastImageDir);
2205 ex.setCaption(vymName+ " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
2206 if (ex.execDialog() )
2208 m->setExportMode(true);
2210 m->setExportMode(false);
2215 void Main::fileExportKDE3Bookmarks() //FIXME-3 not scriptable yet
2217 ExportKDE3Bookmarks ex;
2218 VymModel *m=currentModel();
2226 void Main::fileExportKDE4Bookmarks() //FIXME-3 not scriptable yet
2228 ExportKDE4Bookmarks ex;
2229 VymModel *m=currentModel();
2237 void Main::fileExportTaskjuggler() //FIXME-3 not scriptable yet
2239 ExportTaskjuggler ex;
2240 VymModel *m=currentModel();
2244 ex.setCaption ( vymName+" - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
2245 ex.setDir(lastImageDir);
2246 ex.addFilter ("Taskjuggler (*.tjp)");
2247 if (ex.execDialog() )
2249 m->setExportMode(true);
2251 m->setExportMode(false);
2256 void Main::fileExportOOPresentation() //FIXME-3 not scriptable yet
2258 ExportOOFileDialog *fd=new ExportOOFileDialog( this,vymName+" - "+tr("Export to")+" Open Office");
2259 // TODO add preview in dialog
2260 //ImagePreview *p =new ImagePreview (fd);
2261 //fd->setContentsPreviewEnabled( TRUE );
2262 //fd->setContentsPreview( p, p );
2263 //fd->setPreviewMode( QFileDialog::Contents );
2264 fd->setCaption(vymName+" - " +tr("Export to")+" Open Office");
2265 fd->setDir (QDir().current());
2266 if (fd->foundConfig())
2270 if ( fd->exec() == QDialog::Accepted )
2272 QString fn=fd->selectedFile();
2273 if (!fn.contains (".odp"))
2276 //lastImageDir=fn.left(fn.findRev ("/"));
2277 VymModel *m=currentModel();
2278 if (m) m->exportOOPresentation(fn,fd->selectedConfig());
2282 QMessageBox::warning(0,
2284 tr("Couldn't find configuration for export to Open Office\n"));
2288 void Main::fileCloseMap()
2290 VymModel *m=currentModel();
2293 if (m->hasChanged())
2295 QMessageBox mb( vymName,
2296 tr("The map %1 has been modified but not saved yet. Do you want to").arg(m->getFileName()),
2297 QMessageBox::Warning,
2298 QMessageBox::Yes | QMessageBox::Default,
2300 QMessageBox::Cancel | QMessageBox::Escape );
2301 mb.setButtonText( QMessageBox::Yes, tr("Save modified map before closing it") );
2302 mb.setButtonText( QMessageBox::No, tr("Discard changes"));
2305 case QMessageBox::Yes:
2307 fileSave(m, CompleteMap);
2309 case QMessageBox::No:
2310 // close without saving
2312 case QMessageBox::Cancel:
2317 // And here comes the segfault, because removeTab triggers
2318 // currentChanged->Main::editorChanged -> updateActions and VM is not NULL yet...
2319 vymViews.removeAt (tabWidget->currentIndex() );
2320 tabWidget->removeTab (tabWidget->currentIndex() );
2322 // Remove mapEditor/model FIXME-5
2323 // Better would be delete (me), but then we could have a Qt error:
2324 // "QObject: Do not delete object, 'MapEditor', during its event handler!"
2325 // So we only remove data now and call deconstructor when vym closes later
2326 // this needs to be moved to vymview... me->clear();
2327 // some model->clear is needed to free up memory ...
2333 void Main::filePrint()
2335 if (currentMapEditor())
2336 currentMapEditor()->print();
2339 void Main::fileExitVYM()
2341 // Check if one or more editors have changed
2343 for (i=0;i<=vymViews.count() -1;i++)
2345 // If something changed, ask what to do
2346 if (vymViews.at(i)->getModel()->hasChanged())
2348 tabWidget->setCurrentPage(i);
2349 QMessageBox mb( vymName,
2350 tr("This map is not saved yet. Do you want to"),
2351 QMessageBox::Warning,
2352 QMessageBox::Yes | QMessageBox::Default,
2354 QMessageBox::Cancel | QMessageBox::Escape );
2355 mb.setButtonText( QMessageBox::Yes, tr("Save map") );
2356 mb.setButtonText( QMessageBox::No, tr("Discard changes") );
2359 mb.setActiveWindow();
2360 switch( mb.exec() ) {
2361 case QMessageBox::Yes:
2362 // save (the changed editors) and exit
2363 fileSave(currentModel(), CompleteMap);
2365 case QMessageBox::No:
2366 // exit without saving
2368 case QMessageBox::Cancel:
2369 // don't save and don't exit
2373 } // loop over all MEs
2377 void Main::editUndo()
2379 VymModel *m=currentModel();
2383 void Main::editRedo()
2385 VymModel *m=currentModel();
2389 void Main::gotoHistoryStep (int i)
2391 VymModel *m=currentModel();
2392 if (m) m->gotoHistoryStep(i);
2395 void Main::editCopy()
2397 VymModel *m=currentModel();
2401 void Main::editPaste()
2403 VymModel *m=currentModel();
2407 void Main::editCut()
2409 VymModel *m=currentModel();
2413 void Main::editOpenFindWindow()
2415 findWindow->popup();
2416 findWindow->raise();
2417 findWindow->setActiveWindow();
2420 void Main::editFind(QString s)
2422 VymModel *m=currentModel();
2426 BranchItem *bi=m->findText(s, cs);
2429 statusBar()->message( "Found: " + bi->getHeading(), statusbarTime );
2432 QMessageBox::information( findWindow, tr( "VYM -Information:" ),
2433 tr("No matches found for \"%1\"").arg(s));
2438 void Main::editFindChanged()
2439 { // Notify editor, to abort the current find process
2440 VymModel *m=currentModel();
2441 if (m) m->findReset();
2444 void Main::openTabs(QStringList urls)
2446 if (!urls.isEmpty())
2450 QString browser=settings.value("/mainwindow/readerURL" ).toString();
2452 if (!procBrowser || procBrowser->state()!=QProcess::Running)
2454 QString u=urls.takeFirst();
2455 procBrowser = new QProcess( this );
2457 procBrowser->start(browser,args);
2458 if ( !procBrowser->waitForStarted())
2460 // try to set path to browser
2461 QMessageBox::warning(0,
2463 tr("Couldn't find a viewer to open %1.\n").arg(u)+
2464 tr("Please use Settings->")+tr("Set application to open an URL"));
2467 #if defined(Q_OS_WIN32)
2468 // There's no sleep in VCEE, replace it with Qt's QThread::wait().
2469 this->thread()->wait(3000);
2474 if (browser.contains("konqueror"))
2476 for (int i=0; i<urls.size(); i++)
2479 // Try to open new tab in existing konqueror started previously by vym
2480 p=new QProcess (this);
2482 #if defined(Q_OS_WIN32)
2483 // In Win32, pid is not a longlong, but a pointer to a _PROCESS_INFORMATION structure.
2484 // Redundant change in Win32, as there's no konqueror, but I wanted to follow the original logic.
2485 args<< QString("konqueror-%1").arg(procBrowser->pid()->dwProcessId)<<
2486 "konqueror-mainwindow#1"<<
2490 args<< QString("konqueror-%1").arg(procBrowser->pid())<<
2491 "konqueror-mainwindow#1"<<
2495 p->start ("dcop",args);
2496 if (debug) cout << "MainWindo::openURLs args="<<args.join(" ").toStdString()<<endl;
2497 if ( !p->waitForStarted() ) success=false;
2500 QMessageBox::warning(0,
2502 tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
2504 } else if (browser.contains ("firefox") || browser.contains ("mozilla") )
2506 for (int i=0; i<urls.size(); i++)
2508 // Try to open new tab in firefox
2509 p=new QProcess (this);
2510 args<< "-remote"<< QString("openurl(%1,new-tab)").arg(urls.at(i));
2511 p->start (browser,args);
2512 if ( !p->waitForStarted() ) success=false;
2515 QMessageBox::warning(0,
2517 tr("Couldn't start %1 to open a new tab").arg(browser));
2520 QMessageBox::warning(0,
2522 tr("Sorry, currently only Konqueror and Mozilla support tabbed browsing."));
2526 void Main::editOpenURL()
2529 VymModel *m=currentModel();
2532 QString url=m->getURL();
2534 if (url=="") return;
2535 QString browser=settings.value("/mainwindow/readerURL" ).toString();
2536 procBrowser = new QProcess( this );
2538 procBrowser->start(browser,args);
2539 if ( !procBrowser->waitForStarted())
2541 // try to set path to browser
2542 QMessageBox::warning(0,
2544 tr("Couldn't find a viewer to open %1.\n").arg(url)+
2545 tr("Please use Settings->")+tr("Set application to open an URL"));
2550 void Main::editOpenURLTab()
2552 VymModel *m=currentModel();
2556 urls.append(m->getURL());
2560 void Main::editOpenMultipleURLTabs()
2562 VymModel *m=currentModel();
2572 void Main::editURL()
2574 VymModel *m=currentModel();
2575 if (m) m->editURL();
2578 void Main::editLocalURL()
2580 VymModel *m=currentModel();
2581 if (m) m->editLocalURL();
2584 void Main::editHeading2URL()
2586 VymModel *m=currentModel();
2587 if (m) m->editHeading2URL();
2590 void Main::editBugzilla2URL()
2592 VymModel *m=currentModel();
2593 if (m) m->editBugzilla2URL();
2596 void Main::editFATE2URL()
2598 VymModel *m=currentModel();
2599 if (m) m->editFATE2URL();
2602 void Main::editHeadingFinished(VymModel *m)
2606 if (!actionSettingsAutoSelectNewBranch->isOn() &&
2607 !prevSelection.isEmpty())
2608 m->select(prevSelection);
2613 void Main::openVymLinks(const QStringList &vl)
2615 for (int j=0; j<vl.size(); j++)
2617 // compare path with already loaded maps
2620 for (i=0;i<=vymViews.count() -1;i++)
2622 if (vl.at(j)==vymViews.at(i)->getModel()->getFilePath() )
2631 if (!QFile(vl.at(j)).exists() )
2632 QMessageBox::critical( 0, tr( "Critical Error" ),
2633 tr("Couldn't open map %1").arg(vl.at(j)));
2636 fileLoad (vl.at(j), NewMap);
2637 tabWidget->setCurrentIndex (tabWidget->count()-1);
2640 // Go to tab containing the map
2641 tabWidget->setCurrentIndex (index);
2645 void Main::editOpenVymLink()
2647 VymModel *m=currentModel();
2651 vl.append(m->getVymLink());
2656 void Main::editOpenMultipleVymLinks()
2658 QString currentVymLink;
2659 VymModel *m=currentModel();
2662 QStringList vl=m->getVymLinks();
2667 void Main::editVymLink()
2669 VymModel *m=currentModel();
2674 void Main::editDeleteVymLink()
2676 VymModel *m=currentModel();
2677 if (m) m->deleteVymLink();
2680 void Main::editToggleHideExport()
2682 VymModel *m=currentModel();
2683 if (m) m->toggleHideExport();
2686 void Main::editMapInfo()
2688 VymModel *m=currentModel();
2690 ExtraInfoDialog dia;
2691 dia.setMapName (m->getFileName() );
2692 dia.setAuthor (m->getAuthor() );
2693 dia.setComment(m->getComment() );
2697 /* FIXME-2 no stats at the moment (view dependent...)
2698 stats+=tr("%1 items on map\n","Info about map").arg (mapScene->items().size(),6);
2708 if (!bo->getNote().isEmpty() ) n++;
2709 f+= bo->countFloatImages();
2711 xl+=bo->countXLinks();
2714 stats+=QString ("%1 xLinks \n").arg (xl,6);
2715 stats+=QString ("%1 notes\n").arg (n,6);
2716 stats+=QString ("%1 images\n").arg (f,6);
2718 stats+=QString ("%1 branches\n").arg (m->branchCount(),6);
2719 dia.setStats (stats);
2721 // Finally show dialog
2722 if (dia.exec() == QDialog::Accepted)
2724 m->setAuthor (dia.getAuthor() );
2725 m->setComment (dia.getComment() );
2729 void Main::editMoveUp()
2731 VymModel *m=currentModel();
2735 void Main::editMoveDown()
2737 VymModel *m=currentModel();
2738 if (m) m->moveDown();
2741 void Main::editSortChildren()
2743 VymModel *m=currentModel();
2744 if (m) m->sortChildren();
2747 void Main::editToggleScroll()
2749 VymModel *m=currentModel();
2750 if (m) m->toggleScroll();
2753 void Main::editExpandAll()
2755 VymModel *m=currentModel();
2756 if (m) m->emitExpandAll();
2759 void Main::editUnscrollChildren()
2761 VymModel *m=currentModel();
2762 if (m) m->unscrollChildren();
2765 void Main::editAddMapCenter()
2767 VymModel *m=currentModel();
2768 if (m) m->addMapCenter ();
2771 void Main::editNewBranch()
2773 VymModel *m=currentModel();
2776 BranchItem *bi=m->createBranch();
2783 if (actionSettingsAutoEditNewBranch->isOn())
2785 currentMapEditor()->editHeading();
2788 if (!prevSelection.isEmpty())
2790 m->select(prevSelection);
2796 void Main::editNewBranchBefore()
2798 VymModel *m=currentModel();
2801 BranchItem *bi=m->addNewBranchBefore();
2808 if (actionSettingsAutoEditNewBranch->isOn())
2810 if (!actionSettingsAutoSelectNewBranch->isOn())
2811 prevSelection=m->getSelectString(bi);
2812 currentMapEditor()->editHeading();
2817 void Main::editNewBranchAbove()
2819 VymModel *m=currentModel();
2822 BranchItem *bi=m->addNewBranch (-1);
2830 if (actionSettingsAutoEditNewBranch->isOn())
2832 if (!actionSettingsAutoSelectNewBranch->isOn())
2833 prevSelection=m->getSelectString (bi);
2834 currentMapEditor()->editHeading();
2839 void Main::editNewBranchBelow()
2841 VymModel *m=currentModel();
2844 BranchItem *bi=m->addNewBranch (1);
2851 if (actionSettingsAutoEditNewBranch->isOn())
2853 if (!actionSettingsAutoSelectNewBranch->isOn())
2854 prevSelection=m->getSelectString(bi);
2855 currentMapEditor()->editHeading();
2860 void Main::editImportAdd()
2862 fileLoad (ImportAdd);
2865 void Main::editImportReplace()
2867 fileLoad (ImportReplace);
2870 void Main::editSaveBranch()
2872 fileSaveAs (PartOfMap);
2875 void Main::editDeleteKeepChildren()
2877 VymModel *m=currentModel();
2878 if (m) m->deleteKeepChildren();
2881 void Main::editDeleteChildren()
2883 VymModel *m=currentModel();
2884 if (m) m->deleteChildren();
2887 void Main::editDeleteSelection()
2889 VymModel *m=currentModel();
2890 if (m && actionSettingsUseDelKey->isOn())
2891 m->deleteSelection();
2894 void Main::editLoadImage()
2896 VymModel *m=currentModel();
2897 if (m) m->loadFloatImage();
2900 void Main::editSaveImage()
2902 VymModel *m=currentModel();
2903 if (m) m->saveFloatImage();
2906 void Main::editFollowXLink(QAction *a)
2909 VymModel *m=currentModel();
2911 m->followXLink(branchXLinksContextMenuFollow->actions().indexOf(a));
2914 void Main::editEditXLink(QAction *a)
2916 VymModel *m=currentModel();
2918 m->editXLink(branchXLinksContextMenuEdit->actions().indexOf(a));
2921 void Main::formatSelectColor()
2923 QColor col = QColorDialog::getColor((currentColor ), this );
2924 if ( !col.isValid() ) return;
2925 colorChanged( col );
2928 void Main::formatPickColor()
2930 VymModel *m=currentModel();
2932 colorChanged( m->getCurrentHeadingColor() );
2935 void Main::colorChanged(QColor c)
2937 QPixmap pix( 16, 16 );
2939 actionFormatColor->setIconSet( pix );
2943 void Main::formatColorBranch()
2945 VymModel *m=currentModel();
2946 if (m) m->colorBranch(currentColor);
2949 void Main::formatColorSubtree()
2951 VymModel *m=currentModel();
2952 if (m) m->colorSubtree (currentColor);
2955 void Main::formatLinkStyleLine()
2957 VymModel *m=currentModel();
2960 m->setMapLinkStyle("StyleLine");
2961 actionFormatLinkStyleLine->setOn(true);
2965 void Main::formatLinkStyleParabel()
2967 VymModel *m=currentModel();
2970 m->setMapLinkStyle("StyleParabel");
2971 actionFormatLinkStyleParabel->setOn(true);
2975 void Main::formatLinkStylePolyLine()
2977 VymModel *m=currentModel();
2980 m->setMapLinkStyle("StylePolyLine");
2981 actionFormatLinkStylePolyLine->setOn(true);
2985 void Main::formatLinkStylePolyParabel()
2987 VymModel *m=currentModel();
2990 m->setMapLinkStyle("StylePolyParabel");
2991 actionFormatLinkStylePolyParabel->setOn(true);
2995 void Main::formatSelectBackColor()
2997 VymModel *m=currentModel();
2998 if (m) m->selectMapBackgroundColor();
3001 void Main::formatSelectBackImage()
3003 VymModel *m=currentModel();
3005 m->selectMapBackgroundImage();
3008 void Main::formatSelectLinkColor()
3010 VymModel *m=currentModel();
3013 QColor col = QColorDialog::getColor( m->getMapDefLinkColor(), this );
3014 m->setMapDefLinkColor( col );
3018 void Main::formatSelectSelectionColor()
3020 VymModel *m=currentModel();
3023 QColor col = QColorDialog::getColor( m->getMapDefLinkColor(), this );
3024 m->setSelectionColor (col);
3029 void Main::formatToggleLinkColorHint()
3031 VymModel *m=currentModel();
3032 if (m) m->toggleMapLinkColorHint();
3036 void Main::formatHideLinkUnselected() //FIXME-3 get rid of this with imagepropertydialog
3038 VymModel *m=currentModel();
3040 m->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
3043 void Main::viewZoomReset()
3045 MapEditor *me=currentMapEditor();
3046 if (me) me->setZoomFactorTarget (1);
3049 void Main::viewZoomIn()
3051 MapEditor *me=currentMapEditor();
3052 if (me) me->setZoomFactorTarget (me->getZoomFactorTarget()*1.25);
3055 void Main::viewZoomOut()
3057 MapEditor *me=currentMapEditor();
3058 if (me) me->setZoomFactorTarget (me->getZoomFactorTarget()*0.75);
3061 void Main::viewCenter()
3063 VymModel *m=currentModel();
3064 if (m) m->emitShowSelection();
3067 void Main::networkStartServer()
3069 VymModel *m=currentModel();
3070 if (m) m->newServer();
3073 void Main::networkConnect()
3075 VymModel *m=currentModel();
3076 if (m) m->connectToServer();
3079 bool Main::settingsPDF()
3081 // Default browser is set in constructor
3083 QString text = QInputDialog::getText(
3084 "VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
3085 settings.value("/mainwindow/readerPDF").toString(), &ok, this );
3087 settings.setValue ("/mainwindow/readerPDF",text);
3092 bool Main::settingsURL()
3094 // Default browser is set in constructor
3096 QString text = QInputDialog::getText(
3097 "VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
3098 settings.value("/mainwindow/readerURL").toString()
3101 settings.setValue ("/mainwindow/readerURL",text);
3105 void Main::settingsMacroDir()
3107 QDir defdir(vymBaseDir.path() + "/macros");
3108 if (!defdir.exists())
3110 QDir dir=QFileDialog::getExistingDirectory (
3112 tr ("Directory with vym macros:"),
3113 settings.value ("/macros/macroDir",defdir.path()).toString()
3116 settings.setValue ("/macros/macroDir",dir.absolutePath());
3119 void Main::settingsUndoLevels()
3122 int i = QInputDialog::getInteger(
3124 tr("QInputDialog::getInteger()"),
3125 tr("Number of undo/redo levels:"), settings.value("/mapeditor/stepsTotal").toInt(), 0, 1000, 1, &ok);
3128 settings.setValue ("/mapeditor/stepsTotal",i);
3129 QMessageBox::information( this, tr( "VYM -Information:" ),
3130 tr("Settings have been changed. The next map opened will have \"%1\" undo/redo levels").arg(i));
3134 void Main::settingsAutosaveToggle()
3136 settings.setValue ("/mainwindow/autosave/use",actionSettingsAutosaveToggle->isOn() );
3139 void Main::settingsAutosaveTime()
3142 int i = QInputDialog::getInteger(
3144 tr("QInputDialog::getInteger()"),
3145 tr("Number of seconds before autosave:"), settings.value("/mainwindow/autosave/ms").toInt() / 1000, 10, 10000, 1, &ok);
3147 settings.setValue ("/mainwindow/autosave/ms",i * 1000);
3150 void Main::settingsWriteBackupFileToggle()
3152 settings.setValue ("/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() );
3155 void Main::settingsToggleAnimation()
3157 settings.setValue ("/animation/use",actionSettingsUseAnimation->isOn() );
3160 void Main::settingsToggleDelKey()
3162 if (actionSettingsUseDelKey->isOn())
3164 actionDelete->setAccel (QKeySequence (Qt::Key_Delete));
3167 actionDelete->setAccel (QKeySequence (""));
3171 void Main::windowToggleNoteEditor()
3173 if (textEditor->isVisible() )
3174 windowHideNoteEditor();
3176 windowShowNoteEditor();
3179 void Main::windowToggleHistory()
3181 if (historyWindow->isVisible())
3182 historyWindow->hide();
3184 historyWindow->show();
3188 void Main::windowToggleProperty()
3190 if (branchPropertyWindow->isVisible())
3191 branchPropertyWindow->hide();
3193 branchPropertyWindow->show();
3194 branchPropertyWindow->setModel (currentModel() );
3197 void Main::windowToggleAntiAlias()
3199 bool b=actionViewToggleAntiAlias->isOn();
3201 for (int i=0;i<vymViews.count();i++)
3203 me=vymViews.at(i)->getMapEditor();
3204 if (me) me->setAntiAlias(b);
3209 bool Main::isAliased()
3211 return actionViewToggleAntiAlias->isOn();
3214 bool Main::hasSmoothPixmapTransform()
3216 return actionViewToggleSmoothPixmapTransform->isOn();
3219 void Main::windowToggleSmoothPixmap()
3221 bool b=actionViewToggleSmoothPixmapTransform->isOn();
3223 for (int i=0;i<vymViews.count();i++)
3226 me=vymViews.at(i)->getMapEditor();
3227 if (me) me->setSmoothPixmap(b);
3231 void Main::updateHistory(SimpleSettings &undoSet)
3233 historyWindow->update (undoSet);
3236 void Main::updateNoteFlag()
3238 // this slot is connected to TextEditor::textHasChanged()
3240 VymModel *m=currentModel();
3241 if (m) m->updateNoteFlag();
3244 void Main::updateNoteEditor(QModelIndex index )
3246 TreeItem *ti=((VymModel*)sender())->getItem(index);
3248 cout << "Main::updateNoteEditor model="<<sender();
3249 cout << " item="<<ti->headingStd()<<" ("<<ti<<")"<<endl;
3251 textEditor->setNote (ti->getNoteObj() );
3254 void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel)
3256 //branchPropertyWindow->setModel (model ); //FIXME-2 this used to be called from BranchObj::select(). Maybe use signal now...
3258 if (model && model==currentModel() )
3262 if (!oldsel.indexes().isEmpty() )
3264 ti=model->getItem(oldsel.indexes().first());
3266 // Don't update note if both treeItem and textEditor are empty
3267 //if (! (ti->hasEmptyNote() && textEditor->isEmpty() ))
3268 // ti->setNoteObj (textEditor->getNoteObj(),false );
3270 if (!newsel.indexes().isEmpty() )
3272 ti=model->getItem(newsel.indexes().first());
3273 if (!ti->hasEmptyNote() )
3274 textEditor->setNote(ti->getNoteObj() );
3276 textEditor->setNote(NoteObj() ); //FIXME-4 maybe add a clear() to TE
3278 // Show URL and link in statusbar
3280 QString s=ti->getURL();
3281 if (!s.isEmpty() ) status+="URL: "+s+" ";
3283 if (!s.isEmpty() ) status+="Link: "+s;
3284 if (!status.isEmpty() ) statusMessage (status);
3287 textEditor->setInactive();
3293 void Main::updateActions()
3295 VymModel *m =currentModel();
3299 actionFilePrint->setEnabled (true);
3301 // Link style in context menu
3302 switch (m->getMapLinkStyle())
3304 case LinkableMapObj::Line:
3305 actionFormatLinkStyleLine->setOn(true);
3307 case LinkableMapObj::Parabel:
3308 actionFormatLinkStyleParabel->setOn(true);
3310 case LinkableMapObj::PolyLine:
3311 actionFormatLinkStylePolyLine->setOn(true);
3313 case LinkableMapObj::PolyParabel:
3314 actionFormatLinkStylePolyParabel->setOn(true);
3321 QPixmap pix( 16, 16 );
3322 pix.fill( m->getMapBackgroundColor() );
3323 actionFormatBackColor->setIconSet( pix );
3324 pix.fill( m->getSelectionColor() );
3325 actionFormatSelectionColor->setIconSet( pix );
3326 pix.fill( m->getMapDefLinkColor() );
3327 actionFormatLinkColor->setIconSet( pix );
3330 historyWindow->setCaption (vymName + " - " +tr("History for %1","Window Caption").arg(m->getFileName()));
3335 actionFilePrint->setEnabled (false);
3338 // updateActions is also called when NoteEditor is closed
3339 actionViewToggleNoteEditor->setOn (textEditor->isVisible());
3340 actionViewToggleHistoryWindow->setOn (historyWindow->isVisible());
3341 actionViewTogglePropertyWindow->setOn (branchPropertyWindow->isVisible());
3343 if (m && m->getMapLinkColorHint()==LinkableMapObj::HeadingColor)
3344 actionFormatLinkColorHint->setOn(true);
3346 actionFormatLinkColorHint->setOn(false);
3349 if (m && m->hasChanged() )
3350 actionFileSave->setEnabled( true);
3352 actionFileSave->setEnabled( true);
3353 if (m && m->isUndoAvailable())
3354 actionUndo->setEnabled( true);
3356 actionUndo->setEnabled( false);
3358 if (m && m->isRedoAvailable())
3359 actionRedo->setEnabled( true);
3361 actionRedo->setEnabled( false);
3365 TreeItem *selti=m->getSelectedItem();
3366 BranchItem *selbi=m->getSelectedBranchItem();
3371 // Take care of links // FIXME-1
3373 if (bo->countXLinks()==0)
3375 branchXLinksContextMenuEdit->clear();
3376 branchXLinksContextMenuFollow->clear();
3381 branchXLinksContextMenuEdit->clear();
3382 branchXLinksContextMenuFollow->clear();
3383 for (int i=0; i<=bo->countXLinks();i++)
3385 bot=bo->XLinkTargetAt(i);
3388 s=bot->getHeading();
3389 if (s.length()>xLinkMenuWidth)
3390 s=s.left(xLinkMenuWidth)+"...";
3391 branchXLinksContextMenuFollow->addAction (s);
3392 branchXLinksContextMenuEdit->addAction (s);
3398 standardFlagsMaster->updateToolBar (selbi->activeStandardFlagNames() );
3401 actionToggleScroll->setEnabled (true);
3402 if ( selbi->isScrolled() )
3403 actionToggleScroll->setOn(true);
3405 actionToggleScroll->setOn(false);
3407 if ( selti->getURL().isEmpty() )
3409 actionOpenURL->setEnabled (false);
3410 actionOpenURLTab->setEnabled (false);
3414 actionOpenURL->setEnabled (true);
3415 actionOpenURLTab->setEnabled (true);
3417 if ( selti->getVymLink().isEmpty() )
3419 actionOpenVymLink->setEnabled (false);
3420 actionDeleteVymLink->setEnabled (false);
3423 actionOpenVymLink->setEnabled (true);
3424 actionDeleteVymLink->setEnabled (true);
3427 if (selbi->canMoveUp())
3428 actionMoveUp->setEnabled (true);
3430 actionMoveUp->setEnabled (false);
3431 if (selbi->canMoveDown())
3432 actionMoveDown->setEnabled (true);
3434 actionMoveDown->setEnabled (false);
3436 actionSortChildren->setEnabled (true);
3438 actionToggleHideExport->setEnabled (true);
3439 actionToggleHideExport->setOn (selbi->hideInExport() );
3441 actionFileSave->setEnabled (true);
3442 actionCopy->setEnabled (true);
3443 actionCut->setEnabled (true);
3444 if (!clipboardEmpty)
3445 actionPaste->setEnabled (true);
3447 actionPaste->setEnabled (false);
3448 for (int i=0; i<actionListBranches.size(); ++i)
3449 actionListBranches.at(i)->setEnabled(true);
3450 actionDelete->setEnabled (true);
3451 //FIXME-2 actionFormatHideLinkUnselected->setOn (selection->getHideLinkUnselected());
3453 if ( selti->getType()==TreeItem::Image)
3456 FloatObj *fo=(FloatImageObj*)selection;
3458 actionOpenURL->setEnabled (false);
3459 actionOpenVymLink->setEnabled (false);
3460 actionDeleteVymLink->setEnabled (false);
3461 actionToggleHideExport->setEnabled (true);
3462 actionToggleHideExport->setOn (fo->hideInExport() );
3465 actionCopy->setEnabled (true);
3466 actionCut->setEnabled (true);
3467 actionPaste->setEnabled (false); //FIXME-4 why not allowing copy of images?
3468 for (int i=0; i<actionListBranches.size(); ++i)
3469 actionListBranches.at(i)->setEnabled(false);
3470 actionDelete->setEnabled (true);
3471 actionFormatHideLinkUnselected->setOn
3472 ( selection->getHideLinkUnselected());
3473 actionMoveUp->setEnabled (false);
3474 actionMoveDown->setEnabled (false);
3480 actionFileSave->setEnabled (false);
3481 actionCopy->setEnabled (false);
3482 actionCut->setEnabled (false);
3483 actionPaste->setEnabled (false);
3484 for (int i=0; i<actionListBranches.size(); ++i)
3485 actionListBranches.at(i)->setEnabled(false);
3487 actionToggleScroll->setEnabled (false);
3488 actionOpenURL->setEnabled (false);
3489 actionOpenVymLink->setEnabled (false);
3490 actionDeleteVymLink->setEnabled (false);
3491 actionHeading2URL->setEnabled (false);
3492 actionDelete->setEnabled (false);
3493 actionMoveUp->setEnabled (false);
3494 actionMoveDown->setEnabled (false);
3495 actionSortChildren->setEnabled (false);
3496 actionToggleHideExport->setEnabled (false);
3501 Main::ModMode Main::getModMode()
3503 if (actionModModeColor->isOn()) return ModModeColor;
3504 if (actionModModeCopy->isOn()) return ModModeCopy;
3505 if (actionModModeXLink->isOn()) return ModModeXLink;
3509 bool Main::autoEditNewBranch()
3511 return actionSettingsAutoEditNewBranch->isOn();
3514 bool Main::autoSelectNewBranch()
3516 return actionSettingsAutoSelectNewBranch->isOn();
3519 void Main::windowShowNoteEditor()
3521 textEditor->setShowWithMain(true);
3523 actionViewToggleNoteEditor->setOn (true);
3526 void Main::windowHideNoteEditor()
3528 textEditor->setShowWithMain(false);
3530 actionViewToggleNoteEditor->setOn (false);
3533 void Main::setScript (const QString &script)
3535 scriptEditor->setScript (script);
3538 void Main::runScript (const QString &script)
3540 VymModel *m=currentModel();
3541 if (m) m->runScript (script);
3544 void Main::runScriptEverywhere (const QString &script)
3547 for (int i=0;i<=tabWidget->count() -1;i++)
3549 me=(MapEditor*)tabWidget->page(i);
3550 if (me) me->getModel()->runScript (script);
3554 void Main::windowNextEditor()
3556 if (tabWidget->currentIndex() < tabWidget->count())
3557 tabWidget->setCurrentIndex (tabWidget->currentIndex() +1);
3560 void Main::windowPreviousEditor()
3562 if (tabWidget->currentIndex() >0)
3563 tabWidget->setCurrentIndex (tabWidget->currentIndex() -1);
3566 void Main::standardFlagChanged()
3570 if ( actionSettingsUseFlagGroups->isOn() )
3571 currentModel()->toggleStandardFlag(sender()->name(),standardFlagsMaster);
3573 currentModel()->toggleStandardFlag(sender()->name());
3578 void Main::testFunction1()
3580 if (!currentMapEditor()) return;
3581 currentMapEditor()->testFunction1();
3584 void Main::testFunction2()
3586 if (!currentMapEditor()) return;
3587 currentMapEditor()->setFocus();
3590 void Main::testCommand()
3592 if (!currentMapEditor()) return;
3593 scriptEditor->show();
3596 QString com = QInputDialog::getText(
3597 vymName, "Enter Command:", QLineEdit::Normal,"command", &ok, this );
3598 if (ok) currentMapEditor()->parseAtom(com);
3602 void Main::helpDoc()
3604 QString locale = QLocale::system().name();
3606 if (locale.left(2)=="es")
3607 docname="vym_es.pdf";
3611 QStringList searchList;
3613 #if defined(Q_OS_MACX)
3614 searchList << "./vym.app/Contents/Resources/doc";
3615 #elif defined(Q_OS_WIN32)
3616 searchList << vymInstallDir.path() + "/share/doc/packages/vym";
3618 #if defined(VYM_DOCDIR)
3619 searchList << VYM_DOCDIR;
3621 // default path in SUSE LINUX
3622 searchList << "/usr/share/doc/packages/vym";
3625 searchList << "doc"; // relative path for easy testing in tarball
3626 searchList << "doc/tex"; // Easy testing working on vym.tex
3627 searchList << "/usr/share/doc/vym"; // Debian
3628 searchList << "/usr/share/doc/packages";// Knoppix
3632 for (int i=0; i<searchList.count(); ++i)
3634 docfile.setFileName(searchList.at(i)+"/"+docname);
3635 if (docfile.exists())
3644 QMessageBox::critical(0,
3645 tr("Critcal error"),
3646 tr("Couldn't find the documentation %1 in:\n%2").arg(searchList.join("\n")));
3651 Process *pdfProc = new Process();
3652 args << QDir::toNativeSeparators(docfile.fileName());
3654 pdfProc->start( settings.value("/mainwindow/readerPDF").toString(),args);
3655 if ( !pdfProc->waitForStarted() )
3658 QMessageBox::warning(0,
3660 tr("Couldn't find a viewer to open %1.\n").arg(docfile.fileName())+
3661 tr("Please use Settings->")+tr("Set application to open PDF files"));
3668 void Main::helpDemo()
3670 QStringList filters;
3671 filters <<"VYM example map (*.vym)";
3672 QFileDialog *fd=new QFileDialog( this);
3673 #if defined(Q_OS_MACX)
3674 fd->setDir (QDir("./vym.app/Contents/Resources/demos"));
3676 // default path in SUSE LINUX
3677 fd->setDir (QDir(vymBaseDir.path()+"/demos"));
3680 fd->setFileMode (QFileDialog::ExistingFiles);
3681 fd->setFilters (filters);
3682 fd->setCaption(vymName+ " - " +tr("Load vym example map"));
3686 if ( fd->exec() == QDialog::Accepted )
3688 lastFileDir=fd->directory().path();
3689 QStringList flist = fd->selectedFiles();
3690 QStringList::Iterator it = flist.begin();
3691 while( it != flist.end() )
3694 fileLoad(*it, NewMap);
3702 void Main::helpAbout()
3705 ad.setName ("aboutwindow");
3706 ad.setMinimumSize(500,500);
3707 ad.resize (QSize (500,500));
3711 void Main::helpAboutQT()
3713 QMessageBox::aboutQt( this, "Qt Application Example" );
3716 void Main::callMacro ()
3718 QAction *action = qobject_cast<QAction *>(sender());
3722 i=action->data().toInt();
3723 QString mDir (settings.value ("macros/macroDir").toString() );
3725 QString fn=mDir + QString("/macro-%1.vys").arg(i+1);
3727 if ( !f.open( QIODevice::ReadOnly ) )
3729 QMessageBox::warning(0,
3731 tr("Couldn't find a macro at %1.\n").arg(fn)+
3732 tr("Please use Settings->")+tr("Set directory for vym macros"));
3736 QTextStream ts( &f );
3737 QString macro= ts.read();
3739 if (! macro.isEmpty())
3741 VymModel *m=currentModel();
3742 if (m) m->runScript(macro);