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