1.1 --- a/vymmodel.cpp Tue Mar 09 08:28:49 2010 +0000
1.2 +++ b/vymmodel.cpp Tue Mar 09 08:29:09 2010 +0000
1.3 @@ -1553,7 +1553,6 @@
1.4 TreeItem *selti=getSelectedItem();
1.5 if (selti)
1.6 {
1.7 - emitNoteHasChanged(selti);
1.8 saveState(
1.9 selti,
1.10 "setNote (\""+selti->getNote()+"\")",
1.11 @@ -1561,7 +1560,8 @@
1.12 "setNote (\""+s+"\")",
1.13 QString("Set note of %1 ").arg(getObjectName(selti)) );
1.14 }
1.15 - selti->setNote(s);
1.16 + selti->setNote(s);
1.17 + emitNoteHasChanged(selti);
1.18 }
1.19
1.20 QString VymModel::getNote()
1.21 @@ -1573,6 +1573,39 @@
1.22 return QString();
1.23 }
1.24
1.25 +void VymModel::loadNote (const QString &fn)
1.26 +{
1.27 + BranchItem *selbi=getSelectedBranch();
1.28 + if (selbi)
1.29 + {
1.30 + QString n;
1.31 + if (!loadStringFromDisk (fn,n))
1.32 + qWarning ()<<"VymModel::loadNote Couldn't load "<<fn;
1.33 + else
1.34 + setNote (n);
1.35 + } else
1.36 + qWarning ("VymModel::loadNote no branch selected");
1.37 +}
1.38 +
1.39 +void VymModel::saveNote (const QString &fn)
1.40 +{
1.41 + BranchItem *selbi=getSelectedBranch();
1.42 + if (selbi)
1.43 + {
1.44 + QString n=selbi->getNote();
1.45 + if (n.isEmpty())
1.46 + qWarning ()<<"VymModel::saveNote note is empty, won't save to "<<fn;
1.47 + else
1.48 + {
1.49 + if (!saveStringToDisk (fn,n))
1.50 + qWarning ()<<"VymModel::saveNote Couldn't save "<<fn;
1.51 + else
1.52 + selbi->setNote (n);
1.53 + }
1.54 + } else
1.55 + qWarning ("VymModel::saveNote no branch selected");
1.56 +}
1.57 +
1.58 void VymModel::findDuplicateURLs() // FIXME-3 needs GUI
1.59 {
1.60 // Generate map containing _all_ URLs and branches
1.61 @@ -1612,6 +1645,7 @@
1.62 void VymModel::findAll (FindResultModel *rmodel, QString s, Qt::CaseSensitivity cs)
1.63 {
1.64 rmodel->clear();
1.65 + int i=0;
1.66 BranchItem *cur=NULL;
1.67 BranchItem *prev=NULL;
1.68 nextBranch(cur,prev);
1.69 @@ -1621,7 +1655,14 @@
1.70 {
1.71 rmodel->addItem (cur);
1.72 }
1.73 - //if (cur->getNote().contains (s,cs)) //FIXME-2 does not detect multiple occurences
1.74 + //if (cur->getNote().contains (s,cs)) //FIXME-2 does not detect multiple occurences yet
1.75 + while (i>=0)
1.76 + {
1.77 + i=cur->getNote().indexOf (s,i,cs);
1.78 + if (i>=0) i++;
1.79 + qDebug()<<"i="<<i;
1.80 +
1.81 + }
1.82 nextBranch(cur,prev);
1.83 }
1.84 }
1.85 @@ -3526,6 +3567,20 @@
1.86 if (ok) loadFloatImageInt (selbi,s);
1.87 }
1.88 /////////////////////////////////////////////////////////////////////
1.89 + } else if (com=="loadNote")
1.90 + {
1.91 + if (!selti)
1.92 + {
1.93 + parser.setError (Aborted,"Nothing selected");
1.94 + } else if (! selbi )
1.95 + {
1.96 + parser.setError (Aborted,"Type of selection is not a branch");
1.97 + } else if (parser.checkParCount(1))
1.98 + {
1.99 + s=parser.parString(ok,0);
1.100 + if (ok) loadNote (s);
1.101 + }
1.102 + /////////////////////////////////////////////////////////////////////
1.103 } else if (com=="moveUp")
1.104 {
1.105 if (!selti )
1.106 @@ -3691,6 +3746,20 @@
1.107 }
1.108 }
1.109 /////////////////////////////////////////////////////////////////////
1.110 + } else if (com=="saveNote")
1.111 + {
1.112 + if (!selti)
1.113 + {
1.114 + parser.setError (Aborted,"Nothing selected");
1.115 + } else if (! selbi )
1.116 + {
1.117 + parser.setError (Aborted,"Type of selection is not a branch");
1.118 + } else if (parser.checkParCount(1))
1.119 + {
1.120 + s=parser.parString(ok,0);
1.121 + if (ok) saveNote (s);
1.122 + }
1.123 + /////////////////////////////////////////////////////////////////////
1.124 } else if (com=="scroll")
1.125 {
1.126 if (!selti)