aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-06-05 11:45:42 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-06-05 11:45:42 +0200
commite29b623db36e9c63b1d0796928129a5fad858f0e (patch)
tree288e928461e6939c1ee92277941059cb354a4e00
parent4663e339b828fe955761de317528b9421cbdd6f4 (diff)
downloadbitcoin-e29b623db36e9c63b1d0796928129a5fad858f0e.tar.xz
save changed options in database
-rw-r--r--README.rst4
-rw-r--r--gui/src/optionsmodel.cpp12
2 files changed, 14 insertions, 2 deletions
diff --git a/README.rst b/README.rst
index eb209ce051..70d3c41860 100644
--- a/README.rst
+++ b/README.rst
@@ -20,12 +20,12 @@ This has been implemented:
- Address book and transactions views and models
+- Options dialog
+
- Sending coins
This has to be done:
-- Settings are not remembered between invocations yet
-
- Minimize to tray / Minimize on close
- Start at system start
diff --git a/gui/src/optionsmodel.cpp b/gui/src/optionsmodel.cpp
index f653f67e53..98fd3b110d 100644
--- a/gui/src/optionsmodel.cpp
+++ b/gui/src/optionsmodel.cpp
@@ -1,5 +1,6 @@
#include "optionsmodel.h"
#include "main.h"
+#include "net.h"
#include <QDebug>
@@ -47,6 +48,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
bool successful = true; /* set to false on parse error */
if(role == Qt::EditRole)
{
+ CWalletDB walletdb;
switch(index.row())
{
case StartAtStartup:
@@ -54,15 +56,22 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
break;
case MinimizeToTray:
fMinimizeToTray = value.toBool();
+ walletdb.WriteSetting("fMinimizeToTray", fMinimizeToTray);
break;
case MapPortUPnP:
fUseUPnP = value.toBool();
+ walletdb.WriteSetting("fUseUPnP", fUseUPnP);
+#ifdef USE_UPNP
+ MapPort(fUseUPnP);
+#endif
break;
case MinimizeOnClose:
fMinimizeOnClose = value.toBool();
+ walletdb.WriteSetting("fMinimizeOnClose", fMinimizeOnClose);
break;
case ConnectSOCKS4:
fUseProxy = value.toBool();
+ walletdb.WriteSetting("fUseProxy", fUseProxy);
break;
case ProxyIP:
{
@@ -71,6 +80,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
if (addr.ip != INADDR_NONE)
{
addrProxy.ip = addr.ip;
+ walletdb.WriteSetting("addrProxy", addrProxy);
} else {
successful = false;
}
@@ -82,6 +92,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
if (nPort > 0 && nPort < USHRT_MAX)
{
addrProxy.port = htons(nPort);
+ walletdb.WriteSetting("addrProxy", addrProxy);
} else {
successful = false;
}
@@ -92,6 +103,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
if(ParseMoney(value.toString().toStdString(), retval))
{
nTransactionFee = retval;
+ walletdb.WriteSetting("nTransactionFee", nTransactionFee);
} else {
successful = false; /* parse error */
}