mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 07:16:11 -05:00
commit
97e7df82c5
@ -99,8 +99,6 @@ class RsChatItem: public RsItem
|
||||
}
|
||||
|
||||
virtual ~RsChatItem() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t /*indent*/ = 0) { return out; } // derived from RsItem, but should be removed
|
||||
|
||||
virtual void clear() {}
|
||||
};
|
||||
|
||||
|
@ -181,8 +181,6 @@ public:
|
||||
{}
|
||||
|
||||
void clear() {}
|
||||
std::ostream &print(std::ostream &out, uint16_t /*indent = 0*/)
|
||||
{ return out; }
|
||||
};
|
||||
|
||||
class RsGxsTransSerializer;
|
||||
|
@ -196,7 +196,9 @@ bool p3ServiceServer::sendItem(RsRawItem *item)
|
||||
// Packet Filtering.
|
||||
if (!mServiceControl->checkFilter(item->PacketId() & 0xffffff00, item->PeerId()))
|
||||
{
|
||||
#ifdef SERVICE_DEBUG
|
||||
std::cerr << "p3ServiceServer::sendItem() Fails Filtering for packet id=" << std::hex << item->PacketId() << std::dec << ", and peer " << item->PeerId() << std::endl;
|
||||
#endif
|
||||
delete item;
|
||||
return false;
|
||||
}
|
||||
|
@ -294,8 +294,8 @@ protected:
|
||||
*/
|
||||
RsTokenService::GxsRequestStatus waitToken(
|
||||
uint32_t token,
|
||||
std::chrono::milliseconds maxWait = std::chrono::milliseconds(500),
|
||||
std::chrono::milliseconds checkEvery = std::chrono::milliseconds(2))
|
||||
std::chrono::milliseconds maxWait = std::chrono::milliseconds(2000),
|
||||
std::chrono::milliseconds checkEvery = std::chrono::milliseconds(20))
|
||||
{ return mTokenService.waitToken(token, maxWait, checkEvery); }
|
||||
|
||||
private:
|
||||
|
@ -173,9 +173,6 @@ void RsNxsMsg::clear()
|
||||
meta.TlvClear();
|
||||
}
|
||||
|
||||
std::ostream&RsNxsMsg::print(std::ostream& out, uint16_t /*indent*/)
|
||||
{ return out; }
|
||||
|
||||
void RsNxsGrp::clear()
|
||||
{
|
||||
grpId.clear();
|
||||
|
@ -378,7 +378,6 @@ struct RsNxsMsg : RsNxsItem
|
||||
RsGenericSerializer::SerializeContext& ctx );
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream& out, uint16_t indent);
|
||||
|
||||
uint8_t pos; /// used for splitting up msg
|
||||
uint8_t count; /// number of split up messages
|
||||
|
@ -2958,8 +2958,10 @@ void p3IdService::requestIdsFromNet()
|
||||
|
||||
for(cit = mIdsNotPresent.begin(); cit != mIdsNotPresent.end();)
|
||||
{
|
||||
#ifdef DEBUG_IDS
|
||||
Dbg2() << __PRETTY_FUNCTION__ << " Processing missing key RsGxsId: "
|
||||
<< cit->first << std::endl;
|
||||
#endif
|
||||
|
||||
const RsGxsId& gxsId = cit->first;
|
||||
const std::list<RsPeerId>& peers = cit->second;
|
||||
@ -2978,9 +2980,11 @@ void p3IdService::requestIdsFromNet()
|
||||
requests[peer].push_back(cit->first);
|
||||
request_can_proceed = true ;
|
||||
|
||||
#ifdef DEBUG_IDS
|
||||
Dbg2() << __PRETTY_FUNCTION__ << " Moving missing key RsGxsId:"
|
||||
<< gxsId << " to peer: " << peer << " requests queue"
|
||||
<< std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -3013,9 +3017,11 @@ void p3IdService::requestIdsFromNet()
|
||||
for( std::list<RsGxsId>::const_iterator gxs_id_it = cit2->second.begin();
|
||||
gxs_id_it != cit2->second.end(); ++gxs_id_it )
|
||||
{
|
||||
#ifdef DEBUG_IDS
|
||||
Dbg2() << __PRETTY_FUNCTION__ << " passing RsGxsId: " << *gxs_id_it
|
||||
<< " request for peer: " << peer
|
||||
<< " to RsNetworkExchangeService " << std::endl;
|
||||
#endif
|
||||
grpIds.push_back(RsGxsGroupId(*gxs_id_it));
|
||||
}
|
||||
|
||||
@ -3580,7 +3586,9 @@ RsGenExchange::ServiceCreate_Return p3IdService::service_CreateGroup(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_IDS
|
||||
Dbg2() << __PRETTY_FUNCTION__ << " returns: " << createStatus << std::endl;
|
||||
#endif
|
||||
return createStatus;
|
||||
}
|
||||
|
||||
|
@ -60,11 +60,6 @@ void RsFeedReaderFeed::clear()
|
||||
content.clear();
|
||||
}
|
||||
|
||||
std::ostream &RsFeedReaderFeed::print(std::ostream &out, uint16_t /*indent*/)
|
||||
{
|
||||
return out;
|
||||
}
|
||||
|
||||
uint32_t RsFeedReaderSerialiser::sizeFeed(RsFeedReaderFeed *item)
|
||||
{
|
||||
uint32_t s = 8; /* header */
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <retroshare/rsidentity.h>
|
||||
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "gui/Circles/CreateCircleDialog.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "gui/Identity/IdDialog.h"
|
||||
@ -40,8 +41,8 @@
|
||||
#define CREATECIRCLEDIALOG_IDINFO 3
|
||||
|
||||
#define RSCIRCLEID_COL_NICKNAME 0
|
||||
#define RSCIRCLEID_COL_KEYID 1
|
||||
#define RSCIRCLEID_COL_IDTYPE 2
|
||||
#define RSCIRCLEID_COL_IDTYPE 1
|
||||
#define RSCIRCLEID_COL_KEYID 2
|
||||
|
||||
/** Constructor */
|
||||
CreateCircleDialog::CreateCircleDialog()
|
||||
@ -51,9 +52,6 @@ CreateCircleDialog::CreateCircleDialog()
|
||||
ui.setupUi(this);
|
||||
|
||||
/* Setup Queue */
|
||||
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
||||
mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this);
|
||||
|
||||
ui.headerFrame->setHeaderImage(QPixmap(":/icons/png/circles.png"));
|
||||
|
||||
// connect up the buttons.
|
||||
@ -86,7 +84,7 @@ CreateCircleDialog::CreateCircleDialog()
|
||||
|
||||
QObject::connect(ui.radioButton_ListAll, SIGNAL(toggled(bool)), this, SLOT(idTypeChanged())) ;
|
||||
QObject::connect(ui.radioButton_ListAllPGP, SIGNAL(toggled(bool)), this, SLOT(idTypeChanged())) ;
|
||||
QObject::connect(ui.radioButton_ListKnownPGP, SIGNAL(toggled(bool)), this, SLOT(idTypeChanged())) ;
|
||||
QObject::connect(ui.radioButton_ListFriendPGP, SIGNAL(toggled(bool)), this, SLOT(idTypeChanged())) ;
|
||||
|
||||
QObject::connect(ui.radioButton_Public, SIGNAL(toggled(bool)), this, SLOT(updateCircleType(bool))) ;
|
||||
QObject::connect(ui.radioButton_Self, SIGNAL(toggled(bool)), this, SLOT(updateCircleType(bool))) ;
|
||||
@ -98,17 +96,17 @@ CreateCircleDialog::CreateCircleDialog()
|
||||
mIsExternalCircle = true;
|
||||
mClearList = true;
|
||||
#if QT_VERSION >= 0x040700
|
||||
ui.circleName->setPlaceholderText(QApplication::translate("CreateCircleDialog", "Circle name", 0));
|
||||
ui.circleName->setPlaceholderText(QApplication::translate("CreateCircleDialog", "Circle name", 0));
|
||||
#endif
|
||||
|
||||
ui.treeWidget_IdList->setColumnHidden(RSCIRCLEID_COL_KEYID,true); // no need to show this. the tooltip will do it.
|
||||
|
||||
//ui.idChooser->loadIds(0,RsGxsId());
|
||||
ui.circleComboBox->loadCircles(RsGxsCircleId());
|
||||
}
|
||||
|
||||
CreateCircleDialog::~CreateCircleDialog()
|
||||
{
|
||||
delete(mCircleQueue);
|
||||
delete(mIdQueue);
|
||||
}
|
||||
|
||||
void CreateCircleDialog::editExistingId(const RsGxsGroupId &circleId, const bool &clearList /*= true*/,bool readonly)
|
||||
@ -147,14 +145,15 @@ void CreateCircleDialog::editExistingId(const RsGxsGroupId &circleId, const bool
|
||||
ui.removeButton->setEnabled(!readonly) ;
|
||||
|
||||
if(readonly)
|
||||
{
|
||||
ui.buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
|
||||
ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
|
||||
ui.peersSelection_GB->hide() ;
|
||||
ui.addButton->hide() ;
|
||||
ui.removeButton->hide() ;
|
||||
}
|
||||
requestCircle(circleId);
|
||||
{
|
||||
ui.buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
|
||||
ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
|
||||
ui.peersSelection_GB->hide() ;
|
||||
ui.addButton->hide() ;
|
||||
ui.removeButton->hide() ;
|
||||
}
|
||||
|
||||
loadCircle(circleId);
|
||||
}
|
||||
|
||||
|
||||
@ -233,7 +232,7 @@ void CreateCircleDialog::setupForExternalCircle()
|
||||
ui.idChooser->show();
|
||||
//ui.toolButton_NewId->show();
|
||||
|
||||
requestGxsIdentities();
|
||||
loadIdentities();
|
||||
}
|
||||
|
||||
void CreateCircleDialog::selectedId(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
@ -266,7 +265,7 @@ void CreateCircleDialog::addMember(const RsGxsIdGroup &idGroup)
|
||||
{
|
||||
QString keyId = QString::fromStdString(idGroup.mMeta.mGroupId.toStdString());
|
||||
QString nickname = QString::fromUtf8(idGroup.mMeta.mGroupName.c_str());
|
||||
QString idtype = tr("Anon Id");
|
||||
QString idtype = tr("[Anonymous Id]");
|
||||
|
||||
QPixmap pixmap ;
|
||||
|
||||
@ -327,7 +326,7 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
|
||||
|
||||
QString keyId = QString::fromStdString(gxs_id.toStdString());
|
||||
QString nickname = QString::fromUtf8(gxs_details.mNickname.c_str());
|
||||
QString idtype = tr("Anon Id");
|
||||
QString idtype = tr("[Anonymous Id]");
|
||||
|
||||
QPixmap pixmap ;
|
||||
|
||||
@ -336,8 +335,8 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
|
||||
|
||||
addMember(keyId, idtype, nickname, QIcon(pixmap));
|
||||
|
||||
}//if(!gxs_id.isNull() && rsIdentity->getIdDetails(gxs_id,gxs_details))
|
||||
}//for (itUnknownPeers it = cirDetails.mUnknownPeers.begin()
|
||||
}
|
||||
}
|
||||
|
||||
typedef std::set<RsPgpId>::const_iterator itAllowedPeers;
|
||||
for (itAllowedPeers it = cirDetails.mAllowedNodes.begin() ; it != cirDetails.mAllowedNodes.end() ; ++it )
|
||||
@ -355,8 +354,8 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
|
||||
|
||||
addMember(keyId, idtype, nickname, QIcon(avatar));
|
||||
|
||||
}//if(!gpg_id.isNull() && rsPeers->getGPGDetails(gpg_id,details))
|
||||
}//for (itAllowedPeers it = cirDetails.mAllowedPeers.begin()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CreateCircleDialog::removeMember()
|
||||
@ -388,7 +387,7 @@ void CreateCircleDialog::createCircle()
|
||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a name for your Circle"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
return; //Don't add a empty Subject!!
|
||||
}//if(name.isEmpty())
|
||||
}
|
||||
|
||||
RsGxsCircleGroup circle = mCircleGroup; // init with loaded group
|
||||
|
||||
@ -462,16 +461,6 @@ void CreateCircleDialog::createCircle()
|
||||
|
||||
}
|
||||
|
||||
// if (mIsExistingCircle)
|
||||
// {
|
||||
// std::cerr << "CreateCircleDialog::createCircle() Existing Circle TODO";
|
||||
// std::cerr << std::endl;
|
||||
//
|
||||
// // cannot edit these yet.
|
||||
// QMessageBox::warning(this, tr("RetroShare"),tr("Cannot Edit Existing Circles Yet"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (mIsExternalCircle)
|
||||
{
|
||||
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
|
||||
@ -663,107 +652,79 @@ void CreateCircleDialog::updateCircleGUI()
|
||||
}
|
||||
}
|
||||
|
||||
void CreateCircleDialog::requestCircle(const RsGxsGroupId &groupId)
|
||||
void CreateCircleDialog::loadCircle(const RsGxsGroupId& groupId)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
std::list<RsGxsGroupId> groupIds;
|
||||
groupIds.push_back(groupId);
|
||||
|
||||
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
|
||||
std::cerr << "CreateCircleDialog::requestCircle() Requesting Group Summary(" << groupId << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t token;
|
||||
mCircleQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, CREATECIRCLEDIALOG_CIRCLEINFO);
|
||||
}
|
||||
|
||||
void CreateCircleDialog::loadCircle(uint32_t token)
|
||||
{
|
||||
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
|
||||
std::cerr << "CreateCircleDialog::loadCircle(" << token << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
QTreeWidget *tree = ui.treeWidget_membership;
|
||||
|
||||
if (mClearList) tree->clear();
|
||||
|
||||
std::vector<RsGxsCircleGroup> groups;
|
||||
if (!rsGxsCircles->getGroupData(token, groups)) {
|
||||
std::cerr << "CreateCircleDialog::loadCircle() Error getting GroupData";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
RsThread::async([groupId,this]()
|
||||
{
|
||||
std::vector<RsGxsCircleGroup> circlesInfo ;
|
||||
|
||||
if (groups.size() != 1) {
|
||||
std::cerr << "CreateCircleDialog::loadCircle() Error Group.size() != 1";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
mCircleGroup = groups[0];
|
||||
|
||||
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
|
||||
std::cerr << "CreateCircleDialog::loadCircle() LoadedGroup.meta: " << mCircleGroup.mMeta << std::endl;
|
||||
if(! rsGxsCircles->getCirclesInfo(std::list<RsGxsGroupId>({ groupId }), circlesInfo) || circlesInfo.size() != 1)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve circle info for circle " << groupId << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsCircleGroup grp(circlesInfo[0]);
|
||||
|
||||
RsQThreadUtils::postToObject( [grp,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
mCircleGroup = grp;
|
||||
|
||||
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
|
||||
std::cerr << "CreateCircleDialog::loadCircle() LoadedGroup.meta: " << mCircleGroup.mMeta << std::endl;
|
||||
#endif
|
||||
updateCircleGUI();
|
||||
updateCircleGUI();
|
||||
|
||||
}, this );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*void CreateCircleDialog::getPgpIdentities()
|
||||
void CreateCircleDialog::loadIdentities()
|
||||
{
|
||||
std::cerr << "CreateCircleDialog::getPgpIdentities()";
|
||||
std::cerr << std::endl;
|
||||
RsThread::async([this]()
|
||||
{
|
||||
std::list<RsGroupMetaData> ids_meta;
|
||||
|
||||
QTreeWidget *tree = ui.treeWidget_IdList;
|
||||
if(!rsIdentity->getIdentitiesSummaries(ids_meta))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve identities ids for all identities" << std::endl;
|
||||
return;
|
||||
}
|
||||
std::set<RsGxsId> ids;
|
||||
|
||||
tree->clear();
|
||||
std::list<RsPgpId> ids;
|
||||
std::list<RsPgpId>::iterator it;
|
||||
for(auto& meta:ids_meta)
|
||||
ids.insert(RsGxsId(meta.mGroupId)) ;
|
||||
|
||||
rsPeers->getGPGAcceptedList(ids);
|
||||
for(it = ids.begin(); it != ids.end(); ++it) {
|
||||
RsPeerDetails details;
|
||||
std::vector<RsGxsIdGroup> id_groups;
|
||||
|
||||
rsPeers->getGPGDetails(*it, details);
|
||||
if(!rsIdentity->getIdentitiesInfo(ids,id_groups))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve identities group info for all identities" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
QString keyId = QString::fromStdString(details.gpg_id.toStdString());
|
||||
QString nickname = QString::fromUtf8(details.name.c_str());
|
||||
QString idtype = tr("PGP Identity");
|
||||
RsQThreadUtils::postToObject( [id_groups,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
item->setText(RSCIRCLEID_COL_NICKNAME, nickname);
|
||||
item->setText(RSCIRCLEID_COL_KEYID, keyId);
|
||||
item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
|
||||
tree->addTopLevelItem(item);
|
||||
fillIdentitiesList(id_groups) ;
|
||||
|
||||
// Local Circle.
|
||||
if (mIsExistingCircle)
|
||||
if ( mCircleGroup.mLocalFriends.find(details.gpg_id) != mCircleGroup.mLocalFriends.end()) // check if its in the circle.
|
||||
addMember(keyId, idtype, nickname);
|
||||
}
|
||||
|
||||
filterIds();
|
||||
}*/
|
||||
}, this );
|
||||
});
|
||||
|
||||
|
||||
void CreateCircleDialog::requestGxsIdentities()
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
|
||||
std::cerr << "CreateCircleDialog::requestIdentities()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t token;
|
||||
mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, CREATECIRCLEDIALOG_IDINFO);
|
||||
}
|
||||
|
||||
void CreateCircleDialog::loadIdentities(uint32_t token)
|
||||
void CreateCircleDialog::fillIdentitiesList(const std::vector<RsGxsIdGroup>& id_groups)
|
||||
{
|
||||
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
|
||||
std::cerr << "CreateCircleDialog::loadIdentities(" << token << ")";
|
||||
@ -771,36 +732,22 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
|
||||
#endif
|
||||
|
||||
QTreeWidget *tree = ui.treeWidget_IdList;
|
||||
|
||||
tree->clear();
|
||||
|
||||
bool acceptAnonymous = ui.radioButton_ListAll->isChecked();
|
||||
bool acceptAllPGP = ui.radioButton_ListAllPGP->isChecked();
|
||||
//bool acceptKnownPGP = ui.radioButton_ListKnownPGP->isChecked();
|
||||
bool acceptAll = ui.radioButton_ListAll->isChecked();
|
||||
bool acceptOnlySignedIdentities = ui.radioButton_ListAllPGP->isChecked();
|
||||
bool acceptOnlyIdentitiesSignedByFriend = ui.radioButton_ListFriendPGP->isChecked();
|
||||
|
||||
RsGxsIdGroup idGroup;
|
||||
std::vector<RsGxsIdGroup> datavector;
|
||||
std::vector<RsGxsIdGroup>::iterator vit;
|
||||
if (!rsIdentity->getGroupData(token, datavector)) {
|
||||
std::cerr << "CreateCircleDialog::insertIdentities() Error getting GroupData";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for(vit = datavector.begin(); vit != datavector.end(); ++vit)
|
||||
for(const auto& idGroup:id_groups)
|
||||
{
|
||||
idGroup = (*vit);
|
||||
bool isSigned = !idGroup.mPgpId.isNull();
|
||||
bool isSignedByFriendNode = isSigned && rsPeers->isPgpFriend(idGroup.mPgpId);
|
||||
|
||||
/* do filtering */
|
||||
bool ok = false;
|
||||
if (acceptAnonymous)
|
||||
ok = true;
|
||||
else if (acceptAllPGP)
|
||||
ok = idGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility ;
|
||||
else if (idGroup.mPgpKnown)
|
||||
ok = idGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility ;
|
||||
|
||||
if (!ok) {
|
||||
if(!(acceptAll ||(acceptOnlySignedIdentities && isSigned) ||(acceptOnlyIdentitiesSignedByFriend && isSignedByFriendNode)))
|
||||
{
|
||||
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
|
||||
std::cerr << "CreateCircleDialog::insertIdentities() Skipping ID: " << data.mMeta.mGroupId;
|
||||
std::cerr << std::endl;
|
||||
@ -810,23 +757,21 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
|
||||
|
||||
QString keyId = QString::fromStdString(idGroup.mMeta.mGroupId.toStdString());
|
||||
QString nickname = QString::fromUtf8(idGroup.mMeta.mGroupName.c_str());
|
||||
QString idtype = tr("Anon Id");
|
||||
QString idtype ;
|
||||
|
||||
QPixmap pixmap ;
|
||||
|
||||
if(idGroup.mImage.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idGroup.mImage.mData, idGroup.mImage.mSize, pixmap, GxsIdDetails::SMALL))
|
||||
pixmap = GxsIdDetails::makeDefaultIcon(RsGxsId(idGroup.mMeta.mGroupId),GxsIdDetails::SMALL) ;
|
||||
|
||||
if (idGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility)
|
||||
if (!idGroup.mPgpId.isNull())
|
||||
{
|
||||
if (idGroup.mPgpKnown) {
|
||||
RsPeerDetails details;
|
||||
rsPeers->getGPGDetails(idGroup.mPgpId, details);
|
||||
idtype = QString::fromUtf8(details.name.c_str());
|
||||
}
|
||||
else
|
||||
idtype = tr("PGP Linked Id");
|
||||
RsPeerDetails details;
|
||||
|
||||
if(rsPeers->getGPGDetails(idGroup.mPgpId, details))
|
||||
idtype = QString::fromUtf8(details.name.c_str());
|
||||
else
|
||||
idtype = tr("[Unknown]");
|
||||
}
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
@ -836,6 +781,11 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
|
||||
item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
|
||||
tree->addTopLevelItem(item);
|
||||
|
||||
RsIdentityDetails det;
|
||||
|
||||
if(rsIdentity->getIdDetails(RsGxsId(idGroup.mMeta.mGroupId),det))
|
||||
item->setToolTip(RSCIRCLEID_COL_NICKNAME,GxsIdDetails::getComment(det));
|
||||
|
||||
// External Circle.
|
||||
if (mIsExistingCircle)
|
||||
{
|
||||
@ -851,43 +801,9 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
|
||||
}
|
||||
}
|
||||
|
||||
void CreateCircleDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
|
||||
std::cerr << "CreateCircleDialog::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (queue == mCircleQueue) {
|
||||
/* now switch on req */
|
||||
switch(req.mUserType) {
|
||||
case CREATECIRCLEDIALOG_CIRCLEINFO:
|
||||
loadCircle(req.mToken);
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "CreateCircleDialog::loadRequest() UNKNOWN UserType ";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (queue == mIdQueue) {
|
||||
/* now switch on req */
|
||||
switch(req.mUserType) {
|
||||
case CREATECIRCLEDIALOG_IDINFO:
|
||||
loadIdentities(req.mToken);
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "CreateCircleDialog::loadRequest() UNKNOWN UserType ";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CreateCircleDialog::idTypeChanged()
|
||||
{
|
||||
requestGxsIdentities();
|
||||
loadIdentities();
|
||||
}
|
||||
void CreateCircleDialog::filterChanged(const QString &text)
|
||||
{
|
||||
|
@ -25,12 +25,10 @@
|
||||
|
||||
#include "ui_CreateCircleDialog.h"
|
||||
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
#include <retroshare/rsgxscircles.h>
|
||||
#include <QDialog>
|
||||
|
||||
class CreateCircleDialog : public QDialog, public TokenResponse
|
||||
class CreateCircleDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -45,8 +43,6 @@ public:
|
||||
void addMember(const RsGxsIdGroup &idGroup);
|
||||
void addCircle(const RsGxsCircleDetails &cirDetails);
|
||||
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
private slots:
|
||||
void addMember();
|
||||
void removeMember();
|
||||
@ -75,17 +71,11 @@ private:
|
||||
bool mIsExternalCircle;
|
||||
bool mReadOnly;
|
||||
|
||||
void loadCircle(uint32_t token);
|
||||
void loadIdentities(uint32_t token);
|
||||
|
||||
void requestCircle(const RsGxsGroupId &groupId);
|
||||
void requestGxsIdentities();
|
||||
//void getPgpIdentities();
|
||||
void loadCircle(const RsGxsGroupId& groupId);
|
||||
void loadIdentities();
|
||||
|
||||
void filterIds();
|
||||
|
||||
TokenQueue *mCircleQueue;
|
||||
TokenQueue *mIdQueue;
|
||||
void fillIdentitiesList(const std::vector<RsGxsIdGroup>& id_groups);
|
||||
|
||||
RsGxsCircleGroup mCircleGroup; // for editting existing Circles.
|
||||
bool mClearList;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>500</height>
|
||||
<width>1211</width>
|
||||
<height>647</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -161,12 +161,7 @@
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>ID</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
<string>Profile</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
@ -210,9 +205,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_ListKnownPGP">
|
||||
<widget class="QRadioButton" name="radioButton_ListFriendPGP">
|
||||
<property name="text">
|
||||
<string>Signed by known nodes</string>
|
||||
<string>Signed by friend node</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -411,7 +406,7 @@
|
||||
<string><html><head/><body><p>Circles can be restricted to the members of another circle. Only the members of that second circle will be allowed to see the new circle and its content (list of members, etc).</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Only visible to members of:</string>
|
||||
<string>Only &visible to members of:</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
@ -455,6 +450,11 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>GxsIdChooser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>gui/gxs/GxsIdChooser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LineEditClear</class>
|
||||
<extends>QLineEdit</extends>
|
||||
@ -471,11 +471,6 @@
|
||||
<header>gui/common/HeaderFrame.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GxsIdChooser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>gui/gxs/GxsIdChooser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GxsCircleChooser</class>
|
||||
<extends>QComboBox</extends>
|
||||
|
@ -293,6 +293,9 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
|
||||
|
||||
RsGxsCircleDetails details;
|
||||
|
||||
if(pe->mCircleId.isNull()) // probably an item for cache update
|
||||
return ;
|
||||
|
||||
if(!rsGxsCircles->getCircleDetails(pe->mCircleId,details))
|
||||
{
|
||||
std::cerr << "(EE) Cannot get information about circle " << pe->mCircleId << ". Not in cache?" << std::endl;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/RSTreeWidgetItem.h"
|
||||
#include "gui/common/StatusDefs.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "gui/common/PeerDefs.h"
|
||||
#include "gui/common/GroupDefs.h"
|
||||
#include "rshare.h"
|
||||
@ -92,8 +93,6 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
|
||||
mInSslItemChanged = false;
|
||||
mInFillList = false;
|
||||
|
||||
mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this);
|
||||
|
||||
connect(ui->friendList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
|
||||
connect(ui->friendList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
|
||||
connect(ui->friendList, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*,int)));
|
||||
@ -131,7 +130,6 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
|
||||
|
||||
FriendSelectionWidget::~FriendSelectionWidget()
|
||||
{
|
||||
delete(mIdQueue);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -185,6 +183,11 @@ int FriendSelectionWidget::addColumn(const QString &title)
|
||||
return column;
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::showEvent(QShowEvent *e)
|
||||
{
|
||||
if(gxsIds.empty())
|
||||
loadIdentities();
|
||||
}
|
||||
void FriendSelectionWidget::start()
|
||||
{
|
||||
mStarted = true;
|
||||
@ -237,32 +240,36 @@ void FriendSelectionWidget::fillList()
|
||||
secured_fillList() ;
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::loadRequest(const TokenQueue */*queue*/, const TokenRequest &req)
|
||||
void FriendSelectionWidget::loadIdentities()
|
||||
{
|
||||
// store all IDs locally, and call fillList() ;
|
||||
|
||||
uint32_t token = req.mToken ;
|
||||
|
||||
RsGxsIdGroup data;
|
||||
std::vector<RsGxsIdGroup> datavector;
|
||||
std::vector<RsGxsIdGroup>::iterator vit;
|
||||
|
||||
if (!rsIdentity->getGroupData(token, datavector))
|
||||
RsThread::async([this]()
|
||||
{
|
||||
std::cerr << "FriendSelectionWidget::loadRequest() ERROR. Cannot load data from rsIdentity." << std::endl;
|
||||
return ;
|
||||
}
|
||||
std::list<RsGroupMetaData> ids_meta;
|
||||
|
||||
gxsIds.clear() ;
|
||||
if(!rsIdentity->getIdentitiesSummaries(ids_meta))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve identities group info for all identities" << std::endl;
|
||||
return;
|
||||
}
|
||||
std::vector<RsGxsGroupId> ids;
|
||||
|
||||
for(uint32_t i=0;i<datavector.size();++i)
|
||||
{
|
||||
gxsIds.push_back(datavector[i].mMeta.mGroupId) ;
|
||||
//std::cerr << " got ID = " << datavector[i].mMeta.mGroupId << std::endl;
|
||||
}
|
||||
for(auto& meta:ids_meta)
|
||||
ids.push_back(meta.mGroupId) ;
|
||||
|
||||
//std::cerr << "Got all " << datavector.size() << " ids from rsIdentity. Calling update of list." << std::endl;
|
||||
fillList() ;
|
||||
RsQThreadUtils::postToObject( [ids,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
gxsIds = ids; // we do that is the GUI thread. Dont try it on another thread!
|
||||
|
||||
fillList() ;
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::secured_fillList()
|
||||
@ -666,32 +673,13 @@ void FriendSelectionWidget::secured_fillList()
|
||||
}
|
||||
void FriendSelectionWidget::updateDisplay(bool)
|
||||
{
|
||||
requestGXSIdList() ;
|
||||
loadIdentities() ;
|
||||
}
|
||||
void FriendSelectionWidget::requestGXSIdList()
|
||||
{
|
||||
if (!mIdQueue)
|
||||
return;
|
||||
|
||||
//mStateHelper->setLoading(IDDIALOG_IDLIST, true);
|
||||
//mStateHelper->setLoading(IDDIALOG_IDDETAILS, true);
|
||||
//mStateHelper->setLoading(IDDIALOG_REPLIST, true);
|
||||
|
||||
mIdQueue->cancelActiveRequestTokens(IDDIALOG_IDLIST);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
uint32_t token;
|
||||
|
||||
mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, IDDIALOG_IDLIST);
|
||||
}
|
||||
|
||||
// This call is inlined so that there's no linking conflict with MinGW on Windows
|
||||
template<> inline void FriendSelectionWidget::setSelectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(const std::set<RsGxsId>& ids, bool add)
|
||||
{
|
||||
mPreSelectedGxsIds = ids ;
|
||||
requestGXSIdList();
|
||||
loadIdentities();
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::groupsChanged(int /*type*/)
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <QDialog>
|
||||
|
||||
#include <gui/gxs/RsGxsUpdateBroadcastPage.h>
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
namespace Ui {
|
||||
class FriendSelectionWidget;
|
||||
@ -34,7 +33,7 @@ class FriendSelectionWidget;
|
||||
class QTreeWidgetItem;
|
||||
class RSTreeWidgetItemCompareRole;
|
||||
|
||||
class FriendSelectionWidget : public QWidget, public TokenResponse
|
||||
class FriendSelectionWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -82,6 +81,7 @@ public:
|
||||
bool isSortByState();
|
||||
bool isFilterConnected();
|
||||
|
||||
void loadIdentities();
|
||||
int selectedItemCount();
|
||||
std::string selectedId(IdType &idType);
|
||||
|
||||
@ -115,9 +115,9 @@ public:
|
||||
void addContextMenuAction(QAction *action);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *e) override;
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
virtual void loadRequest(const TokenQueue *queue,const TokenRequest& req);
|
||||
virtual void updateDisplay(bool complete);
|
||||
|
||||
signals:
|
||||
@ -148,8 +148,6 @@ private:
|
||||
void selectedIds(IdType idType, std::set<std::string> &ids, bool onlyDirectSelected);
|
||||
void setSelectedIds(IdType idType, const std::set<std::string> &ids, bool add);
|
||||
|
||||
void requestGXSIdList() ;
|
||||
|
||||
private:
|
||||
bool mStarted;
|
||||
RSTreeWidgetItemCompareRole *mCompareRole;
|
||||
@ -170,7 +168,6 @@ private:
|
||||
friend class FriendSelectionDialog ;
|
||||
|
||||
std::vector<RsGxsGroupId> gxsIds ;
|
||||
TokenQueue *mIdQueue ;
|
||||
QList<QAction*> mContextMenuActions;
|
||||
|
||||
std::set<RsGxsId> mPreSelectedGxsIds; // because loading of GxsIds is asynchroneous we keep selected Ids from the client in a list here and use it to initialize after loading them.
|
||||
|
@ -64,7 +64,6 @@ public:
|
||||
|
||||
std::string msgData;
|
||||
|
||||
std::ostream &print(std::ostream &out, uint16_t /*indent*/ = 0){ return out; }
|
||||
void clear() { msgData.clear(); }
|
||||
|
||||
};
|
||||
@ -79,7 +78,6 @@ public:
|
||||
|
||||
std::string grpData;
|
||||
void clear() { grpData.clear(); }
|
||||
std::ostream &print(std::ostream &out, uint16_t /*indent*/ = 0){ return out; }
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user