┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/terminal/terminalpanel.cpp
diff options
context:
space:
mode:
authorNate Graham <[email protected]>2019-01-19 08:11:26 -0700
committerNate Graham <[email protected]>2019-01-19 08:15:11 -0700
commit2100a7a5c85931d46b72d391faa3d136d4401010 (patch)
tree2ca5faa610a36fd431f9db20879eb2072e36ad84 /src/panels/terminal/terminalpanel.cpp
parent784734ca16803f5109e6268d1afc6c4f33d41def (diff)
Ask for confirmation when Closing Dolphin windows with a terminal panel running a program
Summary: Ask for confirmation when Closing Dolphin windows with a terminal panel running a program. FEATURE: 304816 FIXED-IN: 19.04.0 Test Plan: # Open terminal panel # Run `watch ls` # Close Dolphin # Observe confirmation # Disable confirmation # Repeat, observe no confirmation # Enable confirmation in the settings # Repeat, observe a confirmation Reviewers: #dolphin, markg, elvisangelaccio, rominf Reviewed By: #dolphin, elvisangelaccio Subscribers: kfm-devel, elvisangelaccio, markg, ngraham, rkflx, broulik, #dolphin Tags: #dolphin Differential Revision: https://phabricator.kde.org/D10960
Diffstat (limited to 'src/panels/terminal/terminalpanel.cpp')
-rw-r--r--src/panels/terminal/terminalpanel.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp
index b6c30c29c..3377bab24 100644
--- a/src/panels/terminal/terminalpanel.cpp
+++ b/src/panels/terminal/terminalpanel.cpp
@@ -79,12 +79,12 @@ void TerminalPanel::terminalExited()
emit hideTerminalPanel();
}
-bool TerminalPanel::isHiddenInVisibleWindow()
+bool TerminalPanel::isHiddenInVisibleWindow() const
{
return parentWidget()
&& parentWidget()->isHidden()
&& m_terminal
- && (m_terminal->foregroundProcessId() == -1);
+ && !hasProgramRunning();
}
void TerminalPanel::dockVisibilityChanged()
@@ -107,13 +107,23 @@ void TerminalPanel::dockVisibilityChanged()
}
}
+QString TerminalPanel::runningProgramName() const
+{
+ return m_terminal ? m_terminal->foregroundProcessName() : QString();
+}
+
+bool TerminalPanel::hasProgramRunning() const
+{
+ return m_terminal && (m_terminal->foregroundProcessId() != -1);
+}
+
bool TerminalPanel::urlChanged()
{
if (!url().isValid()) {
return false;
}
- const bool sendInput = m_terminal && (m_terminal->foregroundProcessId() == -1) && isVisible();
+ const bool sendInput = m_terminal && !hasProgramRunning() && isVisible();
if (sendInput) {
changeDir(url());
}