Merge pull request #954 from PhenomRetroShare/Fix_ShowAuthorInPeopleTabAtStartUp

Fix Show Author In People Tab at startup
This commit is contained in:
csoler 2017-07-20 18:19:10 +02:00 committed by GitHub
commit f9d6a78627
2 changed files with 32 additions and 10 deletions

View File

@ -1060,7 +1060,9 @@ void IdDialog::CircleListCustomPopupMenu( QPoint )
} }
#endif #endif
#ifdef ID_DEBUG
std::cerr << " Item is a circle item. Adding Edit/Details menu entry." << std::endl; std::cerr << " Item is a circle item. Adding Edit/Details menu entry." << std::endl;
#endif
is_circle = true ; is_circle = true ;
contextMnu.addSeparator() ; contextMnu.addSeparator() ;
@ -1076,7 +1078,9 @@ void IdDialog::CircleListCustomPopupMenu( QPoint )
am_I_circle_admin = bool(group_flags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) ; am_I_circle_admin = bool(group_flags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) ;
} }
#ifdef ID_DEBUG
std::cerr << " Item is a GxsId item. Requesting flags/group id from parent: " << circle_id << std::endl; std::cerr << " Item is a GxsId item. Requesting flags/group id from parent: " << circle_id << std::endl;
#endif
} }
RsGxsCircleDetails details ; RsGxsCircleDetails details ;
@ -1565,6 +1569,15 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
void IdDialog::insertIdList(uint32_t token) void IdDialog::insertIdList(uint32_t token)
{ {
//First: Get current item to restore after
RsGxsGroupId oldCurrentId = mIdToNavigate;
{
QTreeWidgetItem *oldCurrent = ui->idTreeWidget->currentItem();
if (oldCurrent) {
oldCurrentId = RsGxsGroupId(oldCurrent->text(RSID_COL_KEYID).toStdString());
}
}
mStateHelper->setLoading(IDDIALOG_IDLIST, false); mStateHelper->setLoading(IDDIALOG_IDLIST, false);
int accept = filter; int accept = filter;
@ -1663,6 +1676,7 @@ void IdDialog::insertIdList(uint32_t token)
int itemCount = contactsItem->childCount() + allItem->childCount() + ownItem->childCount(); int itemCount = contactsItem->childCount() + allItem->childCount() + ownItem->childCount();
ui->label_count->setText( "(" + QString::number( itemCount ) + ")" ); ui->label_count->setText( "(" + QString::number( itemCount ) + ")" );
navigate(RsGxsId(oldCurrentId));
filterIds(); filterIds();
updateSelection(); updateSelection();
} }
@ -2050,20 +2064,27 @@ void IdDialog::modifyReputation()
void IdDialog::navigate(const RsGxsId& gxs_id) void IdDialog::navigate(const RsGxsId& gxs_id)
{ {
#ifdef ID_DEBUG
std::cerr << "IdDialog::navigate to " << gxs_id.toStdString() << std::endl; std::cerr << "IdDialog::navigate to " << gxs_id.toStdString() << std::endl;
#endif
// in order to do this, we just select the correct ID in the ID list // in order to do this, we just select the correct ID in the ID list
if (!gxs_id.isNull())
{
QList<QTreeWidgetItem*> select = ui->idTreeWidget->findItems(QString::fromStdString(gxs_id.toStdString()),Qt::MatchExactly | Qt::MatchRecursive | Qt::MatchWrap,RSID_COL_KEYID) ; QList<QTreeWidgetItem*> select = ui->idTreeWidget->findItems(QString::fromStdString(gxs_id.toStdString()),Qt::MatchExactly | Qt::MatchRecursive | Qt::MatchWrap,RSID_COL_KEYID) ;
if(select.empty()) if(select.empty())
{ {
mIdToNavigate = RsGxsGroupId(gxs_id);
std::cerr << "Cannot find item with ID " << gxs_id << " in ID list." << std::endl; std::cerr << "Cannot find item with ID " << gxs_id << " in ID list." << std::endl;
return ; return;
} }
ui->idTreeWidget->setCurrentItem(*select.begin(),true); ui->idTreeWidget->setCurrentItem(*select.begin(),true);
}
mIdToNavigate = RsGxsGroupId();
} }
void IdDialog::updateDisplay(bool complete) void IdDialog::updateDisplay(bool complete)
{ {
/* Update identity list */ /* Update identity list */

View File

@ -154,6 +154,7 @@ private:
std::map<uint32_t, CircleUpdateOrder> mCircleUpdates ; std::map<uint32_t, CircleUpdateOrder> mCircleUpdates ;
RsGxsGroupId mId; RsGxsGroupId mId;
RsGxsGroupId mIdToNavigate;
int filter; int filter;
/* UI - Designer */ /* UI - Designer */