17 QAbstractTableModel(parent), walletModel(parent)
23 std::vector<std::string> vReceiveRequests;
25 for (
const std::string& request : vReceiveRequests)
55 if(!index.isValid() || index.row() >=
list.length())
58 if(role == Qt::DisplayRole || role == Qt::EditRole)
61 switch(index.column())
68 return tr(
"(no label)");
77 return tr(
"(no message)");
85 return tr(
"(no amount requested)");
86 else if (role == Qt::EditRole)
92 else if (role == Qt::TextAlignmentRole)
94 if (index.column() ==
Amount)
95 return (
int)(Qt::AlignRight|Qt::AlignVCenter);
107 if(orientation == Qt::Horizontal)
109 if(role == Qt::DisplayRole && section <
columns.size())
134 return createIndex(row, column);
141 if(count > 0 && row >= 0 && (row+count) <=
list.size())
144 for (
int i = 0; i < count; ++i)
151 beginRemoveRows(parent, row, row + count - 1);
152 list.erase(
list.begin() + row,
list.begin() + row + count);
162 return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
170 newEntry.
date = QDateTime::currentDateTime();
185 std::vector<char>
data(recipient.begin(), recipient.end());
203 beginInsertRows(QModelIndex(), 0, 0);
204 list.prepend(recipient);
225 if (order == Qt::DescendingOrder)
226 std::swap(pLeft, pRight);
231 return pLeft->
date.toTime_t() < pRight->
date.toTime_t();
239 return pLeft->
id < pRight->
id;
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
bool setData(const QModelIndex &index, const QVariant &value, int role)
void addNewRequest(const SendCoinsRecipient &recipient)
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
static QString format(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard, const int nAssetUnit=MIN_ASSET_UNITS - 1)
Format as string.
int64_t nReceiveRequestsMaxId
~RecentRequestsTableModel()
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
QString dateTimeStr(const QDateTime &date)
Double ended buffer combining vector and stream-like interfaces.
RecentRequestsTableModel(CWallet *wallet, WalletModel *parent)
int getDisplayUnit() const
QList< RecentRequestEntry > list
QVariant headerData(int section, Qt::Orientation orientation, int role) const
int rowCount(const QModelIndex &parent) const
QModelIndex index(int row, int column, const QModelIndex &parent) const
SendCoinsRecipient recipient
const RecentRequestEntry & entry(int row) const
bool operator()(RecentRequestEntry &left, RecentRequestEntry &right) const
QVariant data(const QModelIndex &index, int role) const
WalletModel * walletModel
Interface to Raven wallet from Qt view code.
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
static QString name(int unit)
Short name.
int columnCount(const QModelIndex &parent) const
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
QString getAmountTitle()
Gets title for amount column including current display unit if optionsModel reference available...
OptionsModel * getOptionsModel()
Qt::ItemFlags flags(const QModelIndex &index) const