Implement calculating the manual sort order
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
parent
26b6379918
commit
09245a16b6
1 changed files with 39 additions and 0 deletions
|
@ -105,6 +105,22 @@ export default class Task {
|
|||
this._created = this.vtodo.getFirstPropertyValue('created')
|
||||
this._class = this.vtodo.getFirstPropertyValue('class') || 'PUBLIC'
|
||||
|
||||
let sortOrder = this.vtodo.getFirstPropertyValue('x-apple-sort-order')
|
||||
if (sortOrder === null) {
|
||||
sortOrder = this._created.subtractDate(
|
||||
new ICAL.Time({
|
||||
year: 2001,
|
||||
month: 1,
|
||||
day: 1,
|
||||
hour: 0,
|
||||
minute: 0,
|
||||
second: 0,
|
||||
isDate: false
|
||||
})
|
||||
).toSeconds()
|
||||
}
|
||||
this._sortOrder = sortOrder
|
||||
|
||||
this._searchQuery = ''
|
||||
this._matchesSearchQuery = true
|
||||
}
|
||||
|
@ -465,6 +481,29 @@ export default class Task {
|
|||
this._class = this.vtodo.getFirstPropertyValue('class') || 'PUBLIC'
|
||||
}
|
||||
|
||||
get sortOrder() {
|
||||
return this._sortOrder
|
||||
}
|
||||
|
||||
set sortOrder(sortOrder) {
|
||||
if (sortOrder === null) {
|
||||
sortOrder = this._created.subtractDate(
|
||||
new ICAL.Time({
|
||||
year: 2001,
|
||||
month: 1,
|
||||
day: 1,
|
||||
hour: 0,
|
||||
minute: 0,
|
||||
second: 0,
|
||||
isDate: false
|
||||
})
|
||||
).toSeconds()
|
||||
}
|
||||
this.vtodo.updatePropertyWithValue('x-apple-sort-order', sortOrder)
|
||||
this.updateLastModified()
|
||||
this._sortOrder = sortOrder
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the task matches the search query
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue