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 "kiofuse_interface.h"
11 #include "panels/panel.h"
15 class TerminalInterface
;
16 class KActionCollection
;
30 * @brief Shows the terminal which is synchronized with the URL of the
33 class TerminalPanel
: public Panel
38 explicit TerminalPanel(QWidget
* parent
= nullptr);
39 ~TerminalPanel() override
;
42 * @brief This function is used to set the terminal panels's cwd to
43 * home when an unmounting request is received.
46 QString
currentWorkingDirectory();
47 bool isHiddenInVisibleWindow() const;
48 bool terminalHasFocus() const;
49 bool hasProgramRunning() const;
50 QString
runningProgramName() const;
51 KActionCollection
*actionCollection();
54 void terminalExited();
55 void dockVisibilityChanged();
58 void hideTerminalPanel();
61 * Is emitted if the an URL change is requested.
63 void changeUrl(const QUrl
& url
);
66 bool urlChanged() override
;
68 void showEvent(QShowEvent
* event
) override
;
71 void slotMostLocalUrlResult(KJob
* job
);
72 void slotKonsolePartCurrentDirectoryChanged(const QString
& dir
);
75 enum class HistoryPolicy
{
80 void changeDir(const QUrl
& url
);
81 void sendCdToTerminal(const QString
& path
, HistoryPolicy addToHistory
= HistoryPolicy::AddToHistory
);
82 void sendCdToTerminalKIOFuse(const QUrl
&url
);
85 KIO::StatJob
* m_mostLocalUrlJob
;
87 QVBoxLayout
* m_layout
;
88 TerminalInterface
* m_terminal
;
89 QWidget
* m_terminalWidget
;
90 KMessageWidget
* m_konsolePartMissingMessage
;
91 KParts::ReadOnlyPart
* m_konsolePart
;
92 QString m_konsolePartCurrentDirectory
;
93 QQueue
<QString
> m_sendCdToTerminalHistory
;
94 org::kde::KIOFuse::VFS m_kiofuseInterface
;
97 #endif // TERMINALPANEL_H