added proper initializing of existing moderators

This commit is contained in:
csoler 2018-08-30 10:54:52 +02:00
parent 65e3684c46
commit 4c076b60aa
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
4 changed files with 19 additions and 0 deletions

View File

@ -288,8 +288,14 @@ void FriendSelectionWidget::secured_fillList()
}
std::set<RsGxsId> gxsIdsSelected;
if (mShowTypes & SHOW_GXS)
{
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected,true);
if(!ui->friendList->topLevelItemCount()) // if not loaded yet, use the existing list.
gxsIdsSelected = mPreSelectedGxsIds;
}
std::set<RsGxsId> gxsIdsSelected2;
if (mShowTypes & SHOW_CONTACTS)
@ -683,6 +689,11 @@ void FriendSelectionWidget::requestGXSIdList()
mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, IDDIALOG_IDLIST);
}
template<> void FriendSelectionWidget::setSelectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(const std::set<RsGxsId>& ids, bool add)
{
mPreSelectedGxsIds = ids ;
requestGXSIdList();
}
void FriendSelectionWidget::groupsChanged(int /*type*/)
{

View File

@ -174,6 +174,8 @@ private:
std::vector<RsGxsGroupId> gxsIds ;
TokenQueue *mIdQueue ;
QList<QAction*> mContextMenuActions;
std::set<RsGxsId> mPreSelectedGxsIds; // because loading of GxsIds is asynchroneous we keep selected Ids from the client in a list here and use it to initialize after loading them.
};
Q_DECLARE_OPERATORS_FOR_FLAGS(FriendSelectionWidget::ShowTypes)

View File

@ -864,6 +864,11 @@ void GxsGroupDialog::getSelectedModerators(std::set<RsGxsId>& ids)
ui.adminsList->selectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(ids, true);
}
void GxsGroupDialog::setSelectedModerators(const std::set<RsGxsId>& ids)
{
ui.adminsList->setSelectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(ids, false);
}
/***********************************************************************************
Share Lists.
***********************************************************************************/

View File

@ -233,6 +233,7 @@ protected:
* Returns the set of ids that hve been selected as moderators.
*/
void getSelectedModerators(std::set<RsGxsId>& ids);
void setSelectedModerators(const std::set<RsGxsId>& ids);
private slots:
/* actions to take.... */