Skip to content
This repository has been archived by the owner on Nov 13, 2021. It is now read-only.

Commit

Permalink
notification publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Fuchs committed Nov 5, 2020
1 parent 06fa5aa commit 5be6ebb
Showing 1 changed file with 26 additions and 31 deletions.
57 changes: 26 additions & 31 deletions qml/components/NotificationList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,46 +38,41 @@ QtObject {
i < taskList.count; i++){
var task = taskList.get(i)
if (filterTask(task)) {
// var notificationComp = Qt.createComponent(Qt.resolvedUrl("./Notification.qml"))
// var notificationComp = Qt.createComponent(Qt.resolvedUrl("./Notification.qml"))

// var notification = notificationComp.createObject(null , {task: task}) //parent needed?
// var notification = notificationComp.createObject(null , {task: task}) //parent needed?
publishQueue.push(task)
//notification.publish()
//replaceIDs.push(notification.replacesId)
}
}
console.log(publishQueue, publishQueue[0].subject)
//sort by due date
publishQueue.sort(function(a,b){
//console.log(a.dueDate.getTime(), b.dueDate.getTime(),a.dueDate.getTime() - b.dueDate.getTime())
return JS.tools.isoToDate(a.due).getTime() - JS.tools.isoToDate(b.due).getTime()
})
console.log(publishQueue, publishQueue[0].subject)
if (publishQueue.length > 0) {
console.log(publishQueue, publishQueue[0].subject)
//sort by due date
publishQueue.sort(function(a,b){
//console.log(a.dueDate.getTime(), b.dueDate.getTime(),a.dueDate.getTime() - b.dueDate.getTime())
return JS.tools.isoToDate(a.due).getTime() - JS.tools.isoToDate(b.due).getTime()
})
console.log(publishQueue, publishQueue[0].subject)

//crop publishQueue
if (notificationSettings.maxCount > 0) {
publishQueue.splice(notificationSettings.maxCount, publishQueue.length)
}
console.log(notificationSettings.maxCount, publishQueue, publishQueue[0].subject)
//crop publishQueue
if (notificationSettings.maxCount > 0) {
publishQueue.splice(notificationSettings.maxCount, publishQueue.length)
}
console.log(notificationSettings.maxCount, publishQueue, publishQueue[0].subject)

//revers publicQueue (has no effect?)
//publishQueue = publishQueue.reverse()
console.log(publishQueue, publishQueue[0].subject)
var notificationComp, notification
publishQueue.forEach(function(task){
notificationComp = Qt.createComponent(Qt.resolvedUrl("./Notification.qml"))
notification = notificationComp.createObject(null , {task: task}) //parent needed?
notification.publish()
replaceIDs.push(notification.replacesId)
})
publishQueue.forEach(function(task){
notificationComp = Qt.createComponent(Qt.resolvedUrl("./Notification.qml"))
notification = notificationComp.createObject(null , {task: task}) //parent needed?
notification.publish()
replaceIDs.push(notification.replacesId)
})
//revers publicQueue (has no effect? how do get notifications sorted in the end?)
//publishQueue = publishQueue.reverse()
console.log(publishQueue, publishQueue[0].subject)
var notificationComp, notification
publishQueue.forEach(function(task){
notificationComp = Qt.createComponent(Qt.resolvedUrl("./Notification.qml"))
notification = notificationComp.createObject(null , {task: task}) //parent needed?
notification.publish()
replaceIDs.push(notification.replacesId)
})
}
settings.notificationIDs.value = replaceIDs
//console.log("added", replaceIDs, settings.notificationIDs.value)
}
}

Expand Down

0 comments on commit 5be6ebb

Please sign in to comment.