From d856566c69040967d2883d1696114c04e42c0d26 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 3 Sep 2018 22:02:32 +0200 Subject: [PATCH] added comment in the post sorting code --- retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 3e408fc09..93c75fdf4 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -1224,11 +1224,11 @@ public: 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_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_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(); 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); } @@ -1250,6 +1250,8 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum 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 ); item->moveToThread(ui->threadTreeWidget->thread());