diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-02-20 14:40:46 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-02-20 14:40:46 +0100 |
commit | a275a256f08fb28faf64341342b5162bb9a9c634 (patch) | |
tree | e0edb61b9cf2570a4a7b4d067a936628576ed846 | |
parent | window title fixes (diff) | |
parent | Get rid of the selection of the next found expression when the checkbox match... (diff) | |
download | rekonq-a275a256f08fb28faf64341342b5162bb9a9c634.tar.xz |
Merge commit 'refs/merge-requests/92' of git://gitorious.org/rekonq/mainline into mr92
-rw-r--r-- | src/findbar.cpp | 7 | ||||
-rw-r--r-- | src/mainwindow.cpp | 44 | ||||
-rw-r--r-- | src/mainwindow.h | 1 |
3 files changed, 47 insertions, 5 deletions
diff --git a/src/findbar.cpp b/src/findbar.cpp index 1cb16e3f..6b92f130 100644 --- a/src/findbar.cpp +++ b/src/findbar.cpp @@ -64,6 +64,7 @@ FindBar::FindBar(KMainWindow *mainwindow) hideButton->setAutoRaise(true); hideButton->setIcon(KIcon("dialog-close")); connect(hideButton, SIGNAL(clicked()), this, SLOT(hide())); + connect(hideButton, SIGNAL(clicked()), mainwindow, SLOT(findNext())); layout->addWidget(hideButton); layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop); @@ -91,6 +92,7 @@ FindBar::FindBar(KMainWindow *mainwindow) // Case sensitivity. Deliberately set so this is off by default. m_matchCase->setCheckState(Qt::Unchecked); m_matchCase->setTristate(false); + connect(m_matchCase, SIGNAL(toggled(bool)), mainwindow, SLOT(matchCaseUpdate())); layout->addWidget(m_matchCase); // stretching widget on the left @@ -138,6 +140,11 @@ void FindBar::show() QWidget::show(); m_hideTimer->start(60000); + + // emit a new find signal with the current text + QString temp = m_lineEdit->text(); + m_lineEdit->setText(""); + m_lineEdit->setText(temp); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f9143a18..ef74adab 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -773,33 +773,67 @@ void MainWindow::find(const QString & search) if (!currentTab()) return; m_lastSearch = search; + findNext(); } - +void MainWindow::matchCaseUpdate() +{ + if (!currentTab()) + return; + + QWebPage::FindFlags options = QWebPage::FindWrapsAroundDocument; + + if (m_findBar->matchCase()) + options |= QWebPage::FindCaseSensitively; + + currentTab()->view()->findText(m_lastSearch, QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument); + bool found = currentTab()->view()->findText(m_lastSearch, options); + m_findBar->notifyMatch(found); + if(!found) + currentTab()->view()->page()->focusNextPrevChild(true); +} void MainWindow::findNext() { - if (!currentTab() && m_lastSearch.isEmpty()) + if (!currentTab()) return; + if(m_findBar->isHidden()) + { + currentTab()->view()->page()->focusNextPrevChild(true); + return; + } + QWebPage::FindFlags options = QWebPage::FindWrapsAroundDocument; if (m_findBar->matchCase()) options |= QWebPage::FindCaseSensitively; - m_findBar->notifyMatch(currentTab()->view()->findText(m_lastSearch, options)); + bool found = currentTab()->view()->findText(m_lastSearch, options); + m_findBar->notifyMatch(found); + if(!found) + currentTab()->view()->page()->focusNextPrevChild(true); } void MainWindow::findPrevious() { - if (!currentTab() && m_lastSearch.isEmpty()) + if (!currentTab()) return; + if(m_findBar->isHidden()) + { + currentTab()->view()->page()->focusNextPrevChild(true); + return; + } + QWebPage::FindFlags options = QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument; if (m_findBar->matchCase()) options |= QWebPage::FindCaseSensitively; - m_findBar->notifyMatch(currentTab()->view()->findText(m_lastSearch, options)); + bool found = currentTab()->view()->findText(m_lastSearch, options); + m_findBar->notifyMatch(found); + if(!found) + currentTab()->view()->page()->focusNextPrevChild(true); } diff --git a/src/mainwindow.h b/src/mainwindow.h index c104ad4d..db75b1bd 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -127,6 +127,7 @@ private slots: // Find Action slots void find(const QString &); + void matchCaseUpdate(); void findNext(); void findPrevious(); |