From 3cf7e5a71f0820bf26fe2900bb3f324655680623 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sun, 15 Dec 2019 11:51:50 +0100 Subject: [PATCH] [Notifications] Only show do not disturb time in tooltip if not too far in the future Basically what the popup does. --- applets/notifications/package/contents/ui/main.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/applets/notifications/package/contents/ui/main.qml b/applets/notifications/package/contents/ui/main.qml index cd2b612dc..5b93e19d0 100644 --- a/applets/notifications/package/contents/ui/main.qml +++ b/applets/notifications/package/contents/ui/main.qml @@ -60,10 +60,14 @@ Item { var inhibitedUntil = notificationSettings.notificationsInhibitedUntil var inhibitedUntilValid = !isNaN(inhibitedUntil.getTime()); + // Show until time if valid but not if too far in the future // TODO check app inhibition, too - if (inhibitedUntilValid) { + if (inhibitedUntilValid + && inhibitedUntil.getTime() - new Date().getTime() < 365 * 24 * 60 * 60 * 1000 /* 1 year*/) { lines.push(i18n("Do not disturb until %1", KCoreAddons.Format.formatRelativeDateTime(inhibitedUntil, Locale.ShortFormat))); + } else { + lines.push(i18n("Do not disturb")); } } else if (lines.length === 0) { lines.push(i18n("No unread notifications"));