mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
fixed bug causing IdChooser to reset the current id
This commit is contained in:
parent
1f8ecc024d
commit
d711e09b68
@ -127,10 +127,13 @@ void GxsIdChooser::setDefaultId(const RsGxsId &defId)
|
||||
static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/)
|
||||
{
|
||||
GxsIdChooser *chooser = dynamic_cast<GxsIdChooser*>(object);
|
||||
if (!chooser) {
|
||||
|
||||
if (!chooser)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int current_index = chooser->currentIndex();
|
||||
|
||||
QString current_id = (current_index >= 0)? chooser->itemData(current_index).toString() : "" ;
|
||||
|
||||
// this prevents the objects that depend on what's in the combo-box to activate and
|
||||
// perform any change.Only user-changes should cause this.
|
||||
@ -186,6 +189,16 @@ static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetail
|
||||
|
||||
chooser->model()->sort(0);
|
||||
|
||||
// now restore the current item. Problem is, we cannot use the ID position because it may have changed.
|
||||
|
||||
if(!current_id.isNull())
|
||||
for(int indx=0;indx<chooser->count();++indx)
|
||||
if(chooser->itemData(indx).toString() == current_id)
|
||||
{
|
||||
chooser->setCurrentIndex(indx);
|
||||
break;
|
||||
}
|
||||
|
||||
chooser->blockSignals(false) ;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user