Browse Source

Reuse existing code for sorting

This makes the behavior of sorting by TR_SEED_DATE consistent.
adaptive-webui-19844
Chocobo1 4 years ago
parent
commit
45874fa333
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 22
      src/gui/transferlistsortmodel.cpp

22
src/gui/transferlistsortmodel.cpp

@ -166,27 +166,7 @@ bool TransferListSortModel::lessThan_impl(const QModelIndex &left, const QModelI @@ -166,27 +166,7 @@ bool TransferListSortModel::lessThan_impl(const QModelIndex &left, const QModelI
return positionL != 0;
}
// Sort according to TR_SEED_DATE
const auto dateL = left.sibling(left.row(), TransferListModel::TR_SEED_DATE)
.data(TransferListModel::UnderlyingDataRole).toDateTime();
const auto dateR = right.sibling(right.row(), TransferListModel::TR_SEED_DATE)
.data(TransferListModel::UnderlyingDataRole).toDateTime();
if (dateL.isValid() && dateR.isValid())
{
if (dateL != dateR)
return dateL < dateR;
}
else if (dateL.isValid())
{
return false;
}
else if (dateR.isValid())
{
return true;
}
return hashLessThan();
return invokeLessThanForColumn(TransferListModel::TR_SEED_DATE);
}
case TransferListModel::TR_SEEDS:

Loading…
Cancel
Save