Utility functions to sort text messages by timestamp (ascending/descending)

* compare function for text message
* resort function
* text message edit can display HTML text messages with ascending/descending timestamp
* made CTextMessageListModel -> CListModelTimestampObject
This commit is contained in:
Klaus Basan
2019-09-02 22:58:58 +02:00
committed by Mat Sutcliffe
parent 25eb13a83f
commit e12dc3a73a
16 changed files with 113 additions and 31 deletions

View File

@@ -107,8 +107,8 @@ namespace BlackGui
Q_UNUSED(sort);
ModelClass *model = this->derivedModel();
auto sortColumn = model->getSortColumn();
auto sortOrder = model->getSortOrder();
const auto sortColumn = model->getSortColumn();
const auto sortOrder = model->getSortOrder();
this->showLoadIndicator(container.size());
CWorker *worker = CWorker::fromTask(this, "ViewSort", [model, container, sortColumn, sortOrder]()
{
@@ -300,7 +300,7 @@ namespace BlackGui
if (!hasSelection()) { return 0; }
int c = 0;
int lastUpdatedRow = -1;
int lastUpdatedRow = -1;
int firstUpdatedRow = -1;
const CPropertyIndexList propertyIndexes(vm.indexes());
const QModelIndexList indexes = this->selectedRows();
@@ -503,6 +503,18 @@ namespace BlackGui
m_model->sortByPropertyIndex(propertyIndex, order);
}
template<class T>
void CViewBase<T>::sort()
{
m_model->sort();
}
template<class T>
void CViewBase<T>::resort()
{
m_model->resort();
}
template <class T>
QJsonObject CViewBase<T>::toJson(bool selectedOnly) const
{