Merge pull request #33 from razcampagne/master

Fix for mark as read/unread + proposal for gesture feature
This commit is contained in:
Mkiol 2021-02-23 09:01:08 +01:00 committed by GitHub
commit b7dd89c68e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 12 deletions

View file

@ -516,4 +516,69 @@ ListItem {
}
}
}
drag.target: box
drag.axis: Drag.XAxis
drag.minimumX: -width
drag.maximumX: 0
drag.onActiveChanged: {
if (!drag.active) {
if (box.x < -width / 3) {
state = "toggleRead"
} else {
state = "default"
}
}
}
state: "default"
states: [
State {
name: "default"
},
State {
name: "dragging"
when: drag.active
},
State {
name: "toggleRead"
}
]
transitions: [
Transition {
from: "dragging"
to: "default"
NumberAnimation {
target: box
properties: "x"
to: 0
duration: 200
}
},
Transition {
from: "dragging"
to: "toggleRead"
SequentialAnimation {
ScriptAction {
script: {
if (root.read) {
root.markedAsUnread()
} else {
root.markedAsRead();
root.expanded = false;
}
}
}
NumberAnimation {
target: box
properties: "x"
to: 0
duration: 200
}
}
}
]
}

View file

@ -241,7 +241,6 @@ Page {
offlineurl: cserver.getUrlbyId(model.uid)
signal singleEntryClicked
signal doubleEntryClicked
function check() {
// Not allowed while Syncing
@ -337,16 +336,11 @@ Page {
}
onClicked: {
if (timer.running) {
// Double click
timer.stop()
doubleEntryClicked()
} else {
timer.start()
}
timer.start()
}
onDoubleEntryClicked: {
onDoubleClicked: {
timer.stop()
if (model.read === 0) {
entryModel.setData(model.index, "read", 1, "")
//read = 1;
@ -369,7 +363,7 @@ Page {
Timer {
id: timer
interval: 400
interval: 200
onTriggered: {
// Single click
singleEntryClicked()

View file

@ -450,8 +450,9 @@ ApplicationWindow {
switch (app.orientation) {
case Orientation.Portrait: return 0;
case Orientation.Landscape: return 90;
case Orientation.PortraitInverted: 180;
case Orientation.LandscapeInverted: 270;
case Orientation.PortraitInverted: return 180;
case Orientation.LandscapeInverted: return 270;
}
}
transformOrigin: Item.TopLeft