diff options
| author | Peter Penz <[email protected]> | 2008-12-19 06:41:26 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-12-19 06:41:26 +0000 |
| commit | 426a57997b111e76d7b74a69e9b4aedf7f463a35 (patch) | |
| tree | d3f93c5c9cad9fb3746f99861f904bb9dfcde2a0 /src/dolphinviewcontainer.cpp | |
| parent | d05c4ba829dc9b679840a8a3db6e124d0e3e3002 (diff) | |
Don't request the focus for the view because of a completed directory lister, instead directly request it when we know that the user has entered a new URL. This prevents that the focus gets stolen from the Terminal when somebody types "touch foo".
BUG: 178070
svn path=/trunk/KDE/kdebase/apps/; revision=898819
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 8b3def9f3..1b64f9803 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -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) @@ -386,6 +382,17 @@ 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) @@ -408,6 +415,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(); |
