[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: {
|
onCurrentIndexChanged: {
|
||||||
model.selectedIndex = currentIndex
|
model.selectedIndex = currentIndex
|
||||||
if (currentItem && settings.autoMarkRead && currentItem.unread) {
|
if (settings.autoMarkRead) {
|
||||||
console.log("marking item as read")
|
readTimer.restart()
|
||||||
model.toggleRead()
|
|
||||||
}
|
}
|
||||||
panel.close()
|
panel.close()
|
||||||
}
|
}
|
||||||
|
|
@ -81,6 +80,16 @@ Page {
|
||||||
listView.highlightFollowsCurrentItem = true
|
listView.highlightFollowsCurrentItem = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: readTimer
|
||||||
|
interval: 500
|
||||||
|
repeat: false
|
||||||
|
onTriggered: if (currentItem && currentItem.unread) {
|
||||||
|
console.log("marking item as read")
|
||||||
|
model.toggleRead()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Panel {
|
Panel {
|
||||||
id: panel
|
id: panel
|
||||||
anchors {
|
anchors {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue