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

[vidalia-svn] r1215: Be more conservative about when we decide we need to write a (in trunk/src: config gui/config)



Author: edmanm
Date: 2006-09-20 23:18:46 -0400 (Wed, 20 Sep 2006)
New Revision: 1215

Modified:
   trunk/src/config/serversettings.cpp
   trunk/src/config/serversettings.h
   trunk/src/config/torsettings.cpp
   trunk/src/config/vidaliasettings.cpp
   trunk/src/config/vidaliasettings.h
   trunk/src/gui/config/serverpage.cpp
Log:
Be more conservative about when we decide we need to write a setting to our
vidalia.conf or do a setconf.


Modified: trunk/src/config/serversettings.cpp
===================================================================
--- trunk/src/config/serversettings.cpp	2006-09-21 02:23:44 UTC (rev 1214)
+++ trunk/src/config/serversettings.cpp	2006-09-21 03:18:46 UTC (rev 1215)
@@ -61,20 +61,6 @@
 #define SETTING_SERVER_EXITPOLICY "Server/"SERVER_EXITPOLICY
 #define SETTING_SERVER_BWRATE     "Server/"SERVER_BANDWIDTH_RATE
 #define SETTING_SERVER_BWBURST    "Server/"SERVER_BANDWIDTH_BURST
-/* Default server configuration */
-#define DEFAULT_SERVER_ENABLED    false
-#define DEFAULT_SERVER_CHANGED    false
-#define DEFAULT_SERVER_DIRMIRROR  false
-#define DEFAULT_SERVER_MIDDLEMAN  true
-#define DEFAULT_SERVER_NICKNAME   QHostInfo::localHostName()
-#define DEFAULT_SERVER_ORPORT     9001
-#define DEFAULT_SERVER_DIRPORT    9030
-#define DEFAULT_SERVER_CONTACT    "<your@xxxxxxxxx>"
-#define DEFAULT_SERVER_ADDRESS    net_local_address().toString() 
-#define DEFAULT_SERVER_EXITPOLICY ExitPolicy(ExitPolicy::Default).toString()
-#define DEFAULT_SERVER_BWRATE     2097152
-#define DEFAULT_SERVER_BWBURST    5242880
-#define DEFAULT_SERVER_AUTOUPDATE_ADDRESS false
 
 
 /** Constructor.
@@ -85,6 +71,21 @@
 {
   _torControl = torControl;
   _backupSettings = allSettings();
+
+  setDefault(SETTING_SERVER_ENABLED,    false);
+  setDefault(SETTING_SERVER_CHANGED,    false);
+  setDefault(SETTING_SERVER_DIRMIRROR,  false);
+  setDefault(SETTING_SERVER_MIDDLEMAN,  true);
+  setDefault(SETTING_SERVER_ORPORT,     9001);
+  setDefault(SETTING_SERVER_DIRPORT,    9030);
+  setDefault(SETTING_SERVER_CONTACT,    "<your@xxxxxxxxx>");
+  setDefault(SETTING_SERVER_BWRATE,     2097152);
+  setDefault(SETTING_SERVER_BWBURST,    5242880);
+  setDefault(SETTING_SERVER_NICKNAME,   QHostInfo::localHostName());
+  setDefault(SETTING_SERVER_ADDRESS,    net_local_address().toString());
+  setDefault(SETTING_SERVER_AUTOUPDATE_ADDRESS, false);
+  setDefault(SETTING_SERVER_EXITPOLICY,
+    ExitPolicy(ExitPolicy::Default).toString());
 }
 
 /** Stores a boolean value indicating if the server's configuration has
@@ -94,7 +95,7 @@
 void
 ServerSettings::setChanged(bool changed)
 {
-  VidaliaSettings::setValue(SETTING_SERVER_CHANGED, changed);
+  QSettings::setValue(SETTING_SERVER_CHANGED, changed);
 }
 
 /** Returns a boolean value indicating if the server's configuration has
@@ -103,8 +104,7 @@
 bool
 ServerSettings::changedSinceLastApply()
 {
-  return VidaliaSettings::value(SETTING_SERVER_CHANGED,
-                                DEFAULT_SERVER_CHANGED).toBool();
+  return VidaliaSettings::value(SETTING_SERVER_CHANGED).toBool();
 }
 
 /** Restores the server configuration back to its state after the last call to
@@ -145,8 +145,8 @@
   switch (value.type()) {
     case QVariant::String: 
       return (value.toString().isEmpty());
-    case QVariant::UInt:  
-    case QVariant::Int:     
+    case QVariant::UInt:
+    case QVariant::Int:
       return (value.toUInt() == 0);
     case QVariant::Invalid:
       return true;
@@ -157,7 +157,7 @@
 
 /** Returns the stored value for the given key. If no stored value exists for
  * the given key, the specified default value is used. If Vidalia is currently
- * connected to Tor, we will ask Tor what it's value is. Otherwise, we will
+ * connected to Tor, we will ask Tor what its value is. Otherwise, we will
  * retrieve it from Vidalia's stored settings, allowing the configuration
  * information to be edited even if Tor isn't running.
  * \param key Configuration key
@@ -165,7 +165,7 @@
  * specified key.
  */
 QVariant
-ServerSettings::value(QString key, QVariant defaultValue)
+ServerSettings::value(QString key)
 {
   QVariant value;
   QString confKey, confValue;
@@ -173,12 +173,12 @@
   if (_torControl->isConnected()) {
     if (_torControl->getConf(confKey, confValue)) {
       value.setValue(confValue);
-      value.convert(defaultValue.type());
+      value.convert(defaultValue(key).type());
     }
   } else {
-    value = VidaliaSettings::value(key, defaultValue);
+    value = VidaliaSettings::value(key);
   }
-  return (isEmptyValue(value) ? defaultValue : value);
+  return (isEmptyValue(value) ? defaultValue(key) : value);
 }
 
 /** Saves the given configuration key-value to the application settings file.
@@ -188,8 +188,10 @@
 void
 ServerSettings::setValue(QString key, QVariant value)
 {
-  setChanged(true);
-  VidaliaSettings::setValue(key, value);
+  if (value != VidaliaSettings::value(key)) {
+    setChanged(true);
+    VidaliaSettings::setValue(key, value);
+  }
 }
 
 /** Returns a QHash of Tor-recognizable configuratin keys to their current
@@ -200,39 +202,33 @@
   QHash<QString, QString> conf;
   /* Server Nickname */
   conf.insert(SERVER_NICKNAME,
-    (isServerEnabled() ? VidaliaSettings::value(SETTING_SERVER_NICKNAME, 
-                                                DEFAULT_SERVER_NICKNAME).toString()
+    (isServerEnabled() ? VidaliaSettings::value(SETTING_SERVER_NICKNAME).toString()
                        : ""));
   /* Server ORPort */
   conf.insert(SERVER_ORPORT,
-    (isServerEnabled() ? VidaliaSettings::value(SETTING_SERVER_ORPORT, 
-                                                DEFAULT_SERVER_ORPORT).toString()
+    (isServerEnabled() ? VidaliaSettings::value(SETTING_SERVER_ORPORT).toString()
                        : "0"));
   /* Server DirPort */
   conf.insert(SERVER_DIRPORT, 
-    (isDirectoryMirror() ? VidaliaSettings::value(SETTING_SERVER_DIRPORT, 
-                                                  DEFAULT_SERVER_DIRPORT).toString() 
+    (isDirectoryMirror() ? VidaliaSettings::value(SETTING_SERVER_DIRPORT).toString() 
                          : "0"));
   /* Server Exit Policy */
   conf.insert(SERVER_EXITPOLICY, 
     (isMiddleman() ? ExitPolicy(ExitPolicy::Middleman).toString()
-                   : VidaliaSettings::value(SETTING_SERVER_EXITPOLICY,
-                                            DEFAULT_SERVER_EXITPOLICY).toString()));
+                   : VidaliaSettings::value(SETTING_SERVER_EXITPOLICY).toString()));
   /* Server Address */
   conf.insert(SERVER_ADDRESS,      
-    VidaliaSettings::value(SETTING_SERVER_ADDRESS, DEFAULT_SERVER_ADDRESS).toString());
+    VidaliaSettings::value(SETTING_SERVER_ADDRESS).toString());
   
   /* Server bandwidth settings */
   conf.insert(SERVER_BANDWIDTH_RATE,
-    QString::number(VidaliaSettings::value(SETTING_SERVER_BWRATE, 
-                                           DEFAULT_SERVER_BWRATE).toUInt()) + " bytes");
+    QString::number(VidaliaSettings::value(SETTING_SERVER_BWRATE).toUInt()) + " bytes");
   conf.insert(SERVER_BANDWIDTH_BURST,
-    QString::number(VidaliaSettings::value(SETTING_SERVER_BWBURST, 
-                                           DEFAULT_SERVER_BWBURST).toUInt()) + " bytes");
+    QString::number(VidaliaSettings::value(SETTING_SERVER_BWBURST).toUInt()) + " bytes");
     
   /* Server Contact Information */
   QString contact = 
-    VidaliaSettings::value(SETTING_SERVER_CONTACT, DEFAULT_SERVER_CONTACT).toString();
+    VidaliaSettings::value(SETTING_SERVER_CONTACT).toString();
   conf.insert(SERVER_CONTACTINFO, scrub_email_addr(contact));
   
   return conf;
@@ -289,8 +285,7 @@
               !confValues.value(SERVER_NICKNAME).isEmpty());
     }
   }
-  return VidaliaSettings::value(SETTING_SERVER_ENABLED,
-                                DEFAULT_SERVER_ENABLED).toBool();
+  return VidaliaSettings::value(SETTING_SERVER_ENABLED).toBool();
 }
 
 /** Sets the server's ORPort. */
@@ -304,8 +299,7 @@
 quint16
 ServerSettings::getORPort()
 {
-  return (quint16)value(SETTING_SERVER_ORPORT, 
-                        DEFAULT_SERVER_ORPORT).toUInt();
+  return (quint16)value(SETTING_SERVER_ORPORT).toUInt();
 }
 
 /** Sets the server's current DirPort. */
@@ -319,8 +313,7 @@
 quint16
 ServerSettings::getDirPort()
 {
-  return (quint16)value(SETTING_SERVER_DIRPORT, 
-                        DEFAULT_SERVER_DIRPORT).toUInt();
+  return (quint16)value(SETTING_SERVER_DIRPORT).toUInt();
 }
 
 /** Sets the server's externally-reachable address. */
@@ -334,7 +327,7 @@
 QString
 ServerSettings::getAddress()
 {
-  return value(SETTING_SERVER_ADDRESS, DEFAULT_SERVER_ADDRESS).toString();
+  return value(SETTING_SERVER_ADDRESS).toString();
 }
 
 /** Sets the server's nickname. */
@@ -348,8 +341,7 @@
 QString
 ServerSettings::getNickname()
 {
-  QString nickname = value(SETTING_SERVER_NICKNAME, 
-                           DEFAULT_SERVER_NICKNAME).toString();
+  QString nickname = value(SETTING_SERVER_NICKNAME).toString();
   /* Ensure the nickname contains only valid characters and is not too long. */
   return ensure_valid_chars(nickname, 
                             VALID_NICKNAME_CHARS).left(MAX_NICKNAME_LEN);
@@ -366,15 +358,14 @@
 QString
 ServerSettings::getContactInfo()
 {
-  return value(SETTING_SERVER_CONTACT, DEFAULT_SERVER_CONTACT).toString();
+  return value(SETTING_SERVER_CONTACT).toString();
 }
 
 /** Returns whether this server will act as a directory mirror or not. */
 bool
 ServerSettings::isDirectoryMirror()
 {
-  return VidaliaSettings::value(SETTING_SERVER_DIRMIRROR, 
-                                DEFAULT_SERVER_DIRMIRROR).toBool();
+  return VidaliaSettings::value(SETTING_SERVER_DIRMIRROR).toBool();
 }
 
 /** Sets whether this server will act as a directory mirror. */
@@ -390,8 +381,7 @@
 bool
 ServerSettings::isMiddleman()
 {
-  return VidaliaSettings::value(SETTING_SERVER_MIDDLEMAN,
-                                DEFAULT_SERVER_MIDDLEMAN).toBool();
+  return QSettings::value(SETTING_SERVER_MIDDLEMAN).toBool();
 }
 
 /** Sets whether this server will act as a middle-man server. */
@@ -405,8 +395,7 @@
 ExitPolicy
 ServerSettings::getExitPolicy()
 {
-  return ExitPolicy(value(SETTING_SERVER_EXITPOLICY, 
-                          DEFAULT_SERVER_EXITPOLICY).toString());
+  return ExitPolicy(value(SETTING_SERVER_EXITPOLICY).toString());
 }
 
 /** Sets the exit policy for this server. */
@@ -420,7 +409,7 @@
 quint32
 ServerSettings::getBandwidthAvgRate()
 {
-  return value(SETTING_SERVER_BWRATE, DEFAULT_SERVER_BWRATE).toUInt();
+  return value(SETTING_SERVER_BWRATE).toUInt();
 }
 
 /** Sets the long-term average bandwidth rate (in KB/s) for this server. */
@@ -434,7 +423,7 @@
 quint32
 ServerSettings::getBandwidthBurstRate()
 {
-  return value(SETTING_SERVER_BWBURST, DEFAULT_SERVER_BWBURST).toUInt();
+  return value(SETTING_SERVER_BWBURST).toUInt();
 }
 
 /** Sets the maximum bandwidth burst rate (in KB/s) for this server. */
@@ -448,8 +437,7 @@
 bool
 ServerSettings::getAutoUpdateAddress()
 {
-  return VidaliaSettings::value(SETTING_SERVER_AUTOUPDATE_ADDRESS,
-                                DEFAULT_SERVER_AUTOUPDATE_ADDRESS).toBool();
+  return VidaliaSettings::value(SETTING_SERVER_AUTOUPDATE_ADDRESS).toBool();
 }
 
 /** Sets whether we should update the server's IP address automatically. */

Modified: trunk/src/config/serversettings.h
===================================================================
--- trunk/src/config/serversettings.h	2006-09-21 02:23:44 UTC (rev 1214)
+++ trunk/src/config/serversettings.h	2006-09-21 03:18:46 UTC (rev 1215)
@@ -121,7 +121,7 @@
   /** Returns true if the specified QVariant contains an empty value. */
   bool isEmptyValue(QVariant value);
   /** Retrieves a configuration value. If one isn't found, use a default. */
-  QVariant value(QString key, QVariant defaultValue);
+  QVariant value(QString key);
   /** Stores a configuration key-value. */
   void setValue(QString key, QVariant value);
 

Modified: trunk/src/config/torsettings.cpp
===================================================================
--- trunk/src/config/torsettings.cpp	2006-09-21 02:23:44 UTC (rev 1214)
+++ trunk/src/config/torsettings.cpp	2006-09-21 03:18:46 UTC (rev 1215)
@@ -47,16 +47,6 @@
 #define DEFAULT_TOR_EXECUTABLE    "tor"
 #endif
 
-/* Default Tor Settings */
-#define DEFAULT_TOR_ARGUMENTS   QMap<QString,QVariant>()
-#define DEFAULT_CONTROL_ADDR    "127.0.0.1"
-#define DEFAULT_CONTROL_PORT    9051
-#define DEFAULT_AUTH_TOKEN      ""
-#define DEFAULT_TORRC           (Vidalia::dataDirectory() + "/torrc")
-#define DEFAULT_TOR_USER        ""
-#define DEFAULT_TOR_GROUP       ""
-#define DEFAULT_USE_SERVICE     false
-
 /* Arguments we can pass to Tor on the command-line */
 #define TOR_ARG_CONTROL_PORT    "ControlPort"
 #define TOR_ARG_TORRC           "-f"
@@ -67,6 +57,14 @@
 /** Default constructor */
 TorSettings::TorSettings()
 {
+  setDefault(SETTING_TOR_EXECUTABLE, DEFAULT_TOR_EXECUTABLE);
+  setDefault(SETTING_TORRC,         Vidalia::dataDirectory() + "/torrc");
+  setDefault(SETTING_CONTROL_ADDR,  "127.0.0.1");
+  setDefault(SETTING_CONTROL_PORT,  9051);
+  setDefault(SETTING_AUTH_TOKEN,    QByteArray(""));
+  setDefault(SETTING_TOR_USER,      "");
+  setDefault(SETTING_TOR_GROUP,     "");
+  setDefault(SETTING_USE_SERVICE,   false);
 }
 
 /** Returns a fully-qualified path to Tor's executable, including the
@@ -74,8 +72,8 @@
 QString
 TorSettings::getExecutable()
 {
-  return QDir::convertSeparators(value(SETTING_TOR_EXECUTABLE,
-                                       DEFAULT_TOR_EXECUTABLE).toString());
+  return QDir::convertSeparators(
+            value(SETTING_TOR_EXECUTABLE).toString());
 }
 
 /** Sets the location and name of Tor's executable to the given string. */
@@ -132,7 +130,7 @@
 QString
 TorSettings::getTorrc()
 {
-  return value(SETTING_TORRC, DEFAULT_TORRC).toString();
+  return value(SETTING_TORRC).toString();
 }
 
 /** Sets the torrc that will be used when starting Tor.
@@ -141,10 +139,7 @@
 void
 TorSettings::setTorrc(QString torrc)
 {
-  torrc = torrc.simplified();
-  if (torrc != DEFAULT_TORRC) {
-    setValue(SETTING_TORRC, torrc);
-  }
+  setValue(SETTING_TORRC, torrc);
 }
 
 /** Returns the user used when running Tor. The user is specified as an
@@ -152,7 +147,7 @@
 QString
 TorSettings::getUser()
 {
-  return value(SETTING_TOR_USER, DEFAULT_TOR_USER).toString();
+  return value(SETTING_TOR_USER).toString();
 }
 
 /** Sets the user used when running Tor. The user is specified as an argument
@@ -183,8 +178,7 @@
 QHostAddress
 TorSettings::getControlAddress()
 {
-  QString addr = value(SETTING_CONTROL_ADDR,
-                       DEFAULT_CONTROL_ADDR).toString();
+  QString addr = value(SETTING_CONTROL_ADDR).toString();
   return QHostAddress(addr);
 }
 
@@ -199,8 +193,7 @@
 quint16
 TorSettings::getControlPort()
 {
-  return (quint16)value(SETTING_CONTROL_PORT, 
-                        DEFAULT_CONTROL_PORT).toInt();
+  return (quint16)value(SETTING_CONTROL_PORT).toInt();
 }
 
 /** Set the control port used to connect to Tor */
@@ -216,8 +209,8 @@
 QByteArray
 TorSettings::getAuthToken()
 {
-  return QByteArray::fromBase64(value(SETTING_AUTH_TOKEN,
-                                      QByteArray(DEFAULT_AUTH_TOKEN)).toByteArray());
+  return QByteArray::fromBase64(
+            value(SETTING_AUTH_TOKEN).toByteArray());
 }
 
 /** Set the authentication token sent by the controller to Tor. */
@@ -231,7 +224,7 @@
 bool
 TorSettings::getUseService()
 {
-  return value(SETTING_USE_SERVICE, DEFAULT_USE_SERVICE).toBool();
+  return value(SETTING_USE_SERVICE).toBool();
 }
 
 /** Set whether Tor will run as an NT service */

Modified: trunk/src/config/vidaliasettings.cpp
===================================================================
--- trunk/src/config/vidaliasettings.cpp	2006-09-21 02:23:44 UTC (rev 1214)
+++ trunk/src/config/vidaliasettings.cpp	2006-09-21 03:18:46 UTC (rev 1215)
@@ -48,10 +48,6 @@
 #define DEFAULT_STYLE               "plastique"
 #endif
 
-#define DEFAULT_LANGUAGE            LanguageSupport::defaultLanguageCode()
-#define DEFAULT_RUN_TOR_AT_START    true
-#define DEFAULT_OPACITY             100
-
 #if defined(Q_OS_WIN32)
 #define STARTUP_REG_KEY        "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
 #define VIDALIA_REG_KEY        "Vidalia" 
@@ -64,9 +60,47 @@
 /** Default Constructor */
 VidaliaSettings::VidaliaSettings()
 : QSettings(SETTINGS_FILE, QSettings::IniFormat)
-{  
+{
+  setDefault(SETTING_LANGUAGE, LanguageSupport::defaultLanguageCode());
+  setDefault(SETTING_RUN_TOR_AT_START, true);
+  setDefault(SETTING_STYLE, DEFAULT_STYLE);
 }
 
+/** Sets the default value of <b>key</b> to be <b>val</b>. */
+void
+VidaliaSettings::setDefault(QString key, QVariant val)
+{
+  _defaults.insert(key, val);
+}
+
+/** Returns the default value for <b>key</b>. */
+QVariant
+VidaliaSettings::defaultValue(QString key)
+{
+  if (_defaults.contains(key)) {
+    return _defaults.value(key);
+  }
+  return QVariant();
+}
+
+/** Save <b>val</b> to the configuration file for the setting <b>key</b>, if
+ * <b>val</b> is different than <b>key</b>'s current value. */
+void
+VidaliaSettings::setValue(QString key, QVariant val)
+{
+  if (value(key) != val) {
+    QSettings::setValue(key, val);
+  }
+}
+
+/** Returns the value for <b>key</b>. If no value is currently saved, then the
+ * default value for <b>key</b> will be returned. */
+QVariant
+VidaliaSettings::value(QString key)
+{
+  return QSettings::value(key, defaultValue(key));
+}
+
 /** Resets all of Vidalia's settings. */
 void
 VidaliaSettings::reset()
@@ -79,7 +113,7 @@
 QString
 VidaliaSettings::getLanguageCode()
 {
-  return value(SETTING_LANGUAGE, DEFAULT_LANGUAGE).toString();
+  return value(SETTING_LANGUAGE).toString();
 }
 
 /** Sets the preferred language code. */
@@ -93,7 +127,7 @@
 QString
 VidaliaSettings::getInterfaceStyle()
 {
-  return value(SETTING_STYLE, DEFAULT_STYLE).toString();
+  return value(SETTING_STYLE).toString();
 }
 
 /** Sets the interface style key. */
@@ -107,7 +141,7 @@
 bool
 VidaliaSettings::runTorAtStart()
 {
-  return value(SETTING_RUN_TOR_AT_START, DEFAULT_RUN_TOR_AT_START).toBool();
+  return value(SETTING_RUN_TOR_AT_START).toBool();
 }
 
 /** If <b>run</b> is set to true, then Tor will be run when Vidalia starts. */

Modified: trunk/src/config/vidaliasettings.h
===================================================================
--- trunk/src/config/vidaliasettings.h	2006-09-21 02:23:44 UTC (rev 1214)
+++ trunk/src/config/vidaliasettings.h	2006-09-21 03:18:46 UTC (rev 1215)
@@ -27,6 +27,7 @@
 #ifndef _VIDALIASETTINGS_H
 #define _VIDALIASETTINGS_H
 
+#include <QHash>
 #include <QSettings>
 #include <control/logevent.h>
 
@@ -47,6 +48,17 @@
 
   /** Resets all of Vidalia's settings. */
   static void reset();
+  
+  /** Sets the default value of <b>key</b> to be <b>val</b>. */
+  void setDefault(QString key, QVariant val);
+  /** Returns the default value for <b>key</b>. */
+  QVariant defaultValue(QString key);
+  /** Save <b>val</b> to the configuration file for the setting <b>key</b>, if
+   * <b>val</b> is different than <b>key</b>'s current value. */
+  void setValue(QString key, QVariant val);
+  /** Returns the value for <b>key</b>. If no value is currently saved, then
+   * the default value for <b>key</b> will be returned. */
+  QVariant value(QString key);
 
   /** Gets the currently preferred language code for Vidalia. */
   QString getLanguageCode();
@@ -67,6 +79,9 @@
   bool runVidaliaOnBoot();
   /** Set whether to run Vidalia on system boot. */
   void setRunVidaliaOnBoot(bool run);
+
+private:
+  QHash<QString,QVariant> _defaults;
 };
 
 #endif

Modified: trunk/src/gui/config/serverpage.cpp
===================================================================
--- trunk/src/gui/config/serverpage.cpp	2006-09-21 02:23:44 UTC (rev 1214)
+++ trunk/src/gui/config/serverpage.cpp	2006-09-21 03:18:46 UTC (rev 1215)
@@ -161,11 +161,15 @@
   }
   _settings->setExitPolicy(exitPolicy);
   
-  bool success = (_torControl->isConnected() ? _settings->apply(&errmsg) : true);
-  if (!success) {
-    _settings->revert();
+  /* If we're connectd to Tor and we've changed the server settings, attempt
+   * to apply the new settings now. */
+  if (_torControl->isConnected() && _settings->changedSinceLastApply()) {
+    if (!_settings->apply(&errmsg)) {
+      _settings->revert();
+      return false;
+    }
   }
-  return success;
+  return true;
 }
 
 /** Loads previously saved settings */