14 #include <boost/foreach.hpp>
17 QAbstractTableModel(parent), walletModel(parent)
23 std::vector<std::string> vReceiveRequests;
25 BOOST_FOREACH(
const std::string& request, vReceiveRequests)
60 if(role == Qt::DisplayRole || role == Qt::EditRole)
62 switch(
index.column())
69 return tr(
"(no label)");
78 return tr(
"(no message)");
86 return tr(
"(no amount requested)");
87 else if (role == Qt::EditRole)
93 else if (role == Qt::TextAlignmentRole)
96 return (
int)(Qt::AlignRight|Qt::AlignVCenter);
108 if(orientation == Qt::Horizontal)
110 if(role == Qt::DisplayRole && section <
columns.size())
135 return createIndex(row, column);
142 if(count > 0 && row >= 0 && (row+count) <=
list.size())
145 for (
int i = 0; i < count; ++i)
152 beginRemoveRows(parent, row, row + count - 1);
153 list.erase(
list.begin() + row,
list.begin() + row + count);
163 return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
171 newEntry.
date = QDateTime::currentDateTime();
186 std::vector<char>
data(recipient.begin(), recipient.end());
204 beginInsertRows(QModelIndex(), 0, 0);
205 list.prepend(recipient);
224 if (
order == Qt::DescendingOrder)
225 std::swap(pLeft, pRight);
230 return pLeft->
date.toTime_t() < pRight->
date.toTime_t();
238 return pLeft->
id < pRight->
id;
static QString name(int unit)
Short name.
static QString format(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string.
Double ended buffer combining vector and stream-like interfaces.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
SendCoinsRecipient recipient
bool operator()(RecentRequestEntry &left, RecentRequestEntry &right) const
int rowCount(const QModelIndex &parent) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
bool setData(const QModelIndex &index, const QVariant &value, int role)
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
~RecentRequestsTableModel()
Qt::ItemFlags flags(const QModelIndex &index) const
int columnCount(const QModelIndex &parent) const
const RecentRequestEntry & entry(int row) const
QModelIndex index(int row, int column, const QModelIndex &parent) const
QList< RecentRequestEntry > list
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
QString getAmountTitle()
Gets title for amount column including current display unit if optionsModel reference available.
RecentRequestsTableModel(CWallet *wallet, WalletModel *parent)
QVariant data(const QModelIndex &index, int role) const
WalletModel * walletModel
void addNewRequest(const SendCoinsRecipient &recipient)
int64_t nReceiveRequestsMaxId
Interface to Bitcoin wallet from Qt view code.
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
OptionsModel * getOptionsModel()
QString dateTimeStr(const QDateTime &date)