diff options
| author | Peter Penz <[email protected]> | 2008-12-19 06:48:57 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-12-19 06:48:57 +0000 |
| commit | de2d93b068c251d5f87145c0723f08888c4ebed1 (patch) | |
| tree | 8bb3b57b38395d1cc550973235124fcad2cd2a19 /src/dolphinviewcontainer.cpp | |
| parent | 426a57997b111e76d7b74a69e9b4aedf7f463a35 (diff) | |
minor improvement to last commit: only request the focus if we have a listable protocol; otherwise leave the focus where it was (e. g. so that the user can enter another URL)
svn path=/trunk/KDE/kdebase/apps/; revision=898822
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 1b64f9803..3cd6b34f2 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -363,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"))) { @@ -382,17 +392,6 @@ void DolphinViewContainer::restoreView(const KUrl& url) } else { showErrorMessage(i18nc("@info:status", "Invalid protocol")); } - - 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())); - } } void DolphinViewContainer::saveRootUrl(const KUrl& url) |
