[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:
Alberto Mardegan 2016-05-04 23:31:28 +03:00
parent 5598a878be
commit 21aea47514

View file

@ -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 {