mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 08:29:32 -05:00
commit
159a2061f6
@ -258,8 +258,7 @@ int p3discovery2::handleIncoming()
|
||||
|
||||
++nhandled;
|
||||
|
||||
Dbg4() << __PRETTY_FUNCTION__ << " Received item: " << std::endl
|
||||
<< *item << std::endl;
|
||||
Dbg4() << __PRETTY_FUNCTION__ << " Received item: " << *item << std::endl;
|
||||
|
||||
if((contact = dynamic_cast<RsDiscContactItem *>(item)) != nullptr)
|
||||
{
|
||||
@ -269,30 +268,26 @@ int p3discovery2::handleIncoming()
|
||||
processContactInfo(item->PeerId(), contact);
|
||||
}
|
||||
else if( (gxsidlst = dynamic_cast<RsDiscIdentityListItem *>(item)) != nullptr )
|
||||
{
|
||||
recvIdentityList(item->PeerId(),gxsidlst->ownIdentityList);
|
||||
delete item;
|
||||
}
|
||||
else if((pgpkey = dynamic_cast<RsDiscPgpKeyItem *>(item)) != nullptr)
|
||||
recvPGPCertificate(item->PeerId(), pgpkey);
|
||||
else if((pgpcert = dynamic_cast<RsDiscPgpCertItem *>(item)) != nullptr)
|
||||
// sink
|
||||
delete pgpcert;
|
||||
RsWarn() << "Received a deprecated RsDiscPgpCertItem. Will not be handled." << std::endl; // nothing to do.
|
||||
else if((pgplist = dynamic_cast<RsDiscPgpListItem *>(item)) != nullptr)
|
||||
{
|
||||
if (pgplist->mode == RsGossipDiscoveryPgpListMode::FRIENDS)
|
||||
processPGPList(pgplist->PeerId(), pgplist);
|
||||
else if (pgplist->mode == RsGossipDiscoveryPgpListMode::GETCERT)
|
||||
recvPGPCertificateRequest(pgplist->PeerId(), pgplist);
|
||||
else delete item;
|
||||
}
|
||||
else
|
||||
{
|
||||
RsWarn() << __PRETTY_FUNCTION__ << " Received unknown item type " << (int)item->PacketSubType() << "! " << std::endl ;
|
||||
RsWarn() << item << std::endl;
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
delete item;
|
||||
}
|
||||
|
||||
return nhandled;
|
||||
}
|
||||
@ -350,8 +345,6 @@ void p3discovery2::sendOwnContactInfo(const RsPeerId &sslid)
|
||||
|
||||
void p3discovery2::recvOwnContactInfo(const RsPeerId &fromId, const RsDiscContactItem *item)
|
||||
{
|
||||
std::unique_ptr<const RsDiscContactItem> pitem(item); // ensures that item will be destroyed whichever door we leave through
|
||||
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "p3discovery2::recvOwnContactInfo()";
|
||||
std::cerr << std::endl;
|
||||
@ -678,7 +671,6 @@ void p3discovery2::processPGPList(const RsPeerId &fromId, const RsDiscPgpListIte
|
||||
#endif
|
||||
|
||||
// cleanup.
|
||||
delete item;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -716,9 +708,6 @@ void p3discovery2::processPGPList(const RsPeerId &fromId, const RsDiscPgpListIte
|
||||
|
||||
it->second.mergeFriendList(item->pgpIdSet.ids);
|
||||
updatePeers_locked(fromId);
|
||||
|
||||
// cleanup.
|
||||
delete item;
|
||||
}
|
||||
|
||||
|
||||
@ -913,7 +902,6 @@ void p3discovery2::processContactInfo(const RsPeerId &fromId, const RsDiscContac
|
||||
if(sockaddr_storage_isExternalNet(item->currentConnectAddress.addr))
|
||||
mPeerMgr->addCandidateForOwnExternalAddress(item->PeerId(), item->currentConnectAddress.addr);
|
||||
|
||||
delete item;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -942,7 +930,6 @@ void p3discovery2::processContactInfo(const RsPeerId &fromId, const RsDiscContac
|
||||
/* inform NetMgr that we know this peer */
|
||||
mNetMgr->netAssistKnownPeer(item->sslId, item->extAddrV4.addr, NETASSIST_KNOWN_PEER_FOF | NETASSIST_KNOWN_PEER_OFFLINE);
|
||||
}
|
||||
delete item;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -991,8 +978,6 @@ void p3discovery2::processContactInfo(const RsPeerId &fromId, const RsDiscContac
|
||||
|
||||
if(should_notify_discovery)
|
||||
RsServer::notify()->notifyDiscInfoChanged();
|
||||
|
||||
delete item;
|
||||
}
|
||||
|
||||
/* we explictly request certificates, instead of getting them all the time
|
||||
@ -1041,8 +1026,6 @@ void p3discovery2::recvPGPCertificateRequest( const RsPeerId& fromId, const RsDi
|
||||
sendPGPCertificate(pgpId, fromId);
|
||||
else
|
||||
std::cerr << "(WW) not sending certificate " << pgpId << " asked by friend " << fromId << " because this either this cert is not a friend, or discovery is off" << std::endl;
|
||||
|
||||
delete item;
|
||||
}
|
||||
|
||||
|
||||
@ -1119,7 +1102,6 @@ void p3discovery2::recvPGPCertificate(const RsPeerId& fromId, RsDiscPgpKeyItem*
|
||||
#endif
|
||||
// now that will add the key *and* set the skip_signature_validation flag at once
|
||||
rsPeers->loadPgpKeyFromBinaryData((unsigned char*)item->bin_data,item->bin_len, tmp_pgp_id,error_string); // no error should occur at this point because we called loadDetailsFromStringCert() already
|
||||
delete item;
|
||||
|
||||
// Make sure we allow connections after the key is added. This is not the case otherwise. We only do that if the peer is non validated peer, since
|
||||
// otherwise the connection should already be accepted. This only happens when the short invite peer sends its own PGP key.
|
||||
|
@ -1238,14 +1238,6 @@ int AuthSSLimpl::VerifyX509Callback(int /*preverify_ok*/, X509_STORE_CTX* ctx)
|
||||
|
||||
RsErr() << __PRETTY_FUNCTION__ << " " << errMsg << std::endl;
|
||||
|
||||
// if(rsEvents)
|
||||
// {
|
||||
// ev->mErrorMsg = errMsg;
|
||||
// ev->mErrorCode = RsAuthSslConnectionAutenticationEvent::NO_CERTIFICATE_SUPPLIED;
|
||||
//
|
||||
// rsEvents->postEvent(std::move(ev));
|
||||
// }
|
||||
|
||||
return verificationFailed;
|
||||
}
|
||||
|
||||
@ -1400,8 +1392,7 @@ int AuthSSLimpl::VerifyX509Callback(int /*preverify_ok*/, X509_STORE_CTX* ctx)
|
||||
return verificationFailed;
|
||||
}
|
||||
|
||||
//setCurrentConnectionAttemptInfo(pgpId, sslId, sslCn);
|
||||
LocalStoreCert(x509Cert);
|
||||
LocalStoreCert(x509Cert);
|
||||
|
||||
RsInfo() << __PRETTY_FUNCTION__ << " authentication successfull for "
|
||||
<< "sslId: " << sslId << " isSslOnlyFriend: " << isSslOnlyFriend
|
||||
@ -1410,9 +1401,7 @@ int AuthSSLimpl::VerifyX509Callback(int /*preverify_ok*/, X509_STORE_CTX* ctx)
|
||||
return verificationSuccess;
|
||||
}
|
||||
|
||||
bool AuthSSLimpl::parseX509DetailsFromFile(
|
||||
const std::string& certFilePath, RsPeerId& certId,
|
||||
RsPgpId& issuer, std::string& location )
|
||||
bool AuthSSLimpl::parseX509DetailsFromFile( const std::string& certFilePath, RsPeerId& certId, RsPgpId& issuer, std::string& location )
|
||||
{
|
||||
FILE* tmpfp = RsDirUtil::rs_fopen(certFilePath.c_str(), "r");
|
||||
if(!tmpfp)
|
||||
@ -1433,11 +1422,14 @@ bool AuthSSLimpl::parseX509DetailsFromFile(
|
||||
}
|
||||
|
||||
uint32_t diagnostic = 0;
|
||||
|
||||
if(!AuthX509WithGPG(x509,false, diagnostic))
|
||||
{
|
||||
RsErr() << __PRETTY_FUNCTION__ << " AuthX509WithGPG failed with "
|
||||
<< "diagnostic: " << diagnostic << std::endl;
|
||||
return false;
|
||||
|
||||
X509_free(x509);
|
||||
return false;
|
||||
}
|
||||
|
||||
certId = RsX509Cert::getCertSslId(*x509);
|
||||
@ -1805,26 +1797,28 @@ bool AuthSSLimpl::loadList(std::list<RsItem*>& load)
|
||||
for(it = load.begin(); it != load.end(); ++it) {
|
||||
RsConfigKeyValueSet *vitem = dynamic_cast<RsConfigKeyValueSet *>(*it);
|
||||
|
||||
if(vitem) {
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
if(vitem)
|
||||
{
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "AuthSSLimpl::loadList() General Variable Config Item:" << std::endl;
|
||||
vitem->print(std::cerr, 10);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
std::list<RsTlvKeyValue>::iterator kit;
|
||||
for(kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit) {
|
||||
if (RsPeerId(kit->key) == mOwnId) {
|
||||
continue;
|
||||
}
|
||||
for(kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit)
|
||||
{
|
||||
if (RsPeerId(kit->key) == mOwnId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
X509 *peer = loadX509FromPEM(kit->value);
|
||||
/* authenticate it */
|
||||
uint32_t diagnos ;
|
||||
if (AuthX509WithGPG(peer,false,diagnos))
|
||||
{
|
||||
LocalStoreCert(peer);
|
||||
}
|
||||
X509 *peer = loadX509FromPEM(kit->value);
|
||||
/* authenticate it */
|
||||
uint32_t diagnos ;
|
||||
if (peer && AuthX509WithGPG(peer,false,diagnos))
|
||||
LocalStoreCert(peer);
|
||||
|
||||
X509_free(peer);
|
||||
}
|
||||
}
|
||||
delete (*it);
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/misc.h"
|
||||
#include "gui/Circles/CreateCircleDialog.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "gui/Identity/IdDialog.h"
|
||||
@ -53,24 +54,11 @@ CreateCircleDialog::CreateCircleDialog()
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
/* Setup Queue */
|
||||
setAttribute(Qt::WA_DeleteOnClose, false);
|
||||
|
||||
/* Setup Queue */
|
||||
ui.headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/circles.png"));
|
||||
|
||||
// connect up the buttons.
|
||||
connect(ui.addButton, SIGNAL(clicked()), this, SLOT(addMember()));
|
||||
connect(ui.removeButton, SIGNAL(clicked()), this, SLOT(removeMember()));
|
||||
|
||||
connect(ui.createButton, SIGNAL(clicked()), this, SLOT(createCircle()));
|
||||
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
|
||||
connect(ui.treeWidget_membership, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedMember(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||
connect(ui.treeWidget_IdList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedId(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||
|
||||
connect(ui.treeWidget_IdList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint)));
|
||||
connect(ui.treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(MembershipListCustomPopupMenu(QPoint)));
|
||||
|
||||
connect(ui.IdFilter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||
|
||||
//connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||
|
||||
/* Add filter actions */
|
||||
@ -88,15 +76,6 @@ CreateCircleDialog::CreateCircleDialog()
|
||||
ui.removeButton->setEnabled(false);
|
||||
ui.addButton->setEnabled(false);
|
||||
ui.radioButton_ListAll->setChecked(true);
|
||||
|
||||
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_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))) ;
|
||||
QObject::connect(ui.radioButton_Restricted, SIGNAL(toggled(bool)), this, SLOT(updateCircleType(bool))) ;
|
||||
|
||||
ui.radioButton_Public->setChecked(true) ;
|
||||
|
||||
mIsExistingCircle = false;
|
||||
@ -107,9 +86,32 @@ CreateCircleDialog::CreateCircleDialog()
|
||||
#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());
|
||||
ui.circleComboBox->hide();
|
||||
|
||||
// connect up the buttons.
|
||||
connect(ui.addButton, SIGNAL(clicked()), this, SLOT(addMember()));
|
||||
connect(ui.removeButton, SIGNAL(clicked()), this, SLOT(removeMember()));
|
||||
|
||||
connect(ui.createButton, SIGNAL(clicked()), this, SLOT(createCircle()));
|
||||
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
|
||||
connect(ui.treeWidget_membership, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedMember(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||
connect(ui.treeWidget_IdList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedId(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||
|
||||
connect(ui.treeWidget_IdList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint)));
|
||||
connect(ui.treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(MembershipListCustomPopupMenu(QPoint)));
|
||||
|
||||
connect(ui.IdFilter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||
|
||||
|
||||
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_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))) ;
|
||||
QObject::connect(ui.radioButton_Restricted, SIGNAL(toggled(bool)), this, SLOT(updateCircleType(bool))) ;
|
||||
}
|
||||
|
||||
CreateCircleDialog::~CreateCircleDialog()
|
||||
@ -575,7 +577,7 @@ void CreateCircleDialog::updateCircleGUI()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
ui.circleName->setText(QString::fromUtf8(mCircleGroup.mMeta.mGroupName.c_str()));
|
||||
whileBlocking(ui.circleName)->setText(QString::fromUtf8(mCircleGroup.mMeta.mGroupName.c_str()));
|
||||
|
||||
bool isExternal = true;
|
||||
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
|
||||
@ -583,9 +585,9 @@ void CreateCircleDialog::updateCircleGUI()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
ui.radioButton_Public->setChecked(false);
|
||||
ui.radioButton_Self->setChecked(false);
|
||||
ui.radioButton_Restricted->setChecked(false);
|
||||
whileBlocking(ui.radioButton_Public)->setChecked(false);
|
||||
whileBlocking(ui.radioButton_Self)->setChecked(false);
|
||||
whileBlocking(ui.radioButton_Restricted)->setChecked(false);
|
||||
|
||||
switch(mCircleGroup.mMeta.mCircleType)
|
||||
{
|
||||
@ -604,7 +606,7 @@ void CreateCircleDialog::updateCircleGUI()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
ui.radioButton_Public->setChecked(true);
|
||||
whileBlocking(ui.radioButton_Public)->setChecked(true);
|
||||
break;
|
||||
|
||||
case GXS_CIRCLE_TYPE_EXT_SELF:
|
||||
@ -618,11 +620,11 @@ void CreateCircleDialog::updateCircleGUI()
|
||||
#endif
|
||||
|
||||
if (RsGxsGroupId(mCircleGroup.mMeta.mCircleId) == mCircleGroup.mMeta.mGroupId)
|
||||
ui.radioButton_Self->setChecked(true);
|
||||
whileBlocking(ui.radioButton_Self)->setChecked(true);
|
||||
else
|
||||
ui.radioButton_Restricted->setChecked(true);
|
||||
whileBlocking(ui.radioButton_Restricted)->setChecked(true);
|
||||
|
||||
ui.circleComboBox->loadCircles(mCircleGroup.mMeta.mCircleId);
|
||||
whileBlocking(ui.circleComboBox)->loadCircles(mCircleGroup.mMeta.mCircleId);
|
||||
|
||||
break;
|
||||
|
||||
@ -643,15 +645,15 @@ void CreateCircleDialog::updateCircleGUI()
|
||||
|
||||
if(mReadOnly)
|
||||
{
|
||||
ui.circleAdminLabel->setId(mCircleGroup.mMeta.mAuthorId) ;
|
||||
ui.idChooser->setVisible(false) ;
|
||||
ui.circleAdminLabel->setId(mCircleGroup.mMeta.mAuthorId) ;
|
||||
ui.idChooser->setVisible(false) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::set<RsGxsId> ids ;
|
||||
//ids.insert(mCircleGroup.mMeta.mAuthorId) ;
|
||||
ui.idChooser->setDefaultId(mCircleGroup.mMeta.mAuthorId) ;
|
||||
ui.idChooser->setChosenId(mCircleGroup.mMeta.mAuthorId) ;
|
||||
ui.idChooser->setDefaultId(mCircleGroup.mMeta.mAuthorId) ;
|
||||
ui.idChooser->setChosenId(mCircleGroup.mMeta.mAuthorId) ;
|
||||
//ui.idChooser->setIdConstraintSet(ids) ;
|
||||
ui.idChooser->setFlags(IDCHOOSER_NO_CREATE) ;
|
||||
ui.circleAdminLabel->setVisible(false) ;
|
||||
@ -696,6 +698,8 @@ void CreateCircleDialog::loadCircle(const RsGxsGroupId& groupId)
|
||||
|
||||
void CreateCircleDialog::loadIdentities()
|
||||
{
|
||||
std::cerr << "Loading identities..." << std::endl;
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
std::list<RsGroupMetaData> ids_meta;
|
||||
@ -707,23 +711,30 @@ void CreateCircleDialog::loadIdentities()
|
||||
}
|
||||
|
||||
std::set<RsGxsId> ids;
|
||||
for(auto& meta:ids_meta) ids.insert(RsGxsId(meta.mGroupId));
|
||||
for(auto& meta:ids_meta)
|
||||
ids.insert(RsGxsId(meta.mGroupId));
|
||||
|
||||
// Needs a pointer on the heap, to pass to postToObject, otherwise it will get deleted before
|
||||
// the posted method will actually run. Memory ownership is left to the posted method.
|
||||
|
||||
auto id_groups = new std::vector<RsGxsIdGroup>();
|
||||
|
||||
auto id_groups = std::make_unique<std::vector<RsGxsIdGroup>>();
|
||||
if(!rsIdentity->getIdentitiesInfo(ids, *id_groups))
|
||||
{
|
||||
RS_ERR("failed to retrieve identities group info for all identities");
|
||||
delete id_groups;
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject(
|
||||
[id_groups = std::move(id_groups), this]()
|
||||
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 */
|
||||
|
||||
fillIdentitiesList(*id_groups);
|
||||
|
||||
delete id_groups;
|
||||
}, this );
|
||||
});
|
||||
|
||||
|
@ -154,8 +154,8 @@ SearchDialog::SearchDialog(QWidget *parent)
|
||||
// To allow a proper sorting, be careful to pad at right with spaces. This
|
||||
// is achieved by using QString("%1").arg(number,15,10).
|
||||
//
|
||||
ui.searchResultWidget->setItemDelegateForColumn(SR_SIZE_COL, new RSHumanReadableSizeDelegate()) ;
|
||||
ui.searchResultWidget->setItemDelegateForColumn(SR_AGE_COL, new RSHumanReadableAgeDelegate()) ;
|
||||
ui.searchResultWidget->setItemDelegateForColumn(SR_SIZE_COL, mSizeColumnDelegate=new RSHumanReadableSizeDelegate()) ;
|
||||
ui.searchResultWidget->setItemDelegateForColumn(SR_AGE_COL, mAgeColumnDelegate=new RSHumanReadableAgeDelegate()) ;
|
||||
|
||||
/* make it extended selection */
|
||||
ui.searchResultWidget -> setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
@ -225,12 +225,17 @@ SearchDialog::~SearchDialog()
|
||||
// save settings
|
||||
processSettings(false);
|
||||
|
||||
if (compareSummaryRole) {
|
||||
if (compareSummaryRole)
|
||||
delete(compareSummaryRole);
|
||||
}
|
||||
if (compareResultRole) {
|
||||
|
||||
if (compareResultRole)
|
||||
delete(compareResultRole);
|
||||
}
|
||||
|
||||
delete mSizeColumnDelegate;
|
||||
delete mAgeColumnDelegate;
|
||||
|
||||
ui.searchResultWidget->setItemDelegateForColumn(SR_SIZE_COL, nullptr);
|
||||
ui.searchResultWidget->setItemDelegateForColumn(SR_AGE_COL, nullptr);
|
||||
}
|
||||
|
||||
void SearchDialog::processSettings(bool bLoad)
|
||||
|
@ -156,6 +156,9 @@ private:
|
||||
RSTreeWidgetItemCompareRole *compareSummaryRole;
|
||||
RSTreeWidgetItemCompareRole *compareResultRole;
|
||||
|
||||
QAbstractItemDelegate *mAgeColumnDelegate;
|
||||
QAbstractItemDelegate *mSizeColumnDelegate;
|
||||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mTextColorLocal;
|
||||
QColor mTextColorDownloading;
|
||||
|
@ -1124,10 +1124,16 @@ void TransfersDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> eve
|
||||
|
||||
TransfersDialog::~TransfersDialog()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
|
||||
// save settings
|
||||
processSettings(false);
|
||||
|
||||
ui.uploadsList->setItemDelegate(nullptr);
|
||||
ui.downloadList->setItemDelegate(nullptr);
|
||||
|
||||
delete ULDelegate;
|
||||
delete DLDelegate;
|
||||
}
|
||||
|
||||
void TransfersDialog::activatePage(TransfersDialog::Page page)
|
||||
|
@ -505,16 +505,16 @@ void IdDialog::updateCircles()
|
||||
|
||||
/* This can be big so use a smart pointer to just copy the pointer
|
||||
* instead of copying the whole list accross the lambdas */
|
||||
auto circle_metas = std::make_unique<std::list<RsGroupMetaData>>();
|
||||
auto circle_metas = new std::list<RsGroupMetaData>();
|
||||
|
||||
if(!rsGxsCircles->getCirclesSummaries(*circle_metas))
|
||||
{
|
||||
RS_ERR("failed to retrieve circles group info list");
|
||||
delete circle_metas;
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject(
|
||||
[circle_metas = std::move(circle_metas), this]()
|
||||
RsQThreadUtils::postToObject( [circle_metas, 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
|
||||
@ -522,7 +522,8 @@ void IdDialog::updateCircles()
|
||||
|
||||
loadCircles(*circle_metas);
|
||||
|
||||
}, this );
|
||||
delete circle_metas;
|
||||
}, this );
|
||||
|
||||
});
|
||||
}
|
||||
@ -1316,17 +1317,19 @@ void IdDialog::updateIdList()
|
||||
return;
|
||||
}
|
||||
|
||||
auto ids_set = std::make_unique<std::map<RsGxsGroupId,RsGxsIdGroup>>();
|
||||
auto ids_set = new std::map<RsGxsGroupId,RsGxsIdGroup>();
|
||||
|
||||
for(auto it(groups.begin()); it!=groups.end(); ++it)
|
||||
(*ids_set)[(*it).mMeta.mGroupId] = *it;
|
||||
|
||||
RsQThreadUtils::postToObject(
|
||||
[ids_set = std::move(ids_set), this] ()
|
||||
RsQThreadUtils::postToObject( [ids_set, 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 */
|
||||
loadIdentities(*ids_set);
|
||||
delete ids_set;
|
||||
|
||||
}, this );
|
||||
|
||||
});
|
||||
|
@ -375,6 +375,9 @@ MainWindow::~MainWindow()
|
||||
delete soundStatus;
|
||||
delete toasterDisable;
|
||||
delete sysTrayStatus;
|
||||
delete trayIcon;
|
||||
delete trayMenu;
|
||||
delete notifyMenu;
|
||||
#ifdef MESSENGER_WINDOW
|
||||
MessengerWindow::releaseInstance();
|
||||
#endif
|
||||
@ -602,7 +605,7 @@ void MainWindow::displayDiskSpaceWarning(int loc,int size_limit_mb)
|
||||
void MainWindow::createTrayIcon()
|
||||
{
|
||||
/** Tray icon Menu **/
|
||||
QMenu *trayMenu = new QMenu(this);
|
||||
trayMenu = new QMenu(this);
|
||||
if (sysTrayStatus) sysTrayStatus->trayMenu = trayMenu;
|
||||
QObject::connect(trayMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
|
||||
toggleVisibilityAction = trayMenu->addAction(QIcon(IMAGE_RETROSHARE), tr("Show/Hide"), this, SLOT(toggleVisibilitycontextmenu()));
|
||||
|
@ -284,6 +284,7 @@ private:
|
||||
|
||||
QSystemTrayIcon *trayIcon;
|
||||
QMenu *notifyMenu;
|
||||
QMenu *trayMenu;
|
||||
QString notifyToolTip;
|
||||
QAction *toggleVisibilityAction, *toolAct;
|
||||
QList<UserNotify*> userNotifyList;
|
||||
|
@ -256,17 +256,20 @@ void FriendSelectionWidget::loadIdentities()
|
||||
return;
|
||||
}
|
||||
|
||||
auto ids = std::make_unique<std::vector<RsGxsGroupId>>();
|
||||
for(auto& meta: ids_meta) ids->push_back(meta.mGroupId);
|
||||
auto ids = new std::vector<RsGxsGroupId>();
|
||||
|
||||
RsQThreadUtils::postToObject(
|
||||
[ids = std::move(ids), this]()
|
||||
for(auto& meta: ids_meta)
|
||||
ids->push_back(meta.mGroupId);
|
||||
|
||||
RsQThreadUtils::postToObject( [ids, this]()
|
||||
{
|
||||
// We do that is the GUI thread. Dont try it on another thread!
|
||||
gxsIds = *ids;
|
||||
/* TODO: To furter optimize away a copy gxsIds could be a unique_ptr
|
||||
* too */
|
||||
fillList();
|
||||
|
||||
delete ids;
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
@ -264,6 +264,8 @@ void NewFriendList::handleEvent(std::shared_ptr<const RsEvent> /*e*/)
|
||||
NewFriendList::~NewFriendList()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
delete mModel;
|
||||
delete mProxyModel;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -464,17 +464,16 @@ void GxsTransportStatistics::loadGroups()
|
||||
#ifdef DEBUG_FORUMS
|
||||
std::cerr << "Retrieving post data for post " << mThreadId << std::endl;
|
||||
#endif
|
||||
auto stats = std::make_unique<
|
||||
std::map<RsGxsGroupId,RsGxsTransGroupStatistics> >();
|
||||
auto stats = new std::map<RsGxsGroupId,RsGxsTransGroupStatistics>();
|
||||
|
||||
if(!rsGxsTrans->getGroupStatistics(*stats))
|
||||
{
|
||||
RS_ERR("Cannot retrieve group statistics in GxsTransportStatistics");
|
||||
delete stats;
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject(
|
||||
[stats = std::move(stats), this]()
|
||||
RsQThreadUtils::postToObject( [stats, 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
|
||||
@ -485,7 +484,8 @@ void GxsTransportStatistics::loadGroups()
|
||||
updateContent();
|
||||
mStateHelper->setLoading(GXSTRANS_GROUP_META, false);
|
||||
|
||||
}, this );
|
||||
delete stats;
|
||||
}, this );
|
||||
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user