Compare commits

...

1 commit

Author SHA1 Message Date
Raimund Schlüßler
09245a16b6
Implement calculating the manual sort order
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
2019-07-17 19:22:24 +02:00

View file

@ -105,6 +105,22 @@ export default class Task {
this._created = this.vtodo.getFirstPropertyValue('created') this._created = this.vtodo.getFirstPropertyValue('created')
this._class = this.vtodo.getFirstPropertyValue('class') || 'PUBLIC' 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._searchQuery = ''
this._matchesSearchQuery = true this._matchesSearchQuery = true
} }
@ -465,6 +481,29 @@ export default class Task {
this._class = this.vtodo.getFirstPropertyValue('class') || 'PUBLIC' 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 * Checks if the task matches the search query
* *