2019-07-04 16:01:44 -04:00
|
|
|
import QtQuick 2.7
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
import "../Base"
|
|
|
|
|
|
|
|
HListModel {
|
|
|
|
function lastEventOf(room_id) {
|
|
|
|
// Return an event item or undefined if none found
|
|
|
|
|
|
|
|
for (var i = 0; i < count; i++) {
|
|
|
|
var item = get(i) // TODO: standardize
|
|
|
|
if (item.roomId == room_id) { return item }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|