aboutsummaryrefslogtreecommitdiff
path: root/src/qt/walletmodel.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-01-22 08:07:19 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-01-22 08:07:56 +0100
commitceab53b41da4e812a63a7a7d6d05e9ed246a5cd5 (patch)
treefafe0f2960aff0fa77f2a30c5aadc436a76b7f01 /src/qt/walletmodel.h
parent6586bc3b51ac0a3891ff6297e1aea791ff331cd3 (diff)
parent4d901023b732efb492d89cebd8555c689ab7663e (diff)
downloadbitcoin-ceab53b41da4e812a63a7a7d6d05e9ed246a5cd5.tar.xz
Merge pull request #3521
4d90102 [Qt] Add sorting feature to the requested payments table (Cozz Lovan) 8476d5d [Qt] Permanently store requested payments in wallet (Cozz Lovan) b10e147 wallet: add interface for storing generic data on destinations (Wladimir J. van der Laan)
Diffstat (limited to 'src/qt/walletmodel.h')
-rw-r--r--src/qt/walletmodel.h42
1 files changed, 40 insertions, 2 deletions
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h
index 1a4d25615a..600bef346b 100644
--- a/src/qt/walletmodel.h
+++ b/src/qt/walletmodel.h
@@ -36,9 +36,9 @@ QT_END_NAMESPACE
class SendCoinsRecipient
{
public:
- explicit SendCoinsRecipient() : amount(0) { }
+ explicit SendCoinsRecipient() : amount(0), nVersion(SendCoinsRecipient::CURRENT_VERSION) { }
explicit SendCoinsRecipient(const QString &addr, const QString &label, quint64 amount, const QString &message):
- address(addr), label(label), amount(amount), message(message) {}
+ address(addr), label(label), amount(amount), message(message), nVersion(SendCoinsRecipient::CURRENT_VERSION) {}
// If from an insecure payment request, this is used for storing
// the addresses, e.g. address-A<br />address-B<br />address-C.
@@ -55,6 +55,41 @@ public:
PaymentRequestPlus paymentRequest;
// Empty if no authentication or invalid signature/cert/etc.
QString authenticatedMerchant;
+
+ static const int CURRENT_VERSION=1;
+ int nVersion;
+
+ IMPLEMENT_SERIALIZE
+ (
+ SendCoinsRecipient* pthis = const_cast<SendCoinsRecipient*>(this);
+
+ std::string sAddress = pthis->address.toStdString();
+ std::string sLabel = pthis->label.toStdString();
+ std::string sMessage = pthis->message.toStdString();
+ std::string sPaymentRequest;
+ if (!fRead && pthis->paymentRequest.IsInitialized())
+ pthis->paymentRequest.SerializeToString(&sPaymentRequest);
+ std::string sAuthenticatedMerchant = pthis->authenticatedMerchant.toStdString();
+
+ READWRITE(pthis->nVersion);
+ nVersion = pthis->nVersion;
+ READWRITE(sAddress);
+ READWRITE(sLabel);
+ READWRITE(amount);
+ READWRITE(sMessage);
+ READWRITE(sPaymentRequest);
+ READWRITE(sAuthenticatedMerchant);
+
+ if (fRead)
+ {
+ pthis->address = QString::fromStdString(sAddress);
+ pthis->label = QString::fromStdString(sLabel);
+ pthis->message = QString::fromStdString(sMessage);
+ if (!sPaymentRequest.empty())
+ pthis->paymentRequest.parse(QByteArray::fromRawData(sPaymentRequest.data(), sPaymentRequest.size()));
+ pthis->authenticatedMerchant = QString::fromStdString(sAuthenticatedMerchant);
+ }
+ )
};
/** Interface to Bitcoin wallet from Qt view code. */
@@ -152,6 +187,9 @@ public:
void unlockCoin(COutPoint& output);
void listLockedCoins(std::vector<COutPoint>& vOutpts);
+ void loadReceiveRequests(std::vector<std::string>& vReceiveRequests);
+ bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest);
+
private:
CWallet *wallet;