added comment in the post sorting code

This commit is contained in:
csoler 2018-09-03 22:02:32 +02:00
parent 69c6860d8d
commit d856566c69
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -1224,11 +1224,11 @@ public:
bool operator<(const QTreeWidgetItem& other) const bool operator<(const QTreeWidgetItem& other) const
{ {
bool date_left = data(COLUMN_THREAD_DATE,ROLE_THREAD_SORT).toUInt(); // this is used by the sorting model to put all posts on top bool date_left = data(COLUMN_THREAD_DATE,ROLE_THREAD_SORT).toUInt(); // this is used by the sorting model to put all pinned posts on top
bool date_right = other.data(COLUMN_THREAD_DATE,ROLE_THREAD_SORT).toUInt(); // this is used by the sorting model to put all posts on top bool date_right = other.data(COLUMN_THREAD_DATE,ROLE_THREAD_SORT).toUInt();
if(date_left ^ date_right) if(date_left ^ date_right)
return (m_header->sortIndicatorOrder()==Qt::AscendingOrder)?date_right:date_left ; return (m_header->sortIndicatorOrder()==Qt::AscendingOrder)?date_right:date_left ; // always put pinned posts on top
return GxsIdRSTreeWidgetItem::operator<(other); return GxsIdRSTreeWidgetItem::operator<(other);
} }
@ -1250,6 +1250,8 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
redacted = (reputation_level == RsReputations::REPUTATION_LOCALLY_NEGATIVE); redacted = (reputation_level == RsReputations::REPUTATION_LOCALLY_NEGATIVE);
// We use a specific item model for forums in order to handle the post pinning.
GxsIdRSTreeWidgetItem *item = new ForumThreadItem(ui->threadTreeWidget->header(),mThreadCompareRole,GxsIdDetails::ICON_TYPE_AVATAR ); GxsIdRSTreeWidgetItem *item = new ForumThreadItem(ui->threadTreeWidget->header(),mThreadCompareRole,GxsIdDetails::ICON_TYPE_AVATAR );
item->moveToThread(ui->threadTreeWidget->thread()); item->moveToThread(ui->threadTreeWidget->thread());