fixed display of TOR information for hidden nodes (patch from Sehraf)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8108 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-04-02 18:22:55 +00:00
parent bdabfeea46
commit 65da6090fe
2 changed files with 84 additions and 42 deletions

View File

@ -217,18 +217,40 @@ void ConfCertDialog::load()
if (detail.isHiddenNode)
{
/* set local address */
ui.localAddress->setText("hidden");
ui.localPort -> setValue(0);
/* set the server address */
ui.extAddress->setText("hidden");
ui.extPort -> setValue(0);
// enable only the first row and set name of the first label to "Hidden Address"
ui.l_localAddress->setText(tr("Hidden Address"));
ui.dynDNS->setText(QString::fromStdString(detail.hiddenNodeAddress));
ui.l_extAddress->setEnabled(false);
ui.extAddress->setEnabled(false);
ui.l_portExternal->setEnabled(false);
ui.extPort->setEnabled(false);
ui.l_dynDNS->setEnabled(false);
ui.dynDNS->setEnabled(false);
/* set hidden address */
ui.localAddress->setText(QString::fromStdString(detail.hiddenNodeAddress));
ui.localPort -> setValue(detail.hiddenNodePort);
// set everything else to none
ui.extAddress->setText(tr("none"));
ui.extPort->setValue(0);
ui.dynDNS->setText(tr("none"));
}
else
{
/* set local address */
// enable everything and set name of the first label to "Local Address"
ui.l_localAddress->setText(tr("Local Address"));
ui.l_extAddress->setEnabled(true);
ui.extAddress->setEnabled(true);
ui.l_portExternal->setEnabled(true);
ui.extPort->setEnabled(true);
ui.l_dynDNS->setEnabled(true);
ui.dynDNS->setEnabled(true);
/* set local address */
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
ui.localPort -> setValue(detail.localPort);
/* set the server address */
@ -261,9 +283,9 @@ void ConfCertDialog::load()
ui.pgpfingerprint->show();
ui.pgpfingerprint_label->show();
ui.stabWidget->setTabEnabled(2,true) ;
ui.stabWidget->setTabEnabled(3,true) ;
ui.stabWidget->setTabEnabled(4,true) ;
ui.stabWidget->setTabEnabled(2,true) ;
ui.stabWidget->setTabEnabled(3,true) ;
ui.stabWidget->setTabEnabled(4,true) ;
}
else
{
@ -290,10 +312,10 @@ void ConfCertDialog::load()
ui.groupBox->hide();
ui.tabWidget->hide();
ui.stabWidget->setTabEnabled(2,true) ;
ui.stabWidget->setTabEnabled(3,false) ;
ui.stabWidget->setTabEnabled(4,false) ;
//ui._useOldFormat_CB->setEnabled(false) ;
ui.stabWidget->setTabEnabled(2,true) ;
ui.stabWidget->setTabEnabled(3,false) ;
ui.stabWidget->setTabEnabled(4,false) ;
//ui._useOldFormat_CB->setEnabled(false) ;
}
if (detail.gpg_id == rsPeers->getGPGOwnId()) {
@ -475,34 +497,41 @@ void ConfCertDialog::applyDialog()
rsPeers->trustGPGCertificate(pgpId, RS_TRUST_LVL_NEVER);
}
if (!detail.isOnlyGPGdetail) {
/* check if the data is the same */
bool localChanged = false;
bool extChanged = false;
bool dnsChanged = false;
if (!detail.isOnlyGPGdetail) {
if(!detail.isHiddenNode) {
/* check if the data is the same */
bool localChanged = false;
bool extChanged = false;
bool dnsChanged = false;
/* set local address */
if ((detail.localAddr != ui.localAddress->text().toStdString()) || (detail.localPort != ui.localPort -> value()))
localChanged = true;
/* set local address */
if ((detail.localAddr != ui.localAddress->text().toStdString()) || (detail.localPort != ui.localPort -> value()))
localChanged = true;
if ((detail.extAddr != ui.extAddress->text().toStdString()) || (detail.extPort != ui.extPort -> value()))
extChanged = true;
if ((detail.extAddr != ui.extAddress->text().toStdString()) || (detail.extPort != ui.extPort -> value()))
extChanged = true;
if ((detail.dyndns != ui.dynDNS->text().toStdString()))
dnsChanged = true;
if ((detail.dyndns != ui.dynDNS->text().toStdString()))
dnsChanged = true;
/* now we can action the changes */
if (localChanged)
rsPeers->setLocalAddress(peerId, ui.localAddress->text().toStdString(), ui.localPort->value());
/* now we can action the changes */
if (localChanged)
rsPeers->setLocalAddress(peerId, ui.localAddress->text().toStdString(), ui.localPort->value());
if (extChanged)
rsPeers->setExtAddress(peerId,ui.extAddress->text().toStdString(), ui.extPort->value());
if (extChanged)
rsPeers->setExtAddress(peerId,ui.extAddress->text().toStdString(), ui.extPort->value());
if (dnsChanged)
rsPeers->setDynDNS(peerId, ui.dynDNS->text().toStdString());
if (dnsChanged)
rsPeers->setDynDNS(peerId, ui.dynDNS->text().toStdString());
if(localChanged || extChanged || dnsChanged)
emit configChanged();
if(localChanged || extChanged || dnsChanged)
emit configChanged();
} else {
if((detail.hiddenNodeAddress != ui.localAddress->text().toStdString()) || (detail.hiddenNodePort != ui.localPort->value())) {
rsPeers->setHiddenNode(peerId,ui.localAddress->text().toStdString(), ui.localPort->value());
emit configChanged();
}
}
}
setServiceFlags() ;

View File

@ -285,12 +285,25 @@
<string>Peer Address</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>47</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" rowspan="2" colspan="2">
<layout class="QHBoxLayout" name="_4">
<item>
<layout class="QVBoxLayout" name="_5">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="l_localAddress">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
@ -303,14 +316,14 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="l_extAddress">
<property name="text">
<string>External Address</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="l_dynDNS">
<property name="text">
<string>Dynamic DNS</string>
</property>
@ -334,14 +347,14 @@
<item>
<layout class="QVBoxLayout" name="_7">
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="l_portLocal">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="l_portExternal">
<property name="text">
<string>Port</string>
</property>