mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-02 19:26:31 -04:00
Merge pull request #2106 from csoler/v0.6-BugFixing_2
[WIP] Continue fixing 0.6.6 bugs
This commit is contained in:
commit
509f89cb59
32 changed files with 1548 additions and 1280 deletions
|
@ -38,6 +38,7 @@
|
|||
#include "util/misc.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/RsFile.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include "retroshare/rsdisc.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
|
@ -1098,12 +1099,11 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||
registerHelpButton(ui.helpButton,help_str,"TransfersDialog") ;
|
||||
|
||||
mEventHandlerId=0;
|
||||
rsEvents->registerEventsHandler(
|
||||
[this](std::shared_ptr<const RsEvent> event) { handleEvent(event); },
|
||||
mEventHandlerId, RsEventType::FILE_TRANSFER );
|
||||
// Do the GUI events in the GUI thread!
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId, RsEventType::FILE_TRANSFER );
|
||||
}
|
||||
|
||||
void TransfersDialog::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
void TransfersDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if(event->mType != RsEventType::FILE_TRANSFER) return;
|
||||
|
||||
|
@ -1115,6 +1115,7 @@ void TransfersDialog::handleEvent(std::shared_ptr<const RsEvent> event)
|
|||
{
|
||||
case RsFileTransferEventCode::DOWNLOAD_COMPLETE:
|
||||
case RsFileTransferEventCode::COMPLETED_FILES_REMOVED:
|
||||
|
||||
getUserNotify()->updateIcon();
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -260,7 +260,7 @@ private:
|
|||
bool controlTransferFile(uint32_t flags);
|
||||
void changePriority(int priority);
|
||||
void setChunkStrategy(FileChunksInfo::ChunkStrategy s) ;
|
||||
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
QTreeView *downloadList;
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ void GetStartedDialog::inviteFriends()
|
|||
{
|
||||
RsAutoUpdatePage::lockAllEvents();
|
||||
|
||||
cert = rsPeers->GetRetroshareInvite(RsPeerId(),false,false);
|
||||
cert = rsPeers->GetRetroshareInvite(RsPeerId(),RetroshareInviteFlags::DNS | RetroshareInviteFlags::CURRENT_IP | RetroshareInviteFlags::FULL_IP_HISTORY);
|
||||
|
||||
RsAutoUpdatePage::unlockAllEvents() ;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "retroshare/rsinit.h"
|
||||
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/connect/ConnectFriendWizard.h"
|
||||
|
@ -49,8 +51,7 @@ HomePage::HomePage(QWidget *parent) :
|
|||
MainPage(parent),
|
||||
ui(new Ui::HomePage),
|
||||
mIncludeAllIPs(false),
|
||||
mUseShortFormat(false),
|
||||
mUseBackwardCompatibleCert(false)
|
||||
mUseShortFormat(true)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -86,7 +87,7 @@ HomePage::HomePage(QWidget *parent) :
|
|||
useOldFormatAct->setToolTip(tr("Displays the certificate format used up to version 0.6.5\nOld Retroshare nodes will not understand the\nnew short format"));
|
||||
connect(useOldFormatAct, SIGNAL(triggered()), this, SLOT(toggleUseOldFormat()));
|
||||
useOldFormatAct->setCheckable(true);
|
||||
useOldFormatAct->setChecked(mUseBackwardCompatibleCert);
|
||||
useOldFormatAct->setChecked(!mUseShortFormat);
|
||||
menu->addAction(useOldFormatAct);
|
||||
|
||||
menu->addSeparator();
|
||||
|
@ -96,27 +97,53 @@ HomePage::HomePage(QWidget *parent) :
|
|||
|
||||
ui->shareButton->setMenu(menu);
|
||||
|
||||
QObject::connect(ui->userCertEdit,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(certContextMenu(QPoint)));
|
||||
|
||||
connect(ui->openwebhelp,SIGNAL(clicked()), this,SLOT(openWebHelp())) ;
|
||||
|
||||
ui->userCertEdit->hide();
|
||||
|
||||
int S = QFontMetricsF(font()).height();
|
||||
QString help_str = tr(
|
||||
" <h1><img width=\"%1\" src=\":/icons/help_64.png\"> Welcome to Retroshare!</h1>\
|
||||
<p>You need to <b>make friends</b>! After you create a network of friends or join an existing network,\
|
||||
you'll be able to exchange files, chat, talk in forums, etc. </p>\
|
||||
<div align=center>\
|
||||
<IMG align=\"center\" width=\"%2\" src=\":/images/network_map.png\"/> \
|
||||
</div>\
|
||||
<p>To do so, copy your certificate on this page and send it to friends, and add your friends' certificate.</p> \
|
||||
<p>Another option is to search the internet for \"Retroshare chat servers\" (independently administrated). These servers allow you to exchange \
|
||||
certificates with a dedicated Retroshare node, through which\
|
||||
you will be able to anonymously meet other people.</p> ").arg(QString::number(2*S)).arg(width()*0.5);
|
||||
registerHelpButton(ui->helpButton,help_str,"HomePage") ;
|
||||
QString help_str = tr(
|
||||
" <h1><img width=\"%1\" src=\":/icons/help_64.png\"> Welcome to Retroshare!</h1>\
|
||||
<p>You need to <b>make friends</b>! After you create a network of friends or join an existing network,\
|
||||
you'll be able to exchange files, chat, talk in forums, etc. </p>\
|
||||
<div align=center>\
|
||||
<IMG align=\"center\" width=\"%2\" src=\":/images/network_map.png\"/> \
|
||||
</div>\
|
||||
<p>To do so, copy your certificate on this page and send it to friends, and add your friends' certificate.</p> \
|
||||
<p>Another option is to search the internet for \"Retroshare chat servers\" (independently administrated). These servers allow you to exchange \
|
||||
certificates with a dedicated Retroshare node, through which\
|
||||
you will be able to anonymously meet other people.</p> ").arg(QString::number(2*S)).arg(width()*0.5);
|
||||
registerHelpButton(ui->helpButton,help_str,"HomePage") ;
|
||||
|
||||
// register a event handler to catch IP updates
|
||||
|
||||
mEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK );
|
||||
}
|
||||
|
||||
void HomePage::handleEvent(std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
if(e->mType != RsEventType::NETWORK)
|
||||
return;
|
||||
|
||||
const RsNetworkEvent *ne = dynamic_cast<const RsNetworkEvent*>(e.get());
|
||||
|
||||
if(!ne)
|
||||
return;
|
||||
|
||||
// in any case we update the IPs
|
||||
|
||||
switch(ne->mNetworkEventCode)
|
||||
{
|
||||
case RsNetworkEventCode::LOCAL_IP_UPDATED: // [fallthrough]
|
||||
case RsNetworkEventCode::EXTERNAL_IP_UPDATED: // [fallthrough]
|
||||
RsQThreadUtils::postToObject( [=]()
|
||||
{
|
||||
updateCertificate();
|
||||
},this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
void HomePage::certContextMenu(QPoint point)
|
||||
{
|
||||
QMenu menu(this) ;
|
||||
|
@ -168,10 +195,7 @@ HomePage::~HomePage()
|
|||
|
||||
void HomePage::updateCertificate()
|
||||
{
|
||||
if(mUseBackwardCompatibleCert)
|
||||
updateOwnCert();
|
||||
else
|
||||
updateOwnId();
|
||||
updateOwnCert();
|
||||
}
|
||||
|
||||
void HomePage::updateOwnCert()
|
||||
|
@ -186,54 +210,43 @@ void HomePage::updateOwnCert()
|
|||
return ;
|
||||
}
|
||||
|
||||
std::string invite ;
|
||||
QString invite ;
|
||||
RetroshareInviteFlags invite_flags = RetroshareInviteFlags::CURRENT_IP;
|
||||
|
||||
if(mIncludeAllIPs)
|
||||
invite_flags |= RetroshareInviteFlags::FULL_IP_HISTORY;
|
||||
|
||||
if(mUseShortFormat)
|
||||
rsPeers->getShortInvite(invite,rsPeers->getOwnId(),true,!mIncludeAllIPs);
|
||||
else
|
||||
invite = rsPeers->GetRetroshareInvite(detail.id,false,include_extra_locators);
|
||||
{
|
||||
std::string short_invite;
|
||||
rsPeers->getShortInvite(short_invite,rsPeers->getOwnId(),invite_flags | RetroshareInviteFlags::RADIX_FORMAT);
|
||||
|
||||
ui->retroshareid->setText("\n"+QString::fromUtf8(invite.c_str())+"\n");
|
||||
QString S;
|
||||
QString txt;
|
||||
|
||||
for(uint32_t i=0;i<short_invite.size();)
|
||||
if(S.length() < 100)
|
||||
S += short_invite[i++];
|
||||
else
|
||||
{
|
||||
txt += S + "\n";
|
||||
S.clear();
|
||||
}
|
||||
|
||||
txt += S;
|
||||
|
||||
invite = txt; // the "\n" is here to make some space
|
||||
}
|
||||
else
|
||||
invite = QString::fromStdString(rsPeers->GetRetroshareInvite(detail.id,invite_flags));
|
||||
|
||||
ui->retroshareid->setText("\n"+invite+"\n");
|
||||
|
||||
QString description = ConfCertDialog::getCertificateDescription(detail,false,mUseShortFormat,include_extra_locators);
|
||||
|
||||
ui->retroshareid->setToolTip(description);
|
||||
}
|
||||
|
||||
void HomePage::updateOwnId()
|
||||
{
|
||||
RsPeerDetails detail;
|
||||
|
||||
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
||||
{
|
||||
std::cerr << "(EE) Cannot retrieve information about own certificate. That is a real problem!!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
bool include_extra_locators = mIncludeAllIPs || detail.isHiddenNode;
|
||||
std::string invite ;
|
||||
|
||||
rsPeers->getShortInvite(invite,rsPeers->getOwnId(),true,!include_extra_locators);
|
||||
|
||||
QString S;
|
||||
QString txt;
|
||||
int i=0;
|
||||
|
||||
for(uint32_t i=0;i<invite.size();)
|
||||
if(S.length() < 100)
|
||||
S += invite[i++];
|
||||
else
|
||||
{
|
||||
txt += S + "\n";
|
||||
S.clear();
|
||||
}
|
||||
|
||||
txt += S;
|
||||
|
||||
ui->retroshareid->setText("\n"+txt+"\n"); // the "\n" is here to make some space
|
||||
//#endif
|
||||
// ui->retroshareid->setText(QString::fromUtf8(invite.c_str()));
|
||||
}
|
||||
static void sendMail(QString sAddress, QString sSubject, QString sBody)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -335,18 +348,6 @@ void HomePage::openWebHelp()
|
|||
|
||||
void HomePage::toggleUseOldFormat()
|
||||
{
|
||||
mUseBackwardCompatibleCert = !mUseBackwardCompatibleCert;
|
||||
mUseShortFormat = !mUseShortFormat;
|
||||
updateCertificate();
|
||||
|
||||
if (mUseBackwardCompatibleCert)
|
||||
{
|
||||
//ui->userCertEdit->show();
|
||||
//ui->expandButton->setToolTip(tr("Revert to normal Retroshare ID"));
|
||||
}
|
||||
else
|
||||
{
|
||||
//ui->userCertEdit->hide();
|
||||
//ui->expandButton->setToolTip(tr("Show full certificate (old format for backward compatibility)"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ private slots:
|
|||
void certContextMenu(QPoint);
|
||||
void updateOwnCert();
|
||||
void updateCertificate();
|
||||
void updateOwnId();
|
||||
void runEmailClient();
|
||||
void copyCert();
|
||||
void copyId();
|
||||
|
@ -69,8 +68,10 @@ private:
|
|||
|
||||
bool mIncludeAllIPs;
|
||||
bool mUseShortFormat;
|
||||
bool mUseBackwardCompatibleCert;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
|
||||
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||
};
|
||||
|
||||
#endif // HomePage_H
|
||||
|
|
|
@ -225,64 +225,7 @@ private and secure decentralized communication platform.
|
|||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="2" column="0" colspan="7">
|
||||
<widget class="QPlainTextEdit" name="userCertEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Courier New</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tabStopWidth">
|
||||
<number>80</number>
|
||||
</property>
|
||||
<property name="centerOnScroll">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QLabel" name="userCertLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>This is your Retroshare ID. Copy and share with your friends!</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="retroshareid">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
|
@ -312,24 +255,7 @@ private and secure decentralized communication platform.
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QToolButton" name="helpButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="shareButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
|
@ -361,6 +287,44 @@ private and secure decentralized communication platform.
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="userCertLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>This is your Retroshare ID. Copy and share with your friends!</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QToolButton" name="helpButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -153,16 +153,10 @@ IdDialog::IdDialog(QWidget *parent) : MainPage(parent), ui(new Ui::IdDialog)
|
|||
ui->setupUi(this);
|
||||
|
||||
mEventHandlerId_identity = 0;
|
||||
rsEvents->registerEventsHandler(
|
||||
[this](std::shared_ptr<const RsEvent> event)
|
||||
{ RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this); },
|
||||
mEventHandlerId_identity, RsEventType::GXS_IDENTITY );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this); }, mEventHandlerId_identity, RsEventType::GXS_IDENTITY );
|
||||
|
||||
mEventHandlerId_circles = 0;
|
||||
rsEvents->registerEventsHandler(
|
||||
[this](std::shared_ptr<const RsEvent> event)
|
||||
{ RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this); },
|
||||
mEventHandlerId_circles, RsEventType::GXS_CIRCLES );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this); }, mEventHandlerId_circles, RsEventType::GXS_CIRCLES );
|
||||
|
||||
// This is used to grab the broadcast of changes from p3GxsCircles, which is discarded by the current dialog, since it expects data for p3Identity only.
|
||||
//mCirclesBroadcastBase = new RsGxsUpdateBroadcastBase(rsGxsCircles, this);
|
||||
|
@ -2387,6 +2381,10 @@ void IdDialog::sendMsg()
|
|||
if(selected_items.empty())
|
||||
return ;
|
||||
|
||||
if(selected_items.size() > 20)
|
||||
if(QMessageBox::warning(nullptr,tr("Too many identities"),tr("<p>It is not recommended to send a message to more than 20 persons at once. Large scale diffusion of data (including friend invitations) are much more efficiently handled by forums. Click ok to proceed anyway.</p>"),QMessageBox::Ok|QMessageBox::Cancel,QMessageBox::Cancel)==QMessageBox::Cancel)
|
||||
return;
|
||||
|
||||
MessageComposer *nMsgDialog = MessageComposer::newMsg();
|
||||
if (nMsgDialog == NULL)
|
||||
return;
|
||||
|
|
|
@ -566,7 +566,7 @@ RetroShareLink RetroShareLink::createCertificate(const RsPeerId& ssl_id)
|
|||
} else {
|
||||
|
||||
link._type = TYPE_CERTIFICATE;
|
||||
link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id,false,false).c_str());
|
||||
link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id).c_str());
|
||||
link._name = QString::fromUtf8(detail.name.c_str());
|
||||
link._location = QString::fromUtf8(detail.location.c_str());
|
||||
link._radix.replace("\n","");
|
||||
|
|
|
@ -292,6 +292,9 @@ void NewFriendList::sortColumn(int col,Qt::SortOrder so)
|
|||
mProxyModel->sort(col,so);
|
||||
mProxyModel->setSortingEnabled(false);
|
||||
restoreExpandedPathsAndSelection(expanded_indexes, selected_indexes);
|
||||
|
||||
mLastSortColumn = col;
|
||||
mLastSortOrder = so;
|
||||
}
|
||||
|
||||
void NewFriendList::headerContextMenuRequested(QPoint /*p*/)
|
||||
|
@ -1133,6 +1136,9 @@ void NewFriendList::applyWhileKeepingTree(std::function<void()> predicate)
|
|||
ui->peerTreeWidget->setColumnHidden(i,!col_visible[i]);
|
||||
ui->peerTreeWidget->setColumnWidth(i,col_sizes[i]);
|
||||
}
|
||||
|
||||
// restore sorting
|
||||
sortColumn(mLastSortColumn,mLastSortOrder);
|
||||
}
|
||||
|
||||
void NewFriendList::checkInternalData(bool force)
|
||||
|
@ -1267,7 +1273,8 @@ bool NewFriendList::exportFriendlist(QString &fileName)
|
|||
if (!rsPeers->getPeerDetails(*list_iter, detailSSL))
|
||||
continue;
|
||||
|
||||
std::string certificate = rsPeers->GetRetroshareInvite(detailSSL.id, true,true);
|
||||
std::string certificate = rsPeers->GetRetroshareInvite(detailSSL.id, RetroshareInviteFlags::CURRENT_IP | RetroshareInviteFlags::DNS | RetroshareInviteFlags::RADIX_FORMAT);
|
||||
|
||||
// remove \n from certificate
|
||||
certificate.erase(std::remove(certificate.begin(), certificate.end(), '\n'), certificate.end());
|
||||
|
||||
|
|
|
@ -126,6 +126,9 @@ private:
|
|||
std::set<RsNodeGroupId> openGroups;
|
||||
std::set<RsPgpId> openPeers;
|
||||
|
||||
int mLastSortColumn;
|
||||
Qt::SortOrder mLastSortOrder;
|
||||
|
||||
bool getOrCreateGroup(const std::string& name, uint flag, RsNodeGroupId& id);
|
||||
bool getGroupIdByName(const std::string& name, RsNodeGroupId& id);
|
||||
|
||||
|
|
|
@ -275,15 +275,22 @@ void ConfCertDialog::loadInvitePage()
|
|||
// ui.userCertificateText_2->setText(QString::fromUtf8(pgp_key.c_str()));
|
||||
|
||||
std::string invite ;
|
||||
RetroshareInviteFlags flags = RetroshareInviteFlags::DNS | RetroshareInviteFlags::CURRENT_IP | RetroshareInviteFlags::RADIX_FORMAT;
|
||||
|
||||
if(!detail.isHiddenNode && ui._includeIPHistory_CB->isChecked())
|
||||
flags |= RetroshareInviteFlags::FULL_IP_HISTORY;
|
||||
|
||||
if(ui._shortFormat_CB->isChecked())
|
||||
{
|
||||
rsPeers->getShortInvite(invite,detail.id,true,!(ui._includeIPHistory_CB->isChecked()|| detail.isHiddenNode) );
|
||||
rsPeers->getShortInvite(invite,detail.id,flags);
|
||||
ui.stabWidget->setTabText(1, tr("Retroshare ID"));
|
||||
}
|
||||
else
|
||||
{
|
||||
invite = rsPeers->GetRetroshareInvite(detail.id, ui._shouldAddSignatures_CB->isChecked(), ui._includeIPHistory_CB->isChecked() ) ;
|
||||
if(ui._shouldAddSignatures_CB->isChecked())
|
||||
flags |= RetroshareInviteFlags::PGP_SIGNATURES;
|
||||
|
||||
invite = rsPeers->GetRetroshareInvite(detail.id, flags ) ;
|
||||
ui.stabWidget->setTabText(1, tr("Retroshare Certificate"));
|
||||
}
|
||||
|
||||
|
|
|
@ -550,7 +550,25 @@ void ConnectFriendWizard::initializePage(int id)
|
|||
}
|
||||
|
||||
ui->nodeEdit->setText(loc);
|
||||
ui->ipEdit->setText(QString::fromStdString(peerDetails.isHiddenNode ? peerDetails.hiddenNodeAddress : peerDetails.extAddr));
|
||||
|
||||
std::string s;
|
||||
if(peerDetails.isHiddenNode)
|
||||
s += peerDetails.hiddenNodeAddress;
|
||||
else
|
||||
{
|
||||
if(peerDetails.localAddr!="0.0.0.0")// This is not so nice, but because we deal we string there's no way
|
||||
s += peerDetails.localAddr; // to ask about if the ip is null. We really need a proper IP class.
|
||||
|
||||
if(peerDetails.extAddr!="0.0.0.0")
|
||||
{
|
||||
if(!s.empty()) s += " / " ;
|
||||
s += peerDetails.extAddr;
|
||||
}
|
||||
|
||||
if(!peerDetails.dyndns.empty())
|
||||
s += "(" + peerDetails.dyndns + ")" ;
|
||||
}
|
||||
ui->ipEdit->setText(QString::fromStdString(s));
|
||||
ui->signersEdit->setPlainText(ts);
|
||||
|
||||
fillGroups(this, ui->groupComboBox, groupId);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
<width>654</width>
|
||||
<height>677</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -284,7 +284,7 @@
|
|||
<string>Email</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/icons/mail_128.png</normaloff>:/icons/mail_128.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
|
|
|
@ -87,7 +87,20 @@ void updateCommentCounts( std::vector<RsGxsChannelPost>& posts, std::vector<RsGx
|
|||
// now look into comments and increase the count
|
||||
|
||||
for(uint32_t i=0;i<comments.size();++i)
|
||||
++posts[post_indices[comments[i].mMeta.mThreadId]].mCommentCount;
|
||||
{
|
||||
auto it = post_indices.find(comments[i].mMeta.mThreadId);
|
||||
|
||||
// This happens when because of sync periods, we receive
|
||||
// the comments for a post, but not the post itself.
|
||||
// In this case, the post the comment refers to is just not here.
|
||||
// it->second>=posts.size() is impossible by construction, since post_indices
|
||||
// is previously filled using posts ids.
|
||||
|
||||
if(it == post_indices.end())
|
||||
continue;
|
||||
|
||||
++posts[it->second].mCommentCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,11 +117,12 @@ void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEve
|
|||
case RsChannelEventCode::READ_STATUS_CHANGED:
|
||||
{
|
||||
// Normally we should just emit dataChanged() on the index of the data that has changed:
|
||||
//
|
||||
// We need to update the data!
|
||||
|
||||
// make a copy of e, so as to avoid destruction of the shared pointer during async thread execution, since [e] doesn't actually tell
|
||||
// the shared_ptr that it is copied! So no counter is updated.
|
||||
// the original shared_ptr that it is copied! So no counter is updated in event, which will be destroyed (as e will be) during or even before
|
||||
// the execution of the lambda.
|
||||
|
||||
RsGxsChannelEvent E(*e);
|
||||
|
||||
if(E.mChannelGroupId == mChannelGroup.mMeta.mGroupId)
|
||||
|
@ -120,8 +134,6 @@ void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEve
|
|||
std::vector<RsGxsComment> comments;
|
||||
std::vector<RsGxsVote> votes;
|
||||
|
||||
std::cerr << "display of e 1: " << E << std::endl;
|
||||
|
||||
if(!rsGxsChannels->getChannelContent(E.mChannelGroupId,std::set<RsGxsMessageId>{ E.mChannelMsgId }, posts,comments,votes))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve channel message data for channel/msg " << E.mChannelGroupId << "/" << E.mChannelMsgId << std::endl;
|
||||
|
@ -131,8 +143,6 @@ void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEve
|
|||
// Need to call this in order to get the actuall comment count. The previous call only retrieves the message, since we supplied the message ID.
|
||||
// another way to go would be to save the comment ids of the existing message and re-insert them before calling getChannelContent.
|
||||
|
||||
std::cerr << "display of e 2: " << E << std::endl;
|
||||
std::cerr << "Before call : IS_MSG_READ=" << IS_MSG_NEW(posts[0].mMeta.mMsgFlags) << " for message id " << E.mChannelMsgId << std::endl;
|
||||
if(!rsGxsChannels->getChannelComments(E.mChannelGroupId,std::set<RsGxsMessageId>{ E.mChannelMsgId },comments))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve message comment data for channel/msg " << E.mChannelGroupId << "/" << E.mChannelMsgId << std::endl;
|
||||
|
@ -141,7 +151,6 @@ void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEve
|
|||
|
||||
updateCommentCounts(posts,comments);
|
||||
|
||||
std::cerr << "After call : IS_MSG_READ=" << IS_MSG_NEW(posts[0].mMeta.mMsgFlags) << std::endl;
|
||||
// 2 - update the model in the UI thread.
|
||||
|
||||
RsQThreadUtils::postToObject( [posts,this]()
|
||||
|
|
|
@ -134,6 +134,7 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
|
|||
m_completer = NULL;
|
||||
|
||||
ui.distantFrame->hide();
|
||||
ui.sizeLimitFrame->hide();
|
||||
ui.respond_to_CB->hide();
|
||||
ui.fromLabel->hide();
|
||||
|
||||
|
@ -395,6 +396,11 @@ void MessageComposer::updateCells(int,int)
|
|||
ui.distantFrame->hide() ;
|
||||
ui.fromLabel->hide();
|
||||
}
|
||||
|
||||
if(rowCount > 20)
|
||||
ui.sizeLimitFrame->show();
|
||||
else
|
||||
ui.sizeLimitFrame->hide();
|
||||
}
|
||||
|
||||
void MessageComposer::processSettings(bool bLoad)
|
||||
|
@ -2770,7 +2776,10 @@ void MessageComposer::showTagLabels()
|
|||
ui.tagLayout->addStretch();
|
||||
}
|
||||
}
|
||||
|
||||
void MessageComposer::on_closeSizeLimitFrameButton_clicked()
|
||||
{
|
||||
ui.sizeLimitFrame->setVisible(false);
|
||||
}
|
||||
void MessageComposer::on_closeInfoFrameButton_clicked()
|
||||
{
|
||||
ui.distantFrame->setVisible(false);
|
||||
|
|
|
@ -164,7 +164,8 @@ private slots:
|
|||
void tagRemoveAll();
|
||||
|
||||
void on_closeInfoFrameButton_clicked();
|
||||
|
||||
void on_closeSizeLimitFrameButton_clicked();
|
||||
|
||||
static QString inviteMessage();
|
||||
|
||||
private:
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -46,6 +46,7 @@
|
|||
#include "util/DateTime.h"
|
||||
#include "util/RsProtectedTimer.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
|
@ -286,10 +287,10 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||
connect(ui.messageTreeWidget->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(currentChanged(const QModelIndex&,const QModelIndex&)));
|
||||
|
||||
mEventHandlerId=0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::MAIL_STATUS );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_STATUS );
|
||||
}
|
||||
|
||||
void MessagesDialog::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
void MessagesDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if(event->mType != RsEventType::MAIL_STATUS)
|
||||
return;
|
||||
|
|
|
@ -111,7 +111,7 @@ private slots:
|
|||
void tabCloseRequested(int tab);
|
||||
|
||||
private:
|
||||
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
void updateInterface();
|
||||
|
||||
|
|
|
@ -92,7 +92,8 @@ void ProfileWidget::statusmessagedlg()
|
|||
|
||||
void ProfileWidget::copyCert()
|
||||
{
|
||||
std::string cert = rsPeers->GetRetroshareInvite(RsPeerId(),false,false);
|
||||
std::string cert = rsPeers->GetRetroshareInvite(RsPeerId());
|
||||
|
||||
if (cert.empty()) {
|
||||
QMessageBox::information(this, tr("RetroShare"),
|
||||
tr("Sorry, create certificate failed"),
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "CryptoPage.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
#include <gui/RetroShareLink.h>
|
||||
#include <gui/connect/ConfCertDialog.h>
|
||||
#include <gui/profile/ProfileManager.h>
|
||||
|
@ -57,16 +58,38 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
// hide profile manager as it causes bugs when generating a new profile.
|
||||
//ui.profile_Button->hide() ;
|
||||
|
||||
connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(profilemanager()));
|
||||
//connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(profilemanager()));
|
||||
connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(exportProfile()));
|
||||
|
||||
|
||||
ui.onlinesince->setText(DateTime::formatLongDateTime(Rshare::startupTime()));
|
||||
}
|
||||
|
||||
#ifdef UNUSED_CODE
|
||||
void CryptoPage::profilemanager()
|
||||
{
|
||||
ProfileManager().exec();
|
||||
}
|
||||
#endif
|
||||
|
||||
void CryptoPage::exportProfile()
|
||||
{
|
||||
RsPgpId gpgId(rsPeers->getGPGOwnId());
|
||||
|
||||
QString fname = QFileDialog::getSaveFileName(this, tr("Export Identity"), "", tr("RetroShare Identity files (*.asc)"));
|
||||
|
||||
if (fname.isNull())
|
||||
return;
|
||||
|
||||
if (fname.right(4).toUpper() != ".ASC") fname += ".asc";
|
||||
|
||||
if (RsAccounts::ExportIdentity(fname.toUtf8().constData(), gpgId))
|
||||
QMessageBox::information(this, tr("Identity saved"), tr("Your identity was successfully saved\nIt is encrypted\n\nYou can now copy it to another computer\nand use the import button to load it"));
|
||||
else
|
||||
QMessageBox::information(this, tr("Identity not saved"), tr("Your identity was not saved. An error occurred."));
|
||||
}
|
||||
|
||||
|
||||
void CryptoPage::showEvent ( QShowEvent * /*event*/ )
|
||||
{
|
||||
RsPeerDetails detail;
|
||||
|
@ -80,7 +103,7 @@ void CryptoPage::showEvent ( QShowEvent * /*event*/ )
|
|||
ui.pgpfingerprint->setText(misc::fingerPrintStyleSplit(QString::fromStdString(detail.fpr.toStdString())));
|
||||
|
||||
std::string invite ;
|
||||
rsPeers->getShortInvite(invite,rsPeers->getOwnId(),true,false);
|
||||
rsPeers->getShortInvite(invite,rsPeers->getOwnId(),RetroshareInviteFlags::RADIX_FORMAT | RetroshareInviteFlags::DNS | RetroshareInviteFlags::CURRENT_IP);
|
||||
ui.retroshareid->setText(QString::fromUtf8(invite.c_str()));
|
||||
|
||||
/* set retroshare version */
|
||||
|
@ -116,11 +139,22 @@ void
|
|||
CryptoPage::load()
|
||||
{
|
||||
std::string cert ;
|
||||
RetroshareInviteFlags flags = RetroshareInviteFlags::DNS | RetroshareInviteFlags::CURRENT_IP;
|
||||
|
||||
if(ui._shortFormat_CB->isChecked())
|
||||
rsPeers->getShortInvite(cert,rsPeers->getOwnId(), true, !ui._includeAllIPs_CB->isChecked());
|
||||
{
|
||||
if(ui._includeAllIPs_CB->isChecked())
|
||||
flags |= RetroshareInviteFlags::FULL_IP_HISTORY;
|
||||
|
||||
rsPeers->getShortInvite(cert,rsPeers->getOwnId(), RetroshareInviteFlags::RADIX_FORMAT | flags);
|
||||
}
|
||||
else
|
||||
cert = rsPeers->GetRetroshareInvite( rsPeers->getOwnId(), ui._includeSignatures_CB->isChecked(), ui._includeAllIPs_CB->isChecked() );
|
||||
{
|
||||
if(ui._includeSignatures_CB->isChecked())
|
||||
flags |= RetroshareInviteFlags::PGP_SIGNATURES;
|
||||
|
||||
cert = rsPeers->GetRetroshareInvite( rsPeers->getOwnId(), flags);
|
||||
}
|
||||
|
||||
ui.certplainTextEdit->setPlainText( QString::fromUtf8( cert.c_str() ) );
|
||||
|
||||
|
|
|
@ -42,11 +42,12 @@ class CryptoPage : public ConfigPage
|
|||
virtual QString helpText() const { return ""; }
|
||||
|
||||
private slots:
|
||||
void exportProfile();
|
||||
virtual void load();
|
||||
void copyPublicKey();
|
||||
void copyRSLink() ;
|
||||
virtual void showEvent ( QShowEvent * event );
|
||||
void profilemanager();
|
||||
// void profilemanager();
|
||||
bool fileSave();
|
||||
bool fileSaveAs();
|
||||
void showStats();
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>644</width>
|
||||
<height>459</height>
|
||||
<width>869</width>
|
||||
<height>487</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
|
@ -246,6 +246,9 @@
|
|||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QPushButton" name="exportprofile">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Use this to export your profile key. You can then import it in a different computer and make a new node with the same profile. Doing so, existing friends that you also add to the new node will automatically recognise that new node as friend.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Export</string>
|
||||
</property>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "retroshare/rsfiles.h"
|
||||
#include "hashingstatus.h"
|
||||
#include "gui/common/ElidedLabel.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
|
||||
|
@ -54,13 +55,13 @@ HashingStatus::HashingStatus(QWidget *parent)
|
|||
statusHashing->hide();
|
||||
|
||||
mEventHandlerId=0;
|
||||
rsEvents->registerEventsHandler(
|
||||
[this](std::shared_ptr<const RsEvent> event) { handleEvent(event); },
|
||||
mEventHandlerId, RsEventType::SHARED_DIRECTORIES );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId, RsEventType::SHARED_DIRECTORIES );
|
||||
}
|
||||
|
||||
void HashingStatus::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
void HashingStatus::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
// Warning: no GUI calls should happen here!
|
||||
|
||||
if(event->mType != RsEventType::SHARED_DIRECTORIES)
|
||||
return;
|
||||
|
||||
|
@ -72,7 +73,8 @@ void HashingStatus::handleEvent(std::shared_ptr<const RsEvent> event)
|
|||
|
||||
switch (fe->mEventCode)
|
||||
{
|
||||
case RsSharedDirectoriesEventCode::STARTING_DIRECTORY_SWEEP:
|
||||
default:
|
||||
case RsSharedDirectoriesEventCode::STARTING_DIRECTORY_SWEEP:
|
||||
info = tr("Examining shared files...");
|
||||
break;
|
||||
case RsSharedDirectoriesEventCode::DIRECTORY_SWEEP_ENDED:
|
||||
|
@ -85,7 +87,9 @@ void HashingStatus::handleEvent(std::shared_ptr<const RsEvent> event)
|
|||
break;
|
||||
}
|
||||
|
||||
updateHashingInfo(info);
|
||||
// GUI calls should only happen in the GUI thread, which is achieved by postToObject().
|
||||
|
||||
updateHashingInfo(info);
|
||||
}
|
||||
|
||||
HashingStatus::~HashingStatus()
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
private:
|
||||
void updateHashingInfo(const QString& s);
|
||||
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
ElidedLabel *statusHashing;
|
||||
QLabel *hashloader;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue