]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.cpp
SVN_SILENT Remove trailing white space.
[dolphin.git] / src / dolphinviewcontainer.cpp
index 77a2f3f36e89c9e5fbd601eb8535f5594a14bd89..6deb7b8464f0cd749f6b8efdddd2bcae8accf118 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2007 by Peter Penz <peter.penz@gmx.at>                  *
+ *   Copyright (C) 2007 by Peter Penz <peter.penz19@gmail.com>             *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
@@ -36,7 +36,7 @@
 #include <KIO/NetAccess>
 #include <KIO/PreviewJob>
 #include <KMenu>
-#include <knewmenu.h>
+#include <KNewFileMenu>
 #include <konqmimedata.h>
 #include <konq_operations.h>
 #include <KShell>
@@ -212,11 +212,13 @@ void DolphinViewContainer::setSearchModeEnabled(bool enabled)
     m_urlNavigator->setVisible(!enabled);
 
     if (enabled) {
+        KUrl url = m_urlNavigator->locationUrl();
+        m_searchBox->setText(QString());
+        m_searchBox->setReadOnly(isSearchUrl(url));
+
         // 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.
-        KUrl url = m_urlNavigator->locationUrl();
-
         int index = m_urlNavigator->historyIndex();
         const int historySize = m_urlNavigator->historySize();
         while (isSearchUrl(url) && (index < historySize)) {
@@ -257,7 +259,7 @@ void DolphinViewContainer::setUrl(const KUrl& newUrl)
 
 void DolphinViewContainer::setFilterBarVisible(bool visible)
 {
-    Q_ASSERT(m_filterBar != 0);
+    Q_ASSERT(m_filterBar);
     if (visible) {
         m_filterBar->show();
         m_filterBar->setFocus();
@@ -286,21 +288,12 @@ void DolphinViewContainer::updateStatusBar()
 {
     m_statusBarTimestamp.start();
 
-    // As the item count information is less important
-    // in comparison with other messages, it should only
-    // be shown if:
-    // - the status bar is empty or
-    // - shows already the item count information or
-    // - shows only a not very important information
     const QString newMessage = m_view->statusBarText();
-    const QString currentMessage = m_statusBar->message();
-    const bool updateStatusBarMsg = currentMessage.isEmpty()
-                                    || (currentMessage == m_statusBar->defaultText())
-                                    || (m_statusBar->type() == DolphinStatusBar::Information);
-
     m_statusBar->setDefaultText(newMessage);
 
-    if (updateStatusBarMsg) {
+    // We don't want to override errors. Other messages are only protected by
+    // the Statusbar itself depending on timings (see DolphinStatusBar::setMessage).
+    if (m_statusBar->type() != DolphinStatusBar::Error) {
         m_statusBar->setMessage(newMessage, DolphinStatusBar::Default);
     }
 }
@@ -336,7 +329,7 @@ void DolphinViewContainer::slotFinishedPathLoading()
         m_statusBar->setProgress(100);
     }
 
-    if (isSearchUrl(url()) && (m_view->items().count() == 0)) {
+    if (isSearchUrl(url()) && m_view->items().isEmpty()) {
         // The dir lister has been completed on a Nepomuk-URI and no items have been found. Instead
         // of showing the default status bar information ("0 items") a more helpful information is given:
         m_statusBar->setMessage(i18nc("@info:status", "No items found."), DolphinStatusBar::Information);
@@ -501,6 +494,7 @@ void DolphinViewContainer::closeSearchBox()
 void DolphinViewContainer::stopLoading()
 {
     m_view->stopLoading();
+    m_statusBar->setProgress(100);
 }
 
 bool DolphinViewContainer::isSearchUrl(const KUrl& url) const