]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.cpp
Merge branch 'master' of git.kde.org:dolphin
[dolphin.git] / src / dolphinviewcontainer.cpp
index 8fea3ba9d0bb8389d89724b9f0cd74605c0286fe..2ea5b7e00e4e28e19d2bf70f377fb1cefd46c568 100644 (file)
@@ -39,6 +39,7 @@
 #ifdef KActivities_FOUND
 #endif
 
+#include "global.h"
 #include "dolphin_generalsettings.h"
 #include "filterbar/filterbar.h"
 #include "search/dolphinsearchbox.h"
@@ -77,7 +78,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
     const GeneralSettings* settings = GeneralSettings::self();
     m_urlNavigator->setUrlEditable(settings->editableUrl());
     m_urlNavigator->setShowFullPath(settings->showFullPath());
-    m_urlNavigator->setHomeUrl(QUrl::fromLocalFile(settings->homeUrl()));
+    m_urlNavigator->setHomeUrl(Dolphin::homeUrl());
     KUrlComboBox* editor = m_urlNavigator->editor();
     editor->setCompletionMode(KCompletion::CompletionMode(settings->urlCompletionMode()));
 
@@ -94,11 +95,9 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
 
     m_view = new DolphinView(url, this);
     connect(m_view, &DolphinView::urlChanged,
-            m_urlNavigator, &KUrlNavigator::setUrl);
+            m_urlNavigator, &KUrlNavigator::setLocationUrl);
     connect(m_view, &DolphinView::urlChanged,
             m_messageWidget, &KMessageWidget::hide);
-    connect(m_view, &DolphinView::directoryLoadingCompleted,
-            m_messageWidget, &KMessageWidget::hide);
     connect(m_view, &DolphinView::writeStateChanged,
             this, &DolphinViewContainer::writeStateChanged);
     connect(m_view, &DolphinView::requestItemInfo,
@@ -304,7 +303,7 @@ void DolphinViewContainer::readSettings()
         // settings of the URL navigator and the filterbar.
         m_urlNavigator->setUrlEditable(GeneralSettings::editableUrl());
         m_urlNavigator->setShowFullPath(GeneralSettings::showFullPath());
-        m_urlNavigator->setHomeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
+        m_urlNavigator->setHomeUrl(Dolphin::homeUrl());
         setFilterBarVisible(GeneralSettings::filterBar());
     }
 
@@ -340,7 +339,7 @@ void DolphinViewContainer::setSearchModeEnabled(bool enabled)
         // started with a search-URL, the home URL is used as fallback.
         QUrl url = m_searchBox->searchPath();
         if (url.isEmpty() || !url.isValid() || isSearchUrl(url)) {
-            url = QUrl::fromLocalFile(GeneralSettings::self()->homeUrl());
+            url = Dolphin::homeUrl();
         }
         m_urlNavigator->setLocationUrl(url);
     }
@@ -362,11 +361,20 @@ QString DolphinViewContainer::placesText() const
         if (text.isEmpty()) {
             text = url().host();
         }
+        if (text.isEmpty()) {
+            text = url().scheme();
+        }
     }
 
     return text;
 }
 
+void DolphinViewContainer::reload()
+{
+    view()->reload();
+    m_messageWidget->hide();
+}
+
 void DolphinViewContainer::setUrl(const QUrl& newUrl)
 {
     if (newUrl != m_urlNavigator->locationUrl()) {
@@ -575,16 +583,16 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url)
             // When an URL has been entered, the view should get the focus.
             // The focus must be requested asynchronously, as changing the URL might create
             // a new view widget.
-            QTimer::singleShot(0, this, SLOT(requestFocus()));
+            QTimer::singleShot(0, this, &DolphinViewContainer::requestFocus);
         }
     } else if (KProtocolManager::isSourceProtocol(url)) {
-        QString app = "konqueror";
+        QString app = QStringLiteral("konqueror");
         if (url.scheme().startsWith(QLatin1String("http"))) {
             showMessage(i18nc("@info:status", // krazy:exclude=qmethods
                               "Dolphin does not support web pages, the web browser has been launched"),
                         Information);
 
-            const KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), "General");
+            const KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "General");
             const QString browser = config.readEntry("BrowserApplication");
             if (!browser.isEmpty()) {
                 app = browser;
@@ -653,7 +661,7 @@ void DolphinViewContainer::startSearching()
 {
     const QUrl url = m_searchBox->urlForSearching();
     if (url.isValid() && !url.isEmpty()) {
-        m_view->setViewPropertiesContext("search");
+        m_view->setViewPropertiesContext(QStringLiteral("search"));
         m_urlNavigator->setLocationUrl(url);
     }
 }
@@ -681,7 +689,7 @@ void DolphinViewContainer::showErrorMessage(const QString& msg)
 
 bool DolphinViewContainer::isSearchUrl(const QUrl& url) const
 {
-    return url.scheme().contains("search");
+    return url.scheme().contains(QStringLiteral("search"));
 }
 
 void DolphinViewContainer::saveViewState()