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
;
32 * @brief Shows the terminal which is synchronized with the URL of the
35 class TerminalPanel
: public Panel
40 explicit TerminalPanel(QWidget
*parent
= nullptr);
41 ~TerminalPanel() override
;
44 * @brief This function is used to set the terminal panels's cwd to
45 * home when an unmounting request is received.
48 QString
currentWorkingDirectory();
49 bool isHiddenInVisibleWindow() const;
50 bool terminalHasFocus() const;
51 bool hasProgramRunning() const;
52 QString
runningProgramName() const;
53 KActionCollection
*actionCollection();
56 void terminalExited();
57 void dockVisibilityChanged();
60 void hideTerminalPanel();
63 * Is emitted if the an URL change is requested.
65 void changeUrl(const QUrl
&url
);
68 bool urlChanged() override
;
70 void showEvent(QShowEvent
*event
) override
;
73 void slotMostLocalUrlResult(KJob
*job
);
74 void slotKonsolePartCurrentDirectoryChanged(const QString
&dir
);
77 enum class HistoryPolicy
{ AddToHistory
, SkipHistory
};
79 void changeDir(const QUrl
&url
);
80 void sendCdToTerminal(const QString
&path
, HistoryPolicy addToHistory
= HistoryPolicy::AddToHistory
);
81 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