[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1989: Give the network settings page apply(), revert(), and change (in trunk: . src/gui/config)
Author: edmanm
Date: 2007-10-09 23:39:52 -0400 (Tue, 09 Oct 2007)
New Revision: 1989
Modified:
trunk/
trunk/src/gui/config/networkpage.cpp
trunk/src/gui/config/networkpage.h
Log:
r2021@lysithea: edmanm | 2007-10-09 23:34:37 -0400
Give the network settings page apply(), revert(), and changedSinceLastApply()
methods, so we can apply our shiny new network settings to Tor.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /local/vidalia/trunk [r2021] on dc66be73-d13e-47ba-a267-8dc7cda68c65
Modified: trunk/src/gui/config/networkpage.cpp
===================================================================
--- trunk/src/gui/config/networkpage.cpp 2007-10-10 03:39:44 UTC (rev 1988)
+++ trunk/src/gui/config/networkpage.cpp 2007-10-10 03:39:52 UTC (rev 1989)
@@ -26,8 +26,8 @@
*/
#include <QIntValidator>
+#include <networksettings.h>
#include <vidalia.h>
-#include <config/networksettings.h>
#include "networkpage.h"
#include "domainvalidator.h"
@@ -47,11 +47,31 @@
ui.lineHttpProxyPort->setValidator(new QIntValidator(1, 65535, this));
}
-/** Destructor */
-NetworkPage::~NetworkPage()
+/** Applies the network configuration settings to Tor. Returns true if the *
+ * settings were applied successfully. Otherwise, <b>errmsg</b> is set and *
+ * false is return. */
+bool
+NetworkPage::apply(QString &errmsg)
{
+ return NetworkSettings(Vidalia::torControl()).apply(&errmsg);
}
+/** Returns true if the user has changed their server settings since the *
+ * last time they were applied to Tor. */
+bool
+NetworkPage::changedSinceLastApply()
+{
+ return NetworkSettings(Vidalia::torControl()).changedSinceLastApply();
+}
+
+/** Reverts the server configuration settings to their values at the last *
+ * time they were successfully applied to Tor. */
+void
+NetworkPage::revert()
+{
+ NetworkSettings(Vidalia::torControl()).revert();
+}
+
/** Adds a bridge to the bridge list box. */
void
NetworkPage::addBridge()
@@ -78,7 +98,7 @@
bool
NetworkPage::save(QString &errmsg)
{
- NetworkSettings settings;
+ NetworkSettings settings(Vidalia::torControl());
QStringList bridgeList;
QList<quint16> reachablePorts;
bool ok;
@@ -111,7 +131,8 @@
/* Save the reachable port settings */
settings.setFascistFirewall(ui.chkFascistFirewall->isChecked());
- foreach (QString portString, ui.lineReachablePorts->text().split(",")) {
+ foreach (QString portString,
+ ui.lineReachablePorts->text().split(",", QString::SkipEmptyParts)) {
quint32 port = portString.toUInt(&ok);
if (!ok || port < 1 || port > 65535) {
errmsg = tr("'%1' is not a valid port number.").arg(portString);
@@ -126,6 +147,7 @@
for (int i = 0; i < ui.listBridges->count(); i++)
bridgeList << ui.listBridges->item(i)->text();
settings.setBridgeList(bridgeList);
+
return true;
}
@@ -133,7 +155,7 @@
void
NetworkPage::load()
{
- NetworkSettings settings;
+ NetworkSettings settings(Vidalia::torControl());
QStringList reachablePortStrings;
/* Load HTTP/HTTPS proxy settings */
Modified: trunk/src/gui/config/networkpage.h
===================================================================
--- trunk/src/gui/config/networkpage.h 2007-10-10 03:39:44 UTC (rev 1988)
+++ trunk/src/gui/config/networkpage.h 2007-10-10 03:39:52 UTC (rev 1989)
@@ -41,13 +41,23 @@
public:
/** Default Constructor */
NetworkPage(QWidget *parent = 0);
- /** Default Destructor */
- ~NetworkPage();
+
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
+ /** Applies the network configuration settings to Tor. Returns true if the
+ * settings were applied successfully. Otherwise, <b>errmsg</b> is set and
+ * false is return. */
+ bool apply(QString &errmsg);
+ /** Reverts the server configuration settings to their values at the last
+ * time they were successfully applied to Tor. */
+ void revert();
+ /** Returns true if the user has changed their server settings since the
+ * last time they were applied to Tor. */
+ bool changedSinceLastApply();
+
private slots:
/** Adds a bridge to the bridge list box. */
void addBridge();