diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index 5397f6300..b0d8f1863 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -429,14 +429,23 @@ void IdDialog::handleEvent_main_thread(std::shared_ptr event) switch(e->mIdentityEventCode) { case RsGxsIdentityEventCode::DELETED_IDENTITY: - case RsGxsIdentityEventCode::NEW_IDENTITY: + if(mId == e->mIdentityId) + { + mId.clear(); + updateIdentity(); + } + updateIdList(); + break; + + case RsGxsIdentityEventCode::NEW_IDENTITY: case RsGxsIdentityEventCode::UPDATED_IDENTITY: if (isVisible()) { if(rsIdentity->isOwnId(RsGxsId(e->mIdentityId))) updateIdList(); else - updateIdTimer.start(3000); // use a timer for events not generated by local changes + updateIdTimer.start(3000); // use a timer for events not generated by local changes which generally + // come in large herds. Allows to group multiple changes into a single UI update. } else needUpdateIdsOnNextShow = true; @@ -1330,6 +1339,7 @@ void IdDialog::updateSelection() void IdDialog::updateIdList() { //int accept = filter; + std::cerr << "Updating ID list" << std::endl; RsThread::async([this]() { @@ -1512,7 +1522,9 @@ void IdDialog::loadIdentities(const std::map& ids_set { auto ids_set(ids_set_const); - //First: Get current item to restore after + std::cerr << "Loading ID list" << std::endl; + + //First: Get current item to restore after RsGxsGroupId oldCurrentId = mIdToNavigate; { QTreeWidgetItem *oldCurrent = ui->idTreeWidget->currentItem(); @@ -1598,9 +1610,9 @@ void IdDialog::loadIdentities(const std::map& ids_set int allCount = allItem->childCount() ; int ownCount = ownItem->childCount(); - contactsItem->setText(0, tr("My contacts") + " (" + QString::number( contactsCount ) + ")" ); - allItem->setText(0, tr("All") + " (" + QString::number( allCount ) + ")" ); - ownItem->setText(0, tr("My own identities") + " (" + QString::number( ownCount ) + ")" ); + contactsItem->setText(0, tr("My contacts") + ((contactsCount>0)?" (" + QString::number( contactsCount ) + ")":"") ); + allItem->setText(0, tr("All") + ((allCount>0)?" (" + QString::number( allCount ) + ")":"") ); + ownItem->setText(0, tr("My own identities") + ((ownCount>0)?" (" + QString::number( ownCount ) + ")":"") ); //Restore expanding @@ -2086,14 +2098,12 @@ void IdDialog::removeIdentity() return; } - if ((QMessageBox::question(this, tr("Really delete?"), tr("Do you really want to delete this identity?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::No))== QMessageBox::Yes) + if ((QMessageBox::question(this, tr("Really delete?"), tr("Do you really want to delete this identity?\nThis cannot be undone."), QMessageBox::Yes|QMessageBox::No, QMessageBox::No))== QMessageBox::Yes) { - std::string keyId = item->text(RSID_COL_KEYID).toStdString(); + std::string keyId = item->text(RSID_COL_KEYID).toStdString(); + RsGxsId kid(keyId); - uint32_t dummyToken = 0; - RsGxsIdGroup group; - group.mMeta.mGroupId=RsGxsGroupId(keyId); - rsIdentity->deleteIdentity(dummyToken, group); + rsIdentity->deleteIdentity(kid); } }