diff options
| author | Peter Penz <[email protected]> | 2010-01-11 09:21:16 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2010-01-11 09:21:16 +0000 |
| commit | cc06711735d53ae1d2d68fa3096d454828bcb531 (patch) | |
| tree | 2ca7f419a537af9c49100922c69a953101cfbe39 /src/dolphinmainwindow.cpp | |
| parent | 199f9af8b6a58f59ac20a7a83438b3a6619b7991 (diff) | |
- When the filterbar has been activated as startup setting, still the view should get the keyboard focus.
- Assure that the keyboard focus does not get lost when a tab is opened in background.
CCBUG: 183394
svn path=/trunk/KDE/kdebase/apps/; revision=1072868
Diffstat (limited to 'src/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index d9b534e3f..0523085ae 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -397,6 +397,8 @@ void DolphinMainWindow::openNewTab() void DolphinMainWindow::openNewTab(const KUrl& url) { + QWidget* focusWidget = QApplication::focusWidget(); + if (m_viewTab.count() == 1) { // Only one view is open currently and hence no tab is shown at // all. Before creating a tab for 'url', provide a tab for the current URL. @@ -429,6 +431,12 @@ void DolphinMainWindow::openNewTab(const KUrl& url) m_viewTab[tabIndex].secondaryView->setActive(true); m_viewTab[tabIndex].isPrimaryViewActive = false; } + + if (focusWidget != 0) { + // The DolphinViewContainer grabbed the keyboard focus. As the tab is opened + // in background, assure that the previous focused widget gets the focus back. + focusWidget->setFocus(); + } } void DolphinMainWindow::activateNextTab() @@ -487,6 +495,14 @@ void DolphinMainWindow::toggleActiveView() setActiveViewContainer(m_activeViewContainer == right ? left : right); } +void DolphinMainWindow::showEvent(QShowEvent* event) +{ + KXmlGuiWindow::showEvent(event); + if (!event->spontaneous()) { + m_activeViewContainer->view()->setFocus(); + } +} + void DolphinMainWindow::closeEvent(QCloseEvent* event) { DolphinSettings& settings = DolphinSettings::instance(); |
