[tor-commits] [vidalia/master] Improve DirPort and MirrorDirectory behavior

chiiph at torproject.org chiiph at torproject.org
Sat Jun 11 15:21:33 UTC 2011


commit 81f6d57fb9df92b4421a3a13ba3b62de36f10aa5
Author: Tomas Touceda <chiiph at gentoo.org>
Date:   Sat May 21 13:39:15 2011 -0300

    Improve DirPort and MirrorDirectory behavior
    
    To be clearer about those values when setting up a bridge, they are empied.
    Otherwise it may let the user believe that the values are fixed, not
    ignored as they are.
---
 src/vidalia/config/ServerPage.cpp |   20 +++++++++++++++++++-
 src/vidalia/config/ServerPage.h   |    6 ++++++
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/src/vidalia/config/ServerPage.cpp b/src/vidalia/config/ServerPage.cpp
index aaadbfc..5e8e2b6 100644
--- a/src/vidalia/config/ServerPage.cpp
+++ b/src/vidalia/config/ServerPage.cpp
@@ -119,6 +119,9 @@ ServerPage::ServerPage(QWidget *parent)
   ui.chkEnableUpnp->setVisible(false);
   ui.btnTestUpnp->setVisible(false);
 #endif
+
+  _tmpDirPort = "9030";
+  _tmpMirror = true;
 }
 
 /** Destructor */
@@ -234,8 +237,23 @@ ServerPage::serverModeChanged(bool enabled)
   ui.lblBridgeUsage->setVisible(bridgeEnabled
                                   && Vidalia::torControl()->isConnected());
 
-  ui.lineDirPort->setEnabled(!bridgeEnabled);
+  if(bridgeEnabled) {
+    if(ui.lineDirPort->text().length() != 0) {
+      _tmpDirPort = ui.lineDirPort->text();
+      _tmpMirror = ui.chkMirrorDirectory->isChecked();
+    }
+    ui.lineDirPort->clear();
+    ui.chkMirrorDirectory->setChecked(false);
+  } else {
+    ui.lineDirPort->setText(_tmpDirPort);
+    ui.chkMirrorDirectory->setChecked(_tmpMirror);
+  }
+
   ui.chkMirrorDirectory->setEnabled(!bridgeEnabled);
+  if(ui.chkMirrorDirectory->isChecked()) {
+    ui.lblDirPort->setEnabled(!bridgeEnabled);
+    ui.lineDirPort->setEnabled(!bridgeEnabled);
+  }
 }
 
 /** Returns true if the user has changed their server settings since the
diff --git a/src/vidalia/config/ServerPage.h b/src/vidalia/config/ServerPage.h
index 03e4938..54549a2 100644
--- a/src/vidalia/config/ServerPage.h
+++ b/src/vidalia/config/ServerPage.h
@@ -120,6 +120,12 @@ private:
 
   /** Qt Designer generated object */
   Ui::ServerPage ui;
+
+  /** Used to store the dirport value and if the user wants to mirror the
+   * directory so that they can be emptied when selecting being a bridge and
+   * re-added when selecting relay */
+  QString _tmpDirPort;
+  bool _tmpMirror;
 };
 
 #endif





More information about the tor-commits mailing list