Commit 28bfbf1a authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Kurt Hindenburg
Browse files

Pass widget again to monitoring KNotifications

9f656939 introduced the possibility of showing a session in multiple
views, something which is no longer supported.  In doing so, it started
passing QApplication::activeWindow(), instead of TEWidget (nowadays
TerminalDisplay) to KNotification.

7592e894 split notifications for focused/unfocused terminals.
Unfortunately, QApplication::activeWindow() returns nothing for unmapped
windows, which results in issues when notifications are configured to
mark the task bar entry or run a command with %w/%t substitutions (for
window id and window title).

BUG: 443117
parent 0fe44c52
......@@ -656,10 +656,15 @@ void Session::silenceTimerDone()
return;
}
TerminalDisplay *view = nullptr;
if (!_views.isEmpty()) {
view = _views.first();
}
KNotification::event(hasFocus() ? QStringLiteral("Silence") : QStringLiteral("SilenceHidden"),
i18n("Silence in '%1' (Session '%2')", _displayTitle, _nameTitle),
QPixmap(),
QApplication::activeWindow(),
view,
KNotification::CloseWhenWidgetActivated);
setPendingNotification(Notification::Silence);
}
......@@ -1728,11 +1733,16 @@ void Session::handleActivity()
// TODO: should this hardcoded interval be user configurable?
const int activityMaskInSeconds = 15;
TerminalDisplay *view = nullptr;
if (!_views.isEmpty()) {
view = _views.first();
}
if (_monitorActivity && !_notifiedActivity) {
KNotification::event(hasFocus() ? QStringLiteral("Activity") : QStringLiteral("ActivityHidden"),
i18n("Activity in '%1' (Session '%2')", _displayTitle, _nameTitle),
QPixmap(),
QApplication::activeWindow(),
view,
KNotification::CloseWhenWidgetActivated);
// mask activity notification for a while to avoid flooding
......
......@@ -353,7 +353,7 @@ void SessionController::snapshot()
KNotification::event(session()->hasFocus() ? QStringLiteral("ProcessFinished") : QStringLiteral("ProcessFinishedHidden"),
i18n("The process '%1' has finished running in session '%2'", _previousForegroundProcessName, session()->nameTitle()),
QPixmap(),
QApplication::activeWindow(),
view(),
KNotification::CloseWhenWidgetActivated);
}
_previousForegroundProcessName = isForegroundProcessActive ? session()->foregroundProcessName() : QString();
......
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