From 603ec47b8b1221c8fdf5ff2eaaae0a6a9fcc4880 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20D=C3=B6rner?= Date: Wed, 25 May 2011 22:14:14 +0100 Subject: [PATCH] Don't let hidden terminals prevent unmounting Previous state: When the terminal is hidden, the cwd is not updated anymore. If it was on a removable device when hiding, the hidden terminal might prevent unmounting this device. This patch fixes that bug by changing the cwd to "/" when hiding the panel. REVIEW: 101387 BUG: 158264 FIXED-IN: 4.7.0 --- src/dolphinmainwindow.cpp | 2 ++ src/panels/terminal/terminalpanel.cpp | 8 ++++++++ src/panels/terminal/terminalpanel.h | 1 + 3 files changed, 11 insertions(+) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index f5ac94f40..9324cdb21 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1798,6 +1798,8 @@ void DolphinMainWindow::setupDockWidgets() terminalDock->setWidget(terminalPanel); connect(terminalPanel, SIGNAL(hideTerminalPanel()), terminalDock, SLOT(hide())); + connect(terminalDock, SIGNAL(visibilityChanged(bool)), + terminalPanel, SLOT(visibilityChanged(bool))); QAction* terminalAction = terminalDock->toggleViewAction(); terminalAction->setShortcut(Qt::Key_F4); diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index 8977111f8..b45be621a 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -54,6 +54,14 @@ void TerminalPanel::terminalExited() m_terminal = 0; } +void TerminalPanel::visibilityChanged(bool visible) +{ + if (!visible && m_terminal && (m_terminal->foregroundProcessId() == -1)) { + // Make sure this terminal does not prevent unmounting any removable drives + changeDir(KUrl::fromPath("/")); + } +} + bool TerminalPanel::urlChanged() { if (!url().isValid()) { diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index e4d76d54c..288cb05d3 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -44,6 +44,7 @@ public: public slots: void terminalExited(); + void visibilityChanged(bool visible); signals: void hideTerminalPanel(); -- 2.47.3