mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
popupnotifications: a bit of cleanup and bugfixes
This fixes an issue where if a notification is delivered while the action drawer is opened, it won't dismiss properly. Causing an issue where if a new notification comes through any time afterwards, the top touch area will get stuck and prevent touch inputs. This also finishes connecting the do not disturb popup whitelist to the notification model.
This commit is contained in:
parent
abb9b963f0
commit
c6e0591977
3 changed files with 25 additions and 19 deletions
|
|
@ -45,8 +45,9 @@ Item {
|
|||
interval: Kirigami.Units.veryLongDuration
|
||||
running: true
|
||||
onTriggered: {
|
||||
updateNotificationPopups();
|
||||
visible = true;
|
||||
updateNotificationPopups();
|
||||
checkActionDrawerOpened();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,8 +134,9 @@ Item {
|
|||
// if the popup height ever changes, update the notification below wiht new height
|
||||
// also update the allowed touch area for the main window
|
||||
onPopupHeightChanged: {
|
||||
if (popupIndex + 1 < popupCount) {
|
||||
popupNotifications.objectAt(popupIndex + 1).aboveNotificationHeight = popupHeight;
|
||||
let abovePopup = popupNotifications.objectAt(popupIndex + 1)
|
||||
if (popupIndex + 1 < popupCount && abovePopup) {
|
||||
abovePopup.aboveNotificationHeight = popupHeight;
|
||||
}
|
||||
if (popupNotifications.currentPopupIndex == notificationPopup.popupIndex && notificationItem.state == "open") {
|
||||
notificationPopup.updateTouchArea();
|
||||
|
|
@ -143,22 +145,25 @@ Item {
|
|||
|
||||
// if the offset position need in the expanded drawer changes, update the notification below wiht new offset
|
||||
onFullOpenOffsetChanged: {
|
||||
if (popupIndex + 1 < popupCount) {
|
||||
popupNotifications.objectAt(popupIndex + 1).aboveNotificationFullOffset = fullOpenOffset;
|
||||
let abovePopup = popupNotifications.objectAt(popupIndex + 1)
|
||||
if (popupIndex + 1 < popupCount && abovePopup) {
|
||||
abovePopup.aboveNotificationFullOffset = fullOpenOffset;
|
||||
}
|
||||
}
|
||||
// if the notification is being draged and is the current one
|
||||
// update 'currentDragOffset' so all notifications can easily access this value
|
||||
onDragOffsetChanged: {
|
||||
let abovePopup = popupNotifications.objectAt(popupIndex + 1)
|
||||
if (popupNotifications.currentPopupIndex == notificationPopup.popupIndex) {
|
||||
popupNotifications.currentDragOffset = dragOffset;
|
||||
}
|
||||
}
|
||||
// if a new notification is added, update the above notification values need for the expanded drawer
|
||||
onPopupCountChanged: {
|
||||
if (popupIndex + 1 < popupCount) {
|
||||
popupNotifications.objectAt(popupIndex + 1).aboveNotificationHeight = popupHeight;
|
||||
popupNotifications.objectAt(popupIndex + 1).aboveNotificationFullOffset = fullOpenOffset;
|
||||
let abovePopup = popupNotifications.objectAt(popupIndex + 1)
|
||||
if (popupIndex + 1 < abovePopup) {
|
||||
abovePopup.aboveNotificationHeight = popupHeight;
|
||||
abovePopup.aboveNotificationFullOffset = fullOpenOffset;
|
||||
}
|
||||
}
|
||||
// update the current popup index value if the index ever changes.
|
||||
|
|
@ -201,14 +206,10 @@ Item {
|
|||
return model.timeout;
|
||||
}
|
||||
|
||||
Component.onCompleted: checkActionDrawerOpened()
|
||||
|
||||
// check if the action drawer is opened, and if so, close the popup with scale
|
||||
// check if the action drawer is opened and the popup is fully created
|
||||
// if so, close the popup with a scale effect
|
||||
function checkActionDrawerOpened() {
|
||||
if (isActionDrawerOpen) {
|
||||
if (popupNotifications.currentPopupIndex == notificationPopup.popupIndex) {
|
||||
notificationPopup.setInputTransparent();
|
||||
}
|
||||
if (isActionDrawerOpen && popupNotifications.objectAt(popupIndex)) {
|
||||
notificationPopup.expired();
|
||||
keyboardInteractivity = LayerShell.Window.KeyboardInteractivityNone;
|
||||
notificationItem.state = "closeWithScale";
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ Window {
|
|||
model: popupNotificationsModel
|
||||
|
||||
// get the height, drag offset, and idx of the current popup notifition and make it easily accessible by all popup notifications
|
||||
property int currentPopupHeight: (count > 0 && currentPopupIndex < count) ? objectAt(currentPopupIndex).popupHeight : 0;
|
||||
property int currentPopupHeight: (count > 0 && currentPopupIndex < count && objectAt(currentPopupIndex)) ? objectAt(currentPopupIndex).popupHeight : 0;
|
||||
property int currentDragOffset: 0
|
||||
property int currentPopupIndex: 0
|
||||
|
||||
|
|
@ -224,7 +224,11 @@ Window {
|
|||
// but don't actually invalidate the notification
|
||||
model.expired = true;
|
||||
} else {
|
||||
popupNotificationsModel.expire(popupNotificationsModel.index(index, 0));
|
||||
if (notificationModelType === NotificationsModelType.WatchedNotificationsModel) {
|
||||
popupNotificationsModel.expire(model.notificationId);
|
||||
} else if (notificationModelType === NotificationsModelType.NotificationsModel) {
|
||||
popupNotificationsModel.expire(popupNotificationsModel.index(index, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,9 @@ QtObject {
|
|||
showDismissed: false
|
||||
blacklistedDesktopEntries: notificationSettings.popupBlacklistedApplications
|
||||
blacklistedNotifyRcNames: notificationSettings.popupBlacklistedServices
|
||||
whitelistedDesktopEntries: []
|
||||
whitelistedNotifyRcNames: []
|
||||
whitelistedDesktopEntries: notificationProvider.inhibited ? notificationSettings.doNotDisturbPopupWhitelistedApplications : []
|
||||
whitelistedNotifyRcNames: notificationProvider.inhibited ? notificationSettings.doNotDisturbPopupWhitelistedServices : []
|
||||
|
||||
showJobs: notificationSettings.jobsInNotifications
|
||||
sortMode: NotificationManager.Notifications.SortByTypeAndUrgency
|
||||
sortOrder: Qt.DescendingOrder
|
||||
|
|
|
|||
Loading…
Reference in a new issue