2 * SPDX-FileCopyrightText: 2007-2010 Peter Penz <peter.penz19@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #ifndef TERMINALPANEL_H
8 #define TERMINALPANEL_H
10 #include "panels/panel.h"
11 #include "kiofuse_interface.h"
15 class TerminalInterface
;
29 * @brief Shows the terminal which is synchronized with the URL of the
32 class TerminalPanel
: public Panel
37 explicit TerminalPanel(QWidget
* parent
= nullptr);
38 ~TerminalPanel() override
;
41 * @brief This function is used to set the terminal panels's cwd to
42 * home when an unmounting request is received.
45 QString
currentWorkingDirectory();
46 bool isHiddenInVisibleWindow() const;
47 bool terminalHasFocus() const;
48 bool hasProgramRunning() const;
49 QString
runningProgramName() const;
52 void terminalExited();
53 void dockVisibilityChanged();
56 void hideTerminalPanel();
59 * Is emitted if the an URL change is requested.
61 void changeUrl(const QUrl
& url
);
64 bool urlChanged() override
;
66 void showEvent(QShowEvent
* event
) override
;
69 void slotMostLocalUrlResult(KJob
* job
);
70 void slotKonsolePartCurrentDirectoryChanged(const QString
& dir
);
73 enum class HistoryPolicy
{
78 void changeDir(const QUrl
& url
);
79 void sendCdToTerminal(const QString
& path
, HistoryPolicy addToHistory
= HistoryPolicy::AddToHistory
);
80 void sendCdToTerminalKIOFuse(const QUrl
&url
);
83 KIO::StatJob
* m_mostLocalUrlJob
;
85 QVBoxLayout
* m_layout
;
86 TerminalInterface
* m_terminal
;
87 QWidget
* m_terminalWidget
;
88 KMessageWidget
* m_konsolePartMissingMessage
;
89 KParts::ReadOnlyPart
* m_konsolePart
;
90 QString m_konsolePartCurrentDirectory
;
91 QQueue
<QString
> m_sendCdToTerminalHistory
;
92 org::kde::KIOFuse::VFS m_kiofuseInterface
;
95 #endif // TERMINALPANEL_H