┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/terminal
diff options
context:
space:
mode:
authorNate Graham <[email protected]>2023-09-19 08:29:35 -0600
committerNate Graham <[email protected]>2023-09-19 08:29:35 -0600
commit64e40c1d934247fc9e1c2fa00761b2cb8d70a146 (patch)
tree161a29188b58fa77a7c3898ec5eb1b3b6d1724d6 /src/panels/terminal
parent4cbeb81b2b8e2d37c93cda4d88787e08e0658291 (diff)
parente08f6f9b58753d0438162b6cd2e2df65d6e20b35 (diff)
Merge branch 'master' into kf6
Diffstat (limited to 'src/panels/terminal')
-rw-r--r--src/panels/terminal/terminalpanel.cpp61
1 files changed, 33 insertions, 28 deletions
diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp
index ac395d09d..30c9e8409 100644
--- a/src/panels/terminal/terminalpanel.cpp
+++ b/src/panels/terminal/terminalpanel.cpp
@@ -77,18 +77,22 @@ void TerminalPanel::dockVisibilityChanged()
{
// Only react when the DockWidget itself (not some parent) is hidden. This way we don't
// respond when e.g. Dolphin is minimized.
- if (isHiddenInVisibleWindow() && m_terminal && !hasProgramRunning()) {
- // Make sure that the following "cd /" command will not affect the view.
- disconnect(m_konsolePart, SIGNAL(currentDirectoryChanged(QString)), this, SLOT(slotKonsolePartCurrentDirectoryChanged(QString)));
+ if (isHiddenInVisibleWindow()) {
+ if (m_konsolePartMissingMessage) {
+ m_konsolePartMissingMessage->hide();
+ } else if (m_terminal && !hasProgramRunning()) {
+ // Make sure that the following "cd /" command will not affect the view.
+ disconnect(m_konsolePart, SIGNAL(currentDirectoryChanged(QString)), this, SLOT(slotKonsolePartCurrentDirectoryChanged(QString)));
- // Make sure this terminal does not prevent unmounting any removable drives
- changeDir(QUrl::fromLocalFile(QStringLiteral("/")));
+ // Make sure this terminal does not prevent unmounting any removable drives
+ changeDir(QUrl::fromLocalFile(QStringLiteral("/")));
- // Because we have disconnected from the part's currentDirectoryChanged()
- // signal, we have to update m_konsolePartCurrentDirectory manually. If this
- // was not done, showing the panel again might not set the part's working
- // directory correctly.
- m_konsolePartCurrentDirectory = '/';
+ // Because we have disconnected from the part's currentDirectoryChanged()
+ // signal, we have to update m_konsolePartCurrentDirectory manually. If this
+ // was not done, showing the panel again might not set the part's working
+ // directory correctly.
+ m_konsolePartCurrentDirectory = '/';
+ }
}
}
@@ -168,25 +172,26 @@ void TerminalPanel::showEvent(QShowEvent *event)
});
}
- } else if (!m_konsolePartMissingMessage) {
- const auto konsoleInstallUrl = QUrl("appstream://org.kde.konsole.desktop");
- const auto konsoleNotInstalledText = i18n(
- "Terminal cannot be shown because Konsole is not installed. "
- "Please install it and then reopen the panel.");
- m_konsolePartMissingMessage = new KMessageWidget(konsoleNotInstalledText, this);
- m_konsolePartMissingMessage->setCloseButtonVisible(false);
- m_konsolePartMissingMessage->hide();
- if (KIO::DesktopExecParser::hasSchemeHandler(konsoleInstallUrl)) {
- auto installKonsoleAction = new QAction(i18n("Install Konsole"), this);
- connect(installKonsoleAction, &QAction::triggered, [konsoleInstallUrl]() {
- QDesktopServices::openUrl(konsoleInstallUrl);
- });
- m_konsolePartMissingMessage->addAction(installKonsoleAction);
- }
- m_layout->addWidget(m_konsolePartMissingMessage);
- m_layout->addStretch();
- QTimer::singleShot(0, m_konsolePartMissingMessage, &KMessageWidget::animatedShow);
} else {
+ if (!m_konsolePartMissingMessage) {
+ const auto konsoleInstallUrl = QUrl("appstream://org.kde.konsole.desktop");
+ const auto konsoleNotInstalledText = i18n(
+ "Terminal cannot be shown because Konsole is not installed. "
+ "Please install it and then reopen the panel.");
+ m_konsolePartMissingMessage = new KMessageWidget(konsoleNotInstalledText, this);
+ m_konsolePartMissingMessage->setCloseButtonVisible(false);
+ m_konsolePartMissingMessage->hide();
+ if (KIO::DesktopExecParser::hasSchemeHandler(konsoleInstallUrl)) {
+ auto installKonsoleAction = new QAction(i18n("Install Konsole"), this);
+ connect(installKonsoleAction, &QAction::triggered, [konsoleInstallUrl]() {
+ QDesktopServices::openUrl(konsoleInstallUrl);
+ });
+ m_konsolePartMissingMessage->addAction(installKonsoleAction);
+ }
+ m_layout->addWidget(m_konsolePartMissingMessage);
+ m_layout->setSizeConstraint(QLayout::SetMaximumSize);
+ }
+
m_konsolePartMissingMessage->animatedShow();
}
}