aboutsummaryrefslogtreecommitdiff
path: root/src/qt/recentrequeststablemodel.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-11-05 18:03:05 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2013-11-19 14:07:38 +0100
commit666893b1facfbc748de760e6aeb6bc26bd3797f3 (patch)
treeb77cf8d12a7f92178bb8f87ec8124d745ff2257b /src/qt/recentrequeststablemodel.h
parent71f97ea2a71471f383b7e78ce57eb76a76c5c933 (diff)
qt: keep a list of requested payments
Keep a list of requested payments in the Receive tab so that a user can recall previously created requests after closing their windows. Currently this list is not stored between bitcoin-qt sessions. This can be implemented later, but it is not clear where it should be stored as I don't think it belongs in the wallet (maybe in QSettings?)
Diffstat (limited to 'src/qt/recentrequeststablemodel.h')
-rw-r--r--src/qt/recentrequeststablemodel.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/qt/recentrequeststablemodel.h b/src/qt/recentrequeststablemodel.h
new file mode 100644
index 0000000000..d00a2a9055
--- /dev/null
+++ b/src/qt/recentrequeststablemodel.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef RECENTREQUESTSTABLEMODEL_H
+#define RECENTREQUESTSTABLEMODEL_H
+
+#include <QAbstractTableModel>
+#include <QStringList>
+#include <QDateTime>
+
+#include "walletmodel.h"
+
+class CWallet;
+
+struct RecentRequestEntry
+{
+ QDateTime date;
+ SendCoinsRecipient recipient;
+};
+
+/** Model for list of recently generated payment requests / bitcoin URIs.
+ * Part of wallet model.
+ */
+class RecentRequestsTableModel: public QAbstractTableModel
+{
+ Q_OBJECT
+
+public:
+ explicit RecentRequestsTableModel(CWallet *wallet, WalletModel *parent = 0);
+ ~RecentRequestsTableModel();
+
+ enum ColumnIndex {
+ Date = 0,
+ Label = 1,
+ Message = 2,
+ Amount = 3
+ };
+
+ /** @name Methods overridden from QAbstractTableModel
+ @{*/
+ int rowCount(const QModelIndex &parent) const;
+ int columnCount(const QModelIndex &parent) const;
+ QVariant data(const QModelIndex &index, int role) const;
+ bool setData(const QModelIndex &index, const QVariant &value, int role);
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent) const;
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+ /*@}*/
+
+ const RecentRequestEntry &entry(int row) const { return list[row]; }
+ void addNewRequest(const SendCoinsRecipient &recipient);
+
+private:
+ WalletModel *walletModel;
+ QStringList columns;
+ QList<RecentRequestEntry> list;
+};
+
+#endif