aboutsummaryrefslogtreecommitdiff
path: root/src/qt/walletmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/walletmodel.h')
-rw-r--r--src/qt/walletmodel.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h
index a585f8d8d6..b141c0762d 100644
--- a/src/qt/walletmodel.h
+++ b/src/qt/walletmodel.h
@@ -2,6 +2,7 @@
#define WALLETMODEL_H
#include <QObject>
+#include <string>
class OptionsModel;
class AddressTableModel;
@@ -52,8 +53,6 @@ public:
int getNumTransactions() const;
EncryptionStatus getEncryptionStatus() const;
- bool isEncrypted() const;
-
// Check address for validity
bool validateAddress(const QString &address);
@@ -71,6 +70,38 @@ public:
// Send coins to a list of recipients
SendCoinsReturn sendCoins(const QList<SendCoinsRecipient> &recipients);
+
+ // Wallet encryption
+ bool setWalletEncrypted(bool encrypted, const std::string &passphrase);
+ // Passphrase only needed when unlocking
+ bool setWalletLocked(bool locked, const std::string &passPhrase=std::string());
+ bool changePassphrase(const std::string &oldPass, const std::string &newPass);
+
+ // RAI object for unlocking wallet, returned by requestUnlock()
+ class UnlockContext
+ {
+ public:
+ UnlockContext(WalletModel *wallet, bool valid, bool relock);
+ ~UnlockContext();
+
+ bool isValid() const { return valid; }
+
+ UnlockContext(const UnlockContext& obj)
+ { CopyFrom(obj); }
+ private:
+ UnlockContext& operator=(const UnlockContext& rhs)
+ { CopyFrom(rhs); return *this; }
+
+ private:
+ WalletModel *wallet;
+ bool valid;
+ mutable bool relock; // mutable, as it can be set to false by copying
+
+ void CopyFrom(const UnlockContext& rhs);
+ };
+
+ UnlockContext requestUnlock();
+
private:
CWallet *wallet;
@@ -90,6 +121,7 @@ signals:
void balanceChanged(qint64 balance, qint64 unconfirmedBalance);
void numTransactionsChanged(int count);
void encryptionStatusChanged(int status);
+ void requireUnlock();
// Asynchronous error notification
void error(const QString &title, const QString &message);