Browse Source

Sort invalid dates always at the bottom. Closes #106 and #735.

adaptive-webui-19844
sledgehammer999 11 years ago
parent
commit
323de569df
  1. 10
      src/transferlistsortmodel.h

10
src/transferlistsortmodel.h

@ -57,6 +57,16 @@ protected: @@ -57,6 +57,16 @@ protected:
return QSortFilterProxyModel::lessThan(left, right);
}
else if (sortColumn() == TorrentModelItem::TR_ADD_DATE || sortColumn() == TorrentModelItem::TR_SEED_DATE) {
QDateTime vL = sourceModel()->data(left).toDateTime();
QDateTime vR = sourceModel()->data(right).toDateTime();
//not valid dates should be sorted at the bottom.
if (!vL.isValid()) return !(sortOrder() == Qt::AscendingOrder);
if (!vR.isValid()) return (sortOrder() == Qt::AscendingOrder);
return vL < vR;
}
return QSortFilterProxyModel::lessThan(left, right);
}
};

Loading…
Cancel
Save