mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-14 00:55:46 -04:00
ID rework
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7167 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ad1602d701
commit
97ac7f85f7
17 changed files with 57 additions and 57 deletions
|
@ -128,7 +128,7 @@ void CirclesDialog::editExistingCircle()
|
|||
}
|
||||
|
||||
QString coltext = item->text(CIRCLEGROUP_CIRCLE_COL_GROUPID);
|
||||
std::string id = coltext.toStdString();
|
||||
RsGxsGroupId id ( coltext.toStdString());
|
||||
|
||||
CreateCircleDialog dlg;
|
||||
dlg.editExistingId(id);
|
||||
|
@ -140,11 +140,11 @@ void CirclesDialog::reloadAll()
|
|||
requestGroupMeta();
|
||||
|
||||
/* grab all ids */
|
||||
std::list<std::string> friend_pgpIds;
|
||||
std::list<std::string> all_pgpIds;
|
||||
std::list<std::string>::iterator it;
|
||||
std::list<RsPgpId> friend_pgpIds;
|
||||
std::list<RsPgpId> all_pgpIds;
|
||||
std::list<RsPgpId>::iterator it;
|
||||
|
||||
std::set<std::string> friend_set;
|
||||
std::set<RsPgpId> friend_set;
|
||||
|
||||
rsPeers->getGPGAcceptedList(friend_pgpIds);
|
||||
rsPeers->getGPGAllList(all_pgpIds);
|
||||
|
@ -170,7 +170,7 @@ void CirclesDialog::reloadAll()
|
|||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_NAME, QString::fromUtf8(details.name.c_str()));
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_ID, QString::fromStdString(*it));
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_ID, QString::fromStdString((*it).toStdString()));
|
||||
friendsItem->addChild(item);
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ void CirclesDialog::reloadAll()
|
|||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_NAME, QString::fromUtf8(details.name.c_str()));
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_ID, QString::fromStdString(*it));
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_ID, QString::fromStdString((*it).toStdString()));
|
||||
fofItem->addChild(item);
|
||||
}
|
||||
}
|
||||
|
@ -251,10 +251,10 @@ void set_tree_background(QTreeWidget *tree, uint32_t type)
|
|||
}
|
||||
}
|
||||
|
||||
void check_mark_item(QTreeWidgetItem *item, const std::set<std::string> &names, uint32_t col, uint32_t type)
|
||||
void check_mark_item(QTreeWidgetItem *item, const std::set<RsPgpId> &names, uint32_t col, uint32_t type)
|
||||
{
|
||||
QString coltext = item->text(col);
|
||||
std::string colstr = coltext.toStdString();
|
||||
RsPgpId colstr ( coltext.toStdString());
|
||||
if (names.end() != names.find(colstr))
|
||||
{
|
||||
set_item_background(item, type);
|
||||
|
@ -263,7 +263,7 @@ void check_mark_item(QTreeWidgetItem *item, const std::set<std::string> &names,
|
|||
}
|
||||
}
|
||||
|
||||
void update_mark_children(QTreeWidgetItem *item, const std::set<std::string> &names, uint32_t col, uint32_t type)
|
||||
void update_mark_children(QTreeWidgetItem *item, const std::set<RsPgpId> &names, uint32_t col, uint32_t type)
|
||||
{
|
||||
int count = item->childCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
|
@ -278,7 +278,7 @@ void update_mark_children(QTreeWidgetItem *item, const std::set<std::string> &na
|
|||
}
|
||||
}
|
||||
|
||||
void mark_matching_tree(QTreeWidget *tree, const std::set<std::string> &names, uint32_t col, uint32_t type)
|
||||
void mark_matching_tree(QTreeWidget *tree, const std::set<RsPgpId> &names, uint32_t col, uint32_t type)
|
||||
{
|
||||
std::cerr << "CirclesDialog mark_matching_tree()";
|
||||
std::cerr << std::endl;
|
||||
|
@ -296,16 +296,16 @@ void mark_matching_tree(QTreeWidget *tree, const std::set<std::string> &names, u
|
|||
|
||||
/**** Circles checks - v expensive ***/
|
||||
|
||||
void mark_circle_item(QTreeWidgetItem *item, const std::set<std::string> &names)
|
||||
void mark_circle_item(QTreeWidgetItem *item, const std::set<RsPgpId> &names)
|
||||
{
|
||||
std::string id = item->text(CIRCLEGROUP_CIRCLE_COL_GROUPID).toStdString();
|
||||
RsGxsCircleId id ( item->text(CIRCLEGROUP_CIRCLE_COL_GROUPID).toStdString());
|
||||
RsGxsCircleDetails details;
|
||||
if (rsGxsCircles->getCircleDetails(id, details))
|
||||
{
|
||||
std::set<std::string>::iterator it;
|
||||
std::set<RsPgpId>::iterator it;
|
||||
for(it = names.begin(); it != names.end(); it++)
|
||||
{
|
||||
if (details.mAllowedPeers.end() != details.mAllowedPeers.find(*it))
|
||||
if (details.mAllowedPeers.end() != details.mAllowedPeers.find(*it))
|
||||
{
|
||||
set_item_background(item, GREEN_BACKGROUND);
|
||||
std::cerr << "CirclesDialog mark_circle_item: found match: " << id;
|
||||
|
@ -321,7 +321,7 @@ void mark_circle_item(QTreeWidgetItem *item, const std::set<std::string> &names)
|
|||
}
|
||||
}
|
||||
|
||||
void mark_circle_children(QTreeWidgetItem *item, const std::set<std::string> &names)
|
||||
void mark_circle_children(QTreeWidgetItem *item, const std::set<RsPgpId> &names)
|
||||
{
|
||||
int count = item->childCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
|
@ -336,7 +336,7 @@ void mark_circle_children(QTreeWidgetItem *item, const std::set<std::string> &na
|
|||
}
|
||||
}
|
||||
|
||||
void mark_circle_tree(QTreeWidget *tree, const std::set<std::string> &names)
|
||||
void mark_circle_tree(QTreeWidget *tree, const std::set<RsPgpId> &names)
|
||||
{
|
||||
std::cerr << "CirclesDialog mark_circle_tree()";
|
||||
std::cerr << std::endl;
|
||||
|
@ -377,7 +377,7 @@ void CirclesDialog::circle_selected()
|
|||
if (rsGxsCircles->getCircleDetails(id, details))
|
||||
{
|
||||
/* now mark all the members */
|
||||
std::set<std::string> members;
|
||||
std::set<RsPgpId> members;
|
||||
std::map<RsPgpId, std::list<RsGxsId> >::iterator it;
|
||||
for(it = details.mAllowedPeers.begin(); it != details.mAllowedPeers.end(); it++)
|
||||
{
|
||||
|
@ -411,10 +411,10 @@ void CirclesDialog::friend_selected()
|
|||
|
||||
set_item_background(item, BLUE_BACKGROUND);
|
||||
|
||||
std::string id = item->text(CIRCLEGROUP_FRIEND_COL_ID).toStdString();
|
||||
RsPgpId id ( item->text(CIRCLEGROUP_FRIEND_COL_ID).toStdString());
|
||||
|
||||
/* update permission lists */
|
||||
std::set<std::string> names;
|
||||
std::set<RsPgpId> names;
|
||||
names.insert(id);
|
||||
mark_circle_tree(ui.treeWidget_membership, names);
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ void CirclesDialog::loadGroupMeta(const uint32_t &token)
|
|||
|
||||
QTreeWidgetItem *groupItem = new QTreeWidgetItem();
|
||||
groupItem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QString::fromUtf8(vit->mGroupName.c_str()));
|
||||
groupItem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPID, QString::fromStdString(vit->mGroupId));
|
||||
groupItem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPID, QString::fromStdString(vit->mGroupId.toStdString()));
|
||||
|
||||
if (vit->mCircleType == GXS_CIRCLE_TYPE_LOCAL)
|
||||
{
|
||||
|
|
|
@ -78,8 +78,8 @@ CreateCircleDialog::CreateCircleDialog()
|
|||
mIsExistingCircle = false;
|
||||
mIsExternalCircle = true;
|
||||
|
||||
ui.idChooser->loadIds(0,"");
|
||||
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, "");
|
||||
ui.idChooser->loadIds(0,RsGxsId());
|
||||
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, RsGxsCircleId());
|
||||
}
|
||||
|
||||
CreateCircleDialog::~CreateCircleDialog()
|
||||
|
@ -255,7 +255,7 @@ void CreateCircleDialog::createCircle()
|
|||
/* insert into circle */
|
||||
if (mIsExternalCircle)
|
||||
{
|
||||
circle.mInvitedMembers.push_back(keyId.toStdString());
|
||||
circle.mInvitedMembers.push_back(RsGxsId(keyId.toStdString()));
|
||||
std::cerr << "CreateCircleDialog::createCircle() Inserting Member: " << keyId.toStdString();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
|
|||
continue;
|
||||
}
|
||||
|
||||
QString keyId = QString::fromStdString(data.mMeta.mGroupId);
|
||||
QString keyId = QString::fromStdString(data.mMeta.mGroupId.toStdString());
|
||||
QString nickname = QString::fromUtf8(data.mMeta.mGroupName.c_str());
|
||||
QString idtype = tr("Anon Id");
|
||||
|
||||
|
|
|
@ -585,7 +585,7 @@ void IdDialog::insertRepList(uint32_t token)
|
|||
/* insert 4 columns */
|
||||
|
||||
/* friend name */
|
||||
item->setId(op.mMeta.mGroupId.toStdString(), RSIDREP_COL_NAME);
|
||||
item->setId(op.mMeta.mAuthorId, RSIDREP_COL_NAME);
|
||||
|
||||
/* score */
|
||||
item->setText(RSIDREP_COL_OPINION, QString::number(op.getOpinion()));
|
||||
|
|
|
@ -240,7 +240,7 @@ void IdEditDialog::loadExistingId(uint32_t token)
|
|||
void IdEditDialog::checkNewTag()
|
||||
{
|
||||
std::string tag = ui.plainTextEdit_Tag->toPlainText().toStdString();
|
||||
std::string id = ui.lineEdit_KeyId->text().toStdString();
|
||||
RsGxsId id ( ui.lineEdit_KeyId->text().toStdString());
|
||||
std::string name = ui.lineEdit_Nickname->text().toUtf8().data();
|
||||
|
||||
QString desc;
|
||||
|
@ -313,7 +313,7 @@ void IdEditDialog::rmTag(int idx)
|
|||
loadRecognTags();
|
||||
}
|
||||
|
||||
bool IdEditDialog::tagDetails(const std::string &id, const std::string &name, const std::string &tag, QString &desc)
|
||||
bool IdEditDialog::tagDetails(const RsGxsId &id, const std::string &name, const std::string &tag, QString &desc)
|
||||
{
|
||||
if (tag.empty())
|
||||
{
|
||||
|
@ -378,7 +378,7 @@ void IdEditDialog::loadRecognTags()
|
|||
for(it = mEditGroup.mRecognTags.begin(); it != mEditGroup.mRecognTags.end(); it++, i++)
|
||||
{
|
||||
QString recognTag;
|
||||
tagDetails(mEditGroup.mMeta.mGroupId.toStdString(), mEditGroup.mMeta.mGroupName, *it, recognTag);
|
||||
tagDetails(mEditGroup.mMeta.mGroupId, mEditGroup.mMeta.mGroupName, *it, recognTag);
|
||||
|
||||
switch(i)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "util/TokenQueue.h"
|
||||
#include <retroshare/rsidentity.h>
|
||||
#include <retroshare/rsgxsifacetypes.h>
|
||||
|
||||
class UIStateHelper;
|
||||
|
||||
|
@ -65,7 +66,7 @@ private:
|
|||
|
||||
void loadRecognTags();
|
||||
// extract details.
|
||||
bool tagDetails(const std::string &id, const std::string &name, const std::string &tag, QString &desc);
|
||||
bool tagDetails(const RsGxsId &id, const std::string &name, const std::string &tag, QString &desc);
|
||||
void rmTag(int idx);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -508,7 +508,7 @@ bool RetroShareLink::createForum(const std::string& id, const std::string& msgId
|
|||
return valid();
|
||||
}
|
||||
|
||||
bool RetroShareLink::createChannel(const std::string& id, const std::string& msgId)
|
||||
bool RetroShareLink::createChannel(const std::string &id, const std::string &msgId)
|
||||
{
|
||||
clear();
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ GxsCommentDialog::GxsCommentDialog(QWidget *parent, RsTokenService *token_servic
|
|||
ui.treeWidget->setup(token_service, comment_service);
|
||||
|
||||
/* fill in the available OwnIds for signing */
|
||||
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
|
||||
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||
|
||||
connect(ui.refreshButton, SIGNAL(clicked()), this, SLOT(refresh()));
|
||||
connect(ui.idChooser, SIGNAL(currentIndexChanged( int )), this, SLOT(voterSelectionChanged( int )));
|
||||
|
|
|
@ -95,9 +95,9 @@ void GxsCommentTreeWidget::customPopUpMenu(const QPoint& point)
|
|||
contextMnu.addSeparator();
|
||||
|
||||
action = contextMnu.addAction(QIcon(IMAGE_VOTEUP), tr("Vote Up"), this, SLOT(voteUp()));
|
||||
action->setDisabled(mVoterId.empty());
|
||||
action->setDisabled(mVoterId.isNull());
|
||||
action = contextMnu.addAction(QIcon(IMAGE_VOTEDOWN), tr("Vote Down"), this, SLOT(voteDown()));
|
||||
action->setDisabled(mVoterId.empty());
|
||||
action->setDisabled(mVoterId.isNull());
|
||||
|
||||
|
||||
if (!mCurrentMsgId.isNull())
|
||||
|
|
|
@ -37,7 +37,7 @@ GxsCreateCommentDialog::GxsCreateCommentDialog(TokenQueue *tokQ, RsGxsCommentSer
|
|||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment()));
|
||||
|
||||
/* fill in the available OwnIds for signing */
|
||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
|
||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||
}
|
||||
|
||||
void GxsCreateCommentDialog::createComment()
|
||||
|
|
|
@ -108,9 +108,9 @@ void GxsGroupDialog::init()
|
|||
|
||||
/* Setup Reasonable Defaults */
|
||||
|
||||
ui.idChooser->loadIds(0,"");
|
||||
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL,"");
|
||||
ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL,"");
|
||||
ui.idChooser->loadIds(0,RsGxsId());
|
||||
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL,RsGxsCircleId());
|
||||
ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL,RsGxsCircleId());
|
||||
|
||||
initMode();
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ bool GxsIdChooser::MakeIdDesc(const RsGxsId &id, QString &desc)
|
|||
if (mTimerCount > MAX_TRY)
|
||||
{
|
||||
desc = QString("%1 ... [").arg(tr("Not found"));
|
||||
desc += QString::fromStdString(id.substr(0,5));
|
||||
desc += QString::fromStdString(id.toStdString().substr(0,5));
|
||||
desc += "...]";
|
||||
}
|
||||
return false;
|
||||
|
@ -92,7 +92,7 @@ void GxsIdChooser::addPrivateId(const RsGxsId &gxsId, bool replace)
|
|||
}
|
||||
}
|
||||
|
||||
QString id = QString::fromStdString(gxsId);
|
||||
QString id = QString::fromStdString(gxsId.toStdString());
|
||||
|
||||
if (replace) {
|
||||
/* Find and replace text of exisiting item */
|
||||
|
|
|
@ -69,20 +69,19 @@ static bool findTagIcon(int tag_class, int tag_type, QIcon &icon)
|
|||
}
|
||||
|
||||
|
||||
static bool CreateIdIcon(const std::string &id, QIcon &idIcon)
|
||||
static bool CreateIdIcon(const RsGxsId &id, QIcon &idIcon)
|
||||
{
|
||||
QPixmap image(IconSize, IconSize);
|
||||
QPainter painter(&image);
|
||||
|
||||
painter.fillRect(0, 0, IconSize, IconSize, Qt::black);
|
||||
|
||||
int len = id.length();
|
||||
for(int i = 0; i + 1 < len; i += 2)
|
||||
int len = id.SIZE_IN_BYTES;
|
||||
for(int i = 0; i<len; ++i)
|
||||
{
|
||||
char hex1 = id[i];
|
||||
char hex2 = id[i+1];
|
||||
int x = (hex1 >= 'a') ? (hex1 - 'a' + 10) : (hex1 - '0');
|
||||
int y = (hex2 >= 'a') ? (hex2 - 'a' + 10) : (hex2 - '0');
|
||||
unsigned char hex = id.toByteArray()[i];
|
||||
int x = hex & 0xf ;
|
||||
int y = (hex & 0xf0) >> 4 ;
|
||||
painter.fillRect(x, y, x+1, y+1, Qt::green);
|
||||
}
|
||||
idIcon = QIcon(image);
|
||||
|
@ -99,7 +98,7 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, std
|
|||
std::cerr << "GxsIdTreeWidget::MakeIdDesc() FAILED TO GET ID";
|
||||
std::cerr << std::endl;
|
||||
|
||||
str = QObject::tr("Loading... ") + QString::fromStdString(id.substr(0,5));
|
||||
str = QObject::tr("Loading... ") + QString::fromStdString(id.toStdString().substr(0,5));
|
||||
|
||||
if (!doIcons)
|
||||
{
|
||||
|
@ -144,7 +143,7 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, std
|
|||
|
||||
if (addCode)
|
||||
{
|
||||
str += QString::fromStdString(id.substr(0,5));
|
||||
str += QString::fromStdString(id.toStdString().substr(0,5));
|
||||
str += "...]";
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ GxsIdLabel::GxsIdLabel(QWidget *parent)
|
|||
void GxsIdLabel::setId(const RsGxsId &id)
|
||||
{
|
||||
mId = id;
|
||||
if (mId == "")
|
||||
if (mId.isNull())
|
||||
{
|
||||
setText("No Signature");
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ void GxsIdItemDelegate::paint( QPainter * painter,
|
|||
std::cerr << "GxsIdItemDelegate::paint()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsGxsId id = mTree->ItemTextFromIndex(index, mGxsIdColumn).toStdString();
|
||||
RsGxsId id ( mTree->ItemTextFromIndex(index, mGxsIdColumn).toStdString());
|
||||
paintGxsId(painter, option, id);
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ void GxsIdRSItemDelegate::paint( QPainter * painter,
|
|||
std::cerr << "GxsIdRSItemDelegate::paint()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsGxsId id = mTree->ItemTextFromIndex(index, mGxsIdColumn).toStdString();
|
||||
RsGxsId id ( mTree->ItemTextFromIndex(index, mGxsIdColumn).toStdString());
|
||||
paintGxsId(painter, option, id);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void GxsIdRSTreeWidgetItem::setId(const RsGxsId &id, int column)
|
|||
|
||||
mId = id;
|
||||
mColumn = column;
|
||||
if (mId == "")
|
||||
if (mId.isNull())
|
||||
{
|
||||
setText(mColumn, "No Signature");
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void GxsIdTreeWidgetItem::setId(const RsGxsId &id, int column)
|
|||
|
||||
mId = id;
|
||||
mColumn = column;
|
||||
if (mId == "")
|
||||
if (mId.isNull())
|
||||
{
|
||||
setText(mColumn, "No Signature");
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ void CreateGxsForumMsg::newMsg()
|
|||
mForumMetaLoaded = false;
|
||||
|
||||
/* fill in the available OwnIds for signing */
|
||||
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
|
||||
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||
|
||||
if (mForumId.isNull()) {
|
||||
mStateHelper->setActive(CREATEGXSFORUMMSG_FORUMINFO, false);
|
||||
|
|
|
@ -804,7 +804,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
|||
item->setText(COLUMN_THREAD_DATE, text);
|
||||
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
|
||||
|
||||
item->setText(COLUMN_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId));
|
||||
item->setText(COLUMN_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
|
||||
//item->setId(msg.mMeta.mAuthorId, COLUMN_THREAD_AUTHOR);
|
||||
//#TODO
|
||||
#if 0
|
||||
|
@ -1588,7 +1588,7 @@ void GxsForumThreadWidget::replyMessageData(const RsGxsForumMsg &msg)
|
|||
}
|
||||
|
||||
// NB: TODO REMOVE rsPeers references.
|
||||
if (rsPeers->getPeerName(RsPeerId(msg.mMeta.mAuthorId)) !="")
|
||||
if (rsPeers->getPeerName(RsPeerId(msg.mMeta.mAuthorId)) !="")
|
||||
{
|
||||
MessageComposer *msgDialog = MessageComposer::newMsg();
|
||||
msgDialog->setTitleText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()), MessageComposer::REPLY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue