1.1 --- a/vymmodel.cpp Mon Mar 08 12:22:15 2010 +0000
1.2 +++ b/vymmodel.cpp Mon Mar 08 12:24:26 2010 +0000
1.3 @@ -12,6 +12,7 @@
1.4 #include "exporthtmldialog.h"
1.5 #include "exportxhtmldialog.h"
1.6 #include "file.h"
1.7 +#include "findresultmodel.h"
1.8 #include "geometry.h" // for addBBox
1.9 #include "mainwindow.h"
1.10 #include "misc.h"
1.11 @@ -1608,7 +1609,24 @@
1.12 }
1.13 }
1.14
1.15 -BranchItem* VymModel::findText (QString s, bool cs)
1.16 +void VymModel::findAll (FindResultModel *rmodel, QString s, Qt::CaseSensitivity cs)
1.17 +{
1.18 + rmodel->clear();
1.19 + BranchItem *cur=NULL;
1.20 + BranchItem *prev=NULL;
1.21 + nextBranch(cur,prev);
1.22 + while (cur)
1.23 + {
1.24 + if (cur->getHeading().contains (s,cs))
1.25 + {
1.26 + rmodel->addItem (cur);
1.27 + }
1.28 + //if (cur->getNote().contains (s,cs)) //FIXME-2 does not detect multiple occurences
1.29 + nextBranch(cur,prev);
1.30 + }
1.31 +}
1.32 +
1.33 +BranchItem* VymModel::findText (QString s,Qt::CaseSensitivity cs,QTextCursor &cursor)
1.34 {
1.35 if (!s.isEmpty() && s!=findString)
1.36 {
1.37 @@ -1617,7 +1635,7 @@
1.38 }
1.39
1.40 QTextDocument::FindFlags flags=0;
1.41 - if (cs) flags=QTextDocument::FindCaseSensitively;
1.42 + if (cs==Qt::CaseSensitive) flags=QTextDocument::FindCaseSensitively;
1.43
1.44 if (!findCurrent)
1.45 { // Nothing found or new find process
1.46 @@ -1638,14 +1656,7 @@
1.47 if (findCurrent->getNote().contains(findString,cs))
1.48 {
1.49 select (findCurrent);
1.50 - /*
1.51 - if (getSelectedBranch()!=itFind)
1.52 - {
1.53 - select(itFind);
1.54 - emitShowSelection();
1.55 - }
1.56 - */
1.57 - if (textEditor->findText(findString,flags))
1.58 + if (textEditor->findText(findString,flags,cursor))
1.59 {
1.60 searching=false;
1.61 foundNote=true;
1.62 @@ -1663,7 +1674,6 @@
1.63 if (!nextBranch(findCurrent,findPrevious) )
1.64 EOFind=true;
1.65 }
1.66 - //cout <<"still searching... "<<qPrintable( itFind->getHeading())<<endl;
1.67 }
1.68 if (!searching)
1.69 return getSelectedBranch();
1.70 @@ -1679,11 +1689,6 @@
1.71 EOFind=false;
1.72 }
1.73
1.74 -void VymModel::emitShowFindWidget()
1.75 -{
1.76 - emit (showFindWidget());
1.77 -}
1.78 -
1.79 void VymModel::setScene (QGraphicsScene *s)
1.80 {
1.81 mapScene=s;
1.82 @@ -2549,7 +2554,7 @@
1.83 if (selbi->depth()<2) return;
1.84
1.85 pi=(BranchItem*)(selbi->parent());
1.86 - // Check if we have childs at all to keep
1.87 + // Check if we have children at all to keep
1.88 if (selbi->branchCount()==0)
1.89 {
1.90 deleteSelection();