void KSession::search(const QString ®exp, int startLine, int startColumn, bool forwards) { HistorySearch *history = new HistorySearch( QPointer<Emulation>(m_session->emulation()), QRegExp(regexp), forwards, startColumn, startLine, this); connect( history, SIGNAL(matchFound(int,int,int,int)), this, SIGNAL(matchFound(int,int,int,int))); connect( history, SIGNAL(noMatchFound()), this, SIGNAL(noMatchFound())); history->search(); }
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())); }
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(); }