1.1 --- a/mainwindow.cpp Mon Mar 22 15:37:23 2010 +0000
1.2 +++ b/mainwindow.cpp Tue Mar 30 17:30:39 2010 +0000
1.3 @@ -23,6 +23,7 @@
1.4 #include "settings.h"
1.5 #include "shortcuts.h"
1.6 #include "texteditor.h"
1.7 +#include "treeeditor.h"
1.8 #include "warningdialog.h"
1.9 #include "xlinkitem.h"
1.10
1.11 @@ -138,6 +139,8 @@
1.12 dw->setObjectName ("FindResultWidget");
1.13 dw->hide();
1.14 addDockWidget (Qt::RightDockWidgetArea,dw);
1.15 + connect (findResultWidget, SIGNAL (noteSelected (QString, int)),this, SLOT (selectInNoteEditor (QString, int)));
1.16 +
1.17
1.18 // Satellite windows //////////////////////////////////////////
1.19 // history window
1.20 @@ -234,7 +237,8 @@
1.21 setupSettingsActions();
1.22 setupContextMenus();
1.23 setupMacros();
1.24 - if (debug) switchboard.print();
1.25 + if (options.isOn("shortcuts")) switchboard.print();
1.26 + if (options.isOn("shortcutsLaTeX")) switchboard.printLaTeX();
1.27
1.28 if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions();
1.29 setupHelpActions();
1.30 @@ -628,9 +632,12 @@
1.31
1.32 // Shortcut to add attribute
1.33 a= new QAction(tr( "Add attribute" ), this);
1.34 - a->setShortcut ( Qt::Key_Q);
1.35 - a->setShortcutContext (Qt::WindowShortcut);
1.36 - switchboard.addConnection(a,tr("Edit","Shortcut group"));
1.37 + if (settings.value( "/mainwindow/showTestMenu",false).toBool() )
1.38 + {
1.39 + a->setShortcut ( Qt::Key_Q);
1.40 + a->setShortcutContext (Qt::WindowShortcut);
1.41 + switchboard.addConnection(a,tr("Edit","Shortcut group"));
1.42 + }
1.43 addAction (a);
1.44 connect( a, SIGNAL( triggered() ), this, SLOT( editAddAttribute() ) );
1.45 actionAddAttribute= a;
1.46 @@ -719,7 +726,7 @@
1.47
1.48 a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up","Edit menu" ), this);
1.49 a->setStatusTip ( tr( "Move branch up" ) );
1.50 - a->setShortcut (Qt::Key_PageUp ); // Move branch up
1.51 + a->setShortcut (Qt::Key_PageUp ); // Move branch up //FIXME-2 If already on top, GraphicsView scrolls up, probably because this action is disabled?!
1.52 a->setEnabled (false);
1.53 switchboard.addConnection(a,tr("Edit","Shortcut group"));
1.54 tb->addAction (a);
1.55 @@ -1224,7 +1231,8 @@
1.56 connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) );
1.57 actionViewToggleNoteEditor=a;
1.58
1.59 - a = new QAction(QPixmap(), tr( "Show tree editor","View action" ),this);
1.60 + // Original icon is "category" from KDE
1.61 + a = new QAction(QPixmap(iconPath+"treeeditor.png"), tr( "Show tree editor","View action" ),this);
1.62 a->setStatusTip ( tr( "Show tree editor" ));
1.63 a->setShortcut ( Qt::CTRL + Qt::Key_T ); // Toggle Tree Editor // FIXME-3 originally: color subtree
1.64 switchboard.addConnection(a,tr("View shortcuts","Shortcut group"));
1.65 @@ -2730,13 +2738,12 @@
1.66 void Main::editFindNext(QString s)
1.67 {
1.68 Qt::CaseSensitivity cs=Qt::CaseInsensitive;
1.69 - QTextCursor cursor;
1.70 VymModel *m=currentModel();
1.71 if (m)
1.72 {
1.73 m->findAll (findResultWidget->getResultModel(),s,cs);
1.74
1.75 - BranchItem *bi=m->findText(s, cs,cursor);
1.76 + BranchItem *bi=m->findText(s, cs);
1.77 if (bi)
1.78 {
1.79 findWidget->setStatus (FindWidget::Success);
1.80 @@ -3636,6 +3643,13 @@
1.81 textEditor->setNote (ti->getNoteObj() );
1.82 }
1.83
1.84 +void Main::selectInNoteEditor(QString s,int i)
1.85 +{
1.86 + // TreeItem is already selected at this time, therefor
1.87 + // the note is already in the editor
1.88 + textEditor->findText (s,0,i);
1.89 +}
1.90 +
1.91 void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel)
1.92 {
1.93 branchPropertyWindow->setModel (model ); //FIXME-3 this used to be called from BranchObj::select(). Maybe use signal now...
1.94 @@ -3681,6 +3695,10 @@
1.95 actionViewToggleNoteEditor->setChecked (textEditor->isVisible());
1.96 actionViewToggleHistoryWindow->setChecked (historyWindow->isVisible());
1.97 actionViewTogglePropertyWindow->setChecked (branchPropertyWindow->isVisible());
1.98 + if ( tabWidget->currentPage())
1.99 + actionViewToggleTreeEditor->setChecked (
1.100 + vymViews.at(tabWidget->currentIndex())->getTreeEditor()->isVisible()
1.101 + );
1.102
1.103 VymModel *m =currentModel();
1.104 if (m)