diff -r 46553c106c52 -r bec082472471 mainwindow.cpp --- a/mainwindow.cpp Mon Mar 22 15:37:23 2010 +0000 +++ b/mainwindow.cpp Tue Mar 30 17:30:39 2010 +0000 @@ -23,6 +23,7 @@ #include "settings.h" #include "shortcuts.h" #include "texteditor.h" +#include "treeeditor.h" #include "warningdialog.h" #include "xlinkitem.h" @@ -138,6 +139,8 @@ dw->setObjectName ("FindResultWidget"); dw->hide(); addDockWidget (Qt::RightDockWidgetArea,dw); + connect (findResultWidget, SIGNAL (noteSelected (QString, int)),this, SLOT (selectInNoteEditor (QString, int))); + // Satellite windows ////////////////////////////////////////// // history window @@ -234,7 +237,8 @@ setupSettingsActions(); setupContextMenus(); setupMacros(); - if (debug) switchboard.print(); + if (options.isOn("shortcuts")) switchboard.print(); + if (options.isOn("shortcutsLaTeX")) switchboard.printLaTeX(); if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions(); setupHelpActions(); @@ -628,9 +632,12 @@ // Shortcut to add attribute a= new QAction(tr( "Add attribute" ), this); - a->setShortcut ( Qt::Key_Q); - a->setShortcutContext (Qt::WindowShortcut); - switchboard.addConnection(a,tr("Edit","Shortcut group")); + if (settings.value( "/mainwindow/showTestMenu",false).toBool() ) + { + a->setShortcut ( Qt::Key_Q); + a->setShortcutContext (Qt::WindowShortcut); + switchboard.addConnection(a,tr("Edit","Shortcut group")); + } addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editAddAttribute() ) ); actionAddAttribute= a; @@ -719,7 +726,7 @@ a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up","Edit menu" ), this); a->setStatusTip ( tr( "Move branch up" ) ); - a->setShortcut (Qt::Key_PageUp ); // Move branch up + a->setShortcut (Qt::Key_PageUp ); // Move branch up //FIXME-2 If already on top, GraphicsView scrolls up, probably because this action is disabled?! a->setEnabled (false); switchboard.addConnection(a,tr("Edit","Shortcut group")); tb->addAction (a); @@ -1224,7 +1231,8 @@ connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) ); actionViewToggleNoteEditor=a; - a = new QAction(QPixmap(), tr( "Show tree editor","View action" ),this); + // Original icon is "category" from KDE + a = new QAction(QPixmap(iconPath+"treeeditor.png"), tr( "Show tree editor","View action" ),this); a->setStatusTip ( tr( "Show tree editor" )); a->setShortcut ( Qt::CTRL + Qt::Key_T ); // Toggle Tree Editor // FIXME-3 originally: color subtree switchboard.addConnection(a,tr("View shortcuts","Shortcut group")); @@ -2730,13 +2738,12 @@ void Main::editFindNext(QString s) { Qt::CaseSensitivity cs=Qt::CaseInsensitive; - QTextCursor cursor; VymModel *m=currentModel(); if (m) { m->findAll (findResultWidget->getResultModel(),s,cs); - BranchItem *bi=m->findText(s, cs,cursor); + BranchItem *bi=m->findText(s, cs); if (bi) { findWidget->setStatus (FindWidget::Success); @@ -3636,6 +3643,13 @@ textEditor->setNote (ti->getNoteObj() ); } +void Main::selectInNoteEditor(QString s,int i) +{ + // TreeItem is already selected at this time, therefor + // the note is already in the editor + textEditor->findText (s,0,i); +} + void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel) { branchPropertyWindow->setModel (model ); //FIXME-3 this used to be called from BranchObj::select(). Maybe use signal now... @@ -3681,6 +3695,10 @@ actionViewToggleNoteEditor->setChecked (textEditor->isVisible()); actionViewToggleHistoryWindow->setChecked (historyWindow->isVisible()); actionViewTogglePropertyWindow->setChecked (branchPropertyWindow->isVisible()); + if ( tabWidget->currentPage()) + actionViewToggleTreeEditor->setChecked ( + vymViews.at(tabWidget->currentIndex())->getTreeEditor()->isVisible() + ); VymModel *m =currentModel(); if (m)