]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Don't clear the search-text when switching between tabs
authorPeter Penz <peter.penz19@gmail.com>
Fri, 4 Feb 2011 19:55:52 +0000 (20:55 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Fri, 4 Feb 2011 19:55:52 +0000 (20:55 +0100)
The clearing of the search-text should only be done when opening the search-box.

src/dolphinviewcontainer.cpp
src/search/dolphinsearchbox.cpp
src/search/dolphinsearchbox.h

index c46615bccc6a1f4a9d5cd620b0c215876dd73e1c..1b921e678d85875b9660db415c01ba59e1f571c9 100644 (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.
index 68dc9da3cd0b12425140a008468737f116e4ff6a..f4588f67f45de3dae0af5159cebd614ee70cca25 100644 (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;
     }
index 09d2233558f4c13c19aa5e340bfc4651f86fa864..3e464804801c8ee66ccb7e10171ebc05c7535f13 100644 (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;