bool SearchWorker::searchTxtLoop(QTextStream *intxt, QString searchtype, QString searchTerm, bool singleMatch, QString fullpath, QString displabel) { int matchcount=0; QString matchline = ""; QString firstmatchline = ""; //prepare fo RegEx bool enableRegEx = m_profile.getBoolOption(Profile::EnableRegEx); const QRegularExpression searchExpr(searchTerm, QRegularExpression::UseUnicodePropertiesOption); if(!searchExpr.isValid()) enableRegEx=false; while (!intxt->atEnd()) { if (m_cancelled.loadAcquire() == Cancelled) return false; QString linetxt = intxt->readLine(); int findpos=0; QRegularExpressionMatch matchR; //search for several occurences of search text in one line while ( (findpos = (enableRegEx ? (matchR = searchExpr.match(linetxt, findpos)).capturedStart() : linetxt.indexOf(searchTerm, findpos, Qt::CaseInsensitive))) != -1) { //prepate line for output if (findpos>10) matchline = "\u2026" + linetxt.mid(findpos-10,120); else matchline = linetxt.left(120); if(matchcount==0) firstmatchline=matchline; enableRegEx ? findpos=matchR.capturedEnd() : findpos+=searchTerm.size(); matchcount++; if(!singleMatch) { //found result //APPS only on single match if(searchtype != "APPS") emit matchFound(fullpath, searchtype, displabel, matchline, 0); } if (m_cancelled.loadAcquire() == Cancelled) return false; } } if( singleMatch && (matchcount >0) ) { //found result if(searchtype == "APPS") { displabel = prepareForApps(intxt); matchcount = (-1)*matchcount; if(displabel.size()>0) emit matchFound(fullpath, searchtype, displabel, firstmatchline, matchcount); } else emit matchFound(fullpath, searchtype, displabel, firstmatchline, matchcount); } return true; }
void HashGenerator::spawnThread() { HashThread* temp; qDebug() << "Spawning a thread"; temp = new HashThread(keys); //Progress this->connect(temp, SIGNAL(hashComputed()), this, SLOT(computeProgress())); //Target Found this->connect(temp, SIGNAL(matchFound(QString,QString,QString)), this, SIGNAL(targetFound(QString,QString,QString))); //Thread Done this->connect(temp, SIGNAL(done()), this, SLOT(threadDone())); this->threadCount++; this->threadPool->append( temp ); temp->start(); if(this->hashActive){ this->threadsActive++; temp->hash(); } }
void SearchFolder::searchFile(const QFileInfo &item) { if (m_cancelSearch) return; QFile file (item.absoluteFilePath()); if (!file.open(QFile::ReadOnly)) { return; } QTextStream stream (&file); QString line; int i = 0; int column; while (!(line=stream.readLine()).isNull()) { if (m_cancelSearch) return; column = m_regExp.indexIn(line); while (column != -1) { // limit line length if (line.length() > 512) line = line.left(512); emit matchFound(item.absoluteFilePath(), i, column, line, m_regExp.matchedLength()); column = m_regExp.indexIn(line, column + 1); } i++; } }
// --------------------------------------------------------------------------------- // CUpnpTmFilteredAppList::IconLookUp // Performs the icon look up // Checks if the requested icon and given icon matches // @param aIcon Reference to the Terminal Mode Icon object // @return Returns boolean value(true or false) // --------------------------------------------------------------------------------- // TBool CUpnpTmFilteredAppList::IconLookUp( CUpnpTerminalModeIcon& aIcon ) { OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_ICONLOOKUP_ENTRY ); TBool matchFound(EFalse); const TDesC8& filterMimeType = iFilterInfo->MimeType(); const TDesC8& filterWidth = iFilterInfo->Width(); const TDesC8& filterHeight = iFilterInfo->Height(); const TDesC8& filterDepth = iFilterInfo->Depth(); // Check whether the icon is meant to be used only at launch time TBuf8<UpnpString::KShortStringLength> widthBuf; widthBuf.Num(aIcon.Width()); TBuf8<UpnpString::KShortStringLength> heightBuf; heightBuf.Num(aIcon.Height()); TBuf8<UpnpString::KShortStringLength> depthBuf; depthBuf.Num(aIcon.Depth()); /* Check if the icon in provided in the input filter string, and if so then does it match with the desired icon ( type and dimension ) */ if ( (( filterMimeType.Length() == 0 ) ||( (aIcon.MimeType()).MatchC(filterMimeType) != KErrNotFound)) && (( filterWidth.Length() == 0 ) ||( widthBuf.MatchC(filterWidth) != KErrNotFound)) && (( filterHeight.Length() == 0 ) ||( heightBuf.MatchC(filterHeight) != KErrNotFound)) && (( filterDepth.Length() == 0 ) ||( depthBuf.MatchC(filterDepth) != KErrNotFound))) { matchFound = ETrue; } OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_ICONLOOKUP_EXIT ); return matchFound; }
CASpreadsheetHandler::CASpreadsheetHandler (CADocumentController* documentController) : CAAbstractDocumentHandler (documentController) , d (new Private()) { d->findText = new Calligra::Sheets::Find(this); connect (d->findText, SIGNAL(updateCanvas()), SLOT(updateCanvas())); connect (d->findText, SIGNAL(matchFound(KoFindMatch)), SLOT(findMatchFound(KoFindMatch))); connect (d->findText, SIGNAL(noMatchFound()), SLOT(findNoMatchFound())); }
CAPresentationHandler::CAPresentationHandler (CADocumentController* documentController) : CAAbstractDocumentHandler (documentController) , d (new Private()) { QList<QTextDocument*> texts; d->findText = new KoFindText(this); connect(&d->slideshowTimer, SIGNAL(timeout()), SLOT(advanceSlideshow())); connect (d->findText, SIGNAL(updateCanvas()), SLOT(updateCanvas())); connect (d->findText, SIGNAL(matchFound(KoFindMatch)), SLOT(findMatchFound(KoFindMatch))); connect (d->findText, SIGNAL(noMatchFound()), SLOT(findNoMatchFound())); }
/** * 4. For each pair, append the first hard-coded 16-byte salt... */ void HashThread::tryKey(std::wstring key, QByteArray salt, QString goal) { //combine key and salt QByteArray* keyAndSalt = this->combineKeyAndSalt(key, salt); QString hash = this->doHash(keyAndSalt); qDebug() << "Got Hash:" << QString(hash); //test if goal was found if(QString::compare(hash, goal, Qt::CaseInsensitive) == 0){ emit matchFound(hash, QString(salt.toHex()), QString::fromStdWString(key)); } emit hashComputed(); delete keyAndSalt; }
void SearchOpenFiles::doSearchNextFile() { if (m_cancelSearch) { m_nextIndex = -1; emit searchDone(); return; } int column; // NOTE The document managers signal documentWillBeDeleted() must be connected to // cancelSearch(). A closed file could lead to a crash if it is not handled. for (int line =0; line < m_docList[m_nextIndex]->lines(); line++) { column = m_regExp.indexIn(m_docList[m_nextIndex]->line(line)); while (column != -1) { if (m_docList[m_nextIndex]->url().isLocalFile() ) { emit matchFound(m_docList[m_nextIndex]->url().path(), line, column, m_docList[m_nextIndex]->line(line), m_regExp.matchedLength()); } else { emit matchFound(m_docList[m_nextIndex]->url().prettyUrl(), line, column, m_docList[m_nextIndex]->line(line), m_regExp.matchedLength()); } column = m_regExp.indexIn(m_docList[m_nextIndex]->line(line), column + 1); } } m_nextIndex++; if (m_nextIndex == m_docList.size()) { m_nextIndex = -1; emit searchDone(); } else { emit searchNextFile(); } }
void SearchWhileTyping::startSearch(const KTextEditor::Document *doc, const QRegExp ®Exp) { int column; QTime maxTime; maxTime.start(); for (int line =0; line < doc->lines(); line++) { if (maxTime.elapsed() > 50) { kDebug() << "Search time exceeded -> stop" << maxTime.elapsed() << line; break; } column = regExp.indexIn(doc->line(line)); while (column != -1) { emit matchFound(doc->url().pathOrUrl(), line, column, doc->line(line), regExp.matchedLength()); column = regExp.indexIn(doc->line(line), column + 1); } } emit searchDone(); }
void HistorySearch::search() { bool found = false; if (! m_regExp.isEmpty()) { if (m_forwards) { found = search(m_startColumn, m_startLine, -1, m_emulation->lineCount()) || search(0, 0, m_startColumn, m_startLine); } else { found = search(0, 0, m_startColumn, m_startLine) || search(m_startColumn, m_startLine, -1, m_emulation->lineCount()); } if (found) { emit matchFound(m_foundStartColumn, m_foundStartLine, m_foundEndColumn, m_foundEndLine); } else { emit noMatchFound(); } } deleteLater(); }
int SearchOpenFiles::searchSingleLineRegExp(KTextEditor::Document *doc, const QRegExp ®Exp, int startLine) { int column; QTime time; time.start(); for (int line = startLine; line < doc->lines(); line++) { if (time.elapsed() > 100) { kDebug() << "Search time exceeded" << time.elapsed() << line; return line; } column = regExp.indexIn(doc->line(line)); while (column != -1) { if (regExp.cap().isEmpty()) break; emit matchFound(doc->url().pathOrUrl(), doc->documentName(), line, column, doc->line(line), regExp.matchedLength()); column = regExp.indexIn(doc->line(line), column + regExp.cap().size()); } } return 0; }
void addMisMatch(struct misMatch **misMatchList, struct axt *axt, int qSize) { int i; struct misMatch *misMatch = NULL; for (i = 0 ; i <= axt->symCount ; i++) { if (axt->tSym[i] != axt->qSym[i]) { /* check to see if we already have this one * if not, add it */ if (matchFound(misMatchList, axt->tStart+i) == NULL) { AllocVar(misMatch); misMatch->retroLoc = axt->tStart+i; if (axt->qStrand == '+') misMatch->parentLoc = axt->qStart+i; else misMatch->parentLoc = qSize-(axt->qStart+i); misMatch->retroBase = axt->tSym[i]; misMatch->parentBase = axt->qSym[i]; slAddHead(misMatchList, misMatch); verbose(5, "listLen = %d\n",slCount(misMatchList)); verbose(4,"add [%d] %d %d R %c P %c\n", i, misMatch->retroLoc , misMatch->parentLoc, misMatch->retroBase, misMatch->parentBase); } } else { verbose(8,"don't add [%d] %d \n",i, axt->tStart+i); } } }
QString SearchWorker::searchRecursively(QString directory, QString searchTerm) { // skip some system folders - they don't really have any interesting stuff if (directory.startsWith("/proc") || directory.startsWith("/sys/block")) return QString(); QDir dir(directory); if (!dir.exists()) // skip "non-existent" directories (found in /dev) return QString(); // update progress m_currentDirectory = directory; emit progressChanged(m_currentDirectory); //profile settings; bool enableRegEx = m_profile.getBoolOption(Profile::EnableRegEx); bool hiddenSetting = m_profile.getBoolOption(Profile::SearchHiddenFiles); bool enableSymlinks = m_profile.getBoolOption(Profile::EnableSymlinks); bool singleMatchSetting = m_profile.getBoolOption(Profile::SingleMatchSetting); bool enableNotes = m_profile.getBoolOption(Profile::EnableNotes); bool enableFileDir = m_profile.getBoolOption(Profile::EnableFileDir); QHash<SearchWorker::WorkSet, bool> enabler; enabler[SearchWorker::EnableMimeType] = m_profile.getBoolOption(Profile::EnableMimeType); enabler[SearchWorker::EnableTxt] = m_profile.getBoolOption(Profile::EnableTxt); enabler[SearchWorker::EnableHtml] = m_profile.getBoolOption(Profile::EnableHtml); enabler[SearchWorker::EnableSrc] = m_profile.getBoolOption(Profile::EnableSrc); enabler[SearchWorker::EnableApps] = m_profile.getBoolOption(Profile::EnableApps); enabler[SearchWorker::EnableSqlite] = m_profile.getBoolOption(Profile::EnableSqlite); //prepare for regEx const QRegularExpression searchExpr(searchTerm, QRegularExpression::UseUnicodePropertiesOption); if(!searchExpr.isValid()) enableRegEx=false; QDir::Filter hidden = hiddenSetting ? QDir::Hidden : (QDir::Filter)0; // search dirs QString searchtype = "DIR"; QString matchline = ""; QStringList names = dir.entryList(QDir::NoDotAndDotDot | QDir::AllDirs | QDir::System | hidden); for (int i = 0 ; i < names.count() ; ++i) { // stop if cancelled if (m_cancelled.loadAcquire() == Cancelled) return QString(); QString filename = names.at(i); QString fullpath = dir.absoluteFilePath(filename); if (enableFileDir) if ( enableRegEx ? filename.contains(searchExpr) : filename.contains(searchTerm, Qt::CaseInsensitive) ) emit matchFound(fullpath, searchtype, "", matchline, 0); if (enableSymlinks) { //skip deep subdirs when symlinks enabled if (fullpath.count("/") > MAXDIRDEPTH) continue; } else { QFileInfo info(fullpath); // skip symlinks to prevent infinite loops if (info.isSymLink()) continue; } if ( !m_profile.isInBlackList(fullpath) ) { QString errmsg = searchRecursively(fullpath, searchTerm); if (!errmsg.isEmpty()) return errmsg; } } // search files if (enableFileDir) { searchtype = "FILE"; matchline = ""; names = dir.entryList(QDir::Files | hidden); for (int i = 0 ; i < names.count() ; ++i) { // stop if cancelled if (m_cancelled.loadAcquire() == Cancelled) return QString(); QString filename = names.at(i); QString fullpath = dir.absoluteFilePath(filename); if ( enableRegEx ? filename.contains(searchExpr) : filename.contains(searchTerm, Qt::CaseInsensitive) ) emit matchFound(fullpath, searchtype, "", matchline, 0); } } // create table of file lists qualified for search QHash<SearchWorker::WorkSet, QStringList> filesTab = createFileTable(dir,hidden,enabler); // search inside filtered files (*.txt) if (enabler[SearchWorker::EnableTxt]) if ( addSearchTXT("TXT", searchTerm, dir, filesTab, singleMatchSetting) == QString() ) return QString(); // search inside filtered files (*.html) if (enabler[SearchWorker::EnableHtml]) if ( addSearchTXT("HTML", searchTerm, dir, filesTab, singleMatchSetting) == QString() ) return QString(); // search inside filtered files (*.cpp, *.c, *.h, *.py, *.sh, *.qml, *.js) if (enabler[SearchWorker::EnableSrc]) if ( addSearchTXT("SRC", searchTerm, dir, filesTab, singleMatchSetting) == QString() ) return QString(); // search inside filtered files (*.desktop) if (enabler[SearchWorker::EnableApps]) if ( addSearchTXT("APPS", searchTerm, dir, filesTab, singleMatchSetting) == QString() ) return QString(); // search inside raw sqlite files (*.sqlite, *.sqlite3, *db) if (enabler[SearchWorker::EnableSqlite]) if ( addSearchSqlite("SQLITE", searchTerm, dir, filesTab, singleMatchSetting) == QString() ) return QString(); // search inside Notes sqlite db if ( !m_alreadySearchedNotes ) { if (enableNotes) if ( addSearchNotes("NOTES", searchTerm, singleMatchSetting) == QString() ) return QString(); m_alreadySearchedNotes = true; } return QString(); }
void checkExp(char *bedFileName, char *tNibDir, char *nibList) { struct lineFile *bf = lineFileOpen(bedFileName , TRUE), *af = NULL; char *row[PSEUDOGENELINK_NUM_COLS] ; struct pseudoGeneLink *ps; char *tmpName[512], cmd[512]; struct axt *axtList = NULL, *axt, *mAxt = NULL; struct dnaSeq *qSeq = NULL, *tSeq = NULL, *seqList = NULL; struct nibInfo *qNib = NULL, *tNib = NULL; FILE *op; int ret; if (nibHash == NULL) nibHash = hashNew(0); while (lineFileNextRow(bf, row, ArraySize(row))) { struct misMatch *misMatchList = NULL; struct binKeeper *bk = NULL; struct binElement *el, *elist = NULL; struct psl *mPsl = NULL, *rPsl = NULL, *pPsl = NULL, *psl ; struct misMatch *mf = NULL; ps = pseudoGeneLinkLoad(row); tmpName[0] = cloneString(ps->name); chopByChar(tmpName[0], '.', tmpName, sizeof(tmpName)); verbose(2,"name %s %s:%d-%d\n", ps->name, ps->chrom, ps->chromStart,ps->chromEnd); /* get expressed retro from hash */ bk = hashFindVal(mrnaHash, ps->chrom); elist = binKeeperFindSorted(bk, ps->chromStart, ps->chromEnd ) ; for (el = elist; el != NULL ; el = el->next) { rPsl = el->val; verbose(2,"retroGene %s %s:%d-%d\n",rPsl->qName, ps->chrom, ps->chromStart,ps->chromEnd); } /* find mrnas that overlap parent gene */ bk = hashFindVal(mrnaHash, ps->gChrom); elist = binKeeperFindSorted(bk, ps->gStart , ps->gEnd ) ; for (el = elist; el != NULL ; el = el->next) { pPsl = el->val; verbose(2,"parent %s %s:%d %d,%d\n", pPsl->qName, pPsl->tName,pPsl->tStart, pPsl->match, pPsl->misMatch); } /* find self chain */ bk = hashFindVal(chainHash, ps->chrom); elist = binKeeperFind(bk, ps->chromStart , ps->chromEnd ) ; slSort(&elist, chainCmpScoreDesc); for (el = elist; el != NULL ; el = el->next) { struct chain *chain = el->val, *subChain, *retChainToFree, *retChainToFree2; int qs = chain->qStart; int qe = chain->qEnd; int id = chain->id; if (chain->qStrand == '-') { qs = chain->qSize - chain->qEnd; qe = chain->qSize - chain->qStart; } if (!sameString(chain->qName , ps->gChrom) || !positiveRangeIntersection(qs, qe, ps->gStart, ps->gEnd)) { verbose(2," wrong chain %s:%d-%d %s:%d-%d parent %s:%d-%d\n", chain->qName, qs, qe, chain->tName,chain->tStart,chain->tEnd, ps->gChrom,ps->gStart,ps->gEnd); continue; } verbose(2,"chain id %d %4.0f",chain->id, chain->score); chainSubsetOnT(chain, ps->chromStart+7, ps->chromEnd-7, &subChain, &retChainToFree); if (subChain != NULL) chain = subChain; chainSubsetOnQ(chain, ps->gStart, ps->gEnd, &subChain, &retChainToFree2); if (subChain != NULL) chain = subChain; if (chain->qStrand == '-') { qs = chain->qSize - chain->qEnd; qe = chain->qSize - chain->qStart; } verbose(2," %s:%d-%d %s:%d-%d ", chain->qName, qs, qe, chain->tName,chain->tStart,chain->tEnd); if (subChain != NULL) verbose(2,"subChain %s:%d-%d %s:%d-%d\n", subChain->qName, subChain->qStart, subChain->qEnd, subChain->tName,subChain->tStart,subChain->tEnd); qNib = nibInfoFromCache(nibHash, tNibDir, chain->qName); tNib = nibInfoFromCache(nibHash, tNibDir, chain->tName); tSeq = nibInfoLoadStrand(tNib, chain->tStart, chain->tEnd, '+'); qSeq = nibInfoLoadStrand(qNib, chain->qStart, chain->qEnd, chain->qStrand); axtList = chainToAxt(chain, qSeq, chain->qStart, tSeq, chain->tStart, maxGap, BIGNUM); verbose(2,"axt count %d misMatch cnt %d\n",slCount(axtList), slCount(misMatchList)); for (axt = axtList; axt != NULL ; axt = axt->next) { addMisMatch(&misMatchList, axt, chain->qSize); } verbose(2,"%d in mismatch list %s id %d \n",slCount(misMatchList), chain->qName, id); chainFree(&retChainToFree); chainFree(&retChainToFree2); break; } /* create axt of each expressed retroGene to parent gene */ /* get alignment for each mrna overlapping retroGene */ bk = hashFindVal(mrnaHash, ps->chrom); elist = binKeeperFindSorted(bk, ps->chromStart , ps->chromEnd ) ; { char queryName[512]; char axtName[512]; char pslName[512]; safef(queryName, sizeof(queryName), "/tmp/query.%s.fa", ps->chrom); safef(axtName, sizeof(axtName), "/tmp/tmp.%s.axt", ps->chrom); safef(pslName, sizeof(pslName), "/tmp/tmp.%s.psl", ps->chrom); op = fopen(pslName,"w"); for (el = elist ; el != NULL ; el = el->next) { psl = el->val; pslOutput(psl, op, '\t','\n'); qSeq = twoBitReadSeqFrag(twoBitFile, psl->qName, 0, 0); if (qSeq != NULL) slAddHead(&seqList, qSeq); else errAbort("seq %s not found \n", psl->qName); } fclose(op); faWriteAll(queryName, seqList); safef(cmd,sizeof(cmd),"pslPretty -long -axt %s %s %s %s",pslName , nibList, queryName, axtName); ret = system(cmd); if (ret != 0) errAbort("ret is %d %s\n",ret,cmd); verbose(2, "ret is %d %s\n",ret,cmd); af = lineFileOpen(axtName, TRUE); while ((axt = axtRead(af)) != NULL) slAddHead(&mAxt, axt); lineFileClose(&af); } slReverse(&mAxt); /* for each parent/retro pair, count bases matching retro and parent better */ for (el = elist; el != NULL ; el = el->next) { int i, scoreRetro=0, scoreParent=0, scoreNeither=0; struct dyString *parentMatch = newDyString(16*1024); struct dyString *retroMatch = newDyString(16*1024); mPsl = el->val; if (mAxt != NULL) { verbose(2,"mrna %s %s:%d %d,%d axt %s\n", mPsl->qName, mPsl->tName,mPsl->tStart, mPsl->match, mPsl->misMatch, mAxt->qName); assert(sameString(mPsl->qName, mAxt->qName)); for (i = 0 ; i< (mPsl->tEnd-mPsl->tStart) ; i++) { int j = mAxt->tStart - mPsl->tStart; verbose(5, "listLen = %d\n",slCount(&misMatchList)); if ((mf = matchFound(&misMatchList, (mPsl->tStart)+i)) != NULL) { if (toupper(mf->retroBase) == toupper(mAxt->qSym[j+i])) { verbose (3,"match retro[%d] %d %c == %c parent %c %d\n", i,mf->retroLoc, mf->retroBase, mAxt->qSym[j+i], mf->parentBase, mf->parentLoc); dyStringPrintf(retroMatch, "%d,", mf->retroLoc); scoreRetro++; } else if (toupper(mf->parentBase) == toupper(mAxt->qSym[j+i])) { verbose (3,"match parent[%d] %d %c == %c retro %c %d\n", i,mf->parentLoc, mf->parentBase, mAxt->qSym[j+i], mf->retroBase, mf->retroLoc); dyStringPrintf(parentMatch, "%d,", mf->parentLoc); scoreParent++; } else { verbose (3,"match neither[%d] %d %c != %c retro %c %d\n", i,mf->parentLoc, mf->parentBase, mAxt->tSym[j+i], mf->retroBase, mf->retroLoc); scoreNeither++; } } } verbose(2,"final score %s parent %d retro %d neither %d\n", mPsl->qName, scoreParent, scoreRetro, scoreNeither); fprintf(outFile,"%s\t%d\t%d\t%s\t%d\t%s\t%d\t%d\t%s\t%d\t%d\t%d\t%s\t%s\n", ps->chrom, ps->chromStart, ps->chromEnd, ps->name, ps->score, mPsl->tName, mPsl->tStart, mPsl->tEnd, mPsl->qName, scoreParent, scoreRetro, scoreNeither, parentMatch->string, retroMatch->string); mAxt = mAxt->next; } dyStringFree(&parentMatch); dyStringFree(&retroMatch); } } }
int SearchOpenFiles::searchMultiLineRegExp(KTextEditor::Document *doc, const QRegExp ®Exp, int startLine) { int column = 0; int line = 0; QTime time; time.start(); QRegExp tmpRegExp = regExp; if (startLine == 0) { // Copy the whole file to a temporary buffer to be able to search newlines m_fullDoc.clear(); m_lineStart.clear(); m_lineStart << 0; for (int i=0; i<doc->lines(); i++) { m_fullDoc += doc->line(i) + '\n'; m_lineStart << m_fullDoc.size(); } if (!regExp.pattern().endsWith("$")) { // if regExp ends with '$' leave the extra newline at the end as // '$' will be replaced with (?=\\n), which needs the extra newline m_fullDoc.remove(m_fullDoc.size()-1, 1); } } else { if (startLine>0 && startLine<m_lineStart.size()) { column = m_lineStart[startLine]; line = startLine; } else { return 0; } } if (regExp.pattern().endsWith("$")) { QString newPatern = tmpRegExp.pattern(); newPatern.replace("$", "(?=\\n)"); tmpRegExp.setPattern(newPatern); } column = tmpRegExp.indexIn(m_fullDoc, column); while (column != -1) { if (tmpRegExp.cap().isEmpty()) break; // search for the line number of the match int i; line = -1; for (i=1; i<m_lineStart.size(); i++) { if (m_lineStart[i] > column) { line = i-1; break; } } if (line == -1) { break; } emit matchFound(doc->url().pathOrUrl(), doc->documentName(), line, (column - m_lineStart[line]), doc->line(line).left(column - m_lineStart[line])+tmpRegExp.cap(), tmpRegExp.matchedLength()); column = tmpRegExp.indexIn(m_fullDoc, column + tmpRegExp.matchedLength()); if (time.elapsed() > 100) { //kDebug() << "Search time exceeded" << time.elapsed() << line; return line; } } return 0; }