|
a/src/qtgui/ssearch_w.cpp |
|
b/src/qtgui/ssearch_w.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.11 2006-11-13 08:58:47 dockes Exp $ (C) 2006 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.12 2006-11-30 13:38:44 dockes Exp $ (C) 2006 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
67 |
}
|
67 |
}
|
68 |
}
|
68 |
}
|
69 |
|
69 |
|
70 |
void SSearch::startSimpleSearch()
|
70 |
void SSearch::startSimpleSearch()
|
71 |
{
|
71 |
{
|
72 |
LOGDEB(("SSearch::startSimpleSearch\n"));
|
|
|
73 |
|
|
|
74 |
if (queryText->currentText().length() == 0)
|
72 |
if (queryText->currentText().length() == 0)
|
75 |
return;
|
73 |
return;
|
76 |
RefCntr<Rcl::SearchData> sdata(new Rcl::SearchData(Rcl::SCLT_AND));
|
74 |
RefCntr<Rcl::SearchData> sdata(new Rcl::SearchData(Rcl::SCLT_AND));
|
77 |
QCString u8 = queryText->currentText().utf8();
|
75 |
string u8 = (const char *)queryText->currentText().utf8();
|
|
|
76 |
|
|
|
77 |
LOGDEB(("SSearch::startSimpleSearch: [%s]\n", u8.c_str()));
|
|
|
78 |
|
78 |
switch (searchTypCMB->currentItem()) {
|
79 |
switch (searchTypCMB->currentItem()) {
|
79 |
case 0:
|
80 |
case 0:
|
80 |
default:
|
81 |
default:
|
81 |
{
|
|
|
82 |
QString comp = queryText->currentText();
|
|
|
83 |
// If this is an or and we're set for autophrase and there are
|
82 |
// If this is an or and we're set for autophrase and there are
|
84 |
// no quotes in the query, add a phrase search
|
83 |
// no quotes in the query, add a phrase search
|
85 |
if (prefs.ssearchAutoPhrase && comp.find('"', 0) == -1) {
|
84 |
if (prefs.ssearchAutoPhrase &&
|
86 |
comp += QString::fromAscii(" \"") + comp +
|
85 |
u8.find_first_of("\"") == string::npos) {
|
87 |
QString::fromAscii("\"");
|
86 |
u8 += string(" \"") + u8 + "\"";
|
88 |
u8 = comp.utf8();
|
|
|
89 |
}
|
|
|
90 |
sdata->addClause(new Rcl::SearchDataClauseSimple(Rcl::SCLT_OR,
|
|
|
91 |
(const char *)u8));
|
|
|
92 |
}
|
87 |
}
|
|
|
88 |
sdata->addClause(new Rcl::SearchDataClauseSimple(Rcl::SCLT_OR, u8));
|
93 |
break;
|
89 |
break;
|
94 |
case 1:
|
90 |
case 1:
|
95 |
sdata->addClause(new Rcl::SearchDataClauseSimple(Rcl::SCLT_AND,
|
91 |
sdata->addClause(new Rcl::SearchDataClauseSimple(Rcl::SCLT_AND, u8));
|
96 |
(const char *)u8));
|
|
|
97 |
break;
|
92 |
break;
|
98 |
case 2:
|
93 |
case 2:
|
99 |
sdata->addClause(new Rcl::SearchDataClauseFilename((const char *)u8));
|
94 |
sdata->addClause(new Rcl::SearchDataClauseFilename(u8));
|
100 |
break;
|
95 |
break;
|
101 |
}
|
96 |
}
|
102 |
|
97 |
|
103 |
// Search terms history
|
98 |
// Search terms history
|
104 |
|
99 |
|