mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
modules cleanup and qmlfmt everywhere
- throw in 24H clock fix and app drawer fix too
This commit is contained in:
@@ -9,10 +9,15 @@ DankListView {
|
||||
property var keyboardController: null
|
||||
property bool keyboardActive: false
|
||||
property bool autoScrollDisabled: false
|
||||
property alias count: listView.count
|
||||
property alias listContentHeight: listView.contentHeight
|
||||
|
||||
clip: true
|
||||
model: NotificationService.groupedNotifications
|
||||
spacing: Theme.spacingL
|
||||
|
||||
onIsUserScrollingChanged: {
|
||||
if (isUserScrolling && keyboardController
|
||||
&& keyboardController.keyboardNavigationActive) {
|
||||
if (isUserScrolling && keyboardController && keyboardController.keyboardNavigationActive) {
|
||||
autoScrollDisabled = true
|
||||
}
|
||||
}
|
||||
@@ -21,24 +26,13 @@ DankListView {
|
||||
autoScrollDisabled = false
|
||||
}
|
||||
|
||||
property alias count: listView.count
|
||||
property alias listContentHeight: listView.contentHeight
|
||||
|
||||
clip: true
|
||||
model: NotificationService.groupedNotifications
|
||||
spacing: Theme.spacingL
|
||||
|
||||
Timer {
|
||||
id: positionPreservationTimer
|
||||
interval: 200
|
||||
running: keyboardController
|
||||
&& keyboardController.keyboardNavigationActive
|
||||
&& !autoScrollDisabled
|
||||
running: keyboardController && keyboardController.keyboardNavigationActive && !autoScrollDisabled
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (keyboardController
|
||||
&& keyboardController.keyboardNavigationActive
|
||||
&& !autoScrollDisabled) {
|
||||
if (keyboardController && keyboardController.keyboardNavigationActive && !autoScrollDisabled) {
|
||||
keyboardController.ensureVisible()
|
||||
}
|
||||
}
|
||||
@@ -50,107 +44,94 @@ DankListView {
|
||||
}
|
||||
|
||||
onModelChanged: {
|
||||
if (keyboardController && keyboardController.keyboardNavigationActive) {
|
||||
keyboardController.rebuildFlatNavigation()
|
||||
Qt.callLater(function () {
|
||||
if (keyboardController
|
||||
&& keyboardController.keyboardNavigationActive
|
||||
&& !autoScrollDisabled) {
|
||||
keyboardController.ensureVisible()
|
||||
}
|
||||
})
|
||||
if (!keyboardController || !keyboardController.keyboardNavigationActive) {
|
||||
return
|
||||
}
|
||||
keyboardController.rebuildFlatNavigation()
|
||||
Qt.callLater(() => {
|
||||
if (keyboardController && keyboardController.keyboardNavigationActive && !autoScrollDisabled) {
|
||||
keyboardController.ensureVisible()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
delegate: Item {
|
||||
required property var modelData
|
||||
required property int index
|
||||
|
||||
readonly property bool isExpanded: NotificationService.expandedGroups[modelData?.key]
|
||||
|| false
|
||||
readonly property bool isExpanded: (NotificationService.expandedGroups[modelData && modelData.key] || false)
|
||||
|
||||
width: ListView.view.width
|
||||
height: notificationCardWrapper.height
|
||||
height: notificationCard.height
|
||||
|
||||
Item {
|
||||
id: notificationCardWrapper
|
||||
NotificationCard {
|
||||
id: notificationCard
|
||||
width: parent.width
|
||||
height: notificationCard.height
|
||||
notificationGroup: modelData
|
||||
keyboardNavigationActive: listView.keyboardActive
|
||||
|
||||
NotificationCard {
|
||||
id: notificationCard
|
||||
width: parent.width
|
||||
notificationGroup: modelData
|
||||
isGroupSelected: {
|
||||
if (!keyboardController || !keyboardController.keyboardNavigationActive || !listView.keyboardActive) {
|
||||
return false
|
||||
}
|
||||
keyboardController.selectionVersion
|
||||
const selection = keyboardController.getCurrentSelection()
|
||||
return selection.type === "group" && selection.groupIndex === index
|
||||
}
|
||||
|
||||
isGroupSelected: {
|
||||
if (!keyboardController
|
||||
|| !keyboardController.keyboardNavigationActive)
|
||||
return false
|
||||
keyboardController.selectionVersion
|
||||
if (!listView.keyboardActive)
|
||||
return false
|
||||
const selection = keyboardController.getCurrentSelection()
|
||||
return selection.type === "group"
|
||||
&& selection.groupIndex === index
|
||||
selectedNotificationIndex: {
|
||||
if (!keyboardController || !keyboardController.keyboardNavigationActive || !listView.keyboardActive) {
|
||||
return -1
|
||||
}
|
||||
selectedNotificationIndex: {
|
||||
if (!keyboardController
|
||||
|| !keyboardController.keyboardNavigationActive)
|
||||
return -1
|
||||
keyboardController.selectionVersion
|
||||
if (!listView.keyboardActive)
|
||||
return -1
|
||||
const selection = keyboardController.getCurrentSelection()
|
||||
return (selection.type === "notification"
|
||||
&& selection.groupIndex === index) ? selection.notificationIndex : -1
|
||||
}
|
||||
keyboardNavigationActive: listView.keyboardActive
|
||||
keyboardController.selectionVersion
|
||||
const selection = keyboardController.getCurrentSelection()
|
||||
return (selection.type === "notification" && selection.groupIndex === index) ? selection.notificationIndex : -1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: NotificationService
|
||||
|
||||
function onGroupedNotificationsChanged() {
|
||||
if (keyboardController) {
|
||||
if (keyboardController.isTogglingGroup) {
|
||||
keyboardController.rebuildFlatNavigation()
|
||||
return
|
||||
}
|
||||
if (!keyboardController) {
|
||||
return
|
||||
}
|
||||
|
||||
if (keyboardController.isTogglingGroup) {
|
||||
keyboardController.rebuildFlatNavigation()
|
||||
return
|
||||
}
|
||||
|
||||
if (keyboardController.keyboardNavigationActive) {
|
||||
Qt.callLater(function () {
|
||||
if (!autoScrollDisabled) {
|
||||
keyboardController.ensureVisible()
|
||||
}
|
||||
})
|
||||
}
|
||||
keyboardController.rebuildFlatNavigation()
|
||||
|
||||
if (keyboardController.keyboardNavigationActive) {
|
||||
Qt.callLater(() => {
|
||||
if (!autoScrollDisabled) {
|
||||
keyboardController.ensureVisible()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function onExpandedGroupsChanged() {
|
||||
if (keyboardController
|
||||
&& keyboardController.keyboardNavigationActive) {
|
||||
Qt.callLater(function () {
|
||||
if (!autoScrollDisabled) {
|
||||
keyboardController.ensureVisible()
|
||||
}
|
||||
})
|
||||
if (keyboardController && keyboardController.keyboardNavigationActive) {
|
||||
Qt.callLater(() => {
|
||||
if (!autoScrollDisabled) {
|
||||
keyboardController.ensureVisible()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function onExpandedMessagesChanged() {
|
||||
if (keyboardController
|
||||
&& keyboardController.keyboardNavigationActive) {
|
||||
Qt.callLater(function () {
|
||||
if (!autoScrollDisabled) {
|
||||
keyboardController.ensureVisible()
|
||||
}
|
||||
})
|
||||
if (keyboardController && keyboardController.keyboardNavigationActive) {
|
||||
Qt.callLater(() => {
|
||||
if (!autoScrollDisabled) {
|
||||
keyboardController.ensureVisible()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
target: NotificationService
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,11 @@ Rectangle {
|
||||
id: root
|
||||
|
||||
property var notificationGroup
|
||||
property bool expanded: NotificationService.expandedGroups[notificationGroup?.key]
|
||||
|| false
|
||||
property bool descriptionExpanded: NotificationService.expandedMessages[notificationGroup?.latestNotification?.notification?.id + "_desc"]
|
||||
|| false
|
||||
property bool expanded: (NotificationService.expandedGroups[notificationGroup && notificationGroup.key] || false)
|
||||
property bool descriptionExpanded: (NotificationService.expandedMessages[(notificationGroup && notificationGroup.latestNotification && notificationGroup.latestNotification.notification
|
||||
&& notificationGroup.latestNotification.notification.id) ? (notificationGroup.latestNotification.notification.id + "_desc") : ""] || false)
|
||||
property bool userInitiatedExpansion: false
|
||||
|
||||
// Selection properties for keyboard navigation
|
||||
property bool isGroupSelected: false
|
||||
property int selectedNotificationIndex: -1
|
||||
property bool keyboardNavigationActive: false
|
||||
@@ -29,8 +27,7 @@ Rectangle {
|
||||
}
|
||||
const baseHeight = 116
|
||||
if (descriptionExpanded) {
|
||||
return baseHeight + descriptionText.contentHeight
|
||||
- (descriptionText.font.pixelSize * 1.2 * 2)
|
||||
return baseHeight + descriptionText.contentHeight - (descriptionText.font.pixelSize * 1.2 * 2)
|
||||
}
|
||||
return baseHeight
|
||||
}
|
||||
@@ -51,50 +48,33 @@ Rectangle {
|
||||
}
|
||||
|
||||
color: {
|
||||
// Keyboard selection highlighting for groups (both collapsed and expanded)
|
||||
if (isGroupSelected && keyboardNavigationActive) {
|
||||
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
|
||||
Theme.surfaceVariant.b, 0.2)
|
||||
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.2)
|
||||
}
|
||||
// Very subtle group highlighting when navigating within expanded group
|
||||
if (keyboardNavigationActive && expanded
|
||||
&& selectedNotificationIndex >= 0) {
|
||||
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
|
||||
Theme.surfaceVariant.b, 0.12)
|
||||
if (keyboardNavigationActive && expanded && selectedNotificationIndex >= 0) {
|
||||
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.12)
|
||||
}
|
||||
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
|
||||
Theme.surfaceVariant.b, 0.1)
|
||||
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.1)
|
||||
}
|
||||
border.color: {
|
||||
// Keyboard selection highlighting for groups (both collapsed and expanded)
|
||||
if (isGroupSelected && keyboardNavigationActive) {
|
||||
return Qt.rgba(Theme.primary.r, Theme.primary.g,
|
||||
Theme.primary.b, 0.5)
|
||||
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.5)
|
||||
}
|
||||
// Subtle group border when navigating within expanded group
|
||||
if (keyboardNavigationActive && expanded
|
||||
&& selectedNotificationIndex >= 0) {
|
||||
return Qt.rgba(Theme.primary.r, Theme.primary.g,
|
||||
Theme.primary.b, 0.2)
|
||||
if (keyboardNavigationActive && expanded && selectedNotificationIndex >= 0) {
|
||||
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2)
|
||||
}
|
||||
// Critical notification styling
|
||||
if (notificationGroup?.latestNotification?.urgency === NotificationUrgency.Critical) {
|
||||
return Qt.rgba(Theme.primary.r, Theme.primary.g,
|
||||
Theme.primary.b, 0.3)
|
||||
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.3)
|
||||
}
|
||||
return Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.05)
|
||||
}
|
||||
border.width: {
|
||||
// Keyboard selection highlighting for groups (both collapsed and expanded)
|
||||
if (isGroupSelected && keyboardNavigationActive) {
|
||||
return 1.5
|
||||
}
|
||||
// Subtle group border when navigating within expanded group
|
||||
if (keyboardNavigationActive && expanded
|
||||
&& selectedNotificationIndex >= 0) {
|
||||
if (keyboardNavigationActive && expanded && selectedNotificationIndex >= 0) {
|
||||
return 1
|
||||
}
|
||||
// Critical notification styling
|
||||
if (notificationGroup?.latestNotification?.urgency === NotificationUrgency.Critical) {
|
||||
return 2
|
||||
}
|
||||
@@ -142,8 +122,7 @@ Rectangle {
|
||||
width: 55
|
||||
height: 55
|
||||
radius: 27.5
|
||||
color: Qt.rgba(Theme.primary.r, Theme.primary.g,
|
||||
Theme.primary.b, 0.1)
|
||||
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
|
||||
border.color: "transparent"
|
||||
border.width: 0
|
||||
anchors.left: parent.left
|
||||
@@ -158,9 +137,7 @@ Rectangle {
|
||||
return notificationGroup.latestNotification.cleanImage
|
||||
if (notificationGroup?.latestNotification?.appIcon) {
|
||||
const appIcon = notificationGroup.latestNotification.appIcon
|
||||
if (appIcon.startsWith("file://") || appIcon.startsWith(
|
||||
"http://") || appIcon.startsWith(
|
||||
"https://"))
|
||||
if (appIcon.startsWith("file://") || appIcon.startsWith("http://") || appIcon.startsWith("https://"))
|
||||
return appIcon
|
||||
return Quickshell.iconPath(appIcon, true)
|
||||
}
|
||||
@@ -171,9 +148,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
visible: !parent.hasNotificationImage
|
||||
&& (!notificationGroup?.latestNotification?.appIcon
|
||||
|| notificationGroup.latestNotification.appIcon === "")
|
||||
visible: !parent.hasNotificationImage && (!notificationGroup?.latestNotification?.appIcon || notificationGroup.latestNotification.appIcon === "")
|
||||
text: {
|
||||
const appName = notificationGroup?.appName || "?"
|
||||
return appName.charAt(0).toUpperCase()
|
||||
@@ -196,9 +171,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: (notificationGroup?.count
|
||||
|| 0) > 99 ? "99+" : (notificationGroup?.count
|
||||
|| 0).toString()
|
||||
text: (notificationGroup?.count || 0) > 99 ? "99+" : (notificationGroup?.count || 0).toString()
|
||||
color: Theme.primaryText
|
||||
font.pixelSize: 9
|
||||
font.weight: Font.Bold
|
||||
@@ -231,13 +204,9 @@ Rectangle {
|
||||
StyledText {
|
||||
width: parent.width
|
||||
text: {
|
||||
const timeStr = notificationGroup?.latestNotification?.timeStr
|
||||
|| ""
|
||||
if (timeStr.length > 0)
|
||||
return (notificationGroup?.appName
|
||||
|| "") + " • " + timeStr
|
||||
else
|
||||
return notificationGroup?.appName || ""
|
||||
const timeStr = (notificationGroup && notificationGroup.latestNotification && notificationGroup.latestNotification.timeStr) || ""
|
||||
const appName = (notificationGroup && notificationGroup.appName) || ""
|
||||
return timeStr.length > 0 ? `${appName} • ${timeStr}` : appName
|
||||
}
|
||||
color: Theme.surfaceVariantText
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
@@ -247,8 +216,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: notificationGroup?.latestNotification?.summary
|
||||
|| ""
|
||||
text: (notificationGroup && notificationGroup.latestNotification && notificationGroup.latestNotification.summary) || ""
|
||||
color: Theme.surfaceText
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
@@ -260,8 +228,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
id: descriptionText
|
||||
property string fullText: notificationGroup?.latestNotification?.htmlBody
|
||||
|| ""
|
||||
property string fullText: (notificationGroup && notificationGroup.latestNotification && notificationGroup.latestNotification.htmlBody) || ""
|
||||
property bool hasMoreText: truncated
|
||||
|
||||
text: fullText
|
||||
@@ -280,12 +247,10 @@ Rectangle {
|
||||
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : (parent.hasMoreText || descriptionExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
|
||||
onClicked: mouse => {
|
||||
if (!parent.hoveredLink
|
||||
&& (parent.hasMoreText
|
||||
|| descriptionExpanded)) {
|
||||
const messageId = notificationGroup?.latestNotification?.notification?.id + "_desc"
|
||||
NotificationService.toggleMessageExpansion(
|
||||
messageId)
|
||||
if (!parent.hoveredLink && (parent.hasMoreText || descriptionExpanded)) {
|
||||
const messageId = (notificationGroup && notificationGroup.latestNotification && notificationGroup.latestNotification.notification
|
||||
&& notificationGroup.latestNotification.notification.id) ? (notificationGroup.latestNotification.notification.id + "_desc") : ""
|
||||
NotificationService.toggleMessageExpansion(messageId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,9 +315,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: (notificationGroup?.count
|
||||
|| 0) > 99 ? "99+" : (notificationGroup?.count
|
||||
|| 0).toString()
|
||||
text: (notificationGroup?.count || 0) > 99 ? "99+" : (notificationGroup?.count || 0).toString()
|
||||
color: Theme.primaryText
|
||||
font.pixelSize: 9
|
||||
font.weight: Font.Bold
|
||||
@@ -371,8 +334,7 @@ Rectangle {
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
required property int index
|
||||
readonly property bool messageExpanded: NotificationService.expandedMessages[modelData?.notification?.id]
|
||||
|| false
|
||||
readonly property bool messageExpanded: NotificationService.expandedMessages[modelData?.notification?.id] || false
|
||||
readonly property bool isSelected: root.selectedNotificationIndex === index
|
||||
|
||||
width: parent.width
|
||||
@@ -388,17 +350,8 @@ Rectangle {
|
||||
return baseHeight
|
||||
}
|
||||
radius: Theme.cornerRadius
|
||||
color: isSelected ? Qt.rgba(Theme.surfaceVariant.r,
|
||||
Theme.surfaceVariant.g,
|
||||
Theme.surfaceVariant.b,
|
||||
0.25) : "transparent"
|
||||
border.color: isSelected ? Qt.rgba(Theme.primary.r,
|
||||
Theme.primary.g,
|
||||
Theme.primary.b,
|
||||
0.4) : Qt.rgba(
|
||||
Theme.outline.r,
|
||||
Theme.outline.g,
|
||||
Theme.outline.b, 0.05)
|
||||
color: isSelected ? Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.25) : "transparent"
|
||||
border.color: isSelected ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.05)
|
||||
border.width: isSelected ? 1 : 1
|
||||
|
||||
Behavior on color {
|
||||
@@ -427,8 +380,7 @@ Rectangle {
|
||||
Rectangle {
|
||||
id: messageIcon
|
||||
|
||||
readonly property bool hasNotificationImage: modelData?.image
|
||||
&& modelData.image !== ""
|
||||
readonly property bool hasNotificationImage: modelData?.image && modelData.image !== ""
|
||||
|
||||
width: 32
|
||||
height: 32
|
||||
@@ -436,11 +388,8 @@ Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 32
|
||||
color: Qt.rgba(Theme.primary.r, Theme.primary.g,
|
||||
Theme.primary.b, 0.1)
|
||||
border.color: Qt.rgba(Theme.primary.r,
|
||||
Theme.primary.g,
|
||||
Theme.primary.b, 0.2)
|
||||
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
|
||||
border.color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2)
|
||||
border.width: 1
|
||||
|
||||
IconImage {
|
||||
@@ -452,10 +401,7 @@ Rectangle {
|
||||
|
||||
if (modelData?.appIcon) {
|
||||
const appIcon = modelData.appIcon
|
||||
if (appIcon.startsWith("file://")
|
||||
|| appIcon.startsWith("http://")
|
||||
|| appIcon.startsWith(
|
||||
"https://"))
|
||||
if (appIcon.startsWith("file://") || appIcon.startsWith("http://") || appIcon.startsWith("https://"))
|
||||
return appIcon
|
||||
|
||||
return Quickshell.iconPath(appIcon, true)
|
||||
@@ -467,9 +413,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
visible: !parent.hasNotificationImage
|
||||
&& (!modelData?.appIcon
|
||||
|| modelData.appIcon === "")
|
||||
visible: !parent.hasNotificationImage && (!modelData?.appIcon || modelData.appIcon === "")
|
||||
text: {
|
||||
const appName = modelData?.appName || "?"
|
||||
return appName.charAt(0).toUpperCase()
|
||||
@@ -531,19 +475,14 @@ Rectangle {
|
||||
wrapMode: Text.WordWrap
|
||||
visible: text.length > 0
|
||||
linkColor: Theme.primary
|
||||
onLinkActivated: link => Qt.openUrlExternally(
|
||||
link)
|
||||
onLinkActivated: link => Qt.openUrlExternally(link)
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : (bodyText.hasMoreText || messageExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
|
||||
onClicked: mouse => {
|
||||
if (!parent.hoveredLink
|
||||
&& (bodyText.hasMoreText
|
||||
|| messageExpanded)) {
|
||||
NotificationService.toggleMessageExpansion(
|
||||
modelData?.notification?.id
|
||||
|| "")
|
||||
if (!parent.hoveredLink && (bodyText.hasMoreText || messageExpanded)) {
|
||||
NotificationService.toggleMessageExpansion(modelData?.notification?.id || "")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,26 +519,16 @@ Rectangle {
|
||||
Rectangle {
|
||||
property bool isHovered: false
|
||||
|
||||
width: Math.max(
|
||||
actionText.implicitWidth + 12,
|
||||
50)
|
||||
width: Math.max(actionText.implicitWidth + 12, 50)
|
||||
height: 24
|
||||
radius: 4
|
||||
color: isHovered ? Qt.rgba(
|
||||
Theme.primary.r,
|
||||
Theme.primary.g,
|
||||
Theme.primary.b,
|
||||
0.1) : "transparent"
|
||||
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) : "transparent"
|
||||
|
||||
StyledText {
|
||||
id: actionText
|
||||
text: {
|
||||
const baseText = modelData.text
|
||||
|| "View"
|
||||
if (keyboardNavigationActive
|
||||
&& (isGroupSelected
|
||||
|| selectedNotificationIndex
|
||||
>= 0)) {
|
||||
const baseText = modelData.text || "View"
|
||||
if (keyboardNavigationActive && (isGroupSelected || selectedNotificationIndex >= 0)) {
|
||||
return `${baseText} (${index + 1})`
|
||||
}
|
||||
return baseText
|
||||
@@ -618,8 +547,7 @@ Rectangle {
|
||||
onEntered: parent.isHovered = true
|
||||
onExited: parent.isHovered = false
|
||||
onClicked: {
|
||||
if (modelData
|
||||
&& modelData.invoke) {
|
||||
if (modelData && modelData.invoke) {
|
||||
modelData.invoke()
|
||||
}
|
||||
}
|
||||
@@ -630,16 +558,10 @@ Rectangle {
|
||||
Rectangle {
|
||||
property bool isHovered: false
|
||||
|
||||
width: Math.max(
|
||||
clearText.implicitWidth + 12,
|
||||
50)
|
||||
width: Math.max(clearText.implicitWidth + 12, 50)
|
||||
height: 24
|
||||
radius: 4
|
||||
color: isHovered ? Qt.rgba(
|
||||
Theme.primary.r,
|
||||
Theme.primary.g,
|
||||
Theme.primary.b,
|
||||
0.1) : "transparent"
|
||||
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) : "transparent"
|
||||
|
||||
StyledText {
|
||||
id: clearText
|
||||
@@ -656,8 +578,7 @@ Rectangle {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onEntered: parent.isHovered = true
|
||||
onExited: parent.isHovered = false
|
||||
onClicked: NotificationService.dismissNotification(
|
||||
modelData)
|
||||
onClicked: NotificationService.dismissNotification(modelData)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -686,8 +607,7 @@ Rectangle {
|
||||
width: Math.max(actionText.implicitWidth + 12, 50)
|
||||
height: 24
|
||||
radius: 4
|
||||
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g,
|
||||
Theme.primary.b, 0.1) : "transparent"
|
||||
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) : "transparent"
|
||||
|
||||
StyledText {
|
||||
id: actionText
|
||||
@@ -734,8 +654,7 @@ Rectangle {
|
||||
width: clearText.width + 16
|
||||
height: clearText.height + 8
|
||||
radius: 6
|
||||
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g,
|
||||
Theme.primary.b, 0.1) : "transparent"
|
||||
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) : "transparent"
|
||||
|
||||
StyledText {
|
||||
id: clearText
|
||||
@@ -752,19 +671,16 @@ Rectangle {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onEntered: clearButton.isHovered = true
|
||||
onExited: clearButton.isHovered = false
|
||||
onClicked: NotificationService.dismissGroup(
|
||||
notificationGroup?.key || "")
|
||||
onClicked: NotificationService.dismissGroup(notificationGroup?.key || "")
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
visible: !expanded && (notificationGroup?.count || 0) > 1
|
||||
&& !descriptionExpanded
|
||||
visible: !expanded && (notificationGroup?.count || 0) > 1 && !descriptionExpanded
|
||||
onClicked: {
|
||||
root.userInitiatedExpansion = true
|
||||
NotificationService.toggleGroupExpansion(
|
||||
notificationGroup?.key || "")
|
||||
NotificationService.toggleGroupExpansion(notificationGroup?.key || "")
|
||||
}
|
||||
z: -1
|
||||
}
|
||||
@@ -787,8 +703,7 @@ Rectangle {
|
||||
buttonSize: 28
|
||||
onClicked: {
|
||||
root.userInitiatedExpansion = true
|
||||
NotificationService.toggleGroupExpansion(
|
||||
notificationGroup?.key || "")
|
||||
NotificationService.toggleGroupExpansion(notificationGroup?.key || "")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,8 +713,7 @@ Rectangle {
|
||||
iconName: "close"
|
||||
iconSize: 18
|
||||
buttonSize: 28
|
||||
onClicked: NotificationService.dismissGroup(
|
||||
notificationGroup?.key || "")
|
||||
onClicked: NotificationService.dismissGroup(notificationGroup?.key || "")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ DankPopout {
|
||||
id: keyboardController
|
||||
listView: null
|
||||
isOpen: notificationHistoryVisible
|
||||
onClose: function () {
|
||||
notificationHistoryVisible = false
|
||||
}
|
||||
onClose: () => {
|
||||
notificationHistoryVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
function setTriggerPosition(x, y, width, section, screen) {
|
||||
@@ -55,32 +55,27 @@ DankPopout {
|
||||
onShouldBeVisibleChanged: {
|
||||
if (shouldBeVisible) {
|
||||
NotificationService.onOverlayOpen()
|
||||
// Set up keyboard controller when content is loaded
|
||||
Qt.callLater(function () {
|
||||
if (contentLoader.item) {
|
||||
contentLoader.item.externalKeyboardController = keyboardController
|
||||
Qt.callLater(() => {
|
||||
if (contentLoader.item) {
|
||||
contentLoader.item.externalKeyboardController = keyboardController
|
||||
|
||||
// Find the notification list and set up the connection
|
||||
var notificationList = findChild(contentLoader.item,
|
||||
"notificationList")
|
||||
var notificationHeader = findChild(contentLoader.item,
|
||||
"notificationHeader")
|
||||
const notificationList = findChild(contentLoader.item, "notificationList")
|
||||
const notificationHeader = findChild(contentLoader.item, "notificationHeader")
|
||||
|
||||
if (notificationList) {
|
||||
keyboardController.listView = notificationList
|
||||
notificationList.keyboardController = keyboardController
|
||||
}
|
||||
if (notificationHeader) {
|
||||
notificationHeader.keyboardController = keyboardController
|
||||
}
|
||||
if (notificationList) {
|
||||
keyboardController.listView = notificationList
|
||||
notificationList.keyboardController = keyboardController
|
||||
}
|
||||
if (notificationHeader) {
|
||||
notificationHeader.keyboardController = keyboardController
|
||||
}
|
||||
|
||||
keyboardController.reset()
|
||||
keyboardController.rebuildFlatNavigation()
|
||||
}
|
||||
})
|
||||
keyboardController.reset()
|
||||
keyboardController.rebuildFlatNavigation()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
NotificationService.onOverlayClose()
|
||||
// Reset keyboard state when closing
|
||||
keyboardController.keyboardNavigationActive = false
|
||||
}
|
||||
}
|
||||
@@ -89,9 +84,9 @@ DankPopout {
|
||||
if (parent.objectName === objectName) {
|
||||
return parent
|
||||
}
|
||||
for (var i = 0; i < parent.children.length; i++) {
|
||||
var child = parent.children[i]
|
||||
var result = findChild(child, objectName)
|
||||
for (let i = 0; i < parent.children.length; i++) {
|
||||
const child = parent.children[i]
|
||||
const result = findChild(child, objectName)
|
||||
if (result) {
|
||||
return result
|
||||
}
|
||||
@@ -112,44 +107,44 @@ DankPopout {
|
||||
baseHeight += (notificationSettings.expanded ? notificationSettings.contentHeight : 0)
|
||||
baseHeight += Theme.spacingM * 2
|
||||
let listHeight = notificationList.listContentHeight
|
||||
if (NotificationService.groupedNotifications.length === 0)
|
||||
if (NotificationService.groupedNotifications.length === 0) {
|
||||
listHeight = 200
|
||||
}
|
||||
baseHeight += Math.min(listHeight, 600)
|
||||
return Math.max(
|
||||
300, Math.min(
|
||||
baseHeight,
|
||||
root.screen ? root.screen.height * 0.8 : Screen.height * 0.8))
|
||||
const maxHeight = root.screen ? root.screen.height * 0.8 : Screen.height * 0.8
|
||||
return Math.max(300, Math.min(baseHeight, maxHeight))
|
||||
}
|
||||
|
||||
color: Theme.popupBackground()
|
||||
radius: Theme.cornerRadius
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
||||
Theme.outline.b, 0.08)
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||
border.width: 1
|
||||
focus: true
|
||||
|
||||
Component.onCompleted: {
|
||||
if (root.shouldBeVisible)
|
||||
if (root.shouldBeVisible) {
|
||||
forceActiveFocus()
|
||||
}
|
||||
|
||||
Keys.onPressed: function (event) {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
root.close()
|
||||
event.accepted = true
|
||||
} else if (externalKeyboardController) {
|
||||
externalKeyboardController.handleKey(event)
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onPressed: event => {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
root.close()
|
||||
event.accepted = true
|
||||
} else if (externalKeyboardController) {
|
||||
externalKeyboardController.handleKey(event)
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onShouldBeVisibleChanged() {
|
||||
if (root.shouldBeVisible)
|
||||
Qt.callLater(function () {
|
||||
notificationContent.forceActiveFocus()
|
||||
})
|
||||
else
|
||||
if (root.shouldBeVisible) {
|
||||
Qt.callLater(() => {
|
||||
notificationContent.forceActiveFocus()
|
||||
})
|
||||
} else {
|
||||
notificationContent.focus = false
|
||||
}
|
||||
}
|
||||
target: root
|
||||
}
|
||||
@@ -182,8 +177,7 @@ DankPopout {
|
||||
objectName: "notificationList"
|
||||
|
||||
width: parent.width
|
||||
height: parent.height - notificationContent.cachedHeaderHeight
|
||||
- notificationSettings.height - contentColumnInner.spacing * 2
|
||||
height: parent.height - notificationContent.cachedHeaderHeight - notificationSettings.height - contentColumnInner.spacing * 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,7 +188,7 @@ DankPopout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: Theme.spacingL
|
||||
showHints: externalKeyboardController ? externalKeyboardController.showKeyboardHints : false
|
||||
showHints: (externalKeyboardController && externalKeyboardController.showKeyboardHints) || false
|
||||
z: 200
|
||||
}
|
||||
|
||||
|
||||
@@ -19,16 +19,14 @@ Item {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
name: "notifications_none"
|
||||
size: Theme.iconSizeLarge + 16
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||
Theme.surfaceText.b, 0.3)
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3)
|
||||
}
|
||||
|
||||
StyledText {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: "Nothing to see here"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||
Theme.surfaceText.b, 0.3)
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3)
|
||||
font.weight: Font.Medium
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ Item {
|
||||
anchors.bottom: parent.top
|
||||
anchors.bottomMargin: Theme.spacingS
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: doNotDisturbButton.children[1].containsMouse // Access StateLayer's containsMouse
|
||||
visible: doNotDisturbButton.children[1].containsMouse
|
||||
opacity: visible ? 1 : 0
|
||||
|
||||
StyledText {
|
||||
@@ -76,12 +76,10 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
// Keyboard help button
|
||||
DankActionButton {
|
||||
id: helpButton
|
||||
iconName: "info"
|
||||
iconColor: keyboardController
|
||||
&& keyboardController.showKeyboardHints ? Theme.primary : Theme.surfaceText
|
||||
iconColor: (keyboardController && keyboardController.showKeyboardHints) ? Theme.primary : Theme.surfaceText
|
||||
buttonSize: 28
|
||||
visible: keyboardController !== null
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -92,7 +90,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Settings button
|
||||
DankActionButton {
|
||||
id: settingsButton
|
||||
iconName: "settings"
|
||||
@@ -109,17 +106,8 @@ Item {
|
||||
height: 28
|
||||
radius: Theme.cornerRadius
|
||||
visible: NotificationService.notifications.length > 0
|
||||
color: clearArea.containsMouse ? Qt.rgba(Theme.primary.r,
|
||||
Theme.primary.g,
|
||||
Theme.primary.b,
|
||||
0.12) : Qt.rgba(
|
||||
Theme.surfaceVariant.r,
|
||||
Theme.surfaceVariant.g,
|
||||
Theme.surfaceVariant.b, 0.3)
|
||||
border.color: clearArea.containsMouse ? Theme.primary : Qt.rgba(
|
||||
Theme.outline.r,
|
||||
Theme.outline.g,
|
||||
Theme.outline.b, 0.08)
|
||||
color: clearArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
|
||||
border.color: clearArea.containsMouse ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||
border.width: 1
|
||||
|
||||
Row {
|
||||
|
||||
@@ -25,15 +25,13 @@ QtObject {
|
||||
function rebuildFlatNavigation() {
|
||||
isRebuilding = true
|
||||
|
||||
var nav = []
|
||||
var groups = NotificationService.groupedNotifications
|
||||
const nav = []
|
||||
const groups = NotificationService.groupedNotifications
|
||||
|
||||
for (var i = 0; i < groups.length; i++) {
|
||||
var group = groups[i]
|
||||
var isExpanded = NotificationService.expandedGroups[group.key]
|
||||
|| false
|
||||
for (let i = 0; i < groups.length; i++) {
|
||||
const group = groups[i]
|
||||
const isExpanded = NotificationService.expandedGroups[group.key] || false
|
||||
|
||||
// Add the group itself
|
||||
nav.push({
|
||||
"type": "group",
|
||||
"groupIndex": i,
|
||||
@@ -42,12 +40,10 @@ QtObject {
|
||||
"notificationId": ""
|
||||
})
|
||||
|
||||
// If expanded, add individual notifications
|
||||
if (isExpanded) {
|
||||
var notifications = group.notifications || []
|
||||
for (var j = 0; j < notifications.length; j++) {
|
||||
var notifId = String(
|
||||
notifications[j]?.notification?.id || "")
|
||||
const notifications = group.notifications || []
|
||||
for (let j = 0; j < notifications.length; j++) {
|
||||
const notifId = String(notifications[j] && notifications[j].notification && notifications[j].notification.id ? notifications[j].notification.id : "")
|
||||
nav.push({
|
||||
"type": "notification",
|
||||
"groupIndex": i,
|
||||
@@ -65,22 +61,18 @@ QtObject {
|
||||
}
|
||||
|
||||
function updateSelectedIndexFromId() {
|
||||
if (!keyboardNavigationActive)
|
||||
if (!keyboardNavigationActive) {
|
||||
return
|
||||
}
|
||||
|
||||
// Find the index that matches our selected ID/key
|
||||
for (var i = 0; i < flatNavigation.length; i++) {
|
||||
var item = flatNavigation[i]
|
||||
for (let i = 0; i < flatNavigation.length; i++) {
|
||||
const item = flatNavigation[i]
|
||||
|
||||
if (selectedItemType === "group" && item.type === "group"
|
||||
&& item.groupKey === selectedGroupKey) {
|
||||
if (selectedItemType === "group" && item.type === "group" && item.groupKey === selectedGroupKey) {
|
||||
selectedFlatIndex = i
|
||||
selectionVersion++ // Trigger UI update
|
||||
return
|
||||
} else if (selectedItemType === "notification"
|
||||
&& item.type === "notification" && String(
|
||||
item.notificationId) === String(
|
||||
selectedNotificationId)) {
|
||||
} else if (selectedItemType === "notification" && item.type === "notification" && String(item.notificationId) === String(selectedNotificationId)) {
|
||||
selectedFlatIndex = i
|
||||
selectionVersion++ // Trigger UI update
|
||||
return
|
||||
@@ -89,10 +81,9 @@ QtObject {
|
||||
|
||||
// If not found, try to find the same group but select the group header instead
|
||||
if (selectedItemType === "notification") {
|
||||
for (var j = 0; j < flatNavigation.length; j++) {
|
||||
var groupItem = flatNavigation[j]
|
||||
if (groupItem.type === "group"
|
||||
&& groupItem.groupKey === selectedGroupKey) {
|
||||
for (let j = 0; j < flatNavigation.length; j++) {
|
||||
const groupItem = flatNavigation[j]
|
||||
if (groupItem.type === "group" && groupItem.groupKey === selectedGroupKey) {
|
||||
selectedFlatIndex = j
|
||||
selectedItemType = "group"
|
||||
selectedNotificationId = ""
|
||||
@@ -104,8 +95,7 @@ QtObject {
|
||||
|
||||
// If still not found, clamp to valid range and update
|
||||
if (flatNavigation.length > 0) {
|
||||
selectedFlatIndex = Math.min(selectedFlatIndex,
|
||||
flatNavigation.length - 1)
|
||||
selectedFlatIndex = Math.min(selectedFlatIndex, flatNavigation.length - 1)
|
||||
selectedFlatIndex = Math.max(selectedFlatIndex, 0)
|
||||
updateSelectedIdFromIndex()
|
||||
selectionVersion++ // Trigger UI update
|
||||
@@ -113,9 +103,8 @@ QtObject {
|
||||
}
|
||||
|
||||
function updateSelectedIdFromIndex() {
|
||||
if (selectedFlatIndex >= 0
|
||||
&& selectedFlatIndex < flatNavigation.length) {
|
||||
var item = flatNavigation[selectedFlatIndex]
|
||||
if (selectedFlatIndex >= 0 && selectedFlatIndex < flatNavigation.length) {
|
||||
const item = flatNavigation[selectedFlatIndex]
|
||||
selectedItemType = item.type
|
||||
selectedGroupKey = item.groupKey
|
||||
selectedNotificationId = item.notificationId
|
||||
@@ -143,8 +132,7 @@ QtObject {
|
||||
listView.enableAutoScroll()
|
||||
}
|
||||
|
||||
selectedFlatIndex = Math.min(selectedFlatIndex + 1,
|
||||
flatNavigation.length - 1)
|
||||
selectedFlatIndex = Math.min(selectedFlatIndex + 1, flatNavigation.length - 1)
|
||||
updateSelectedIdFromIndex()
|
||||
selectionVersion++
|
||||
ensureVisible()
|
||||
@@ -167,8 +155,7 @@ QtObject {
|
||||
}
|
||||
|
||||
function toggleGroupExpanded() {
|
||||
if (flatNavigation.length === 0
|
||||
|| selectedFlatIndex >= flatNavigation.length)
|
||||
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length)
|
||||
return
|
||||
|
||||
const currentItem = flatNavigation[selectedFlatIndex]
|
||||
@@ -182,8 +169,7 @@ QtObject {
|
||||
if (notificationCount < 2)
|
||||
return
|
||||
|
||||
const wasExpanded = NotificationService.expandedGroups[group.key]
|
||||
|| false
|
||||
const wasExpanded = NotificationService.expandedGroups[group.key] || false
|
||||
const groupIndex = currentItem.groupIndex
|
||||
|
||||
isTogglingGroup = true
|
||||
@@ -193,18 +179,16 @@ QtObject {
|
||||
// Smart selection after toggle
|
||||
if (!wasExpanded) {
|
||||
// Just expanded - move to first notification in the group
|
||||
for (var i = 0; i < flatNavigation.length; i++) {
|
||||
if (flatNavigation[i].type === "notification"
|
||||
&& flatNavigation[i].groupIndex === groupIndex) {
|
||||
for (let i = 0; i < flatNavigation.length; i++) {
|
||||
if (flatNavigation[i].type === "notification" && flatNavigation[i].groupIndex === groupIndex) {
|
||||
selectedFlatIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Just collapsed - stay on the group header
|
||||
for (var i = 0; i < flatNavigation.length; i++) {
|
||||
if (flatNavigation[i].type === "group"
|
||||
&& flatNavigation[i].groupIndex === groupIndex) {
|
||||
for (let i = 0; i < flatNavigation.length; i++) {
|
||||
if (flatNavigation[i].type === "group" && flatNavigation[i].groupIndex === groupIndex) {
|
||||
selectedFlatIndex = i
|
||||
break
|
||||
}
|
||||
@@ -216,8 +200,7 @@ QtObject {
|
||||
}
|
||||
|
||||
function handleEnterKey() {
|
||||
if (flatNavigation.length === 0
|
||||
|| selectedFlatIndex >= flatNavigation.length)
|
||||
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length)
|
||||
return
|
||||
|
||||
const currentItem = flatNavigation[selectedFlatIndex]
|
||||
@@ -239,8 +222,7 @@ QtObject {
|
||||
}
|
||||
|
||||
function toggleTextExpanded() {
|
||||
if (flatNavigation.length === 0
|
||||
|| selectedFlatIndex >= flatNavigation.length)
|
||||
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length)
|
||||
return
|
||||
|
||||
const currentItem = flatNavigation[selectedFlatIndex]
|
||||
@@ -249,15 +231,12 @@ QtObject {
|
||||
if (!group)
|
||||
return
|
||||
|
||||
var messageId = ""
|
||||
let messageId = ""
|
||||
|
||||
if (currentItem.type === "group") {
|
||||
messageId = group.latestNotification?.notification?.id + "_desc"
|
||||
} else if (currentItem.type === "notification"
|
||||
&& currentItem.notificationIndex >= 0
|
||||
&& currentItem.notificationIndex < group.notifications.length) {
|
||||
messageId = group.notifications[currentItem.notificationIndex]?.notification?.id
|
||||
+ "_desc"
|
||||
} else if (currentItem.type === "notification" && currentItem.notificationIndex >= 0 && currentItem.notificationIndex < group.notifications.length) {
|
||||
messageId = group.notifications[currentItem.notificationIndex]?.notification?.id + "_desc"
|
||||
}
|
||||
|
||||
if (messageId) {
|
||||
@@ -266,8 +245,7 @@ QtObject {
|
||||
}
|
||||
|
||||
function executeAction(actionIndex) {
|
||||
if (flatNavigation.length === 0
|
||||
|| selectedFlatIndex >= flatNavigation.length)
|
||||
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length)
|
||||
return
|
||||
|
||||
const currentItem = flatNavigation[selectedFlatIndex]
|
||||
@@ -276,15 +254,12 @@ QtObject {
|
||||
if (!group)
|
||||
return
|
||||
|
||||
var actions = []
|
||||
let actions = []
|
||||
|
||||
if (currentItem.type === "group") {
|
||||
actions = group.latestNotification?.actions || []
|
||||
} else if (currentItem.type === "notification"
|
||||
&& currentItem.notificationIndex >= 0
|
||||
&& currentItem.notificationIndex < group.notifications.length) {
|
||||
actions = group.notifications[currentItem.notificationIndex]?.actions
|
||||
|| []
|
||||
} else if (currentItem.type === "notification" && currentItem.notificationIndex >= 0 && currentItem.notificationIndex < group.notifications.length) {
|
||||
actions = group.notifications[currentItem.notificationIndex]?.actions || []
|
||||
}
|
||||
|
||||
if (actionIndex >= 0 && actionIndex < actions.length) {
|
||||
@@ -298,8 +273,7 @@ QtObject {
|
||||
}
|
||||
|
||||
function clearSelected() {
|
||||
if (flatNavigation.length === 0
|
||||
|| selectedFlatIndex >= flatNavigation.length)
|
||||
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length)
|
||||
return
|
||||
|
||||
const currentItem = flatNavigation[selectedFlatIndex]
|
||||
@@ -330,24 +304,20 @@ QtObject {
|
||||
}
|
||||
|
||||
function ensureVisible() {
|
||||
if (flatNavigation.length === 0
|
||||
|| selectedFlatIndex >= flatNavigation.length || !listView)
|
||||
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length || !listView)
|
||||
return
|
||||
|
||||
const currentItem = flatNavigation[selectedFlatIndex]
|
||||
|
||||
if (keyboardNavigationActive && currentItem
|
||||
&& currentItem.groupIndex >= 0) {
|
||||
if (keyboardNavigationActive && currentItem && currentItem.groupIndex >= 0) {
|
||||
// Always center the selected item for better visibility
|
||||
// This ensures the selected item stays in view even when new notifications arrive
|
||||
if (currentItem.type === "notification") {
|
||||
// For individual notifications, center on the group but bias towards the notification
|
||||
listView.positionViewAtIndex(currentItem.groupIndex,
|
||||
ListView.Center)
|
||||
listView.positionViewAtIndex(currentItem.groupIndex, ListView.Center)
|
||||
} else {
|
||||
// For group headers, center on the group
|
||||
listView.positionViewAtIndex(currentItem.groupIndex,
|
||||
ListView.Center)
|
||||
listView.positionViewAtIndex(currentItem.groupIndex, ListView.Center)
|
||||
}
|
||||
|
||||
// Force immediate update
|
||||
@@ -356,8 +326,7 @@ QtObject {
|
||||
}
|
||||
|
||||
function handleKey(event) {
|
||||
if ((event.key === Qt.Key_Delete || event.key === Qt.Key_Backspace)
|
||||
&& (event.modifiers & Qt.ShiftModifier)) {
|
||||
if ((event.key === Qt.Key_Delete || event.key === Qt.Key_Backspace) && (event.modifiers & Qt.ShiftModifier)) {
|
||||
NotificationService.clearAllNotifications()
|
||||
rebuildFlatNavigation()
|
||||
if (flatNavigation.length === 0) {
|
||||
@@ -430,15 +399,13 @@ QtObject {
|
||||
if (event.key === Qt.Key_Space) {
|
||||
toggleGroupExpanded()
|
||||
event.accepted = true
|
||||
} else if (event.key === Qt.Key_Return
|
||||
|| event.key === Qt.Key_Enter) {
|
||||
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||
handleEnterKey()
|
||||
event.accepted = true
|
||||
} else if (event.key === Qt.Key_E) {
|
||||
toggleTextExpanded()
|
||||
event.accepted = true
|
||||
} else if (event.key === Qt.Key_Delete
|
||||
|| event.key === Qt.Key_Backspace) {
|
||||
} else if (event.key === Qt.Key_Delete || event.key === Qt.Key_Backspace) {
|
||||
clearSelected()
|
||||
event.accepted = true
|
||||
} else if (event.key >= Qt.Key_1 && event.key <= Qt.Key_9) {
|
||||
@@ -456,8 +423,7 @@ QtObject {
|
||||
|
||||
// Get current selection info for UI
|
||||
function getCurrentSelection() {
|
||||
if (!keyboardNavigationActive || selectedFlatIndex < 0
|
||||
|| selectedFlatIndex >= flatNavigation.length) {
|
||||
if (!keyboardNavigationActive || selectedFlatIndex < 0 || selectedFlatIndex >= flatNavigation.length) {
|
||||
return {
|
||||
"type": "",
|
||||
"groupIndex": -1,
|
||||
|
||||
@@ -9,8 +9,7 @@ Rectangle {
|
||||
|
||||
height: 80
|
||||
radius: Theme.cornerRadius
|
||||
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
|
||||
Theme.surfaceContainer.b, 0.95)
|
||||
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95)
|
||||
border.color: Theme.primary
|
||||
border.width: 2
|
||||
opacity: showHints ? 1 : 0
|
||||
|
||||
@@ -15,10 +15,8 @@ Rectangle {
|
||||
visible: expanded
|
||||
clip: true
|
||||
radius: Theme.cornerRadius
|
||||
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
|
||||
Theme.surfaceContainer.b, 0.3)
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
||||
Theme.outline.b, 0.1)
|
||||
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3)
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1)
|
||||
border.width: 1
|
||||
|
||||
Behavior on height {
|
||||
@@ -29,7 +27,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure smooth opacity transition
|
||||
opacity: expanded ? 1 : 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
@@ -82,17 +79,20 @@ Rectangle {
|
||||
return "5 seconds"
|
||||
}
|
||||
|
||||
for (var i = 0; i < timeoutOptions.length; i++) {
|
||||
for (let i = 0; i < timeoutOptions.length; i++) {
|
||||
if (timeoutOptions[i].value === value) {
|
||||
return timeoutOptions[i].text
|
||||
}
|
||||
}
|
||||
if (value === 0)
|
||||
if (value === 0) {
|
||||
return "Never"
|
||||
if (value < 1000)
|
||||
}
|
||||
if (value < 1000) {
|
||||
return value + "ms"
|
||||
if (value < 60000)
|
||||
}
|
||||
if (value < 60000) {
|
||||
return Math.round(value / 1000) + " seconds"
|
||||
}
|
||||
return Math.round(value / 60000) + " minutes"
|
||||
}
|
||||
|
||||
@@ -139,16 +139,14 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: SessionData.doNotDisturb
|
||||
onToggled: SessionData.setDoNotDisturb(
|
||||
!SessionData.doNotDisturb)
|
||||
onToggled: SessionData.setDoNotDisturb(!SessionData.doNotDisturb)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
||||
Theme.outline.b, 0.1)
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1)
|
||||
}
|
||||
|
||||
StyledText {
|
||||
@@ -165,10 +163,9 @@ Rectangle {
|
||||
currentValue: getTimeoutText(SettingsData.notificationTimeoutLow)
|
||||
options: timeoutOptions.map(opt => opt.text)
|
||||
onValueChanged: value => {
|
||||
for (var i = 0; i < timeoutOptions.length; i++) {
|
||||
for (let i = 0; i < timeoutOptions.length; i++) {
|
||||
if (timeoutOptions[i].text === value) {
|
||||
SettingsData.setNotificationTimeoutLow(
|
||||
timeoutOptions[i].value)
|
||||
SettingsData.setNotificationTimeoutLow(timeoutOptions[i].value)
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -182,10 +179,9 @@ Rectangle {
|
||||
currentValue: getTimeoutText(SettingsData.notificationTimeoutNormal)
|
||||
options: timeoutOptions.map(opt => opt.text)
|
||||
onValueChanged: value => {
|
||||
for (var i = 0; i < timeoutOptions.length; i++) {
|
||||
for (let i = 0; i < timeoutOptions.length; i++) {
|
||||
if (timeoutOptions[i].text === value) {
|
||||
SettingsData.setNotificationTimeoutNormal(
|
||||
timeoutOptions[i].value)
|
||||
SettingsData.setNotificationTimeoutNormal(timeoutOptions[i].value)
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -196,14 +192,12 @@ Rectangle {
|
||||
width: parent.width
|
||||
text: "Critical Priority"
|
||||
description: "Timeout for critical priority notifications"
|
||||
currentValue: getTimeoutText(
|
||||
SettingsData.notificationTimeoutCritical)
|
||||
currentValue: getTimeoutText(SettingsData.notificationTimeoutCritical)
|
||||
options: timeoutOptions.map(opt => opt.text)
|
||||
onValueChanged: value => {
|
||||
for (var i = 0; i < timeoutOptions.length; i++) {
|
||||
for (let i = 0; i < timeoutOptions.length; i++) {
|
||||
if (timeoutOptions[i].text === value) {
|
||||
SettingsData.setNotificationTimeoutCritical(
|
||||
timeoutOptions[i].value)
|
||||
SettingsData.setNotificationTimeoutCritical(timeoutOptions[i].value)
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -213,8 +207,7 @@ Rectangle {
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
||||
Theme.outline.b, 0.1)
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1)
|
||||
}
|
||||
|
||||
Item {
|
||||
@@ -255,8 +248,7 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: SettingsData.notificationOverlayEnabled
|
||||
onToggled: toggled => SettingsData.setNotificationOverlayEnabled(
|
||||
toggled)
|
||||
onToggled: toggled => SettingsData.setNotificationOverlayEnabled(toggled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user