]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.cpp
SVN_SILENT made messages (.desktop file)
[dolphin.git] / src / dolphinviewcontainer.cpp
index 8b3def9f3a899b3ff126e9f5e8daa87b2a9329e4..3cd6b34f2e13a5cf6bf7537a7514ac78c34c3173 100644 (file)
@@ -271,10 +271,6 @@ void DolphinViewContainer::slotDirListerCompleted()
         KonqFileItemCapabilities capabilities(KFileItemList() << item);
         createNew->setEnabled(capabilities.supportsWriting());
     }
-
-    if (isActive()) {
-        m_view->setFocus();
-    }
 }
 
 void DolphinViewContainer::showItemInfo(const KFileItem& item)
@@ -367,6 +363,16 @@ void DolphinViewContainer::restoreView(const KUrl& url)
 {
     if (KProtocolManager::supportsListing(url)) {
         m_view->updateView(url, m_urlNavigator->savedRootUrl());
+        if (isActive()) {
+            // 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. Using QTimer::singleShow() works reliable, however
+            // QMetaObject::invokeMethod() with a queued connection does not work, which might
+            // indicate that we should pass a hint to DolphinView::updateView()
+            // regarding the focus instead. To test: Enter an URL and press CTRL+Enter.
+            // Expected result: The view should get the focus.
+            QTimer::singleShot(0, this, SLOT(requestFocus()));
+        }
     } else if (KProtocolManager::isSourceProtocol(url)) {
         QString app = "konqueror";
         if (url.protocol().startsWith(QLatin1String("http"))) {
@@ -408,6 +414,11 @@ void DolphinViewContainer::redirect(const KUrl& oldUrl, const KUrl& newUrl)
     m_urlNavigator->blockSignals(block);
 }
 
+void DolphinViewContainer::requestFocus()
+{
+    m_view->setFocus();
+}
+
 void DolphinViewContainer::slotItemTriggered(const KFileItem& item)
 {
     KUrl url = item.targetUrl();