2019-07-07 23:52:41 -04:00
|
|
|
// Copyright 2019 miruka
|
|
|
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
|
|
|
|
2019-07-13 05:39:01 -04:00
|
|
|
import QtQuick 2.12
|
2019-07-04 16:01:44 -04:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
import "../Base"
|
|
|
|
|
|
|
|
HListModel {
|
2019-07-18 04:46:37 -04:00
|
|
|
function lastEventOf(roomId) {
|
2019-07-18 05:18:13 -04:00
|
|
|
for (let i = 0; i < count; i++) {
|
|
|
|
let item = get(i) // TODO: standardize
|
2019-07-18 04:46:37 -04:00
|
|
|
if (item.roomId == roomId) { return item }
|
2019-07-04 16:01:44 -04:00
|
|
|
}
|
2019-07-18 05:18:13 -04:00
|
|
|
return null
|
2019-07-04 16:01:44 -04:00
|
|
|
}
|
|
|
|
|
2019-07-04 23:12:21 -04:00
|
|
|
sorters: ExpressionSorter {
|
|
|
|
expression: modelLeft.isLocalEcho && ! modelRight.isLocalEcho ?
|
|
|
|
true :
|
|
|
|
! modelLeft.isLocalEcho && modelRight.isLocalEcho ?
|
|
|
|
false :
|
|
|
|
modelLeft.date > modelRight.date // descending order
|
2019-07-04 16:01:44 -04:00
|
|
|
}
|
|
|
|
}
|