diff options
-rw-r--r-- | bitcoin-qt.pro | 16 | ||||
-rw-r--r-- | contrib/debian/control | 3 | ||||
-rw-r--r-- | contrib/debian/copyright | 2 | ||||
-rwxr-xr-x | contrib/debian/rules | 2 | ||||
-rw-r--r-- | contrib/gitian-descriptors/deps-win32.yml | 2 | ||||
-rw-r--r-- | contrib/gitian-descriptors/gitian.yml | 10 | ||||
-rw-r--r-- | doc/assets-attribution.txt | 2 | ||||
-rw-r--r-- | src/db.cpp | 16 | ||||
-rw-r--r-- | src/init.cpp | 8 | ||||
-rw-r--r-- | src/makefile.unix | 4 | ||||
-rw-r--r-- | src/netbase.cpp | 2 | ||||
-rw-r--r-- | src/qt/bitcoin.qrc | 1 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 17 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 3 | ||||
-rw-r--r-- | src/qt/messagepage.cpp | 12 | ||||
-rw-r--r-- | src/qt/res/icons/filesave.png | bin | 0 -> 1741 bytes | |||
-rw-r--r-- | src/qt/walletmodel.cpp | 6 | ||||
-rw-r--r-- | src/qt/walletmodel.h | 2 |
18 files changed, 75 insertions, 33 deletions
diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index e2097fd4b0..933f4a70da 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -19,14 +19,6 @@ OBJECTS_DIR = build MOC_DIR = build UI_DIR = build -# use: qmake "USE_QRCODE=1" -# libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support -contains(USE_QRCODE, 1) { - message(Building with QRCode support) - DEFINES += USE_QRCODE - LIBS += -lqrencode -} - # use: qmake "RELEASE=1" contains(RELEASE, 1) { # Mac: compile for maximum compatibility (10.5, 32-bit) @@ -38,6 +30,14 @@ contains(RELEASE, 1) { } } +# use: qmake "USE_QRCODE=1" +# libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support +contains(USE_QRCODE, 1) { + message(Building with QRCode support) + DEFINES += USE_QRCODE + LIBS += -lqrencode +} + # use: qmake "USE_UPNP=1" ( enabled by default; default) # or: qmake "USE_UPNP=0" (disabled by default) # or: qmake "USE_UPNP=-" (not supported) diff --git a/contrib/debian/control b/contrib/debian/control index c41664ca6f..745fd71ea8 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -15,7 +15,8 @@ Build-Depends: debhelper, libboost-thread-dev (>> 1.35) | libboost-thread1.35-dev, libboost-test-dev (>> 1.35) | libboost-test1.35-dev, qt4-qmake, - libqt4-dev + libqt4-dev, + libqrencode-dev Standards-Version: 3.9.2 Homepage: http://www.bitcoin.org/ Vcs-Git: git://github.com/bitcoin/bitcoin.git diff --git a/contrib/debian/copyright b/contrib/debian/copyright index 5db418df3a..71fa77cf6c 100644 --- a/contrib/debian/copyright +++ b/contrib/debian/copyright @@ -37,7 +37,7 @@ Files: src/qt/res/icons/address-book.png, src/qt/res/icons/export.png, src/qt/res/icons/history.png, src/qt/res/icons/key.png, src/qt/res/icons/lock_*.png, src/qt/res/icons/overview.png, src/qt/res/icons/receive.png, src/qt/res/icons/send.png, - src/qt/res/icons/synced.png + src/qt/res/icons/synced.png, src/qt/res/icons/filesave.png Copyright: David Vignoni (david@icon-king.com) ICON KING - www.icon-king.com License: LGPL diff --git a/contrib/debian/rules b/contrib/debian/rules index a1d65652e3..6d6f119b59 100755 --- a/contrib/debian/rules +++ b/contrib/debian/rules @@ -20,7 +20,7 @@ override_dh_auto_clean: cd src; $(MAKE) -f makefile.unix clean override_dh_auto_configure: - qmake bitcoin-qt.pro + qmake bitcoin-qt.pro USE_SSL=1 USE_QRCODE=1 override_dh_auto_test: cd src; $(MAKE) -f makefile.unix test_bitcoin diff --git a/contrib/gitian-descriptors/deps-win32.yml b/contrib/gitian-descriptors/deps-win32.yml index 4485f3658f..0107b306ec 100644 --- a/contrib/gitian-descriptors/deps-win32.yml +++ b/contrib/gitian-descriptors/deps-win32.yml @@ -59,5 +59,3 @@ script: | cd .. # tar cjvpf "$OUTDIR/bitcoin-deps-0.0.1.tbz2" "$HOME/build" - - diff --git a/contrib/gitian-descriptors/gitian.yml b/contrib/gitian-descriptors/gitian.yml index 8a0ee0e038..086e09743d 100644 --- a/contrib/gitian-descriptors/gitian.yml +++ b/contrib/gitian-descriptors/gitian.yml @@ -16,13 +16,15 @@ packages: - "libssl-dev" - "git-core" - "unzip" -- "libqrencode-dev" +- "pkg-config" +- "libpng12-dev" reference_datetime: "2011-01-30 00:00:00" remotes: - "url": "https://github.com/bitcoin/bitcoin.git" "dir": "bitcoin" files: - "miniupnpc-1.6.tar.gz" +- "qrencode-3.2.0.tar.bz2" script: | INSTDIR="$HOME/install" export LIBRARY_PATH="$INSTDIR/lib" @@ -32,6 +34,12 @@ script: | INSTALLPREFIX=$INSTDIR make $MAKEOPTS install cd .. # + tar xjf qrencode-3.2.0.tar.bz2 + cd qrencode-3.2.0 + ./configure --prefix=$INSTDIR --enable-static --disable-shared + make $MAKEOPTS install + cd .. + # cd bitcoin mkdir -p $OUTDIR/src cp -a . $OUTDIR/src diff --git a/doc/assets-attribution.txt b/doc/assets-attribution.txt index 5cf0a734bf..fabcdeea76 100644 --- a/doc/assets-attribution.txt +++ b/doc/assets-attribution.txt @@ -7,7 +7,7 @@ Icon: src/qt/res/icons/address-book.png, src/qt/res/icons/export.png, src/qt/res/icons/history.png, src/qt/res/icons/key.png, src/qt/res/icons/lock_*.png, src/qt/res/icons/overview.png, src/qt/res/icons/receive.png, src/qt/res/icons/send.png, - src/qt/res/icons/synced.png + src/qt/res/icons/synced.png, src/qt/res/icons/filesave.png Icon Pack: NUVOLA ICON THEME for KDE 3.x Designer: David Vignoni (david@icon-king.com) ICON KING - www.icon-king.com diff --git a/src/db.cpp b/src/db.cpp index 3bdda61569..9a904ec2e0 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -6,6 +6,7 @@ #include "headers.h" #include "db.h" #include "net.h" +#include <boost/version.hpp> #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> @@ -1064,14 +1065,19 @@ bool BackupWallet(const CWallet& wallet, const string& strDest) filesystem::path pathDest(strDest); if (filesystem::is_directory(pathDest)) pathDest = pathDest / wallet.strWalletFile; + + try { #if BOOST_VERSION >= 104000 - filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists); + filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists); #else - filesystem::copy_file(pathSrc, pathDest); + filesystem::copy_file(pathSrc, pathDest); #endif - printf("copied wallet.dat to %s\n", pathDest.string().c_str()); - - return true; + printf("copied wallet.dat to %s\n", pathDest.string().c_str()); + return true; + } catch(const filesystem::filesystem_error &e) { + printf("error copying wallet.dat to %s - %s\n", pathDest.string().c_str(), e.what()); + return false; + } } } Sleep(100); diff --git a/src/init.cpp b/src/init.cpp index 22f34aa755..0f2e10dab5 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -210,10 +210,10 @@ bool AppInit2(int argc, char* argv[]) #endif #endif " -paytxfee=<amt> \t " + _("Fee per KB to add to transactions you send") + "\n" + -#ifdef GUI +#ifdef QT_GUI " -server \t\t " + _("Accept command line and JSON-RPC commands") + "\n" + #endif -#ifndef WIN32 +#if !defined(WIN32) && !defined(QT_GUI) " -daemon \t\t " + _("Run in the background as a daemon and accept commands") + "\n" + #endif " -testnet \t\t " + _("Use the test network") + "\n" + @@ -253,7 +253,7 @@ bool AppInit2(int argc, char* argv[]) fTestNet = GetBoolArg("-testnet"); fDebug = GetBoolArg("-debug"); -#ifndef WIN32 +#if !defined(WIN32) && !defined(QT_GUI) fDaemon = GetBoolArg("-daemon"); #else fDaemon = false; @@ -284,7 +284,7 @@ bool AppInit2(int argc, char* argv[]) } #endif -#ifndef WIN32 +#if !defined(WIN32) && !defined(QT_GUI) if (fDaemon) { // Daemonize diff --git a/src/makefile.unix b/src/makefile.unix index 41452dec81..80b5bca341 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -7,7 +7,7 @@ USE_UPNP:=0 DEFS=-DNOPCH DEFS += $(addprefix -I,$(CURDIR) $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH)) -LIBS += $(addprefix -l,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH)) +LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH)) LMODE = dynamic LMODE2 = dynamic @@ -21,7 +21,7 @@ else endif # for boost 1.37, add -mt to the boost libraries -LIBS= \ +LIBS += \ -Wl,-B$(LMODE) \ -l boost_system$(BOOST_LIB_SUFFIX) \ -l boost_filesystem$(BOOST_LIB_SUFFIX) \ diff --git a/src/netbase.cpp b/src/netbase.cpp index 54aa933a54..7799a65972 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -402,7 +402,7 @@ bool CNetAddr::IsRFC6145() const bool CNetAddr::IsRFC4843() const { - return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x00 && GetByte(12) & 0xF0 == 0x10); + return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x00 && (GetByte(12) & 0xF0) == 0x10); } bool CNetAddr::IsLocal() const diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index 5693ae187e..d823752c9c 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -37,6 +37,7 @@ <file alias="lock_closed">res/icons/lock_closed.png</file> <file alias="lock_open">res/icons/lock_open.png</file> <file alias="key">res/icons/key.png</file> + <file alias="filesave">res/icons/filesave.png</file> </qresource> <qresource prefix="/images"> <file alias="about">res/images/about.png</file> diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index b72f128291..f3b1d0e48f 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -46,6 +46,8 @@ #include <QStackedWidget> #include <QDateTime> #include <QMovie> +#include <QFileDialog> +#include <QDesktopServices> #include <QDragEnterEvent> #include <QUrl> @@ -243,6 +245,8 @@ void BitcoinGUI::createActions() encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet"), this); encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet")); encryptWalletAction->setCheckable(true); + backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet"), this); + backupWalletAction->setToolTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase"), this); changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption")); @@ -252,6 +256,7 @@ void BitcoinGUI::createActions() connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(openBitcoinAction, SIGNAL(triggered()), this, SLOT(showNormal())); connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool))); + connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet())); connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase())); } @@ -277,6 +282,7 @@ void BitcoinGUI::createMenuBar() QMenu *settings = appMenuBar->addMenu(tr("&Settings")); settings->addAction(encryptWalletAction); settings->addAction(changePassphraseAction); + settings->addAction(backupWalletAction); settings->addSeparator(); settings->addAction(optionsAction); @@ -778,6 +784,17 @@ void BitcoinGUI::encryptWallet(bool status) setEncryptionStatus(walletModel->getEncryptionStatus()); } +void BitcoinGUI::backupWallet() +{ + QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); + QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)")); + if(!filename.isEmpty()) { + if(!walletModel->backupWallet(filename)) { + QMessageBox::warning(this, tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location.")); + } + } +} + void BitcoinGUI::changePassphrase() { AskPassphraseDialog dlg(AskPassphraseDialog::ChangePass, this); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 37ab12577c..a522429000 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -86,6 +86,7 @@ private: QAction *openBitcoinAction; QAction *exportAction; QAction *encryptWalletAction; + QAction *backupWalletAction; QAction *changePassphraseAction; QAction *aboutQtAction; @@ -162,6 +163,8 @@ private slots: void incomingTransaction(const QModelIndex & parent, int start, int end); /** Encrypt the wallet */ void encryptWallet(bool status); + /** Backup the wallet */ + void backupWallet(); /** Change encrypted wallet passphrase */ void changePassphrase(); /** Ask for pass phrase to unlock wallet temporarily */ diff --git a/src/qt/messagepage.cpp b/src/qt/messagepage.cpp index dee1837ed6..46a0cbae24 100644 --- a/src/qt/messagepage.cpp +++ b/src/qt/messagepage.cpp @@ -1,6 +1,12 @@ #include <string> #include <vector> +#include <QClipboard> +#include <QInputDialog> +#include <QList> +#include <QListWidgetItem> +#include <QMessageBox> + #include "main.h" #include "wallet.h" #include "init.h" @@ -13,12 +19,6 @@ #include "guiutil.h" #include "walletmodel.h" -#include <QClipboard> -#include <QInputDialog> -#include <QList> -#include <QListWidgetItem> -#include <QMessageBox> - MessagePage::MessagePage(QWidget *parent) : QDialog(parent), ui(new Ui::MessagePage) diff --git a/src/qt/res/icons/filesave.png b/src/qt/res/icons/filesave.png Binary files differnew file mode 100644 index 0000000000..ae13a151d5 --- /dev/null +++ b/src/qt/res/icons/filesave.png diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index f028f10f6c..8344a653d5 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -5,6 +5,7 @@ #include "transactiontablemodel.h" #include "headers.h" +#include "db.h" // for BackupWallet #include <QTimer> #include <QSet> @@ -239,6 +240,11 @@ bool WalletModel::changePassphrase(const SecureString &oldPass, const SecureStri return retval; } +bool WalletModel::backupWallet(const QString &filename) +{ + return BackupWallet(*wallet, filename.toLocal8Bit().data()); +} + // WalletModel::UnlockContext implementation WalletModel::UnlockContext WalletModel::requestUnlock() { diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 89e8cdd2a0..4123240e90 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -77,6 +77,8 @@ public: // Passphrase only needed when unlocking bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString()); bool changePassphrase(const SecureString &oldPass, const SecureString &newPass); + // Wallet backup + bool backupWallet(const QString &filename); // RAI object for unlocking wallet, returned by requestUnlock() class UnlockContext |