|
a/src/qtgui/spell_w.cpp |
|
b/src/qtgui/spell_w.cpp |
|
... |
|
... |
46 |
#endif
|
46 |
#endif
|
47 |
|
47 |
|
48 |
void SpellW::init()
|
48 |
void SpellW::init()
|
49 |
{
|
49 |
{
|
50 |
// Don't change the order, or fix the rest of the code...
|
50 |
// Don't change the order, or fix the rest of the code...
|
51 |
/*0*/expTypeCMB->insertItem(tr("Wildcards"));
|
51 |
/*0*/expTypeCMB->addItem(tr("Wildcards"));
|
52 |
/*1*/expTypeCMB->insertItem(tr("Regexp"));
|
52 |
/*1*/expTypeCMB->addItem(tr("Regexp"));
|
53 |
/*2*/expTypeCMB->insertItem(tr("Stem expansion"));
|
53 |
/*2*/expTypeCMB->addItem(tr("Stem expansion"));
|
54 |
#ifdef RCL_USE_ASPELL
|
54 |
#ifdef RCL_USE_ASPELL
|
55 |
bool noaspell = false;
|
55 |
bool noaspell = false;
|
56 |
rclconfig->getConfParam("noaspell", &noaspell);
|
56 |
rclconfig->getConfParam("noaspell", &noaspell);
|
57 |
if (!noaspell)
|
57 |
if (!noaspell)
|
58 |
/*3*/expTypeCMB->insertItem(tr("Spelling/Phonetic"));
|
58 |
/*3*/expTypeCMB->addItem(tr("Spelling/Phonetic"));
|
59 |
#endif
|
59 |
#endif
|
60 |
|
60 |
|
61 |
int typ = prefs.termMatchType;
|
61 |
int typ = prefs.termMatchType;
|
62 |
if (typ < 0 || typ > expTypeCMB->count())
|
62 |
if (typ < 0 || typ > expTypeCMB->count())
|
63 |
typ = 0;
|
63 |
typ = 0;
|
64 |
expTypeCMB->setCurrentItem(typ);
|
64 |
expTypeCMB->setCurrentIndex(typ);
|
65 |
|
65 |
|
66 |
// Stemming language combobox
|
66 |
// Stemming language combobox
|
67 |
stemLangCMB->clear();
|
67 |
stemLangCMB->clear();
|
68 |
list<string> langs;
|
68 |
list<string> langs;
|
69 |
if (!getStemLangs(langs)) {
|
69 |
if (!getStemLangs(langs)) {
|
|
... |
|
... |
71 |
tr("error retrieving stemming languages"));
|
71 |
tr("error retrieving stemming languages"));
|
72 |
}
|
72 |
}
|
73 |
for (list<string>::const_iterator it = langs.begin();
|
73 |
for (list<string>::const_iterator it = langs.begin();
|
74 |
it != langs.end(); it++) {
|
74 |
it != langs.end(); it++) {
|
75 |
stemLangCMB->
|
75 |
stemLangCMB->
|
76 |
insertItem(QString::fromAscii(it->c_str(), it->length()));
|
76 |
addItem(QString::fromAscii(it->c_str(), it->length()));
|
77 |
}
|
77 |
}
|
78 |
stemLangCMB->setEnabled(expTypeCMB->currentItem()==2);
|
78 |
stemLangCMB->setEnabled(expTypeCMB->currentIndex()==2);
|
79 |
|
79 |
|
80 |
(void)new HelpClient(this);
|
80 |
(void)new HelpClient(this);
|
81 |
HelpClient::installMap(this->name(), "RCL.SEARCH.TERMEXPLORER");
|
81 |
HelpClient::installMap((const char *)this->objectName().toUtf8(),
|
|
|
82 |
"RCL.SEARCH.TERMEXPLORER");
|
82 |
|
83 |
|
83 |
// signals and slots connections
|
84 |
// signals and slots connections
|
84 |
connect(baseWordLE, SIGNAL(textChanged(const QString&)),
|
85 |
connect(baseWordLE, SIGNAL(textChanged(const QString&)),
|
85 |
this, SLOT(wordChanged(const QString&)));
|
86 |
this, SLOT(wordChanged(const QString&)));
|
86 |
connect(baseWordLE, SIGNAL(returnPressed()), this, SLOT(doExpand()));
|
87 |
connect(baseWordLE, SIGNAL(returnPressed()), this, SLOT(doExpand()));
|
|
... |
|
... |
114 |
if (!maybeOpenDb(reason)) {
|
115 |
if (!maybeOpenDb(reason)) {
|
115 |
LOGDEB(("SpellW::doExpand: db error: %s\n", reason.c_str()));
|
116 |
LOGDEB(("SpellW::doExpand: db error: %s\n", reason.c_str()));
|
116 |
return;
|
117 |
return;
|
117 |
}
|
118 |
}
|
118 |
|
119 |
|
119 |
string expr = string((const char *)baseWordLE->text().utf8());
|
120 |
string expr = string((const char *)baseWordLE->text().toUtf8());
|
120 |
list<string> suggs;
|
121 |
list<string> suggs;
|
121 |
|
122 |
|
122 |
prefs.termMatchType = expTypeCMB->currentItem();
|
123 |
prefs.termMatchType = expTypeCMB->currentIndex();
|
123 |
|
124 |
|
124 |
Rcl::Db::MatchType mt = Rcl::Db::ET_WILD;
|
125 |
Rcl::Db::MatchType mt = Rcl::Db::ET_WILD;
|
125 |
switch(expTypeCMB->currentItem()) {
|
126 |
switch(expTypeCMB->currentIndex()) {
|
126 |
case 0: mt = Rcl::Db::ET_WILD; break;
|
127 |
case 0: mt = Rcl::Db::ET_WILD; break;
|
127 |
case 1:mt = Rcl::Db::ET_REGEXP; break;
|
128 |
case 1:mt = Rcl::Db::ET_REGEXP; break;
|
128 |
case 2:mt = Rcl::Db::ET_STEM; break;
|
129 |
case 2:mt = Rcl::Db::ET_STEM; break;
|
129 |
}
|
130 |
}
|
130 |
|
131 |
|
131 |
Rcl::TermMatchResult res;
|
132 |
Rcl::TermMatchResult res;
|
132 |
switch (expTypeCMB->currentItem()) {
|
133 |
switch (expTypeCMB->currentIndex()) {
|
133 |
case 0:
|
134 |
case 0:
|
134 |
case 1:
|
135 |
case 1:
|
135 |
case 2:
|
136 |
case 2:
|
136 |
{
|
137 |
{
|
137 |
string l_stemlang = stemLangCMB->currentText().ascii();
|
138 |
string l_stemlang = (const char*)stemLangCMB->currentText().toAscii();
|
138 |
|
139 |
|
139 |
if (!rcldb->termMatch(mt, l_stemlang, expr, res, 200)) {
|
140 |
if (!rcldb->termMatch(mt, l_stemlang, expr, res, 200)) {
|
140 |
LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
|
141 |
LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
|
141 |
return;
|
142 |
return;
|
142 |
}
|
143 |
}
|