1 #include "mainwindow.h"
3 #include <qstatusbar.h>
4 #include <qmessagebox.h>
6 #include <qapplication.h>
10 #include <q3filedialog.h>
12 #include <qcolordialog.h>
14 #include <qinputdialog.h>
18 #include <QCloseEvent>
21 #include <Q3PopupMenu>
22 #include <Q3ActionGroup>
24 //#include <qdatetime.h> // for random seed
31 #include "aboutdialog.h"
32 #include "exportoofiledialog.h"
34 #include "exportxhtmldialog.h"
36 #include "flagrowobj.h"
38 #include "mapeditor.h"
43 #include "showtextdialog.h"
44 #include "texteditor.h"
47 extern TextEditor *textEditor;
48 extern Main *mainWindow;
49 extern QString tmpVymDir;
50 extern QString clipboardDir;
51 extern bool clipboardEmpty;
52 extern int statusbarTime;
53 extern FlagRowObj* standardFlagsDefault;
54 extern FlagRowObj* systemFlagsDefault;
56 extern Q3PtrList <QAction> actionListBranches;
58 extern QAction* actionFileSave;
59 extern QAction* actionFilePrint;
60 extern QAction* actionEditUndo;
61 extern QAction* actionEditRedo;
62 extern QAction *actionEditCopy;
63 extern QAction *actionEditCut;
64 extern QAction *actionEditPaste;
65 extern QAction *actionEditMoveUp;
66 extern QAction *actionEditMoveDown;
67 extern QAction *actionEditToggleScroll;
68 extern QAction* actionEditOpenURL;
69 extern QAction* actionEditOpenURLTab;
70 extern QAction* actionEditURL;
71 extern QAction* actionEditHeading2URL;
72 extern QAction* actionEditBugzilla2URL;
73 extern QAction* actionEditFATE2URL;
74 extern QAction *actionEditOpenVymLink;
75 extern QAction *actionEditVymLink;
76 extern QAction *actionEditDeleteVymLink;
77 extern QAction *actionEditToggleHideExport;
78 extern QAction *actionEditMapInfo;
79 extern QAction *actionEditHeading;
80 extern QAction *actionEditDelete;
81 extern QAction *actionEditAddBranch;
82 extern QAction *actionEditAddBranchHere;
83 extern QAction *actionEditAddBranchAbove;
84 extern QAction *actionEditAddBranchBelow;
85 extern QAction *actionEditRemoveBranchKeepChilds;
86 extern QAction *actionEditRemoveChilds;
87 extern QAction *actionEditImportAdd;
88 extern QAction *actionEditImportReplace;
89 extern QAction *actionEditSaveBranch;
90 extern QAction *actionEditSelectFirst;
91 extern QAction *actionEditSelectLast;
92 extern QAction *actionEditLoadImage;
94 extern QAction* actionFormatColor;
95 extern QAction* actionFormatPickColor;
96 extern QAction* actionFormatColorBranch;
97 extern QAction* actionFormatColorSubtree;
98 extern QAction* actionFormatLinkColorHint;
99 extern QAction* actionFormatBackColor;
100 extern QAction* actionFormatLinkColor;
101 extern QAction *actionFormatIncludeImagesVer;
102 extern QAction *actionFormatIncludeImagesHor;
104 extern Q3ActionGroup* actionGroupModModes;
105 extern QAction* actionModModeColor;
106 extern QAction* actionModModeLink;
107 extern QAction* actionModModeCopy;
109 extern Q3ActionGroup *actionGroupFormatFrameTypes;
110 extern QAction *actionFormatFrameNone;
111 extern QAction *actionFormatFrameRectangle;
113 extern Q3ActionGroup *actionGroupFormatLinkStyles;
114 extern QAction *actionFormatLinkStyleLine;
115 extern QAction *actionFormatLinkStyleParabel;
116 extern QAction *actionFormatLinkStylePolyLine;
117 extern QAction *actionFormatLinkStylePolyParabel;
118 extern QAction *actionFormatHideLinkUnselected;
120 extern QAction *actionViewToggleNoteEditor;
121 extern QAction *actionViewToggleHistoryWindow;
123 extern QAction* actionSettingsAutoedit;
124 extern QAction* actionSettingsAutoselectHeading;
125 extern QAction* actionSettingsAutoselectHeading;
126 extern QAction* actionSettingsAutoselectText;
127 extern QAction* actionSettingsPasteNewHeading;
128 extern QAction* actionSettingsUseDelKey;
129 extern QAction* actionSettingsUseFlagGroups;
130 extern QAction* actionSettingsUseHideExport;
132 extern Q3PopupMenu* branchContextMenu;
133 extern Q3PopupMenu* branchAddContextMenu;
134 extern Q3PopupMenu* branchRemoveContextMenu;
135 extern Q3PopupMenu* branchLinksContextMenu;
136 extern Q3PopupMenu* branchLinksContextMenuDup;
137 extern Q3PopupMenu* floatimageContextMenu;
138 extern Q3PopupMenu* saveImageFormatMenu;
139 extern Q3PopupMenu* canvasContextMenu;
140 extern Q3PopupMenu* lastMapsMenu;
141 extern Q3PopupMenu* importMenu;
142 extern Q3PopupMenu* exportMenu;
143 extern Q3PopupMenu* exportImageFormatMenu;
146 extern Settings settings;
147 extern Options options;
148 extern QDir vymBaseDir;
149 extern QString iconPath;
150 extern QString flagsPath;
152 Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
153 Q3MainWindow(parent,name,f)
157 setCaption ("VYM - View Your Mind");
159 // Load window settings
160 resize (settings.readNumEntry( "/vym/mainwindow/geometry/width", 800),
161 settings.readNumEntry( "/vym/mainwindow/geometry/height",600));
162 move (settings.readNumEntry( "/vym/mainwindow/geometry/posX", 100),
163 settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100));
166 // Create unique temporary directory
167 tmpVymDir=makeUniqueDir ("/tmp/vym-XXXXXX");
169 // Create direcctory for clipboard
170 clipboardDir=tmpVymDir+"/clipboard";
171 QDir d(clipboardDir);
172 d.mkdir (clipboardDir,true);
173 makeSubDirs (clipboardDir);
178 // FIXME not used currently
179 // Set random seed (random used for object IDs)
180 // QTime t = QTime::currentTime(); // set random seed
181 // srand( t.hour()*12+t.minute()*60+t.second()*60 );
184 // Initialize some settings, which are platform dependant
187 // application to open URLs
188 p="/vym/mainwindow/readerURL";
189 #if defined(Q_OS_LINUX)
190 s=settings.readEntry (p,"konqueror");
192 #if defined(Q_OS_MACX)
193 s=settings.readEntry (p,"/usr/bin/open");
195 s=settings.readEntry (p,"mozilla");
198 settings.writeEntry( p,s);
200 // application to open PDFs
201 p="/vym/mainwindow/readerPDF";
202 #if defined(Q_OS_LINUX)
203 s=settings.readEntry (p,"acroread");
205 #if defined(Q_OS_MACX)
206 s=settings.readEntry (p,"/usr/bin/open");
208 s=settings.readEntry (p,"acroread");
211 settings.writeEntry( p,s);
216 // Create tab widget which holds the maps
217 tabWidget= new QTabWidget (this);
218 connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ),
219 this, SLOT( editorChanged( QWidget * ) ) );
221 setCentralWidget(tabWidget);
225 setupFormatActions();
229 setupSettingsActions();
231 if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) setupTestActions();
234 // After menu is created, we can enable some actions
235 actionFilePrint->setEnabled (true);
240 // Initialize Find window
241 findWindow=new FindWindow(NULL,"findwindow");
242 connect (findWindow, SIGNAL( findButton(QString) ),
243 this, SLOT(editFind(QString) ) );
244 connect (findWindow, SIGNAL( somethingChanged() ),
245 this, SLOT(editFindChanged() ) );
247 // Connect TextEditor, so that we can update flags if text changes
248 connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
256 settings.writeEntry( "/vym/mainwindow/geometry/width", width() );
257 settings.writeEntry( "/vym/mainwindow/geometry/height", height() );
258 settings.writeEntry( "/vym/mainwindow/geometry/posX", pos().x() );
259 settings.writeEntry( "/vym/mainwindow/geometry/posY", pos().y() );
261 settings.writeEntry( "/vym/version/version", __VYM_VERSION );
262 settings.writeEntry( "/vym/version/builddate", __BUILD_DATE );
264 settings.writeEntry( "/vym/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
265 settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
266 settings.writeEntry( "/vym/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() );
267 settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
268 settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
269 settings.writeEntry( "/vym/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
270 settings.writeEntry( "/vym/export/useHideExport",actionSettingsUseHideExport->isOn() );
273 int maps=lastMaps.count();
274 settings.writeEntry( "/vym/lastMaps/number",maps );
275 for (int i=1;i<=maps;i++)
277 s=QString("/vym/lastMaps/map-%1").arg(i);
278 if (!s.isEmpty() && i<=maxLastMaps)
279 settings.writeEntry (s, lastMaps.at(i-1));
283 // To make the texteditor save its settings, call the destructor
286 // Remove temporary directory
287 removeDir (QDir(tmpVymDir));
290 void Main::loadCmdLine()
292 /* TODO draw some kind of splashscreen while loading...
298 QStringList flist=options.getFileList();
299 QStringList::Iterator it=flist.begin();
301 while (it !=flist.end() )
303 fileLoad (*it, NewMap);
309 void Main::statusMessage(const QString &s)
311 statusBar()->message (s);
314 void Main::closeEvent (QCloseEvent* )
320 void Main::setupFileActions()
322 Q3ToolBar *tb = new Q3ToolBar( this );
323 tb->setLabel( "File Actions" );
324 Q3PopupMenu *menu = new Q3PopupMenu( this );
325 menuBar()->insertItem( tr( "&File" ), menu );
327 // Keycodes: /usr/lib64/qt3/include/qnamespace.h
330 a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
331 a->setStatusTip ( tr( "New map","File menu" ) );
332 a->setShortcut ( Qt::CTRL + Qt::Key_N );
335 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
337 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ),this);
338 a->setStatusTip (tr( "Open","File menu" ) );
339 a->setShortcut ( Qt::CTRL + Qt::Key_O );
342 connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
344 lastMapsMenu = new Q3PopupMenu (this);
346 menu->insertItem (tr("Open Recent"),lastMapsMenu );
347 menu->insertSeparator();
349 a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), this);
350 a->setStatusTip ( tr( "Save" ));
351 a->setShortcut (Qt::CTRL + Qt::Key_S );
354 connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
357 a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this);
358 a->setStatusTip (tr( "Save &As" ) );
360 connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
362 menu->insertSeparator();
364 importMenu = new Q3PopupMenu (this);
365 menu->insertItem (tr("Import"),importMenu );
367 a = new QAction(tr("KDE Bookmarks"), this);
368 a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" ));
369 a->addTo (importMenu);
370 connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) );
372 if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
374 a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this);
375 a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) );
376 a->addTo (importMenu);
377 connect( a, SIGNAL( activated() ), this, SLOT( fileImportFirefoxBookmarks() ) );
380 a = new QAction("Mind Manager...",this);
381 a->setStatusTip ( tr( "Import")+" Mind Manager" );
382 a->addTo (importMenu);
383 connect( a, SIGNAL( activated() ), this, SLOT( fileImportMM() ) );
385 a = new QAction( tr( "Import Dir"+QString("...") ), this);
386 a->setStatusTip (tr( "Import directory structure (experimental)" ) );
387 a->addTo( importMenu);
388 connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
390 exportMenu = new Q3PopupMenu (this);
391 menu->insertItem (tr("Export"),exportMenu );
393 menu->insertSeparator();
396 a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this);
397 a->setStatusTip ( tr( "Print" ) );
398 a->setShortcut (Qt::CTRL + Qt::Key_P );
401 connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
404 a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this);
405 a->setStatusTip (tr( "Close Map" ) );
406 a->setShortcut (Qt::ALT + Qt::Key_C );
408 connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
410 a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, this);
411 a->setStatusTip ( tr( "Exit")+" "+__VYM );
412 a->setShortcut (Qt::CTRL + Qt::Key_Q );
414 connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
419 void Main::setupEditActions()
421 Q3ToolBar *tb = new Q3ToolBar( this );
422 tb->setLabel( "Edit Actions" );
423 Q3PopupMenu *menu = new Q3PopupMenu( this );
424 menuBar()->insertItem( tr( "&Edit" ), menu );
428 a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo" ),this);
429 connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
430 a->setStatusTip (tr( "Undo" ) );
431 a->setShortcut ( Qt::CTRL + Qt::Key_Z );
432 a->setEnabled (false);
437 if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
439 a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this);
440 a->setStatusTip (tr( "Redo" ));
441 a->setShortcut (Qt::CTRL + Qt::Key_Y );
444 connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
447 menu->insertSeparator();
448 a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), this);
449 a->setStatusTip ( tr( "Copy" ) );
450 a->setShortcut (Qt::CTRL + Qt::Key_C );
451 a->setEnabled (false);
454 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
457 a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t" ), this);
458 a->setStatusTip ( tr( "Cut" ) );
459 a->setShortcut (Qt::CTRL + Qt::Key_X );
460 a->setEnabled (false);
464 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
466 a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ),this);
467 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
468 a->setStatusTip ( tr( "Paste" ) );
469 a->setShortcut ( Qt::CTRL + Qt::Key_V );
470 a->setEnabled (false);
475 a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up" ), this);
476 a->setStatusTip ( tr( "Move branch up" ) );
477 a->setShortcut (Qt::Key_PageUp );
478 a->setEnabled (false);
481 connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
484 a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down" ),this);
485 connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) );
486 a->setStatusTip (tr( "Move branch down" ) );
487 a->setShortcut ( Qt::Key_PageDown );
488 a->setEnabled (false);
491 actionEditMoveDown=a;
494 a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ),this);
495 a->setShortcut ( Qt::Key_ScrollLock );
496 a->setStatusTip (tr( "Scroll branch" ) );
497 connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
498 alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), this);
499 alt->setShortcut ( Qt::Key_S );
500 alt->setStatusTip (tr( "Scroll branch" ));
501 connect( alt, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
502 #if defined(Q_OS_MACX)
503 actionEditToggleScroll=alt;
505 actionEditToggleScroll=a;
507 actionEditToggleScroll->setEnabled (false);
508 actionEditToggleScroll->setToggleAction(true);
509 actionEditToggleScroll->addTo( tb );
510 actionEditToggleScroll->addTo( menu );
511 actionListBranches.append(actionEditToggleScroll);
513 a = new QAction( tr( "Unscroll all scrolled branches" ), this);
514 a->setStatusTip (tr( "Unscroll all" ));
516 connect( a, SIGNAL( activated() ), this, SLOT( editUnScrollAll() ) );
518 menu->insertSeparator();
520 a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), this);
521 a->setStatusTip (tr( "Find" ) );
522 a->setShortcut (Qt::CTRL + Qt::Key_F );
524 connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) );
526 menu->insertSeparator();
528 a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), this);
529 a->setShortcut (Qt::CTRL + Qt::Key_U );
530 a->setShortcut (tr( "Open URL" ));
532 a->setEnabled (false);
533 connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
536 a = new QAction( tr( "Open URL in new tab" ), this);
537 a->setStatusTip (tr( "Open URL in new tab" ));
538 a->setShortcut (Qt::CTRL+Qt::Key_U );
539 a->setEnabled (false);
540 connect( a, SIGNAL( activated() ), this, SLOT( editOpenURLTab() ) );
541 actionEditOpenURLTab=a;
543 a = new QAction(QPixmap(), tr( "Edit URL"+QString("...") ), this);
544 a->setStatusTip ( tr( "Edit URL" ) );
545 a->setShortcut (Qt::SHIFT + Qt::CTRL+Qt::Key_U );
546 a->setEnabled (false);
547 actionListBranches.append(a);
548 connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
551 a = new QAction( tr( "Use heading for URL" ), this);
552 a->setStatusTip ( tr( "Use heading of selected branch as URL" ));
553 a->setEnabled (false);
554 actionListBranches.append(a);
555 connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
556 actionEditHeading2URL=a;
558 a = new QAction(tr( "Create URL to Bugzilla" ), this);
559 a->setStatusTip ( tr( "Create URL to Bugzilla" ));
560 a->setEnabled (false);
561 actionListBranches.append(a);
562 connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) );
563 actionEditBugzilla2URL=a;
565 a = new QAction(tr( "Create URL to FATE" ), this);
566 a->setStatusTip ( tr( "Create URL to FATE" ));
567 a->setEnabled (false);
568 actionListBranches.append(a);
569 connect( a, SIGNAL( activated() ), this, SLOT( editFATE2URL() ) );
570 actionEditFATE2URL=a;
572 a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Jump to map" ), this);
573 a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
575 a->setEnabled (false);
576 connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
577 actionEditOpenVymLink=a;
579 a = new QAction(tr( "Edit vym link"+QString("...") ), this);
580 a->setEnabled (false);
581 a->setStatusTip ( tr( "Edit link to another vym map" ));
582 connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
583 actionListBranches.append(a);
586 a = new QAction(tr( "Delete vym link" ),this);
587 a->setStatusTip ( tr( "Delete link to another vym map" ));
588 a->setEnabled (false);
589 connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) );
590 actionEditDeleteVymLink=a;
592 a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), this);
593 a->setStatusTip ( tr( "Hide object in exports" ) );
594 a->setShortcut (Qt::Key_H );
595 a->setToggleAction(true);
597 a->setEnabled (false);
598 connect( a, SIGNAL( activated() ), this, SLOT( editToggleHideExport() ) );
599 actionEditToggleHideExport=a;
601 a = new QAction(tr( "Edit Map Info"+QString("...") ),this);
602 a->setStatusTip ( tr( "Edit Map Info" ));
603 a->setEnabled (true);
604 connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) );
607 menu->insertSeparator();
609 // Shortcuts to modify heading:
610 a = new QAction(tr( "Edit heading" ),this);
611 a->setStatusTip ( tr( "edit Heading" ));
612 a->setShortcut ( Qt::Key_Enter );
613 connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
614 actionListBranches.append(a);
615 a = new QAction( tr( "Edit heading" ), this);
616 a->setStatusTip (tr( "edit Heading" ));
617 a->setShortcut (Qt::Key_Return );
618 connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
619 actionListBranches.append(a);
621 a = new QAction( tr( "Edit heading" ),this);
622 a->setStatusTip (tr( "edit Heading" ));
623 a->setShortcut ( Qt::Key_F2 );
624 connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
625 a->setEnabled (false);
627 actionListBranches.append(a);
629 // Shortcut to delete selection
630 a = new QAction( tr( "Delete Selection" ),this);
631 a->setStatusTip (tr( "Delete Selection" ));
632 a->setShortcut ( Qt::Key_Delete);
633 connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) );
634 a->setEnabled (false);
637 // Shortcut to add branch
638 alt = new QAction(tr( "Add branch as child" ), this);
639 alt->setStatusTip ( tr( "Add a branch as child of selection" ));
640 alt->setShortcut (Qt::Key_A);
641 connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
642 a = new QAction(tr( "Add branch as child" ), this);
643 a->setStatusTip ( tr( "Add a branch as child of selection" ));
644 a->setShortcut (Qt::Key_Insert);
645 a->setEnabled (false);
646 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
647 actionListBranches.append(a);
648 #if defined (Q_OS_MACX)
649 // In OSX show different shortcut in menues, the keys work independtly always
650 actionEditAddBranch=alt;
652 actionEditAddBranch=a;
655 // Add branch by inserting it at selection
656 a = new QAction(tr( "Add branch (insert)" ), this);
657 a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
658 a->setShortcut (Qt::ALT + Qt::Key_Insert );
659 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
660 a->setEnabled (false);
661 actionListBranches.append(a);
662 actionEditAddBranchHere=a;
663 a = new QAction(tr( "Add branch (insert)" ),this);
664 a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
665 a->setShortcut ( Qt::ALT + Qt::Key_A );
666 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
667 actionListBranches.append(a);
670 a = new QAction(tr( "Add branch above" ), this);
671 a->setStatusTip ( tr( "Add a branch above selection" ));
672 a->setShortcut (Qt::SHIFT+Qt::Key_Insert );
673 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
674 a->setEnabled (false);
675 actionListBranches.append(a);
676 actionEditAddBranchAbove=a;
677 a = new QAction(tr( "Add branch above" ), this);
678 a->setStatusTip ( tr( "Add a branch above selection" ));
679 a->setShortcut (Qt::SHIFT+Qt::Key_A );
680 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
681 actionListBranches.append(a);
684 a = new QAction(tr( "Add branch below" ), this);
685 a->setStatusTip ( tr( "Add a branch below selection" ));
686 a->setShortcut (Qt::CTRL +Qt::Key_Insert );
687 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
688 a->setEnabled (false);
689 actionListBranches.append(a);
690 actionEditAddBranchBelow=a;
691 a = new QAction(tr( "Add branch below" ), this);
692 a->setStatusTip ( tr( "Add a branch below selection" ));
693 a->setShortcut (Qt::CTRL +Qt::Key_A );
694 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
695 actionListBranches.append(a);
697 // Import at selection (adding to selection)
698 a = new QAction( tr( "Add map (insert)" ),this);
699 a->setStatusTip (tr( "Add map at selection" ));
700 connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
701 a->setEnabled (false);
702 actionListBranches.append(a);
703 actionEditImportAdd=a;
705 // Import at selection (replacing selection)
706 a = new QAction( tr( "Add map (replace)" ), this);
707 a->setStatusTip (tr( "Replace selection with map" ));
708 connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
709 a->setEnabled (false);
710 actionListBranches.append(a);
711 actionEditImportReplace=a;
714 a = new QAction( tr( "Save selection" ), this);
715 a->setStatusTip (tr( "Save selection" ));
716 connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) );
717 a->setEnabled (false);
718 actionListBranches.append(a);
719 actionEditSaveBranch=a;
721 // Only remove branch, not its childs
722 a = new QAction(tr( "Remove only branch " ), this);
723 a->setStatusTip ( tr( "Remove only branch and keep its childs" ));
724 a->setShortcut (Qt::ALT + Qt::Key_Delete );
725 connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchKeepChilds() ) );
726 a->setEnabled (false);
727 actionListBranches.append(a);
728 actionEditRemoveBranchKeepChilds=a;
730 // Only remove childs of a branch
731 a = new QAction( tr( "Remove childs" ), this);
732 a->setStatusTip (tr( "Remove childs of branch" ));
733 a->setShortcut (Qt::SHIFT + Qt::Key_Delete );
734 connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) );
735 a->setEnabled (false);
736 actionListBranches.append(a);
737 actionEditRemoveChilds=a;
739 // Shortcuts for navigating with cursor:
740 a = new QAction(tr( "Select upper branch" ), this);
741 a->setStatusTip ( tr( "Select upper branch" ));
742 a->setShortcut (Qt::Key_Up );
743 connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) );
744 a = new QAction( tr( "Select lower branch" ),this);
745 a->setStatusTip (tr( "Select lower branch" ));
746 a->setShortcut ( Qt::Key_Down );
747 connect( a, SIGNAL( activated() ), this, SLOT( editLowerBranch() ) );
748 a = new QAction(tr( "Select left branch" ), this);
749 a->setStatusTip ( tr( "Select left branch" ));
750 a->setShortcut (Qt::Key_Left );
751 connect( a, SIGNAL( activated() ), this, SLOT( editLeftBranch() ) );
752 a = new QAction( tr( "Select child branch" ), this);
753 a->setStatusTip (tr( "Select right branch" ));
754 a->setShortcut (Qt::Key_Right);
755 connect( a, SIGNAL( activated() ), this, SLOT( editRightBranch() ) );
756 a = new QAction( tr( "Select first branch" ), this);
757 a->setStatusTip (tr( "Select first branch" ));
758 a->setShortcut (Qt::Key_Home );
759 a->setEnabled (false);
761 actionListBranches.append(a);
762 actionEditSelectFirst=a;
763 connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) );
764 a = new QAction( tr( "Select last branch" ),this);
765 a->setStatusTip (tr( "Select last branch" ));
766 a->setShortcut ( Qt::Key_End );
767 connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) );
768 a->setEnabled (false);
770 actionListBranches.append(a);
771 actionEditSelectLast=a;
773 a = new QAction( tr( "Add Image" )+QString("..."), this);
774 a->setStatusTip (tr( "Add Image" ));
775 connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) );
776 actionEditLoadImage=a;
781 void Main::setupFormatActions()
783 Q3PopupMenu *menu = new Q3PopupMenu( this );
784 menuBar()->insertItem( tr( "F&ormat" ), menu );
786 Q3ToolBar *tb = new Q3ToolBar( this );
789 pix.fill (Qt::black);
790 a= new QAction(pix, tr( "Set &Color" )+QString("..."), this);
791 a->setStatusTip ( tr( "Set Color" ));
792 connect( a, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
796 a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), this);
797 a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) );
798 a->setShortcut (Qt::CTRL + Qt::Key_K );
799 connect( a, SIGNAL( activated() ), this, SLOT( formatPickColor() ) );
800 a->setEnabled (false);
803 actionListBranches.append(a);
804 actionFormatPickColor=a;
806 a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), this);
807 a->setStatusTip ( tr( "Color branch" ) );
808 a->setShortcut (Qt::CTRL + Qt::Key_I);
809 connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) );
810 a->setEnabled (false);
813 actionListBranches.append(a);
814 actionFormatColorBranch=a;
816 a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), this);
817 a->setStatusTip ( tr( "Color Subtree" ));
818 a->setShortcut (Qt::CTRL + Qt::Key_T);
819 connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) );
820 a->setEnabled (false);
823 actionListBranches.append(a);
824 actionFormatColorSubtree=a;
826 menu->insertSeparator();
827 actionGroupFormatLinkStyles=new Q3ActionGroup ( this, "formatLinkStyles");
828 actionGroupFormatLinkStyles->setExclusive (true);
829 a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
830 a->setStatusTip (tr( "Line" ));
831 a->setToggleAction(true);
832 connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleLine() ) );
833 actionFormatLinkStyleLine=a;
834 a= new QAction( tr( "Linkstyle Parabel" ), actionGroupFormatLinkStyles);
835 a->setStatusTip (tr( "Line" ));
836 a->setToggleAction(true);
837 connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleParabel() ) );
838 actionFormatLinkStyleParabel=a;
839 a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles );
840 a->setStatusTip (tr( "PolyLine" ));
841 a->setToggleAction(true);
842 connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyLine() ) );
843 actionFormatLinkStylePolyLine=a;
844 a= new QAction( tr( "Linkstyle Thick Parabel" ), actionGroupFormatLinkStyles);
845 a->setStatusTip (tr( "PolyParabel" ) );
846 a->setToggleAction(true);
847 connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyParabel() ) );
848 actionFormatLinkStylePolyParabel=a;
849 actionGroupFormatLinkStyles->addTo (menu);
851 actionGroupFormatFrameTypes=new Q3ActionGroup ( this, "formatFrameTypes");
852 actionGroupFormatFrameTypes->setExclusive (true);
853 a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes );
854 a->setStatusTip (tr("No Frame"));
855 a->setToggleAction(true);
856 connect( a, SIGNAL( activated() ), this, SLOT( formatFrameNone() ) );
857 actionFormatFrameNone=a;
858 a = new QAction( tr( "Rectangle" ), actionGroupFormatFrameTypes);
859 a->setStatusTip (tr( "Rectangle" ));
860 a->setToggleAction(true);
861 connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) );
862 actionFormatFrameRectangle=a;
864 a = new QAction( tr( "Include images vertically" ), actionFormatIncludeImagesVer);
865 a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
866 a->setToggleAction(true);
867 connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesVer() ) );
868 actionFormatIncludeImagesVer=a;
870 a = new QAction( tr( "Include images horizontally" ), actionFormatIncludeImagesHor );
871 a->setStatusTip ( tr ("Include left and right position of images into branch"));
872 a->setToggleAction(true);
873 connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesHor() ) );
874 actionFormatIncludeImagesHor=a;
876 a = new QAction( tr( "Hide link if object is not selected" ), actionFormatHideLinkUnselected);
877 a->setStatusTip (tr( "Hide link" ));
878 a->setToggleAction(true);
879 connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) );
880 actionFormatHideLinkUnselected=a;
882 menu->insertSeparator();
883 a= new QAction( tr( "&Use color of heading for link" ), this);
884 a->setStatusTip (tr( "Use same color for links and headings" ));
885 a->setToggleAction(true);
886 connect( a, SIGNAL( activated() ), this, SLOT( formatToggleLinkColorHint() ) );
888 actionFormatLinkColorHint=a;
890 pix.fill (Qt::white);
891 a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this );
892 a->setStatusTip (tr( "Set Link Color" ));
894 connect( a, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
895 actionFormatLinkColor=a;
897 a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this );
898 a->setStatusTip (tr( "Set Background Color" ));
900 connect( a, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
901 actionFormatBackColor=a;
905 void Main::setupViewActions()
907 Q3ToolBar *tb = new Q3ToolBar( this );
908 tb->setLabel( "View Actions" );
909 Q3PopupMenu *menu = new Q3PopupMenu( this );
910 menuBar()->insertItem( tr( "&View" ), menu );
913 a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), this);
914 a->setStatusTip ( tr( "Zoom reset" ) );
915 a->setShortcut (Qt::CTRL + Qt::Key_0 );
918 connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
920 a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in" ), this);
921 a->setStatusTip (tr( "Zoom in" ));
922 a->setShortcut (Qt::CTRL + Qt::Key_Plus);
925 connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
927 a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out" ), this);
928 a->setStatusTip (tr( "Zoom out" ));
929 a->setShortcut (Qt::CTRL + Qt::Key_Minus );
932 connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
935 a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ),this);
936 a->setStatusTip ( tr( "Show Note Editor" ));
937 a->setShortcut ( Qt::CTRL + Qt::Key_E );
938 a->setToggleAction(true);
939 if (textEditor->showWithMain())
945 connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
946 actionViewToggleNoteEditor=a;
948 a = new QAction( tr( "Show history window" ),this );
949 a->setStatusTip ( tr( "Show history window" ));
950 a->setShortcut ( Qt::CTRL + Qt::Key_H );
951 a->setToggleAction(false);
953 connect( a, SIGNAL( activated() ), this, SLOT(windowToggleHistory() ) );
954 actionViewToggleHistoryWindow=a;
956 a = new QAction(tr( "Next Window" ), this);
957 a->setStatusTip ( tr( "&Next Window" ) );
958 a->setShortcut (Qt::ALT + Qt::Key_N );
960 connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) );
962 a = new QAction (tr( "Previous Window" ), this );
963 a->setStatusTip (tr( "&Previous Window" ));
964 a->setShortcut (Qt::ALT + Qt::Key_P );
966 connect( a, SIGNAL( activated() ), this, SLOT(windowPreviousEditor() ) );
970 void Main::setupModeActions()
972 //QPopupMenu *menu = new QPopupMenu( this );
973 //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
975 Q3ToolBar *tb = new Q3ToolBar( this );
976 tb->setLabel( tr ("Modes when using modifiers") );
978 actionGroupModModes=new Q3ActionGroup ( this, "formatLinkStyles");
979 actionGroupModModes->setExclusive (true);
980 a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes);
981 a->setShortcut (Qt::Key_J);
982 a->setStatusTip ( tr( "Use modifier to color branches" ));
983 a->setToggleAction(true);
986 actionModModeColor=a;
988 a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy" ), actionGroupModModes );
989 a->setShortcut( Qt::Key_K);
990 a->setStatusTip( tr( "Use modifier to copy" ));
991 a->setToggleAction(true);
995 a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks" ), actionGroupModModes );
996 a->setShortcut (Qt::Key_L);
997 a->setStatusTip( tr( "Use modifier to draw xLinks" ));
998 a->setToggleAction(true);
1000 actionModModeLink=a;
1004 void Main::setupFlagActions()
1006 // Create System Flags
1007 systemFlagsDefault = new FlagRowObj ();
1008 systemFlagsDefault->setVisibility (false);
1009 systemFlagsDefault->setName ("systemFlagsDef");
1011 FlagObj *fo = new FlagObj ();
1012 fo->load(QPixmap(flagsPath+"flag-note.png"));
1013 fo->setName("note");
1014 fo->setToolTip(tr("Note","Systemflag"));
1015 systemFlagsDefault->addFlag (fo); // makes deep copy
1017 fo->load(QPixmap(flagsPath+"flag-url.png"));
1019 fo->setToolTip(tr("WWW Document (external)","Systemflag"));
1020 systemFlagsDefault->addFlag (fo);
1022 fo->load(QPixmap(flagsPath+"flag-vymlink.png"));
1023 fo->setName("vymLink");
1024 fo->setToolTip(tr("Link to another vym map","Systemflag"));
1025 systemFlagsDefault->addFlag (fo);
1027 fo->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
1028 fo->setName("scrolledright");
1029 fo->setToolTip(tr("subtree is scrolled","Systemflag"));
1030 systemFlagsDefault->addFlag (fo);
1032 fo->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
1033 fo->setName("tmpUnscrolledright");
1034 fo->setToolTip(tr("subtree is temporary scrolled","Systemflag"));
1035 systemFlagsDefault->addFlag (fo);
1037 fo->load(QPixmap(flagsPath+"flag-hideexport.png"));
1038 fo->setName("hideInExport");
1039 fo->setToolTip(tr("Hide object in exported maps","Systemflag"));
1040 systemFlagsDefault->addFlag (fo);
1042 // Create Standard Flags
1043 standardFlagsDefault = new FlagRowObj ();
1044 standardFlagsDefault->setVisibility (false);
1045 standardFlagsDefault->setName ("standardFlagsDef");
1047 fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
1048 fo->setName ("exclamationmark");
1049 fo->setGroup("standard-mark");
1050 fo->setToolTip(tr("Take care!","Standardflag"));
1051 standardFlagsDefault->addFlag (fo); // makes deep copy
1053 fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
1054 fo->setName("questionmark");
1055 fo->setGroup("standard-mark");
1056 fo->setToolTip(tr("Really?","Standardflag"));
1057 standardFlagsDefault->addFlag (fo);
1059 fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
1060 fo->setName("hook-green");
1061 fo->setGroup("standard-hook");
1062 fo->setToolTip(tr("ok!","Standardflag"));
1063 standardFlagsDefault->addFlag (fo);
1065 fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
1066 fo->setName("cross-red");
1067 fo->setGroup("standard-hook");
1068 fo->setToolTip(tr("Not ok!","Standardflag"));
1069 standardFlagsDefault->addFlag (fo);
1071 fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
1072 fo->setName("stopsign");
1073 fo->setToolTip(tr("This won't work!","Standardflag"));
1074 standardFlagsDefault->addFlag (fo);
1076 fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
1077 fo->setName("smiley-good");
1078 fo->setGroup("standard-smiley");
1079 fo->setToolTip(tr("Good","Standardflag"));
1080 standardFlagsDefault->addFlag (fo);
1082 fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
1083 fo->setName("smiley-sad");
1084 fo->setGroup("standard-smiley");
1085 fo->setToolTip(tr("Bad","Standardflag"));
1086 standardFlagsDefault->addFlag (fo);
1088 fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
1089 // Original omg.png (in KDE emoticons)
1090 fo->setName("smiley-omg");
1091 fo->setGroup("standard-smiley");
1092 fo->setToolTip(tr("Oh no!","Standardflag"));
1093 standardFlagsDefault->addFlag (fo);
1095 fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
1096 fo->setName("clock");
1097 fo->setToolTip(tr("Time critical","Standardflag"));
1098 standardFlagsDefault->addFlag (fo);
1100 fo->load(QPixmap(flagsPath+"flag-phone.png"));
1101 fo->setName("phone");
1102 fo->setToolTip(tr("Call...","Standardflag"));
1103 standardFlagsDefault->addFlag (fo);
1105 fo->load(QPixmap(flagsPath+"flag-lamp.png"));
1106 fo->setName("lamp");
1107 fo->setToolTip(tr("Idea!","Standardflag"));
1108 standardFlagsDefault->addFlag (fo);
1110 fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
1111 fo->setName("arrow-up");
1112 fo->setGroup("standard-arrow");
1113 fo->setToolTip(tr("Important","Standardflag"));
1114 standardFlagsDefault->addFlag (fo);
1116 fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
1117 fo->setName("arrow-down");
1118 fo->setGroup("standard-arrow");
1119 fo->setToolTip(tr("Unimportant","Standardflag"));
1120 standardFlagsDefault->addFlag (fo);
1122 fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
1123 fo->setName("2arrow-up");
1124 fo->setGroup("standard-arrow");
1125 fo->setToolTip(tr("Very important!","Standardflag"));
1126 standardFlagsDefault->addFlag (fo);
1128 fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
1129 fo->setName("2arrow-down");
1130 fo->setGroup("standard-arrow");
1131 fo->setToolTip(tr("Very unimportant!","Standardflag"));
1132 standardFlagsDefault->addFlag (fo);
1134 fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
1135 fo->setName("thumb-up");
1136 fo->setGroup("standard-thumb");
1137 fo->setToolTip(tr("I like this","Standardflag"));
1138 standardFlagsDefault->addFlag (fo);
1140 fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
1141 fo->setName("thumb-down");
1142 fo->setGroup("standard-thumb");
1143 fo->setToolTip(tr("I like this","Standardflag"));
1144 fo->setToolTip(tr("I do not like this","Standardflag"));
1145 standardFlagsDefault->addFlag (fo);
1147 fo->load(QPixmap(flagsPath+"flag-rose.png"));
1148 fo->setName("rose");
1149 fo->setToolTip(tr("Rose","Standardflag"));
1150 standardFlagsDefault->addFlag (fo);
1152 fo->load(QPixmap(flagsPath+"flag-heart.png"));
1153 fo->setName("heart");
1154 fo->setToolTip(tr("I just love... ","Standardflag"));
1155 standardFlagsDefault->addFlag (fo);
1157 fo->load(QPixmap(flagsPath+"flag-present.png"));
1158 fo->setName("present");
1159 fo->setToolTip(tr("Surprise!","Standardflag"));
1160 standardFlagsDefault->addFlag (fo);
1162 fo->load(QPixmap(flagsPath+"flag-flash.png"));
1163 fo->setName("flash");
1164 fo->setToolTip(tr("Dangerous","Standardflag"));
1165 standardFlagsDefault->addFlag (fo);
1167 fo->load(QPixmap(flagsPath+"flag-info.png"));
1168 // Original: xsldbg_output.png
1169 fo->setName("info");
1170 fo->setToolTip(tr("Info","Standardflag"));
1171 standardFlagsDefault->addFlag (fo);
1173 fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
1174 // Original khelpcenter.png
1175 fo->setName("lifebelt");
1176 fo->setToolTip(tr("This will help","Standardflag"));
1177 standardFlagsDefault->addFlag (fo);
1181 standardFlagsDefault->makeToolbar(this, "Standard Flags");
1185 void Main::setupSettingsActions()
1187 Q3PopupMenu *menu = new Q3PopupMenu( this );
1188 menuBar()->insertItem( tr( "&Settings" ), menu );
1193 a = new QAction( tr( "Set application to open pdf files"), this);
1194 a->setStatusTip ( tr( "Set application to open pdf files"));
1195 connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) );
1198 a = new QAction( tr( "Set application to open external links"), this);
1199 a->setStatusTip( tr( "Set application to open external links"));
1200 connect( a, SIGNAL( activated() ), this, SLOT( settingsURL() ) );
1203 menu->insertSeparator();
1204 a = new QAction( tr( "Edit branch after adding it" ), this );
1205 a->setStatusTip( tr( "Edit branch after adding it" ));
1206 a->setToggleAction(true);
1207 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoedit",true) );
1209 actionSettingsAutoedit=a;
1211 a= new QAction( tr( "Select branch after adding it" ), this );
1212 a->setStatusTip( tr( "Select branch after adding it" ));
1213 a->setToggleAction(true);
1214 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselect",false) );
1216 actionSettingsAutoselectHeading=a;
1218 a= new QAction(tr( "Select existing heading" ), this);
1219 a->setStatusTip( tr( "Select heading before editing" ));
1220 a->setToggleAction(true);
1221 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselectexistingtext",true) );
1223 actionSettingsAutoselectText=a;
1225 a= new QAction(tr( "pasting into new branch" ), this );
1226 a->setStatusTip( tr( "Pasting into new branch" ));
1227 a->setToggleAction(true);
1228 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/newheadingisempty",true) );
1230 actionSettingsPasteNewHeading=a;
1232 a= new QAction( tr( "Delete key" ), this);
1233 a->setStatusTip( tr( "Delete key for deleting branches" ));
1234 a->setToggleAction(true);
1235 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) );
1237 connect( a, SIGNAL( activated() ), this, SLOT( settingsToggleDelKey() ) );
1238 actionSettingsUseDelKey=a;
1240 a= new QAction( tr( "Exclusive flags" ), this);
1241 a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
1242 a->setToggleAction(true);
1243 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) );
1245 actionSettingsUseFlagGroups=a;
1247 a= new QAction( tr( "Use hide flags" ), this);
1248 a->setStatusTip( tr( "Use hide flag during exports " ));
1249 a->setToggleAction(true);
1250 a->setOn ( settings.readBoolEntry ("/vym/export/useHideExport",true) );
1252 actionSettingsUseHideExport=a;
1256 void Main::setupTestActions()
1258 Q3PopupMenu *menu = new Q3PopupMenu( this );
1259 menuBar()->insertItem( tr( "&Test" ), menu );
1262 a = new QAction( tr( "test flag" ), this);
1263 a->setStatusTip( tr( "Call test function" ));
1264 connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) );
1269 void Main::setupHelpActions()
1271 Q3PopupMenu *menu = new Q3PopupMenu( this );
1272 menuBar()->insertItem( tr( "&Help" ), menu );
1275 a = new QAction( tr( "Open VYM Documentation (pdf) " ), this );
1276 a->setStatusTip( tr( "Open VYM Documentation (pdf)" ));
1277 connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
1280 a = new QAction( tr( "About VYM" ), this);
1281 a->setStatusTip( tr( "About VYM")+" "__VYM);
1282 connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
1285 a = new QAction( tr( "About QT" ), this);
1286 a->setStatusTip( tr( "Information about QT toolkit" ));
1287 connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQT() ) );
1292 void Main::setupContextMenus()
1296 // Context Menu for branch or mapcenter
1297 branchContextMenu =new Q3PopupMenu (this);
1300 branchAddContextMenu =new Q3PopupMenu (this);
1301 actionEditPaste->addTo ( branchAddContextMenu );
1302 actionEditAddBranch->addTo ( branchAddContextMenu );
1303 actionEditAddBranchHere->addTo ( branchAddContextMenu );
1304 actionEditAddBranchAbove->addTo ( branchAddContextMenu );
1305 actionEditAddBranchBelow->addTo ( branchAddContextMenu );
1306 branchAddContextMenu->insertSeparator();
1307 actionEditLoadImage->addTo( branchAddContextMenu );
1308 branchAddContextMenu->insertSeparator();
1309 actionEditImportAdd->addTo ( branchAddContextMenu );
1310 actionEditImportReplace->addTo ( branchAddContextMenu );
1313 branchRemoveContextMenu =new Q3PopupMenu (this);
1314 actionEditCut->addTo ( branchRemoveContextMenu );
1315 actionEditDelete->addTo ( branchRemoveContextMenu );
1316 actionEditRemoveBranchKeepChilds->addTo( branchRemoveContextMenu );
1317 actionEditRemoveChilds->addTo( branchRemoveContextMenu );
1319 branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);
1320 branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu);
1322 actionEditSaveBranch->addTo( branchContextMenu );
1324 branchContextMenu->insertSeparator();
1325 actionEditOpenURL->addTo ( branchContextMenu );
1326 actionEditOpenURLTab->addTo ( branchContextMenu );
1327 actionEditURL->addTo ( branchContextMenu );
1328 actionEditHeading2URL->addTo ( branchContextMenu );
1329 actionEditBugzilla2URL->addTo( branchContextMenu );
1330 if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
1332 actionEditFATE2URL->addTo( branchContextMenu );
1334 branchContextMenu->insertSeparator();
1335 actionEditOpenVymLink->addTo ( branchContextMenu );
1336 actionEditVymLink->addTo ( branchContextMenu );
1337 actionEditDeleteVymLink->addTo ( branchContextMenu );
1339 branchContextMenu->insertSeparator();
1340 actionGroupFormatFrameTypes->addTo( branchContextMenu );
1342 branchContextMenu->insertSeparator();
1343 actionFormatIncludeImagesVer->addTo( branchContextMenu );
1344 actionFormatIncludeImagesHor->addTo( branchContextMenu );
1345 actionFormatHideLinkUnselected->addTo( branchContextMenu );
1347 // Context Menu for links in a branch menu
1348 // This will be populated "on demand" in MapEditor::updateActions
1349 branchContextMenu->insertSeparator();
1350 branchLinksContextMenu =new Q3PopupMenu (this);
1351 branchLinksContextMenuDup =new Q3PopupMenu (this);
1352 branchContextMenu->insertItem (tr("Edit XLink"),branchLinksContextMenuDup);
1353 connect( branchLinksContextMenuDup, SIGNAL( activated(int) ), this, SLOT( editEditXLink(int ) ) );
1355 branchContextMenu->insertItem (tr("Goto XLink"),branchLinksContextMenu);
1356 connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowXLink(int ) ) );
1358 // Context menu for floatimage
1359 floatimageContextMenu =new Q3PopupMenu (this);
1360 saveImageFormatMenu=new Q3PopupMenu (this);
1361 exportImageFormatMenu=new Q3PopupMenu (this);
1363 /* FIXME strange error
1364 foreach (QByteArray format, QImageWriter::supportedImageFormats())
1366 QString text = tr("%1...").arg(QString(format).toUpper());
1367 saveImageFormatMenu->insertItem( text );
1368 exportImageFormatMenu->insertItem( text );
1372 /* FIXME not needed any longer
1373 Q3StrList fmt = QImageWriter::supportedImageFormats();
1374 for (const char* f = fmt.first(); f; f = fmt.next())
1376 saveImageFormatMenu->insertItem( f );
1377 exportImageFormatMenu->insertItem( f );
1380 connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) );
1381 connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) );
1382 floatimageContextMenu->insertItem( tr("Save image"),saveImageFormatMenu );
1384 floatimageContextMenu->insertSeparator();
1385 actionEditCopy->addTo( floatimageContextMenu );
1386 actionEditCut->addTo( floatimageContextMenu );
1388 floatimageContextMenu->insertSeparator();
1389 actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
1391 exportMenu->insertItem ( tr("Export as")+" Image",exportImageFormatMenu);
1393 a = new QAction( "Open Office"+QString("..."), this);
1394 a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " ));
1395 connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
1396 a->addTo (exportMenu);
1398 a = new QAction( "Webpage (XHTML)...",this );
1399 a->setShortcut (Qt::ALT + Qt::Key_X);
1400 a->setStatusTip ( tr( "Export as")+" webpage (XHTML)");
1401 connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
1402 a->addTo( exportMenu );
1404 a = new QAction( "Text (ASCII)...", this);
1405 a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ));
1406 connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
1407 a->addTo( exportMenu );
1409 a = new QAction( tr("KDE Bookmarks"), this);
1410 a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" ));
1411 connect( a, SIGNAL( activated() ), this, SLOT( fileExportKDEBookmarks() ) );
1412 a->addTo (exportMenu);
1414 a = new QAction( "Taskjuggler...", this );
1415 a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ));
1416 connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) );
1417 a->addTo( exportMenu );
1419 a = new QAction( "LaTeX...", this);
1420 a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ));
1421 connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
1422 a->addTo( exportMenu );
1424 a = new QAction( "XML..." , this );
1425 a->setStatusTip (tr( "Export as")+" XML");
1426 connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
1427 a->addTo( exportMenu );
1429 // Context menu for canvas
1430 canvasContextMenu =new Q3PopupMenu (this);
1431 actionEditMapInfo->addTo( canvasContextMenu );
1432 canvasContextMenu->insertSeparator();
1433 actionGroupFormatLinkStyles->addTo( canvasContextMenu );
1434 canvasContextMenu->insertSeparator();
1435 actionFormatLinkColorHint->addTo( canvasContextMenu );
1436 actionFormatLinkColor->addTo( canvasContextMenu );
1437 actionFormatBackColor->addTo( canvasContextMenu );
1439 // Menu for last opened files
1440 // Read settings initially
1442 int j=settings.readNumEntry( "/vym/lastMaps/number",0);
1443 for (int i=1;i<=j;i++)
1445 s=settings.readEntry(QString("/vym/lastMaps/map-%1").arg(i),"");
1446 if (!s.isEmpty() && j<=maxLastMaps)
1449 setupLastMapsMenu();
1450 connect( lastMapsMenu, SIGNAL( activated(int) ), this, SLOT( fileLoadLast(int ) ) );
1453 void Main::setupLastMapsMenu()
1455 // Remove double entries
1456 QStringList::Iterator it=lastMaps.begin();
1457 QStringList::Iterator jt;
1458 while (it!=lastMaps.end() )
1462 while (jt!=lastMaps.end() )
1465 jt=lastMaps.remove(jt);
1472 // Limit length of list to maxLastMaps
1473 while ((int)(lastMaps.count()) > maxLastMaps) lastMaps.pop_back();
1475 // build Menu from lastMaps string list
1476 lastMapsMenu->clear();
1477 for (it = lastMaps.begin(); it != lastMaps.end(); ++it )
1478 lastMapsMenu->insertItem (*it );
1482 void Main::hideEvent (QHideEvent * )
1484 if (!textEditor->isMinimized() ) textEditor->hide();
1487 void Main::showEvent (QShowEvent * )
1489 if (textEditor->showWithMain()) textEditor->showNormal();
1492 bool Main::reallyWriteDirectory(const QString &dir)
1494 QStringList eList = QDir(dir).entryList();
1495 if (eList.first() ==".") eList.pop_front(); // remove "."
1496 if (eList.first() =="..") eList.pop_front(); // remove "."
1497 if (!eList.isEmpty())
1499 QMessageBox mb( __VYM,
1500 tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?").arg(dir),
1501 QMessageBox::Warning,
1503 QMessageBox::Cancel | QMessageBox::Default,
1504 QMessageBox::QMessageBox::NoButton );
1506 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
1507 mb.setButtonText( QMessageBox::No, tr("Cancel"));
1510 case QMessageBox::Yes:
1513 case QMessageBox::Cancel:
1521 QString Main::browseDirectory (const QString &caption)
1523 Q3FileDialog fd(this,caption);
1524 fd.setMode (Q3FileDialog::DirectoryOnly);
1525 fd.setCaption(__VYM " - "+caption);
1528 if ( fd.exec() == QDialog::Accepted )
1529 return fd.selectedFile();
1534 MapEditor* Main::currentMapEditor() const
1536 if ( tabWidget->currentPage() &&
1537 tabWidget->currentPage()->inherits( "MapEditor" ) )
1538 return (MapEditor*)tabWidget->currentPage();
1542 //TODO not used now, maybe use this for overview window later
1543 void Main::newView()
1545 // Open a new view... have it delete when closed.
1546 Main *m = new Main(0, 0, Qt::WDestructiveClose);
1547 qApp->setMainWidget(m);
1549 qApp->setMainWidget(0);
1552 void Main::editorChanged(QWidget *)
1554 // Unselect all possibly selected objects
1555 // (Important to update note editor)
1558 for (i=0;i<=tabWidget->count() -1;i++)
1561 me=(MapEditor*)tabWidget->page(i);
1564 currentMapEditor()->reselect();
1566 // Update actions to in menus and toolbars according to editor
1567 currentMapEditor()->updateActions();
1570 void Main::fileNew()
1572 QString fn="unnamed";
1573 MapEditor* medit = new MapEditor ( NULL,true);
1574 tabWidget->addTab (medit,fn);
1575 tabWidget->showPage(medit);
1576 medit->viewport()->setFocus();
1577 // For the very first map we do not have flagrows yet...
1578 medit->select("mc:");
1581 ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
1583 ErrorCode err=success;
1585 // fn is usually the archive, mapfile the file after uncompressing
1588 // Make fn absolute (needed for unzip)
1589 fn=QDir (fn).absPath();
1595 // Check, if map is already loaded
1597 while (i<=tabWidget->count() -1)
1599 me=(MapEditor*)tabWidget->page(i);
1600 if (me->getFilePath() == fn)
1602 // Already there, ask for confirmation
1603 QMessageBox mb( __VYM,
1604 tr("The map %1\nis already opened."
1605 "Opening the same map in multiple editors may lead \n"
1606 "to confusion when finishing working with vym."
1607 "Do you want to").arg(fn),
1608 QMessageBox::Warning,
1609 QMessageBox::Yes | QMessageBox::Default,
1610 QMessageBox::Cancel | QMessageBox::Escape,
1611 QMessageBox::NoButton);
1612 mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
1613 mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
1616 case QMessageBox::Yes:
1618 i=tabWidget->count();
1620 case QMessageBox::Cancel:
1632 if ( !fn.isEmpty() )
1634 me = currentMapEditor();
1635 int tabIndex=tabWidget->currentPageIndex();
1636 // Check first, if mapeditor exists
1637 // If it is not default AND we want a new map,
1638 // create a new mapeditor in a new tab
1639 if ( lmode==NewMap && (!me || !me->isDefault() ) )
1641 me = new MapEditor (tabWidget,true);
1642 tabWidget->addTab (me,fn);
1643 tabIndex=tabWidget->indexOf (me);
1644 tabWidget->setCurrentPage (tabIndex);
1647 // Check, if file exists (important for creating new files
1648 // from command line
1649 if (!QFile(fn).exists() )
1651 QMessageBox mb( __VYM,
1652 tr("This map does not exist:\n %1\nDo you want to create a new one?").arg(fn),
1653 QMessageBox::Question,
1655 QMessageBox::Cancel | QMessageBox::Default,
1656 QMessageBox::NoButton );
1658 mb.setButtonText( QMessageBox::Yes, tr("Create"));
1659 mb.setButtonText( QMessageBox::No, tr("Cancel"));
1662 case QMessageBox::Yes:
1664 currentMapEditor()->setFilePath(fn);
1665 tabWidget->setTabLabel (currentMapEditor(),
1666 currentMapEditor()->getFileName() );
1667 statusBar()->message( "Created " + fn , statusbarTime );
1670 case QMessageBox::Cancel:
1671 // don't create new map
1672 statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
1679 //tabWidget->currentPage() won't be NULL here, because of above...
1680 tabWidget->showPage(me);
1681 me->viewport()->setFocus();
1683 // Create temporary directory for packing
1684 char tmpdir1[]="/tmp/vym-XXXXXX";
1685 QString tmpMapDir=mkdtemp(tmpdir1);
1687 // Try to unzip file
1688 err=unzipDir (tmpMapDir,fn);
1692 me->setZipped(false);
1695 me->setZipped(true);
1697 // Look for mapname.xml
1698 mapfile= fn.left(fn.findRev(".",-1,true));
1699 mapfile=mapfile.section( '/', -1 );
1700 QFile file( tmpMapDir + "/" + mapfile + ".xml");
1701 if (!file.exists() )
1703 // mapname.xml does not exist, well,
1704 // maybe some renamed the mapname.vym file...
1705 // Try to find any .xml in the toplevel
1706 // directory of the .vym file
1707 QStringList flist=QDir (tmpMapDir).entryList("*.xml");
1708 if (flist.count()==1)
1710 // Only one entry, take this one
1711 mapfile=tmpMapDir + "/"+flist.first();
1714 for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it )
1715 *it=tmpMapDir + "/" + *it;
1716 // TODO Multiple entries, load all (but only the first one into this ME)
1717 //mainWindow->fileLoadFromTmp (flist);
1718 //returnCode=1; // Silently forget this attempt to load
1719 qWarning ("MainWindow::load (fn) multimap found...");
1722 if (flist.isEmpty() )
1724 QMessageBox::critical( 0, tr( "Critical Load Error" ),
1725 tr("Couldn't find a map (*.xml) in .vym archive.\n"));
1728 } //file doesn't exist
1730 mapfile=file.name();
1735 // Save existing filename in case we import
1736 QString fn_org=me->getFilePath();
1738 // Finally load map into mapEditor
1739 me->setFilePath (mapfile,fn);
1740 err=me->load(mapfile,lmode);
1742 // Restore old (maybe empty) filepath, if this is an import
1744 me->setFilePath (fn_org);
1747 // Finally check for errors and go home
1750 if (lmode==NewMap) fileCloseMap();
1751 statusBar()->message( "Could not load " + fn, statusbarTime );
1756 me->setFilePath (fn);
1757 tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
1758 if (fn.left(9)!="/tmp/vym-")
1760 // Only append to lastMaps if not loaded from a tmpDir
1761 // e.g. imported bookmarks are in a tmpDir
1762 lastMaps.prepend(me->getFilePath() );
1763 setupLastMapsMenu();
1765 actionFilePrint->setEnabled (true);
1767 statusBar()->message( "Loaded " + fn, statusbarTime );
1771 removeDir (QDir(tmpMapDir));
1777 void Main::fileLoad(const LoadMode &lmode)
1779 Q3FileDialog *fd=new Q3FileDialog( this);
1780 if (!lastFileDir.isEmpty())
1781 fd->setDir (lastFileDir);
1782 fd->setMode (Q3FileDialog::ExistingFiles);
1783 fd->addFilter ("XML (*.xml)");
1784 fd->addFilter ("VYM map (*.vym *.vyp)");
1788 fd->setCaption(tr("Load vym map"));
1791 fd->setCaption(tr("Import: Add vym map to selection"));
1794 fd->setCaption(tr("Import: Replace selection with vym map"));
1800 if ( fd->exec() == QDialog::Accepted )
1802 lastFileDir=fd->dirPath();
1803 QStringList flist = fd->selectedFiles();
1804 QStringList::Iterator it = flist.begin();
1805 while( it != flist.end() )
1808 fileLoad(*it, lmode);
1815 void Main::fileLoad()
1820 void Main::fileLoadLast(int i)
1822 fileLoad(QString(*lastMaps.at(lastMapsMenu->indexOf (i)) ),NewMap);
1825 void Main::fileSave(const SaveMode &savemode)
1827 // tmp dir for zipping
1831 ErrorCode err=success;
1833 QString safeFilePath;
1835 bool saveZipped=currentMapEditor()->saveZipped();
1837 MapEditor * me=currentMapEditor();
1840 QString fn=me->getFilePath();
1841 // filename=unnamed, filepath="" in constructor...
1842 if ( !fn.isEmpty() )
1844 // We have a filepath, go on saving
1845 // First remove existing file, we
1846 // don't want to add to old zip archives
1850 QMessageBox::warning( 0, tr( "Save Error" ),
1851 fn+ tr("\ncould not be removed before saving"));
1853 // Look, if we should zip the data:
1856 QMessageBox mb( __VYM,
1857 tr("The map %1\ndid not use the compressed "
1858 "vym file format.\nWriting it uncompressed will also write images \n"
1859 "and flags and thus may overwrite files in the "
1860 "given directory\n\nDo you want to write the map").arg(fn),
1861 QMessageBox::Warning,
1862 QMessageBox::Yes | QMessageBox::Default,
1864 QMessageBox::Cancel | QMessageBox::Escape);
1865 mb.setButtonText( QMessageBox::Yes, tr("compressed (vym default)") );
1866 mb.setButtonText( QMessageBox::No, tr("uncompressed") );
1867 mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
1870 case QMessageBox::Yes:
1871 // save compressed (default file format)
1874 case QMessageBox::No:
1875 // save uncompressed
1878 case QMessageBox::Cancel:
1887 char tmpdir1[]="/tmp/vym-XXXXXX";
1888 tmpMapDir=mkdtemp(tmpdir1);
1890 safeFilePath=me->getFilePath();
1891 me->setFilePath (tmpMapDir+"/"+
1892 me->getMapName()+ ".xml",
1894 me->save (savemode);
1895 me->setFilePath (safeFilePath);
1897 zipDir (tmpMapDir,fn);
1902 safeFilePath=me->getFilePath();
1903 me->setFilePath (fn, safeFilePath);
1904 me->save (savemode);
1905 me->setFilePath (safeFilePath);
1907 } // filepath available
1910 // We have no filepath yet,
1911 // call fileSaveAs() now, this will call fileSave()
1913 fileSaveAs(savemode);
1917 if (saveZipped && !tmpMapDir.isEmpty())
1919 removeDir (QDir(tmpMapDir));
1923 statusBar()->message(
1924 tr("Saved %1").arg(me->getFilePath()),
1926 lastMaps.prepend(me->getFilePath() );
1927 setupLastMapsMenu();
1929 statusBar()->message(
1930 tr("Couldn't save ").arg(me->getFilePath()),
1934 void Main::fileSave()
1936 fileSave (CompleteMap);
1939 void Main::fileSaveAs(const SaveMode& savemode)
1943 if (currentMapEditor())
1945 if (savemode==CompleteMap)
1946 fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
1948 fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
1949 if ( !fn.isEmpty() )
1951 // Check for existing file
1952 if (QFile (fn).exists())
1954 QMessageBox mb( __VYM,
1955 tr("The file %1\nexists already. Do you want to").arg(fn),
1956 QMessageBox::Warning,
1957 QMessageBox::Yes | QMessageBox::Default,
1958 QMessageBox::Cancel | QMessageBox::Escape,
1959 QMessageBox::NoButton);
1960 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
1961 mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
1964 case QMessageBox::Yes:
1967 case QMessageBox::Cancel:
1974 // New file, add extension to filename, if missing
1975 // This is always .vym or .vyp, depending on savemode
1976 if (savemode==CompleteMap)
1978 if (!fn.contains (".vym") && !fn.contains (".xml"))
1982 if (!fn.contains (".vyp") && !fn.contains (".xml"))
1991 currentMapEditor()->setFilePath(fn);
1995 if (savemode==CompleteMap)
1996 tabWidget->setTabLabel (currentMapEditor(),
1997 currentMapEditor()->getFileName() );
2003 void Main::fileSaveAs()
2005 fileSaveAs (CompleteMap);
2008 void Main::fileImportKDEBookmarks()
2010 ImportKDEBookmarks im;
2012 if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
2013 currentMapEditor()->setFilePath ("");
2016 void Main::fileImportFirefoxBookmarks()
2018 Q3FileDialog *fd=new Q3FileDialog( this);
2019 fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox");
2020 fd->setMode (Q3FileDialog::ExistingFiles);
2021 fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)");
2022 fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks"));
2025 if ( fd->exec() == QDialog::Accepted )
2027 ImportFirefoxBookmarks im;
2028 QStringList flist = fd->selectedFiles();
2029 QStringList::Iterator it = flist.begin();
2030 while( it != flist.end() )
2033 if (im.transform() &&
2034 success==fileLoad (im.getTransformedFile(),NewMap) &&
2035 currentMapEditor() )
2036 currentMapEditor()->setFilePath ("");
2043 void Main::fileImportMM()
2047 Q3FileDialog *fd=new Q3FileDialog( this);
2048 if (!lastFileDir.isEmpty())
2049 fd->setDir (lastFileDir);
2050 fd->setMode (Q3FileDialog::ExistingFiles);
2051 fd->addFilter ("Mind Manager (*.mmap)");
2052 fd->setCaption(tr("Import")+" "+"Mind Manager");
2055 if ( fd->exec() == QDialog::Accepted )
2057 lastFileDir=fd->dirPath();
2058 QStringList flist = fd->selectedFiles();
2059 QStringList::Iterator it = flist.begin();
2060 while( it != flist.end() )
2063 if (im.transform() &&
2064 success==fileLoad (im.getTransformedFile(),NewMap) &&
2065 currentMapEditor() )
2066 currentMapEditor()->setFilePath ("");
2075 void Main::fileImportDir()
2077 if (currentMapEditor())
2078 currentMapEditor()->importDir();
2081 void Main::fileExportXML()
2083 if (currentMapEditor())
2085 QString dir=browseDirectory(tr("Export XML to directory"));
2086 if (dir !="" && reallyWriteDirectory(dir) )
2087 currentMapEditor()->exportXML(dir);
2092 void Main::fileExportXHTML()
2094 MapEditor *me=currentMapEditor();
2098 ExportXHTMLDialog dia(this);
2099 dia.setFilePath (me->getFilePath() );
2100 dia.setMapName (me->getMapName() );
2103 if (dia.exec()==QDialog::Accepted)
2105 QString dir=dia.getDir();
2106 // Check, if warnings should be used before overwriting
2107 // the output directory
2110 ok=reallyWriteDirectory(dir);
2116 me->exportXML (dia.getDir() );
2117 dia.doExport(me->getMapName() );
2118 if (dia.hasChanged())
2125 void Main::fileExportImage(int item)
2127 MapEditor *me=currentMapEditor();
2130 QString fn = Q3FileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
2132 if ( !fn.isEmpty() )
2133 me->exportImage(fn,item);
2135 statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime );
2140 void Main::fileExportASCII()
2142 MapEditor *me=currentMapEditor();
2146 ex.setMapCenter(me->getMapCenter());
2147 ex.addFilter ("TXT (*.txt)");
2148 ex.setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
2149 if (ex.execDialog() )
2151 me->setExportMode(true);
2153 me->setExportMode(false);
2158 void Main::fileExportLaTeX()
2160 MapEditor *me=currentMapEditor();
2164 ex.setMapCenter(me->getMapCenter());
2165 ex.addFilter ("Tex (*.tex)");
2166 ex.setCaption(__VYM " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
2167 if (ex.execDialog() )
2169 me->setExportMode(true);
2171 me->setExportMode(false);
2176 void Main::fileExportKDEBookmarks()
2178 ExportKDEBookmarks ex;
2179 MapEditor *me=currentMapEditor();
2182 ex.setMapCenter (me->getMapCenter() );
2187 void Main::fileExportTaskjuggler()
2189 ExportTaskjuggler ex;
2190 MapEditor *me=currentMapEditor();
2193 ex.setMapCenter (me->getMapCenter() );
2194 ex.setCaption ( __VYM " - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
2195 ex.addFilter ("Taskjuggler (*.tjp)");
2196 if (ex.execDialog() )
2198 me->setExportMode(true);
2200 me->setExportMode(false);
2205 void Main::fileExportOOPresentation()
2207 ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office");
2208 // FIXME add extra info in dialog
2209 //ImagePreview *p =new ImagePreview (fd);
2210 //fd->setContentsPreviewEnabled( TRUE );
2211 //fd->setContentsPreview( p, p );
2212 //fd->setPreviewMode( QFileDialog::Contents );
2213 fd->setCaption(__VYM " - " +tr("Export to")+" Open Office");
2214 //fd->setDir (lastImageDir);
2217 if ( fd->exec() == QDialog::Accepted )
2219 QString fn=fd->selectedFile();
2220 //lastImageDir=fn.left(fn.findRev ("/"));
2221 if (currentMapEditor())
2222 currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());
2226 void Main::fileCloseMap()
2228 if (currentMapEditor())
2230 if (currentMapEditor()->hasChanged())
2232 QMessageBox mb( __VYM,
2233 tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
2234 QMessageBox::Warning,
2235 QMessageBox::Yes | QMessageBox::Default,
2237 QMessageBox::Cancel | QMessageBox::Escape );
2238 mb.setButtonText( QMessageBox::Yes, tr("Save modified map before closing it") );
2239 mb.setButtonText( QMessageBox::No, tr("Discard changes"));
2242 case QMessageBox::Yes:
2244 fileSave(CompleteMap);
2246 case QMessageBox::No:
2247 // close without saving
2249 case QMessageBox::Cancel:
2254 currentMapEditor()->closeMap();
2255 tabWidget->removePage(currentMapEditor());
2256 if (tabWidget->count()==0)
2257 actionFilePrint->setEnabled (false);
2261 void Main::filePrint()
2263 if (currentMapEditor())
2264 currentMapEditor()->print();
2267 void Main::fileExitVYM()
2269 // Check if one or more editors have changed
2272 for (i=0;i<=tabWidget->count() -1;i++)
2275 me=(MapEditor*)tabWidget->page(i);
2277 // If something changed, ask what to do
2278 if (me->isUnsaved())
2280 tabWidget->setCurrentPage(i);
2281 QMessageBox mb( __VYM,
2282 tr("This map is not saved yet. Do you want to"),
2283 QMessageBox::Warning,
2284 QMessageBox::Yes | QMessageBox::Default,
2286 QMessageBox::Cancel | QMessageBox::Escape );
2287 mb.setButtonText( QMessageBox::Yes, tr("Save map") );
2288 mb.setButtonText( QMessageBox::No, tr("Discard changes") );
2290 mb.setActiveWindow();
2291 switch( mb.exec() ) {
2292 case QMessageBox::Yes:
2293 // save (the changed editors) and exit
2294 fileSave(CompleteMap);
2296 case QMessageBox::No:
2297 // exit without saving
2299 case QMessageBox::Cancel:
2300 // don't save and don't exit
2304 } // loop over all MEs
2308 void Main::editUndo()
2310 if (currentMapEditor())
2311 currentMapEditor()->undo();
2314 void Main::editRedo()
2316 if (currentMapEditor())
2317 currentMapEditor()->redo();
2320 void Main::editCopy()
2322 if (currentMapEditor())
2323 currentMapEditor()->copy();
2326 void Main::editPaste()
2328 if (currentMapEditor())
2329 currentMapEditor()->paste();
2332 void Main::editCut()
2334 if (currentMapEditor())
2335 currentMapEditor()->cut();
2338 void Main::editOpenFindWindow()
2340 findWindow->popup();
2341 findWindow->raise();
2342 findWindow->setActiveWindow();
2345 void Main::editFind(QString s)
2348 BranchObj *bo=currentMapEditor()->findText(s, cs);
2351 statusBar()->message( "Found: " + bo->getHeading(), statusbarTime );
2354 QMessageBox::information( findWindow, tr( "VYM -Information:" ),
2355 tr("No matches found for \"%1\"").arg(s));
2359 void Main::editFindChanged()
2360 { // Notify editor, to abort the current find process
2361 currentMapEditor()->findReset();
2364 void Main::editOpenURL()
2367 if (currentMapEditor())
2369 QString url=currentMapEditor()->getURL();
2370 if (url=="") return;
2371 QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
2372 procBrowser = new Q3Process( this );
2374 procBrowser->addArgument( browser);
2375 procBrowser->addArgument( url);
2377 if ( !procBrowser->start() )
2379 // try to set path to browser
2380 QMessageBox::warning(0,
2382 tr("Couldn't find a viewer to open %1.\n").arg(url)+
2383 tr("Please use Settings->")+tr("Set application to open an URL"));
2388 void Main::editOpenURLTab()
2390 if (currentMapEditor())
2392 QString url=currentMapEditor()->getURL();
2393 if (url=="") return;
2394 QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
2395 if (procBrowser && procBrowser->isRunning())
2397 if (browser.contains("konqueror"))
2399 // Try to open new tab in existing konqueror started previously by vym
2400 Q3Process *p=new Q3Process (this);
2401 p->addArgument ("dcop");
2402 p->addArgument (QString("konqueror-%1").arg(procBrowser->processIdentifier()));
2403 p->addArgument ("konqueror-mainwindow#1");
2404 p->addArgument ("newTab");
2405 p->addArgument (url);
2407 // try to set browser
2408 QMessageBox::warning(0,
2410 tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
2412 } else if (browser.contains ("firefox") || browser.contains ("mozilla") )
2414 // Try to open new tab in firefox
2415 Q3Process *p=new Q3Process (this);
2416 p->addArgument (browser);
2417 p->addArgument ("-remote");
2418 p->addArgument (QString("openurl(%1,new-tab)").arg(url));
2420 // try to set browser
2421 QMessageBox::warning(0,
2423 tr("Couldn't start %1 to open a new tab").arg(browser));
2432 void Main::editURL()
2434 if (currentMapEditor())
2435 currentMapEditor()->editURL();
2438 void Main::editHeading2URL()
2440 if (currentMapEditor())
2441 currentMapEditor()->editHeading2URL();
2444 void Main::editBugzilla2URL()
2446 if (currentMapEditor())
2447 currentMapEditor()->editBugzilla2URL();
2450 void Main::editFATE2URL()
2452 if (currentMapEditor())
2453 currentMapEditor()->editFATE2URL();
2456 void Main::editOpenVymLink()
2458 // Get current path to map
2459 QString currentVymLink;
2460 if (currentMapEditor())
2462 currentVymLink=currentMapEditor()->getVymLink();
2463 // compare path with already loaded maps
2467 for (i=0;i<=tabWidget->count() -1;i++)
2469 me=(MapEditor*)tabWidget->page(i);
2470 if (currentVymLink==me->getFilePath() )
2479 if (!QFile(currentVymLink).exists() )
2480 QMessageBox::critical( 0, tr( "Critical Error" ),
2481 tr("Couldn't open map %1").arg(currentVymLink));
2484 fileLoad (currentVymLink, NewMap);
2485 tabWidget->setCurrentPage (tabWidget->count()-1);
2488 // Go to tab containing the map
2489 tabWidget->setCurrentPage (index);
2493 void Main::editVymLink()
2495 if (currentMapEditor())
2496 currentMapEditor()->editVymLink();
2499 void Main::editDeleteVymLink()
2501 if (currentMapEditor())
2502 currentMapEditor()->deleteVymLink();
2505 void Main::editToggleHideExport()
2507 if (currentMapEditor())
2508 currentMapEditor()->toggleHideExport();
2511 void Main::editMapInfo()
2513 if (currentMapEditor())
2514 currentMapEditor()->editMapInfo();
2517 void Main::editMoveUp()
2519 if (currentMapEditor())
2520 currentMapEditor()->moveBranchUp();
2523 void Main::editMoveDown()
2525 if (currentMapEditor())
2526 currentMapEditor()->moveBranchDown();
2529 void Main::editToggleScroll()
2531 if (currentMapEditor())
2533 currentMapEditor()->toggleScroll();
2537 void Main::editUnScrollAll()
2539 if (currentMapEditor())
2541 currentMapEditor()->unScrollAll();
2545 void Main::editHeading()
2547 if (currentMapEditor())
2548 currentMapEditor()->editHeading();
2551 void Main::editNewBranch()
2553 if (currentMapEditor())
2554 currentMapEditor()->addNewBranch(0);
2557 void Main::editNewBranchHere()
2559 if (currentMapEditor())
2560 currentMapEditor()->addNewBranchHere();
2563 void Main::editNewBranchAbove()
2565 if (currentMapEditor())
2566 currentMapEditor()->addNewBranch(-1);
2569 void Main::editNewBranchBelow()
2571 if (currentMapEditor())
2572 currentMapEditor()->addNewBranch(1);
2575 void Main::editImportAdd()
2577 fileLoad (ImportAdd);
2580 void Main::editImportReplace()
2582 fileLoad (ImportReplace);
2585 void Main::editSaveBranch()
2587 fileSaveAs (PartOfMap);
2590 void Main::editRemoveBranchKeepChilds()
2592 if (currentMapEditor())
2593 currentMapEditor()->removeBranchKeepChilds();
2596 void Main::editRemoveChilds()
2598 if (currentMapEditor())
2599 currentMapEditor()->removeChilds();
2602 void Main::editDeleteSelection()
2604 if (currentMapEditor() && actionSettingsUseDelKey->isOn())
2605 currentMapEditor()->deleteSelection();
2608 void Main::editUpperBranch()
2610 if (currentMapEditor())
2611 currentMapEditor()->selectUpperBranch();
2614 void Main::editLowerBranch()
2616 if (currentMapEditor())
2617 currentMapEditor()->selectLowerBranch();
2620 void Main::editLeftBranch()
2622 if (currentMapEditor())
2623 currentMapEditor()->selectLeftBranch();
2626 void Main::editRightBranch()
2628 if (currentMapEditor())
2629 currentMapEditor()->selectRightBranch();
2632 void Main::editFirstBranch()
2634 if (currentMapEditor())
2635 currentMapEditor()->selectFirstBranch();
2638 void Main::editLastBranch()
2640 if (currentMapEditor())
2641 currentMapEditor()->selectLastBranch();
2644 void Main::editLoadImage()
2646 if (currentMapEditor())
2647 currentMapEditor()->loadFloatImage();
2650 void Main::editSaveImage(int item)
2652 if (currentMapEditor())
2653 currentMapEditor()->saveFloatImage(item);
2656 void Main::editFollowXLink(int item)
2658 if (currentMapEditor())
2659 currentMapEditor()->followXLink(branchLinksContextMenu->indexOf(item));
2662 void Main::editEditXLink(int item)
2664 if (currentMapEditor())
2665 currentMapEditor()->editXLink(branchLinksContextMenuDup->indexOf(item));
2668 void Main::formatSelectColor()
2670 if (currentMapEditor())
2672 QColor col = QColorDialog::getColor( currentMapEditor()->color(), this );
2673 if ( !col.isValid() ) return;
2674 currentMapEditor()->setColor( col );
2675 colorChanged( col );
2679 void Main::formatPickColor()
2681 if (currentMapEditor())
2682 colorChanged( currentMapEditor()->pickColor() );
2685 void Main::colorChanged(QColor c)
2687 QPixmap pix( 16, 16 );
2689 actionFormatColor->setIconSet( pix );
2692 void Main::formatColorItem()
2694 if (currentMapEditor())
2695 currentMapEditor()->colorItem();
2698 void Main::formatColorBranch()
2700 if (currentMapEditor())
2701 currentMapEditor()->colorBranch();
2704 void Main::formatLinkStyleLine()
2706 if (currentMapEditor())
2707 currentMapEditor()->setLinkStyle(StyleLine);
2710 void Main::formatLinkStyleParabel()
2712 if (currentMapEditor())
2713 currentMapEditor()->setLinkStyle(StyleParabel);
2716 void Main::formatLinkStylePolyLine()
2718 if (currentMapEditor())
2719 currentMapEditor()->setLinkStyle(StylePolyLine);
2722 void Main::formatLinkStylePolyParabel()
2724 if (currentMapEditor())
2725 currentMapEditor()->setLinkStyle(StylePolyParabel);
2728 void Main::formatSelectBackColor()
2730 if (currentMapEditor())
2731 currentMapEditor()->selectBackgroundColor();
2734 void Main::formatSelectLinkColor()
2736 if (currentMapEditor())
2737 currentMapEditor()->selectLinkColor();
2740 void Main::formatToggleLinkColorHint()
2742 currentMapEditor()->toggleLinkColorHint();
2745 void Main::formatFrameNone()
2747 if (currentMapEditor())
2748 currentMapEditor()->setFrame(NoFrame);
2751 void Main::formatFrameRectangle()
2753 if (currentMapEditor())
2754 currentMapEditor()->setFrame(Rectangle);
2757 void Main::formatIncludeImagesVer()
2759 if (currentMapEditor())
2760 currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn());
2763 void Main::formatIncludeImagesHor()
2765 if (currentMapEditor())
2766 currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
2769 void Main::formatHideLinkUnselected()
2771 if (currentMapEditor())
2772 currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
2775 void Main::viewZoomReset()
2777 if (currentMapEditor())
2781 currentMapEditor()->setWorldMatrix( m );
2782 currentMapEditor()->setViewCenter();
2783 currentMapEditor()->adjustCanvasSize();
2787 void Main::viewZoomIn()
2789 if (currentMapEditor())
2791 QMatrix m = currentMapEditor()->worldMatrix();
2792 m.scale( 1.25, 1.25 );
2793 currentMapEditor()->setWorldMatrix( m );
2794 currentMapEditor()->setViewCenter();
2795 currentMapEditor()->adjustCanvasSize();
2799 void Main::viewZoomOut()
2801 if (currentMapEditor())
2803 QMatrix m = currentMapEditor()->worldMatrix();
2804 m.scale( 0.8, 0.8 );
2805 currentMapEditor()->setWorldMatrix( m );
2806 currentMapEditor()->setViewCenter();
2807 currentMapEditor()->adjustCanvasSize();
2811 void Main::modModeColor()
2815 void Main::modModeLink()
2819 bool Main::settingsPDF()
2821 // Default browser is set in constructor
2823 QString text = QInputDialog::getText(
2824 "VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
2825 settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this );
2827 settings.writeEntry ("/vym/mainwindow/readerPDF",text);
2832 bool Main::settingsURL()
2834 // Default browser is set in constructor
2836 QString text = QInputDialog::getText(
2837 "VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
2838 settings.readEntry("/vym/mainwindow/readerURL")
2841 settings.writeEntry ("/vym/mainwindow/readerURL",text);
2845 void Main::settingsToggleDelKey()
2847 if (actionSettingsUseDelKey->isOn())
2849 actionEditDelete->setAccel (QKeySequence (Qt::Key_Delete));
2852 actionEditDelete->setAccel (QKeySequence (""));
2856 void Main::windowToggleNoteEditor()
2858 if (textEditor->showWithMain() )
2859 windowHideNoteEditor();
2861 windowShowNoteEditor();
2864 void Main::windowToggleHistory()
2866 if (currentMapEditor())
2867 currentMapEditor()->toggleHistoryWindow();
2870 void Main::updateNoteFlag()
2872 if (currentMapEditor())
2873 currentMapEditor()->updateNoteFlag();
2876 void Main::windowShowNoteEditor()
2878 textEditor->setShowWithMain(true);
2880 actionViewToggleNoteEditor->setOn (true);
2883 void Main::windowHideNoteEditor()
2885 textEditor->setShowWithMain(false);
2887 actionViewToggleNoteEditor->setOn (false);
2890 void Main::windowNextEditor()
2892 if (tabWidget->currentPageIndex() < tabWidget->count())
2893 tabWidget->setCurrentPage (tabWidget->currentPageIndex() +1);
2896 void Main::windowPreviousEditor()
2898 if (tabWidget->currentPageIndex() >0)
2899 tabWidget->setCurrentPage (tabWidget->currentPageIndex() -1);
2902 void Main::standardFlagChanged()
2904 currentMapEditor()->toggleStandardFlag(sender()->name());
2907 void Main::testFunction()
2909 currentMapEditor()->testFunction();
2912 void Main::helpDoc()
2915 #if defined(Q_OS_MACX)
2916 docpath="./vym.app/Contents/vym.pdf";
2918 // default path in SUSE LINUX
2919 docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
2922 if (!QFile (docpath).exists() )
2924 // relative path for easy testing in tarball
2925 docpath="doc/vym.pdf";
2926 if (!QFile (docpath).exists() )
2928 // relative path for testing while still writing vym.tex
2929 docpath="doc/tex/vym.pdf";
2930 if (!QFile (docpath).exists() )
2932 // Try yet another one for Knoppix
2933 docpath="/usr/share/doc/packages/vym/vym.pdf";
2934 if (!QFile (docpath).exists() )
2936 QMessageBox::critical(0,
2937 tr("Critcal error"),
2938 tr("Couldn't find the documentation\n"
2939 "vym.pdf in various places."));
2946 Process *pdfProc = new Process();
2947 pdfProc->clearArguments();
2948 pdfProc->addArgument( settings.readEntry("/vym/mainwindow/readerPDF"));
2949 pdfProc->addArgument( docpath);
2951 if ( !pdfProc->start() )
2954 QMessageBox::warning(0,
2956 tr("Couldn't find a viewer to open %1.\n").arg("vym.pdf")+
2957 tr("Please use Settings->")+tr("Set application to open PDF files"));
2964 void Main::helpAbout()
2967 ad.setName ("aboutwindow");
2968 ad.setMinimumSize(500,500);
2969 ad.resize (QSize (500,500));
2973 void Main::helpAboutQT()
2975 QMessageBox::aboutQt( this, "Qt Application Example" );