16 QAbstractTableModel(parent), walletModel(parent)
22 std::vector<std::string> vReceiveRequests;
24 for (
const std::string& request : vReceiveRequests)
54 if(!index.isValid() || index.row() >=
list.length())
57 if(role == Qt::DisplayRole || role == Qt::EditRole)
60 switch(index.column())
67 return tr(
"(no label)");
76 return tr(
"(no message)");
84 return tr(
"(no amount requested)");
85 else if (role == Qt::EditRole)
91 else if (role == Qt::TextAlignmentRole)
93 if (index.column() ==
Amount)
94 return (
int)(Qt::AlignRight|Qt::AlignVCenter);
106 if(orientation == Qt::Horizontal)
108 if(role == Qt::DisplayRole && section <
columns.size())
133 return createIndex(row, column);
140 if(count > 0 && row >= 0 && (row+count) <=
list.size())
143 for (
int i = 0; i <
count; ++i)
150 beginRemoveRows(parent, row, row + count - 1);
161 return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
169 newEntry.
date = QDateTime::currentDateTime();
184 std::vector<char>
data(recipient.begin(), recipient.end());
202 beginInsertRows(QModelIndex(), 0, 0);
203 list.prepend(recipient);
222 if (order == Qt::DescendingOrder)
228 return pLeft->
date.toTime_t() < pRight->
date.toTime_t();
236 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)
int64_t nReceiveRequestsMaxId
QModelIndex index(int row, int column, const QModelIndex &parent) const
~RecentRequestsTableModel()
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
void swap(dev::eth::Watch &_a, dev::eth::Watch &_b)
QString dateTimeStr(const QDateTime &date)
Double ended buffer combining vector and stream-like interfaces.
RecentRequestsTableModel(CWallet *wallet, WalletModel *parent)
const RecentRequestEntry & entry(int row) const
Qt::ItemFlags flags(const QModelIndex &index) const
QVariant data(const QModelIndex &index, int role) const
QList< RecentRequestEntry > list
int rowCount(const QModelIndex &parent) const
static QString format(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string.
SendCoinsRecipient recipient
bool operator()(RecentRequestEntry &left, RecentRequestEntry &right) const
WalletModel * walletModel
static QString name(int unit)
Short name.
Interface to Fabcoin wallet from Qt view code.
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
QVariant headerData(int section, Qt::Orientation orientation, int role) const
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
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()