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

View file

@ -285,12 +285,25 @@
<string>Peer Address</string> <string>Peer Address</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_6"> <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"> <layout class="QHBoxLayout" name="_4">
<item> <item>
<layout class="QVBoxLayout" name="_5"> <layout class="QVBoxLayout" name="_5">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="l_localAddress">
<property name="layoutDirection"> <property name="layoutDirection">
<enum>Qt::LeftToRight</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
@ -303,14 +316,14 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="l_extAddress">
<property name="text"> <property name="text">
<string>External Address</string> <string>External Address</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="l_dynDNS">
<property name="text"> <property name="text">
<string>Dynamic DNS</string> <string>Dynamic DNS</string>
</property> </property>
@ -334,14 +347,14 @@
<item> <item>
<layout class="QVBoxLayout" name="_7"> <layout class="QVBoxLayout" name="_7">
<item> <item>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="l_portLocal">
<property name="text"> <property name="text">
<string>Port</string> <string>Port</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="l_portExternal">
<property name="text"> <property name="text">
<string>Port</string> <string>Port</string>
</property> </property>