Commit 081138ac authored by Karel Slaný's avatar Karel Slaný

Added DataboxListModel::allEntries().

parent 1358c874
......@@ -247,6 +247,25 @@ QVariant DataboxListModel::data(const QModelIndex &index, int role) const
return QVariant();
}
QList<DataboxModelEntry> DataboxListModel::allEntries(void) const
{
QList<DataboxModelEntry> entries;
foreach (const QString &boxId, m_boxIds) {
QMap<QString, InternalEntry>::const_iterator it =
m_entries.find(boxId);
if (Q_UNLIKELY(it == m_entries.end())) {
continue;
}
if (Q_UNLIKELY(it->entry.dbID().isEmpty())) {
continue;
}
entries.append(it->entry);
}
return entries;
}
bool DataboxListModel::addEntry(const DataboxModelEntry &entry)
{
const QString key(entry.dbID());
......
......@@ -196,6 +196,13 @@ public:
virtual
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
/*!
* @brief Return list of all entries.
*
* @return List of all entries.
*/
QList<DataboxModelEntry> allEntries(void) const;
/*!
* @brief Add data-box entry into model.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment