Don't clear the search-text when switching between tabs

The clearing of the search-text should only be done when opening the search-box.
This commit is contained in:
Peter Penz 2011-02-04 20:55:52 +01:00
parent fd74aa8e20
commit 236eac2ffa
3 changed files with 9 additions and 7 deletions

View file

@ -212,6 +212,8 @@ void DolphinViewContainer::setSearchModeEnabled(bool enabled)
m_urlNavigator->setVisible(!enabled);
if (enabled) {
m_searchBox->clearText();
// Remember the most recent non-search URL as search path
// of the search-box, so that it can be restored
// when switching back to the URL navigator.

View file

@ -56,7 +56,6 @@
DolphinSearchBox::DolphinSearchBox(QWidget* parent) :
QWidget(parent),
m_startedSearching(false),
m_nepomukActivated(false),
m_topLayout(0),
m_searchInput(0),
m_fileNameButton(0),
@ -142,6 +141,11 @@ void DolphinSearchBox::selectAll()
m_searchInput->selectAll();
}
void DolphinSearchBox::clearText()
{
m_searchInput->clear();
}
bool DolphinSearchBox::event(QEvent* event)
{
if (event->type() == QEvent::Polish) {
@ -153,11 +157,6 @@ bool DolphinSearchBox::event(QEvent* event)
void DolphinSearchBox::showEvent(QShowEvent* event)
{
if (!event->spontaneous()) {
#ifdef HAVE_NEPOMUK
m_nepomukActivated = (Nepomuk::ResourceManager::instance()->init() == 0);
#endif
m_searchInput->clear();
m_searchInput->setFocus();
m_startedSearching = false;
}

View file

@ -69,6 +69,8 @@ public:
*/
void selectAll();
void clearText();
protected:
virtual bool event(QEvent* event);
virtual void showEvent(QShowEvent* event);
@ -114,7 +116,6 @@ private:
private:
bool m_startedSearching;
bool m_nepomukActivated;
QVBoxLayout* m_topLayout;