[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 58790784cfa1bf8facb5a28e6d5bb8b7bf74c229
Author: Tomas Touceda <chiiph@xxxxxxxxxx>
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 |   21 ++++++++++++++++++++-
 src/vidalia/config/ServerPage.h   |    6 ++++++
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/src/vidalia/config/ServerPage.cpp b/src/vidalia/config/ServerPage.cpp
index f15268f..32dc152 100644
--- a/src/vidalia/config/ServerPage.cpp
+++ b/src/vidalia/config/ServerPage.cpp
@@ -121,6 +121,9 @@ ServerPage::ServerPage(QWidget *parent)
   ui.chkEnableUpnp->setVisible(false);
   ui.btnTestUpnp->setVisible(false);
 #endif
+
+  _tmpDirPort = "9030";
+  _tmpMirror = true;
 }
 
 /** Destructor */
@@ -235,12 +238,28 @@ 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);
 
   /* Disable the Exit Policies tab when bridge or non-exit relay mode is 
    * selected */
   ui.tabsMenu->setTabEnabled(2, !bridgeEnabled and !ui.rdoNonExitMode->isChecked());
+
+  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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits