mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
TerminalPanel: better check if terminal needs to change its currentWorkingDirectory when unmounting
CCBUG: 467403
This commit is contained in:
parent
7a7215a948
commit
a654b8dae6
|
@ -1504,7 +1504,7 @@ void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString &mo
|
||||||
setViewsToHomeIfMountPathOpen(mountPath);
|
setViewsToHomeIfMountPathOpen(mountPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (m_terminalPanel && m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) {
|
if (m_terminalPanel && m_terminalPanel->currentWorkingDirectoryIsParentOf(mountPath)) {
|
||||||
m_tearDownFromPlacesRequested = true;
|
m_tearDownFromPlacesRequested = true;
|
||||||
m_terminalPanel->goHome();
|
m_terminalPanel->goHome();
|
||||||
// m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged
|
// m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged
|
||||||
|
@ -1519,7 +1519,7 @@ void DolphinMainWindow::slotStorageTearDownExternallyRequested(const QString &mo
|
||||||
setViewsToHomeIfMountPathOpen(mountPath);
|
setViewsToHomeIfMountPathOpen(mountPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (m_terminalPanel && m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) {
|
if (m_terminalPanel && m_terminalPanel->currentWorkingDirectoryIsParentOf(mountPath)) {
|
||||||
m_tearDownFromPlacesRequested = false;
|
m_tearDownFromPlacesRequested = false;
|
||||||
m_terminalPanel->goHome();
|
m_terminalPanel->goHome();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,12 +54,12 @@ void TerminalPanel::goHome()
|
||||||
sendCdToTerminal(QDir::homePath(), HistoryPolicy::SkipHistory);
|
sendCdToTerminal(QDir::homePath(), HistoryPolicy::SkipHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TerminalPanel::currentWorkingDirectory()
|
bool TerminalPanel::currentWorkingDirectoryIsParentOf(const QString &path) const
|
||||||
{
|
{
|
||||||
if (m_terminal) {
|
if (m_terminal) {
|
||||||
return m_terminal->currentWorkingDirectory();
|
return m_terminal->currentWorkingDirectory().startsWith(path);
|
||||||
}
|
}
|
||||||
return QString();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerminalPanel::terminalExited()
|
void TerminalPanel::terminalExited()
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
* home when an unmounting request is received.
|
* home when an unmounting request is received.
|
||||||
*/
|
*/
|
||||||
void goHome();
|
void goHome();
|
||||||
QString currentWorkingDirectory();
|
bool currentWorkingDirectoryIsParentOf(const QString &path) const;
|
||||||
bool isHiddenInVisibleWindow() const;
|
bool isHiddenInVisibleWindow() const;
|
||||||
bool terminalHasFocus() const;
|
bool terminalHasFocus() const;
|
||||||
bool hasProgramRunning() const;
|
bool hasProgramRunning() const;
|
||||||
|
|
Loading…
Reference in a new issue