|
|
@ -121,25 +121,25 @@ TQString StrongsResultClass::getStrongsNumberText(const TQString& verseContent,
|
|
|
|
const bool cs = false;
|
|
|
|
const bool cs = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (*startIndex == 0) {
|
|
|
|
if (*startIndex == 0) {
|
|
|
|
index = verseContent.tqfind("<body", 0);
|
|
|
|
index = verseContent.find("<body", 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
index = *startIndex;
|
|
|
|
index = *startIndex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// find all the "lemma=" inside the the content
|
|
|
|
// find all the "lemma=" inside the the content
|
|
|
|
while((index = verseContent.tqfind("lemma=", index, cs)) != -1) {
|
|
|
|
while((index = verseContent.find("lemma=", index, cs)) != -1) {
|
|
|
|
// get the strongs number after the lemma and compare it with the
|
|
|
|
// get the strongs number after the lemma and compare it with the
|
|
|
|
// strongs number we are looking for
|
|
|
|
// strongs number we are looking for
|
|
|
|
idx1 = verseContent.tqfind("\"", index) + 1;
|
|
|
|
idx1 = verseContent.find("\"", index) + 1;
|
|
|
|
idx2 = verseContent.tqfind("\"", idx1 + 1);
|
|
|
|
idx2 = verseContent.find("\"", idx1 + 1);
|
|
|
|
sNumber = verseContent.mid(idx1, idx2 - idx1);
|
|
|
|
sNumber = verseContent.mid(idx1, idx2 - idx1);
|
|
|
|
if (sNumber == lemmaText) {
|
|
|
|
if (sNumber == lemmaText) {
|
|
|
|
// strongs number is found now we need to get the text of this node
|
|
|
|
// strongs number is found now we need to get the text of this node
|
|
|
|
// search right until the ">" is found. Get the text from here to
|
|
|
|
// search right until the ">" is found. Get the text from here to
|
|
|
|
// the next "<".
|
|
|
|
// the next "<".
|
|
|
|
index = verseContent.tqfind(">", index, cs) + 1;
|
|
|
|
index = verseContent.find(">", index, cs) + 1;
|
|
|
|
idx2 = verseContent.tqfind("<", index, cs);
|
|
|
|
idx2 = verseContent.find("<", index, cs);
|
|
|
|
strongsText = verseContent.mid(index, idx2 - index);
|
|
|
|
strongsText = verseContent.mid(index, idx2 - index);
|
|
|
|
index = idx2;
|
|
|
|
index = idx2;
|
|
|
|
*startIndex = index;
|
|
|
|
*startIndex = index;
|
|
|
@ -413,12 +413,12 @@ TQStringList CSearchResultPage::QueryParser(const TQString& queryString) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if the token contains a ^ then trim the remainder of the
|
|
|
|
// if the token contains a ^ then trim the remainder of the
|
|
|
|
// token from the ^
|
|
|
|
// token from the ^
|
|
|
|
else if ( (pos = (*it).tqcontains("^")) >= 0 ) {
|
|
|
|
else if ( (pos = (*it).contains("^")) >= 0 ) {
|
|
|
|
(*it) = (*it).left(pos - 1);
|
|
|
|
(*it) = (*it).left(pos - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if the token contains a ~ then trim the remainder of the
|
|
|
|
// if the token contains a ~ then trim the remainder of the
|
|
|
|
// token from the ~
|
|
|
|
// token from the ~
|
|
|
|
else if ( (pos = (*it).tqcontains("~")) >= 0 ) {
|
|
|
|
else if ( (pos = (*it).contains("~")) >= 0 ) {
|
|
|
|
(*it) = (*it).left(pos - 2) + "*";
|
|
|
|
(*it) = (*it).left(pos - 2) + "*";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -432,7 +432,7 @@ const TQString CSearchResultPage::highlightSearchedText(const TQString& content,
|
|
|
|
const bool cs = false;
|
|
|
|
const bool cs = false;
|
|
|
|
|
|
|
|
|
|
|
|
// int index = 0;
|
|
|
|
// int index = 0;
|
|
|
|
int index = ret.tqfind("<body", 0);
|
|
|
|
int index = ret.find("<body", 0);
|
|
|
|
int matchLen = 0;
|
|
|
|
int matchLen = 0;
|
|
|
|
int length = searchedText.length();
|
|
|
|
int length = searchedText.length();
|
|
|
|
|
|
|
|
|
|
|
@ -449,7 +449,7 @@ const TQString CSearchResultPage::highlightSearchedText(const TQString& content,
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
// search the searched text for "strong:" until it is not found anymore
|
|
|
|
// search the searched text for "strong:" until it is not found anymore
|
|
|
|
sstIndex = 0;
|
|
|
|
sstIndex = 0;
|
|
|
|
while ((sstIndex = newSearchText.tqfind("strong:", sstIndex)) != -1) {
|
|
|
|
while ((sstIndex = newSearchText.find("strong:", sstIndex)) != -1) {
|
|
|
|
int idx1, idx2, sTokenIndex, sTokenIndex2;
|
|
|
|
int idx1, idx2, sTokenIndex, sTokenIndex2;
|
|
|
|
TQString sNumber, lemmaText;
|
|
|
|
TQString sNumber, lemmaText;
|
|
|
|
const TQString rep3("style=\"background-color:#FFFF66;\" ");
|
|
|
|
const TQString rep3("style=\"background-color:#FFFF66;\" ");
|
|
|
@ -461,8 +461,8 @@ const TQString CSearchResultPage::highlightSearchedText(const TQString& content,
|
|
|
|
// first find the first space after "strong:"
|
|
|
|
// first find the first space after "strong:"
|
|
|
|
// this should indicate a change in search token
|
|
|
|
// this should indicate a change in search token
|
|
|
|
sstIndex = sstIndex + 7;
|
|
|
|
sstIndex = sstIndex + 7;
|
|
|
|
sTokenIndex = newSearchText.tqfind(" ", sstIndex);
|
|
|
|
sTokenIndex = newSearchText.find(" ", sstIndex);
|
|
|
|
sTokenIndex2 = newSearchText.tqfind("|", sstIndex);
|
|
|
|
sTokenIndex2 = newSearchText.find("|", sstIndex);
|
|
|
|
if ((sTokenIndex2 != -1) && (sTokenIndex2 < sTokenIndex)) {
|
|
|
|
if ((sTokenIndex2 != -1) && (sTokenIndex2 < sTokenIndex)) {
|
|
|
|
sNumber = newSearchText.mid(sstIndex, sTokenIndex2 - sstIndex);
|
|
|
|
sNumber = newSearchText.mid(sstIndex, sTokenIndex2 - sstIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -471,13 +471,13 @@ const TQString CSearchResultPage::highlightSearchedText(const TQString& content,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// remove this strong entry
|
|
|
|
// remove this strong entry
|
|
|
|
sstIndex -= 7;
|
|
|
|
sstIndex -= 7;
|
|
|
|
newSearchText.tqreplace(sstIndex, sTokenIndex - sstIndex, "");
|
|
|
|
newSearchText.replace(sstIndex, sTokenIndex - sstIndex, "");
|
|
|
|
// find all the "lemma=" inside the the content
|
|
|
|
// find all the "lemma=" inside the the content
|
|
|
|
while((strongIndex = ret.tqfind("lemma=", strongIndex, cs)) != -1) {
|
|
|
|
while((strongIndex = ret.find("lemma=", strongIndex, cs)) != -1) {
|
|
|
|
// get the strongs number after the lemma and compare it with the
|
|
|
|
// get the strongs number after the lemma and compare it with the
|
|
|
|
// strongs number we are looking for
|
|
|
|
// strongs number we are looking for
|
|
|
|
idx1 = ret.tqfind("\"", strongIndex) + 1;
|
|
|
|
idx1 = ret.find("\"", strongIndex) + 1;
|
|
|
|
idx2 = ret.tqfind("\"", idx1 + 1);
|
|
|
|
idx2 = ret.find("\"", idx1 + 1);
|
|
|
|
lemmaText = ret.mid(idx1, idx2 - idx1);
|
|
|
|
lemmaText = ret.mid(idx1, idx2 - idx1);
|
|
|
|
if (lemmaText == sNumber) {
|
|
|
|
if (lemmaText == sNumber) {
|
|
|
|
// strongs number is found now we need to highlight it
|
|
|
|
// strongs number is found now we need to highlight it
|
|
|
@ -521,9 +521,9 @@ const TQString CSearchResultPage::highlightSearchedText(const TQString& content,
|
|
|
|
for ( int wi = 0; (unsigned int)wi < words.count(); ++wi ) { //search for every word in the list
|
|
|
|
for ( int wi = 0; (unsigned int)wi < words.count(); ++wi ) { //search for every word in the list
|
|
|
|
TQRegExp findExp;
|
|
|
|
TQRegExp findExp;
|
|
|
|
TQString word = words[ wi ];
|
|
|
|
TQString word = words[ wi ];
|
|
|
|
if (word.tqcontains("*")) {
|
|
|
|
if (word.contains("*")) {
|
|
|
|
length = word.length() - 1;
|
|
|
|
length = word.length() - 1;
|
|
|
|
word.tqreplace('*', "\\S*"); //match within a word
|
|
|
|
word.replace('*', "\\S*"); //match within a word
|
|
|
|
findExp = TQRegExp(word);
|
|
|
|
findExp = TQRegExp(word);
|
|
|
|
findExp.setMinimal(TRUE);
|
|
|
|
findExp.setMinimal(TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -533,9 +533,9 @@ const TQString CSearchResultPage::highlightSearchedText(const TQString& content,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// index = 0; //for every word start at the beginning
|
|
|
|
// index = 0; //for every word start at the beginning
|
|
|
|
index = ret.tqfind("<body", 0);
|
|
|
|
index = ret.find("<body", 0);
|
|
|
|
findExp.setCaseSensitive(cs);
|
|
|
|
findExp.setCaseSensitive(cs);
|
|
|
|
//while ( (index = ret.tqfind(findExp, index)) != -1 ) { //while we found the word
|
|
|
|
//while ( (index = ret.find(findExp, index)) != -1 ) { //while we found the word
|
|
|
|
while ( (index = findExp.search(ret, index)) != -1 ) { //while we found the word
|
|
|
|
while ( (index = findExp.search(ret, index)) != -1 ) { //while we found the word
|
|
|
|
matchLen = findExp.matchedLength();
|
|
|
|
matchLen = findExp.matchedLength();
|
|
|
|
if (!CToolClass::inHTMLTag(index, ret)) {
|
|
|
|
if (!CToolClass::inHTMLTag(index, ret)) {
|
|
|
@ -658,7 +658,7 @@ void CSearchOptionsPage::setModules( ListCSwordModuleInfo modules ) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( !m_modules.tqcontains(*it) ) {
|
|
|
|
if ( !m_modules.contains(*it) ) {
|
|
|
|
m_modules.append( *it );
|
|
|
|
m_modules.append( *it );
|
|
|
|
t.append( (*it)->name() );
|
|
|
|
t.append( (*it)->name() );
|
|
|
|
if (*it != modules.last()) {
|
|
|
|
if (*it != modules.last()) {
|
|
|
|