added sorting of selected items on top in moderator selection list of forum edit dialog

This commit is contained in:
csoler 2023-01-28 21:10:45 +01:00
parent 95e9d76af9
commit 7a49099952
4 changed files with 22 additions and 4 deletions

View File

@ -51,7 +51,8 @@
#define ROLE_SORT_STANDARD_GROUP Qt::UserRole + 2
#define ROLE_SORT_NAME Qt::UserRole + 3
#define ROLE_SORT_STATE Qt::UserRole + 4
#define ROLE_FILTER_REASON Qt::UserRole + 5
#define ROLE_SORT_SELECTED Qt::UserRole + 5
#define ROLE_FILTER_REASON Qt::UserRole + 6
#define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png"
@ -667,8 +668,13 @@ void FriendSelectionWidget::secured_fillList()
emit itemAdded(IDTYPE_GXS, QString::fromStdString(detail.mId.toStdString()), gxsItem);
if (std::find(gxsIdsSelected.begin(), gxsIdsSelected.end(), detail.mId) != gxsIdsSelected.end())
{
setSelected(mListModus, gxsItem, true);
}
gxsItem->setData(COLUMN_NAME,ROLE_SORT_SELECTED,0);
}
else
gxsItem->setData(COLUMN_NAME,ROLE_SORT_SELECTED,1);
}
}
if(mShowTypes & SHOW_CONTACTS)
{
@ -1219,9 +1225,18 @@ std::string FriendSelectionWidget::idFromItem(QTreeWidgetItem *item)
return item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
}
void FriendSelectionWidget::sortByChecked(bool sort)
{
mCompareRole->clear();
mCompareRole->setRole(COLUMN_NAME,ROLE_SORT_SELECTED);
ui->friendList->resort();
}
void FriendSelectionWidget::sortByState(bool sort)
{
mCompareRole->setRole(COLUMN_NAME, ROLE_SORT_GROUP);
mCompareRole->clear();
mCompareRole->setRole(COLUMN_NAME, ROLE_SORT_GROUP);
mCompareRole->addRole(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP);
if (sort) {

View File

@ -132,7 +132,8 @@ signals:
public slots:
void sortByState(bool sort);
void filterConnected(bool filter);
void sortByChecked(bool sort);
void filterConnected(bool filter);
private slots:
void groupsChanged(int type);

View File

@ -32,6 +32,7 @@ public:
RSTreeWidgetItemCompareRole();
explicit RSTreeWidgetItemCompareRole(QMap<int, QList<int>> map);
void clear() { QMap<int, QList<int> >::clear() ; }
void setRole(const int column, const int role);
void addRole(const int column, const int role);
void findRoles(const int column, QList<int> &roles) const;

View File

@ -151,6 +151,7 @@ bool GxsForumGroupDialog::service_loadGroup(const RsGxsGenericGroupData *data, M
// Local information. Description should be handled here.
setSelectedModerators(pgroup->mAdminList.ids);
ui.adminsList->sortByChecked(true);
mGroupData = *pgroup; // keeps the private information