diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index 3c9d661ae..743204734 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp @@ -372,7 +372,7 @@ void GroupTreeWidget::calculateScore(QTreeWidgetItem *item) } } - item->setData(COLUMN_DATA, ROLE_SEARCH_SCORE, score); + item->setData(COLUMN_DATA, ROLE_SEARCH_SCORE, -score); // negative for correct sorting return; } @@ -448,35 +448,3 @@ void GroupTreeWidget::sort() { resort(NULL); } - -GroupTreeWidgetItem::GroupTreeWidgetItem() : QTreeWidgetItem() -{ -} - -bool GroupTreeWidgetItem::operator<(const QTreeWidgetItem& other) const -{ - QDateTime otherChanTs = other.data(COLUMN_DATA, ROLE_LASTPOST).toDateTime(); - QDateTime thisChanTs = this->data(COLUMN_DATA, ROLE_LASTPOST).toDateTime(); - - uint32_t otherCount = other.data(COLUMN_DATA, ROLE_SEARCH_SCORE).toUInt(); - uint32_t thisCount = this->data(COLUMN_DATA, ROLE_SEARCH_SCORE).toUInt(); - - /* If counts are equal then determine by who has the most recent post */ - if (otherCount == thisCount){ - if (thisChanTs < otherChanTs) { - return true; - } - } - - /* Choose the item where the string occurs the most */ - if (thisCount < otherCount) { - return true; - } - - if (thisChanTs < otherChanTs) { - return true; - } - - /* Compare name */ - return text(COLUMN_NAME) < other.text(COLUMN_NAME); -} diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.h b/retroshare-gui/src/gui/common/GroupTreeWidget.h index 67219a6f7..6f04a6509 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.h +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.h @@ -108,16 +108,4 @@ private: Ui::GroupTreeWidget *ui; }; -class GroupTreeWidgetItem : public QTreeWidgetItem -{ -public: - GroupTreeWidgetItem(); - - /** - * reimplementing comparison operator so GroupTreeWidgetItem can be ordered in terms - * of occurences of property filterText in its data columns - */ - bool operator<(const QTreeWidgetItem &other) const; -}; - #endif // GROUPTREEWIDGET_H