diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/findbar.cpp | 38 | ||||
-rw-r--r-- | src/findbar.h | 4 | ||||
-rw-r--r-- | src/mainwindow.cpp | 1 |
3 files changed, 18 insertions, 25 deletions
diff --git a/src/findbar.cpp b/src/findbar.cpp index b3b80fac..18a4f168 100644 --- a/src/findbar.cpp +++ b/src/findbar.cpp @@ -138,25 +138,27 @@ bool FindBar::highlightAllState() const return m_highlightAll->isChecked(); } - -void FindBar::show() +void FindBar::setVisible(bool visible) { - // show findbar if not visible - if (isHidden()) - { - emit visibilityChanged(true); - QWidget::show(); + QWidget::setVisible(visible); + + if (visible != isVisible()) + emit visibilityChanged(visible); + + if (visible) { + // show findbar if not visible emit searchString(m_lineEdit->text()); - } - m_hideTimer->start(60000); + m_hideTimer->start(60000); - // set focus to findbar if user select showFindBar shortcut - m_lineEdit->setFocus(); - m_lineEdit->selectAll(); + // set focus to findbar if user select showFindBar shortcut + m_lineEdit->setFocus(); + m_lineEdit->selectAll(); + } else { + m_hideTimer->stop(); + } } - void FindBar::notifyMatch(bool match) { QPalette p = m_lineEdit->palette(); @@ -180,16 +182,6 @@ void FindBar::notifyMatch(bool match) m_hideTimer->start(60000); } - -void FindBar::hide() -{ - m_hideTimer->stop(); - emit visibilityChanged(false); - QWidget::hide(); - emit(searchString(m_lineEdit->text())); -} - - void FindBar::toggleVisibility() { isVisible() ? hide() : show(); diff --git a/src/findbar.h b/src/findbar.h index 38bbcbc5..974d6137 100644 --- a/src/findbar.h +++ b/src/findbar.h @@ -55,9 +55,9 @@ public: void notifyMatch(bool match); bool highlightAllState() const; + void setVisible(bool visible); + public slots: - void show(); - void hide(); void toggleVisibility(); signals: diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4f9d6dab..28a3bebf 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -370,6 +370,7 @@ void MainWindow::setupActions() findShortcut.setAlternate(Qt::Key_Slash); a->setShortcut(findShortcut); a->setCheckable(true); + a->setChecked(m_findBar->isVisible()); connect(m_findBar, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool))); KStandardAction::findNext(this, SLOT(findNext()) , actionCollection()); |