Fixed up the Id GUI to match new data types and use rsPeers for other info.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5783 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-11-06 19:18:56 +00:00
parent c09cab4439
commit aebd08f106
2 changed files with 114 additions and 83 deletions

View File

@ -25,6 +25,7 @@
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h> #include <retroshare/rsidentity.h>
#include "gxs/rsgxsflags.h"
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
@ -163,43 +164,67 @@ void IdDialog::insertIdDetails(uint32_t token)
data = datavector[0]; data = datavector[0];
/* get GPG Details from rsPeers */ /* get GPG Details from rsPeers */
std::string gpgid = rsPeers->getGPGOwnId(); std::string ownPgpId = rsPeers->getGPGOwnId();
RsPeerDetails details;
rsPeers->getPeerDetails(gpgid, details);
//ui.lineEdit_Nickname->setText(QString::fromStdString(data.mNickname));
ui.lineEdit_Nickname->setText(QString::fromStdString(data.mMeta.mGroupName)); ui.lineEdit_Nickname->setText(QString::fromStdString(data.mMeta.mGroupName));
//ui.lineEdit_KeyId->setText(QString::fromStdString(data.mKeyId));
ui.lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId)); ui.lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId));
ui.lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash)); ui.lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash));
//ui.lineEdit_GpgId->setText(QString::fromStdString(data.mGpgId)); ui.lineEdit_GpgId->setText(QString::fromStdString(data.mPgpId));
//ui.lineEdit_GpgName->setText(QString::fromStdString(data.mGpgName));
//ui.lineEdit_GpgEmail->setText(QString::fromStdString(data.mGpgEmail));
#if 0 if (data.mPgpKnown)
if (data.mIdType & RSID_RELATION_YOURSELF) {
RsPeerDetails details;
rsPeers->getGPGDetails(data.mPgpId, details);
ui.lineEdit_GpgName->setText(QString::fromStdString(details.name));
ui.lineEdit_GpgEmail->setText(QString::fromStdString(details.email));
}
else
{
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
{
ui.lineEdit_GpgName->setText("Unknown Real Name");
ui.lineEdit_GpgEmail->setText("Unknown Email");
}
else
{
ui.lineEdit_GpgName->setText("Anonymous Id");
ui.lineEdit_GpgEmail->setText("-- N/A --");
}
}
bool isOwnId = (data.mPgpKnown && (data.mPgpId == ownPgpId)) ||
(data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
if (isOwnId)
{ {
ui.radioButton_IdYourself->setChecked(true); ui.radioButton_IdYourself->setChecked(true);
} }
else if (data.mIdType & RSID_TYPE_PSEUDONYM) else if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
{ {
ui.radioButton_IdPseudo->setChecked(true); if (data.mPgpKnown)
} {
else if (data.mIdType & RSID_RELATION_FRIEND) if (rsPeers->isGPGAccepted(data.mPgpId))
{ {
ui.radioButton_IdFriend->setChecked(true); ui.radioButton_IdFriend->setChecked(true);
} }
else if (data.mIdType & RSID_RELATION_FOF) else
{ {
ui.radioButton_IdFOF->setChecked(true); ui.radioButton_IdFOF->setChecked(true);
} }
}
else else
{ {
ui.radioButton_IdOther->setChecked(true); ui.radioButton_IdOther->setChecked(true);
} }
}
else
{
ui.radioButton_IdPseudo->setChecked(true);
}
ui.pushButton_NewId->setEnabled(true); ui.pushButton_NewId->setEnabled(true);
if (data.mIdType & RSID_RELATION_YOURSELF)
if (isOwnId)
{ {
ui.pushButton_Reputation->setEnabled(false); ui.pushButton_Reputation->setEnabled(false);
ui.pushButton_Delete->setEnabled(true); ui.pushButton_Delete->setEnabled(true);
@ -211,7 +236,6 @@ void IdDialog::insertIdDetails(uint32_t token)
ui.pushButton_Delete->setEnabled(false); ui.pushButton_Delete->setEnabled(false);
ui.pushButton_EditId->setEnabled(false); ui.pushButton_EditId->setEnabled(false);
} }
#endif
} }
void IdDialog::checkUpdate() void IdDialog::checkUpdate()
@ -307,39 +331,30 @@ void IdDialog::insertIdList(uint32_t token)
return; return;
} }
std::string ownPgpId = rsPeers->getGPGOwnId();
for(vit = datavector.begin(); vit != datavector.end(); vit++) for(vit = datavector.begin(); vit != datavector.end(); vit++)
{ {
data = (*vit); data = (*vit);
bool isOwnId = (data.mPgpKnown && (data.mPgpId == ownPgpId)) ||
(data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
/* do filtering */ /* do filtering */
bool ok = false; bool ok = false;
if (acceptAll) if (acceptAll)
{ {
ok = true; ok = true;
} }
#if 0 else if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
else if (data.mIdType & RSID_TYPE_PSEUDONYM)
{ {
if (acceptPseudo) if (isOwnId && acceptYourself)
{ {
ok = true; ok = true;
} }
if ((data.mIdType & RSID_RELATION_YOURSELF) && (acceptYourself))
{
ok = true;
}
}
else else
{ {
if (data.mIdType & RSID_RELATION_YOURSELF) if (data.mPgpKnown)
{
if (acceptYourself)
{
ok = true;
}
}
else if (data.mIdType & (RSID_RELATION_FRIEND | RSID_RELATION_FOF))
{ {
if (acceptFriends) if (acceptFriends)
{ {
@ -354,20 +369,36 @@ void IdDialog::insertIdList(uint32_t token)
} }
} }
} }
#endif }
else
{
if (acceptPseudo)
{
ok = true;
}
if (isOwnId && acceptYourself)
{
ok = true;
}
}
if (!ok) if (!ok)
{ {
continue; continue;
} }
QTreeWidgetItem *item = new QTreeWidgetItem(); QTreeWidgetItem *item = new QTreeWidgetItem();
//item->setText(RSID_COL_NICKNAME, QString::fromStdString(data.mNickname));
//item->setText(RSID_COL_KEYID, QString::fromStdString(data.mKeyId));
item->setText(RSID_COL_NICKNAME, QString::fromStdString(data.mMeta.mGroupName)); item->setText(RSID_COL_NICKNAME, QString::fromStdString(data.mMeta.mGroupName));
item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId)); item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId));
//item->setText(RSID_COL_IDTYPE, QString::fromStdString(rsIdTypeToString(data.mIdType))); if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
{
item->setText(RSID_COL_IDTYPE, "PGP Linked Id");
}
else
{
item->setText(RSID_COL_IDTYPE, "Anon Id");
}
tree->addTopLevelItem(item); tree->addTopLevelItem(item);
} }

View File

@ -146,51 +146,51 @@ void IdEditDialog::loadExistingId(uint32_t token)
data = datavector[0]; data = datavector[0];
bool realid = (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID);
bool pseudo = false; //(data.mIdType & RSID_TYPE_PSEUDONYM); if (realid)
if (pseudo)
{ {
ui.radioButton_Pseudo->setChecked(true); ui.radioButton_GpgId->setChecked(true);
} }
else else
{ {
ui.radioButton_GpgId->setChecked(true); ui.radioButton_Pseudo->setChecked(true);
} }
// DOES THIS TRIGGER ALREADY??? // DOES THIS TRIGGER ALREADY???
// force - incase it wasn't triggered. // force - incase it wasn't triggered.
IdTypeToggled(true); IdTypeToggled(true);
//ui.lineEdit_Nickname->setText(QString::fromStdString(data.mNickname));
//ui.lineEdit_KeyId->setText(QString::fromStdString(data.mKeyId));
ui.lineEdit_Nickname->setText(QString::fromStdString(data.mMeta.mGroupName)); ui.lineEdit_Nickname->setText(QString::fromStdString(data.mMeta.mGroupName));
ui.lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId)); ui.lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId));
if (pseudo) if (realid)
{
ui.lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash));
if (data.mPgpKnown)
{
RsPeerDetails details;
rsPeers->getGPGDetails(data.mPgpId, details);
ui.lineEdit_GpgName->setText(QString::fromStdString(details.name));
ui.lineEdit_GpgEmail->setText(QString::fromStdString(details.email));
ui.lineEdit_GpgId->setText(QString::fromStdString(data.mPgpId));
}
else
{
ui.lineEdit_GpgId->setText("Unknown PgpId");
ui.lineEdit_GpgName->setText("Unknown Real Name");
ui.lineEdit_GpgEmail->setText("Unknown Email");
}
}
else
{ {
ui.lineEdit_GpgHash->setText("N/A"); ui.lineEdit_GpgHash->setText("N/A");
ui.lineEdit_GpgId->setText("N/A"); ui.lineEdit_GpgId->setText("N/A");
ui.lineEdit_GpgName->setText("N/A"); ui.lineEdit_GpgName->setText("N/A");
ui.lineEdit_GpgEmail->setText("N/A"); ui.lineEdit_GpgEmail->setText("N/A");
} }
else
{
ui.lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash));
if (0) //if (data.mGpgIdKnown)
{
//ui.lineEdit_GpgId->setText(QString::fromStdString(data.mGpgId));
//ui.lineEdit_GpgName->setText(QString::fromStdString(data.mGpgName));
//ui.lineEdit_GpgEmail->setText(QString::fromStdString(data.mGpgEmail));
}
else
{
ui.lineEdit_GpgId->setText("EXIST Unknown");
ui.lineEdit_GpgName->setText("Unknown");
ui.lineEdit_GpgEmail->setText("Unknown");
}
}
return; return;
} }