Add a warning to Direct download checkbox depends general setting.

This commit is contained in:
Phenom 2017-07-03 18:36:47 +02:00
parent f413433480
commit 2192a439ff
3 changed files with 95 additions and 91 deletions

View File

@ -19,13 +19,15 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QUrl>
#include <QDesktopServices>
#include <QMessageBox>
#include <QCheckBox>
#include <QClipboard>
#include <QDesktopServices>
#include <QFileDialog>
#include <QTextStream>
#include <QLayout>
#include <QMessageBox>
#include <QTextCodec>
#include <QTextStream>
#include <QUrl>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <QUrlQuery>
@ -107,7 +109,7 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
ui->foffRadioButton->hide();
ui->rsidRadioButton->hide();
ui->fr_label->hide();
ui->cp_Label->hide();
ui->requestinfolabel->hide();
connect(ui->acceptNoSignGPGCheckBox,SIGNAL(toggled(bool)), ui->_options_GB,SLOT(setEnabled(bool))) ;
@ -135,7 +137,7 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
else
{
ui->userFrame->hide(); // certificates page - top half with own cert and it's functions
ui->horizontalLayout_13->hide(); // Advanced options - key sign, whitelist, direct source ...
ui->cp_Frame->hide(); // Advanced options - key sign, whitelist, direct source ...
AdvancedVisible=false;
ui->trustLabel->hide();
ui->trustEdit->hide();
@ -145,7 +147,25 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
rsPeers->getPeerCount (&friendCount, &onlineCount, false);
if(friendCount<30)
ui->makefriend_infolabel->hide();
//Add warning to direct source checkbox depends general setting.
switch (rsFiles->filePermDirectDL())
{
case RS_FILE_PERM_DIRECT_DL_YES:
ui->_direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui->_direct_transfer_CB->setToolTip(ui->_direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to Yes.")));
ui->_direct_transfer_CB_2->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui->_direct_transfer_CB_2->setToolTip(ui->_direct_transfer_CB_2->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to Yes.")));
break ;
case RS_FILE_PERM_DIRECT_DL_NO:
ui->_direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui->_direct_transfer_CB->setToolTip(ui->_direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to No.")));
ui->_direct_transfer_CB_2->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui->_direct_transfer_CB_2->setToolTip(ui->_direct_transfer_CB_2->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to No.")));
break ;
default: break ;
}
updateStylesheet();
}
@ -279,7 +299,7 @@ void ConnectFriendWizard::setCertificate(const QString &certificate, bool friend
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
setStartId(Page_Conclusion);
if (friendRequest){
ui->fr_label->show();
ui->cp_Label->show();
ui->requestinfolabel->show();
setTitleText(ui->ConclusionPage, tr("Friend request"));
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
@ -305,7 +325,7 @@ void ConnectFriendWizard::setGpgId(const RsPgpId &gpgId, const RsPeerId &sslId,
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
setStartId(Page_Conclusion);
if (friendRequest){
ui->fr_label->show();
ui->cp_Label->show();
ui->requestinfolabel->show();
setTitleText(ui->ConclusionPage,tr("Friend request"));
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
@ -520,7 +540,7 @@ void ConnectFriendWizard::initializePage(int id)
}
}
ui->fr_label->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
ui->cp_Label->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
ui->nameEdit->setText(QString::fromUtf8(peerDetails.name.c_str()));
ui->trustEdit->setText(trustString);
ui->emailEdit->setText(QString::fromUtf8(peerDetails.email.c_str()));
@ -619,7 +639,7 @@ void ConnectFriendWizard::initializePage(int id)
ui->fr_nodeEdit->setText(loc);
ui->fr_label_3->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
ui->fr_InfoTopLabel->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
fillGroups(this, ui->fr_groupComboBox, groupId);
}
@ -1345,13 +1365,13 @@ void ConnectFriendWizard::toggleAdvanced()
{
if(AdvancedVisible)
{
ui->horizontalLayout_13->hide();
ui->cp_Frame->hide();
ui->toggleadvancedButton->setText("Show advanced options");
AdvancedVisible=false;
}
else
{
ui->horizontalLayout_13->show();
ui->cp_Frame->show();
ui->toggleadvancedButton->setText("Hide advanced options");
AdvancedVisible=true;
}

View File

@ -27,7 +27,7 @@
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Intro</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="IntroPageVLayout">
<item>
<widget class="QRadioButton" name="textRadioButton">
<property name="text">
@ -90,12 +90,12 @@
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Text</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="TextPageVLayout">
<item>
<widget class="QFrame" name="userFrame">
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="userFrameGLayout">
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="userCertButtonVLayout">
<item>
<widget class="QToolButton" name="userCertHelpButton">
<property name="sizePolicy">
@ -235,7 +235,7 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<spacer name="userCertButtonVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -396,7 +396,7 @@
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Cert</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<layout class="QVBoxLayout" name="CertificatePageVLayout">
<item>
<widget class="QGroupBox" name="userFileFrame">
<property name="title">
@ -405,7 +405,7 @@
<property name="flat">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="userFileFrameHLayout">
<item>
<widget class="QLabel" name="userFileLabel">
<property name="text">
@ -434,7 +434,7 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="friendFileNameHLayout">
<item>
<widget class="DropLineEdit" name="friendFileNameEdit"/>
</item>
@ -459,9 +459,9 @@
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Foff</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_11">
<layout class="QVBoxLayout" name="FofPageVLayout">
<item>
<widget class="QLabel" name="userFileLabel_2">
<widget class="QLabel" name="userSelectionLabel">
<property name="text">
<string>Show me:</string>
</property>
@ -506,7 +506,7 @@
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Rsid</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<layout class="QVBoxLayout" name="RsidPageVLayout">
<item>
<widget class="QGroupBox" name="userRsidFrame">
<property name="title">
@ -515,7 +515,7 @@
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8"/>
<layout class="QVBoxLayout" name="userRsidFrameVLayout"/>
</widget>
</item>
<item>
@ -534,7 +534,7 @@
</item>
</layout>
</widget>
<widget class="QWizardPage" name="WebmalPage">
<widget class="QWizardPage" name="WebmailPage">
<property name="title">
<string>RetroShare is better with Friends </string>
</property>
@ -544,9 +544,9 @@
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_WebMail</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="WebmalPageGLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<layout class="QHBoxLayout" name="webMailButtonHLayout">
<property name="leftMargin">
<number>9</number>
</property>
@ -560,7 +560,7 @@
<number>9</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<spacer name="webMailButtonLHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -693,7 +693,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="webMailButtonRHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -711,37 +711,7 @@
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_6">
<spacer name="WebmailPageVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -765,9 +735,9 @@
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Email</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_9">
<layout class="QVBoxLayout" name="EmailPageVLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<layout class="QHBoxLayout" name="addressHLayout">
<item>
<widget class="QLabel" name="addressLabel">
<property name="text">
@ -785,7 +755,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<layout class="QHBoxLayout" name="subjectHLayout">
<item>
<widget class="QLabel" name="subjectLabel">
<property name="text">
@ -817,7 +787,7 @@
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_FriendRequest</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_15">
<layout class="QVBoxLayout" name="FriendRequestPageVLayout">
<property name="leftMargin">
<number>6</number>
</property>
@ -825,10 +795,10 @@
<number>6</number>
</property>
<item>
<widget class="QFrame" name="frame">
<layout class="QVBoxLayout" name="verticalLayout_13">
<widget class="QFrame" name="fr_Frame">
<layout class="QVBoxLayout" name="fr_FrameVLayout">
<item>
<widget class="StyledLabel" name="fr_label_3">
<widget class="StyledLabel" name="fr_InfoTopLabel">
<property name="text">
<string notr="true">You have a friend request from</string>
</property>
@ -857,7 +827,7 @@
<property name="title">
<string>Peer details</string>
</property>
<layout class="QFormLayout" name="formLayout_3">
<layout class="QFormLayout" name="fr_peerDetailsFrameGLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
@ -909,15 +879,15 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="fr_optionslLayout">
<layout class="QHBoxLayout" name="fr_optionsHLayout">
<item>
<widget class="QGroupBox" name="fr_optionsFrame">
<property name="title">
<string>Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_14">
<layout class="QVBoxLayout" name="fr_optionsFrameVLayout">
<item>
<layout class="QHBoxLayout" name="fr_groupLayout">
<layout class="QHBoxLayout" name="fr_groupHLayout">
<item>
<widget class="QLabel" name="fr_groupLabel">
<property name="sizePolicy">
@ -961,11 +931,11 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="fr_RVBox">
<property name="title">
<string>Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
<layout class="QVBoxLayout" name="fr_RVBoxVLayout">
<item>
<widget class="QCheckBox" name="_direct_transfer_CB">
<property name="text">
@ -988,7 +958,7 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<spacer name="fr_RVBoxVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -1009,14 +979,14 @@
</widget>
</item>
<item>
<widget class="StyledLabel" name="requestinfolabel_3">
<widget class="StyledLabel" name="fr_InfoBottomLabel">
<property name="text">
<string>To accept the Friend Request, click the Finish button.</string>
</property>
</widget>
</item>
<item>
<spacer name="fr_verticalSpacer">
<spacer name="fr_VSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -1040,7 +1010,7 @@
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_ErrorMessage</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<layout class="QVBoxLayout" name="ErrorMessagePageVLayout">
<item>
<widget class="QLabel" name="messageLabel">
<property name="text">
@ -1060,7 +1030,7 @@
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Conclusion</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_17">
<layout class="QVBoxLayout" name="ConclusionPageVLayout">
<item>
<widget class="StyledLabel" name="makefriend_infolabel">
<property name="palette">
@ -1143,7 +1113,7 @@ resources.</string>
</widget>
</item>
<item>
<widget class="StyledLabel" name="fr_label">
<widget class="StyledLabel" name="cp_Label">
<property name="palette">
<palette>
<active>
@ -1230,7 +1200,7 @@ resources.</string>
<property name="title">
<string>Peer details</string>
</property>
<layout class="QFormLayout" name="formLayout">
<layout class="QFormLayout" name="peerDetailsFrameGLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
@ -1342,13 +1312,13 @@ resources.</string>
</widget>
</item>
<item>
<widget class="QFrame" name="horizontalLayout_13">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<widget class="QFrame" name="cp_Frame">
<layout class="QHBoxLayout" name="cp_FrameHLayout">
<property name="spacing">
<number>6</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_18">
<layout class="QVBoxLayout" name="cp_KeyVLayout">
<item>
<widget class="QCheckBox" name="addKeyToKeyring_CB">
<property name="text">
@ -1374,7 +1344,7 @@ resources.</string>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<layout class="QHBoxLayout" name="cp_AddIPHLayout">
<item>
<widget class="QCheckBox" name="_addIPToWhiteList_CB_2">
<property name="text">
@ -1388,7 +1358,7 @@ resources.</string>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<layout class="QHBoxLayout" name="cp_GroupHLayout">
<item>
<widget class="QLabel" name="groupLabel">
<property name="text">
@ -1404,7 +1374,7 @@ resources.</string>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_19">
<layout class="QVBoxLayout" name="cp_OptionVLayout">
<item>
<widget class="QGroupBox" name="_options_GB">
<property name="title">
@ -1445,7 +1415,7 @@ resources.</string>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<spacer name="cp_OptionVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -1543,7 +1513,7 @@ resources.</string>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<spacer name="ConclusionPageVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -1567,9 +1537,9 @@ resources.</string>
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_FriendRecommendations</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_16">
<layout class="QVBoxLayout" name="FriendRecommendationsPageVLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<layout class="QHBoxLayout" name="frec_HLayout">
<item>
<widget class="FriendSelectionWidget" name="frec_recommendList" native="true">
<property name="sizePolicy">

View File

@ -152,6 +152,20 @@ void PGPKeyDialog::load()
ui.pgpfingerprint_label->show();
ui._direct_transfer_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_DIRECT_DL ) ;
//Add warning to direct source checkbox depends general setting.
switch (rsFiles->filePermDirectDL())
{
case RS_FILE_PERM_DIRECT_DL_YES:
ui._direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui._direct_transfer_CB->setToolTip(ui._direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to Yes.")));
break ;
case RS_FILE_PERM_DIRECT_DL_NO:
ui._direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
ui._direct_transfer_CB->setToolTip(ui._direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to No.")));
break ;
default: break ;
}
ui._allow_push_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_ALLOW_PUSH) ;
ui._require_WL_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_REQUIRE_WL) ;