diff -r fac2248e2afa -r 832e96c9abb6 vymmodel.cpp --- a/vymmodel.cpp Mon Mar 08 12:22:15 2010 +0000 +++ b/vymmodel.cpp Mon Mar 08 12:24:26 2010 +0000 @@ -12,6 +12,7 @@ #include "exporthtmldialog.h" #include "exportxhtmldialog.h" #include "file.h" +#include "findresultmodel.h" #include "geometry.h" // for addBBox #include "mainwindow.h" #include "misc.h" @@ -1608,7 +1609,24 @@ } } -BranchItem* VymModel::findText (QString s, bool cs) +void VymModel::findAll (FindResultModel *rmodel, QString s, Qt::CaseSensitivity cs) +{ + rmodel->clear(); + BranchItem *cur=NULL; + BranchItem *prev=NULL; + nextBranch(cur,prev); + while (cur) + { + if (cur->getHeading().contains (s,cs)) + { + rmodel->addItem (cur); + } + //if (cur->getNote().contains (s,cs)) //FIXME-2 does not detect multiple occurences + nextBranch(cur,prev); + } +} + +BranchItem* VymModel::findText (QString s,Qt::CaseSensitivity cs,QTextCursor &cursor) { if (!s.isEmpty() && s!=findString) { @@ -1617,7 +1635,7 @@ } QTextDocument::FindFlags flags=0; - if (cs) flags=QTextDocument::FindCaseSensitively; + if (cs==Qt::CaseSensitive) flags=QTextDocument::FindCaseSensitively; if (!findCurrent) { // Nothing found or new find process @@ -1638,14 +1656,7 @@ if (findCurrent->getNote().contains(findString,cs)) { select (findCurrent); - /* - if (getSelectedBranch()!=itFind) - { - select(itFind); - emitShowSelection(); - } - */ - if (textEditor->findText(findString,flags)) + if (textEditor->findText(findString,flags,cursor)) { searching=false; foundNote=true; @@ -1663,7 +1674,6 @@ if (!nextBranch(findCurrent,findPrevious) ) EOFind=true; } - //cout <<"still searching... "<getHeading())<depth()<2) return; pi=(BranchItem*)(selbi->parent()); - // Check if we have childs at all to keep + // Check if we have children at all to keep if (selbi->branchCount()==0) { deleteSelection();