[ubuntu] Wait half a second before marking articles as read
Besides being a reasonable thing, this helps working around a problem where the first article of a feed would always be marked as read even when the user opened another item (because currentIndex is always changed to 0 as soon as the model is ready).
This commit is contained in:
parent
5598a878be
commit
21aea47514
1 changed files with 12 additions and 3 deletions
|
|
@ -65,9 +65,8 @@ Page {
|
|||
|
||||
onCurrentIndexChanged: {
|
||||
model.selectedIndex = currentIndex
|
||||
if (currentItem && settings.autoMarkRead && currentItem.unread) {
|
||||
console.log("marking item as read")
|
||||
model.toggleRead()
|
||||
if (settings.autoMarkRead) {
|
||||
readTimer.restart()
|
||||
}
|
||||
panel.close()
|
||||
}
|
||||
|
|
@ -81,6 +80,16 @@ Page {
|
|||
listView.highlightFollowsCurrentItem = true
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: readTimer
|
||||
interval: 500
|
||||
repeat: false
|
||||
onTriggered: if (currentItem && currentItem.unread) {
|
||||
console.log("marking item as read")
|
||||
model.toggleRead()
|
||||
}
|
||||
}
|
||||
|
||||
Panel {
|
||||
id: panel
|
||||
anchors {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue