Marco Bravi wrote:
Il giorno ven, 16/03/2007 alle 16.10 +0100, Marco Bravi ha scritto:
I will try the patch in the next couple of days or so. However, I tend
to work with 3-4 databases at once but not so big (overall, there may be
some hundreds of references inside, not more).
There is an annoying delay in simple typing speed, as you anticipated. I
think the solution below might be workable and (almost) elegant. You
don't search until the user has not stopped typing for a certain amount
of time. I think 500 ms might be a good starting value. You do not
experience typing delays, and could still search fast.
Please try my newer patch (attached) and report back.
It could be replaced by simply sensing the writer stopping typing for a
short time (say, 0.5 to 1 sec), and assuming that he wants to update
the search results; after all, if you have to press "Next", you must
have to leave the keyboard for at least as much time as that...
There is one bug in the patch, as one matching record is found twice (I
think you are counting the second match on the key!).
Indeed, I'll correct that.
Abdel.
PS: please try to keep the development list in copy.
Index: QCitation.C
===================================================================
--- QCitation.C (revision 17455)
+++ QCitation.C (working copy)
@@ -113,8 +113,21 @@
void QCitation::findKey(QString const & str)
{
- QStringList sl = available_keys_.stringList().filter(str,
Qt::CaseInsensitive);
- found_keys_.setStringList(sl);
+ QStringList keys = (str.size() > 1)?
+ found_keys_.stringList() : available_keys_.stringList();
+ QStringList result;
+
+ // First search within the key info:
+ for (int i = 0; i < keys.size(); ++i) {
+ QString info = getKeyInfo(keys[i]);
+ if (info.contains(str, Qt::CaseInsensitive))
+ result += keys[i];
+ }
+
+ // Then add also the matching keys:
+ result += keys.filter(str, Qt::CaseInsensitive);
+
+ found_keys_.setStringList(result);
}