Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit c442d223 authored by Joshua Noack's avatar Joshua Noack Committed by Kurt Hindenburg

Use default close button of KMessageWidget

D10935 introduced KMessageWidgets in TerminalDisplay for the "resume"
and "read-only" messages. This patch restores the default close button
and makes use of animateShow/animateHide. A nice plus is that I also
removed some code which has become obsolete AND that the messages
are now animated.


Test Plan:
Show/hide works like before.
Also still works if readonly and suspended at the same time.
Detaching works.

Reviewers: ach, #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, ach, #konsole

Tags: #konsole

Differential Revision:
parent 5eb9952b
......@@ -3355,25 +3355,19 @@ void TerminalDisplay::outputSuspended(bool suspended)
//all terminal emulators.
//If there isn't a suitable article available in the target language the link
//can simply be removed.
auto linkHandler = [this](const QString &url) {
if (url == QLatin1String("#close")) {
} else {
_outputSuspendedMessageWidget = createMessageWidget(i18n("<qt>Output has been "
"<a href=\"\">suspended</a>"
" by pressing Ctrl+S."
" Press <b>Ctrl+Q</b> to resume."
" Click <a href=\"#close\">here</a> to dismiss this message.</qt>"), linkHandler);
" Press <b>Ctrl+Q</b> to resume.</qt>"));
connect(_outputSuspendedMessageWidget, &KMessageWidget::linkActivated, this, [this](const QString &url) {
suspended ? _outputSuspendedMessageWidget->animatedShow() : _outputSuspendedMessageWidget->animatedHide();
void TerminalDisplay::dismissOutputSuspendedMessage()
......@@ -3381,15 +3375,12 @@ void TerminalDisplay::dismissOutputSuspendedMessage()
KMessageWidget* TerminalDisplay::createMessageWidget(const QString &text, std::function<void (const QString&)> linkHandler) {
KMessageWidget* TerminalDisplay::createMessageWidget(const QString &text) {
auto widget = new KMessageWidget(text);
connect(widget, &KMessageWidget::linkActivated, this, linkHandler);
_verticalLayout->insertWidget(0, widget);
return widget;
......@@ -3399,20 +3390,13 @@ void TerminalDisplay::updateReadOnlyState(bool readonly) {
if (readonly) {
// Lazy create the readonly messagewidget
if (_readOnlyMessageWidget == nullptr) {
auto linkHandler = [this](const QString &url) {
if (url == QLatin1String("#close")) {
_readOnlyMessageWidget = createMessageWidget(i18n("<qt>This terminal is read-only. <a href=\"#close\">Dismiss</a></qt>"), linkHandler);
_readOnlyMessageWidget = createMessageWidget(i18n("This terminal is read-only."));
if (_readOnlyMessageWidget != nullptr) {
readonly ? _readOnlyMessageWidget->animatedShow() : _readOnlyMessageWidget->animatedHide();
......@@ -21,8 +21,6 @@
#include <functional>
// Qt
#include <QColor>
#include <QPointer>
......@@ -882,7 +880,7 @@ private:
Screen::DecodingOptions currentDecodingOptions();
// Boilerplate setup for MessageWidget
KMessageWidget* createMessageWidget(const QString &text, std::function<void (const QString&)> linkHandler);
KMessageWidget* createMessageWidget(const QString &text);
// the window onto the terminal screen which this display
// is currently showing.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment