Commit 0fe44c52 authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Kurt Hindenburg
Browse files

Pass widget again to KNotification on bell

67508680 refactored TerminalBell out from TerminalDisplay, and in the
process stopped passing the TerminalDisplay widget to KNotification,
which resulted in issues when notifications where configured to mark the
task bar entry or run a command with %w/%t substitutions (for window id
and window title).

Many thanks to Nicole Kleinhoff and Jan Palus who identified the commit
that introduced the regression.

CCBUG: 443117
BUG: 443411
BUG: 445520
parent 830f4168
......@@ -9,6 +9,7 @@
#include "TerminalBell.h"
#include <QTimer>
#include <QWidget>
#include <KNotification>
......@@ -25,7 +26,7 @@ TerminalBell::TerminalBell(Enum::BellModeEnum bellMode)
{
}
void TerminalBell::bell(const QString &message, bool terminalHasFocus)
void TerminalBell::bell(QWidget *terminalDisplay, const QString &message, bool terminalHasFocus)
{
switch (_bellMode) {
case Enum::SystemBeepBell:
......@@ -36,7 +37,7 @@ void TerminalBell::bell(const QString &message, bool terminalHasFocus)
// Please note that these event names, "BellVisible" and "BellInvisible",
// should not change and should be kept stable, because other applications
// that use this code via KPart rely on these names for notifications.
KNotification::event(terminalHasFocus ? QStringLiteral("BellVisible") : QStringLiteral("BellInvisible"), message, QPixmap());
KNotification::event(terminalHasFocus ? QStringLiteral("BellVisible") : QStringLiteral("BellInvisible"), message, QPixmap(), terminalDisplay);
break;
case Enum::VisualBell:
Q_EMIT visualBell();
......
......@@ -9,6 +9,7 @@
#pragma once
#include <QObject>
#include <QWidget>
#include <Enumeration.h>
......@@ -20,7 +21,7 @@ class TerminalBell : public QObject
public:
TerminalBell(Enum::BellModeEnum bellMode);
void bell(const QString &message, bool terminalHasFocus);
void bell(QWidget *td, const QString &message, bool terminalHasFocus);
/**
* Sets the type of effect used to alert the user when a 'bell' occurs in the
......
......@@ -2688,7 +2688,7 @@ void TerminalDisplay::contextMenuEvent(QContextMenuEvent *event)
void TerminalDisplay::bell(const QString &message)
{
_bell.bell(message, hasFocus());
_bell.bell(this, message, hasFocus());
}
/* --------------------------------------------------------------------- */
......
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