# HG changeset patch # User Chris Cannam # Date 1330010909 0 # Node ID 57a7f95ef4001e66c496597d299412cc7e828ac2 # Parent 04f18b2a32e8bafff506c7a4823f2628d3bbd58c Make find widget behave as if text is cleared when it's closed, and restored when it's opened again diff -r 04f18b2a32e8 -r 57a7f95ef400 src/filestatuswidget.cpp --- a/src/filestatuswidget.cpp Thu Feb 23 11:44:50 2012 +0000 +++ b/src/filestatuswidget.cpp Thu Feb 23 15:28:29 2012 +0000 @@ -446,6 +446,7 @@ } QStringList files = m_fileStates.filesInState(s); + bool foundSomething = false; QStringList highPriority, lowPriority; @@ -454,8 +455,11 @@ if (finding) { if (file.contains(m_searchText, Qt::CaseInsensitive)) { highPriority.push_back(file); + foundSomething = true; } continue; + } else { + foundSomething = true; } bool highlighted = false; @@ -499,7 +503,7 @@ setLabelFor(w, s, !highPriority.empty()); - if (files.empty()) { + if (!foundSomething) { w->parentWidget()->hide(); } else { w->parentWidget()->show(); diff -r 04f18b2a32e8 -r 57a7f95ef400 src/findwidget.cpp --- a/src/findwidget.cpp Thu Feb 23 11:44:50 2012 +0000 +++ b/src/findwidget.cpp Thu Feb 23 15:28:29 2012 +0000 @@ -61,9 +61,15 @@ if (m_lineEdit->isVisible()) { m_lineEdit->hide(); button->setText(tr("Find...")); + if (m_lineEdit->text() != "") { + emit findTextChanged(""); + } } else { m_lineEdit->show(); button->setText(tr("Find:")); + if (m_lineEdit->text() != "") { + emit findTextChanged(m_lineEdit->text()); + } } }