diff options
| author | Antti Savolainen <[email protected]> | 2026-04-20 09:48:28 +0000 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2026-04-20 09:48:28 +0000 |
| commit | 07baa7bb68d3d3c8ed1f564ea42efa80684b3a23 (patch) | |
| tree | f0a2be174f534a4951e69c85431b072228f30e2d /src/panels | |
| parent | f0d681577363b8b0c87e51d6c32232fa394ea5cd (diff) | |
terminalpanel: allow refreshing the terminal location
When a program is running on front while the graphical view is being changed, that can make the terminal and file view working directories out of sync. I wasn't able to find a signal from Konsole for when the foreground program exits, so having the terminal respond to F5 is the second best thing.
BUG: 510557
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/panel.cpp | 9 | ||||
| -rw-r--r-- | src/panels/panel.h | 6 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.cpp | 3 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.h | 1 |
4 files changed, 18 insertions, 1 deletions
diff --git a/src/panels/panel.cpp b/src/panels/panel.cpp index e8250c62b..94f80f7e7 100644 --- a/src/panels/panel.cpp +++ b/src/panels/panel.cpp @@ -54,6 +54,15 @@ void Panel::setUrl(const QUrl &url) } } +void Panel::refreshUrl(const QUrl &url) +{ + const QUrl oldUrl = m_url; + m_url = url; + if (!urlChanged()) { + m_url = oldUrl; + } +} + void Panel::readSettings() { } diff --git a/src/panels/panel.h b/src/panels/panel.h index 5f1fabb4a..23136a4b9 100644 --- a/src/panels/panel.h +++ b/src/panels/panel.h @@ -46,6 +46,12 @@ public Q_SLOTS: void setUrl(const QUrl &url); /** + * This is invoked whenever the folder being displayed in the + * active Dolphin view is refreshed. + */ + void refreshUrl(const QUrl &url); + + /** * Refreshes the view to get synchronized with the settings. */ virtual void readSettings(); diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index a357b31ac..2ed6cd33e 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -145,9 +145,10 @@ bool TerminalPanel::urlChanged() return false; } - const bool sendInput = m_terminal && !hasProgramRunning() && isVisible() && m_syncUrl; + const bool sendInput = m_terminal && !hasProgramRunning() && isVisible() && m_syncUrl && url() != m_url; if (sendInput) { changeDir(url()); + m_url = url(); } return true; diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index 0aaf921c0..7f4e9e36c 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -86,6 +86,7 @@ private: private: bool m_clearTerminal; bool m_syncUrl; + QUrl m_url; KIO::StatJob *m_mostLocalUrlJob; QVBoxLayout *m_layout; |
