commit 3a56ccd23d99242bc51f935538b3491f2b8169f9 Author: Tomás Touceda chiiph@torproject.org Date: Sat Jun 9 17:17:24 2012 -0300
Properly name a private member variable and mark the Torrc as changed if a key is cleared --- src/vidalia/config/torrc/Torrc.cpp | 11 ++++++----- src/vidalia/config/torrc/Torrc.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/vidalia/config/torrc/Torrc.cpp b/src/vidalia/config/torrc/Torrc.cpp index 8e96f89..18dd64d 100644 --- a/src/vidalia/config/torrc/Torrc.cpp +++ b/src/vidalia/config/torrc/Torrc.cpp @@ -19,7 +19,7 @@ #include <QtGlobal>
Torrc::Torrc(const QString &torrcPath, const QString &defaultsPath) : - QObject(), _torrcPath(torrcPath), changed(false) + QObject(), _torrcPath(torrcPath), _changed(false) { load(torrcPath, defaultsPath); } @@ -39,7 +39,7 @@ Torrc::load(const QString &torrcPath, const QString &defaultsPath) bool Torrc::apply(TorControl *tc, QString *errmsg) { - if(not changed) + if(not _changed) return true;
QFile torrc(_torrcPath); @@ -70,7 +70,7 @@ Torrc::apply(TorControl *tc, QString *errmsg) clearAll(); load(_torrcPath);
- changed = false; + _changed = false;
bool ret = true; if(tc && tc->isConnected()) { @@ -155,7 +155,7 @@ Torrc::setValue(const QString &key, const QString &value, const QString &comment .arg(value)); if(not comment.isEmpty() and val.second.line()->comment().isEmpty()) val.second.line()->setComment(comment); - changed = true; + _changed = true; return; } else if(not val.second.isMultilined() and val.first == value) { // if it's the same, leave it like that @@ -164,7 +164,7 @@ Torrc::setValue(const QString &key, const QString &value, const QString &comment } }
- changed = true; + _changed = true;
TorrcLine *line = new TorrcLine(QString("%1 %2") .arg(key) @@ -212,6 +212,7 @@ Torrc::clear(QStringList &keys) } } _torrcMap.remove(key); + _changed = true; } }
diff --git a/src/vidalia/config/torrc/Torrc.h b/src/vidalia/config/torrc/Torrc.h index fcdc6a3..9d45742 100644 --- a/src/vidalia/config/torrc/Torrc.h +++ b/src/vidalia/config/torrc/Torrc.h @@ -71,7 +71,7 @@ class Torrc : public QObject QString _torrcPath;
/** True if the config options have been changed */ - bool changed; + bool _changed; };
#endif
tor-commits@lists.torproject.org