Commit 4245774c authored by Tobias Hunger's avatar Tobias Hunger

VCS: Add some convenience methods to SubmitFileModel

Change-Id: I7b425883472e00bbdce7f5fcbab3bb6e0e9807e4
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent e733cb21
......@@ -85,6 +85,36 @@ QList<QStandardItem *> SubmitFileModel::rowAt(int row) const
return rc;
}
QString SubmitFileModel::state(int row) const
{
if (row < 0 || row >= rowCount())
return QString();
return item(row)->text();
}
QString SubmitFileModel::file(int row) const
{
if (row < 0 || row >= rowCount())
return QString();
return item(row, 1)->text();
}
bool SubmitFileModel::checked(int row) const
{
if (row < 0 || row >= rowCount())
return false;
return (item(row)->checkState() == Qt::Checked);
}
bool SubmitFileModel::hasCheckedFiles() const
{
for (int i = 0; i < rowCount(); ++i) {
if (checked(i))
return true;
}
return false;
}
QList<QStandardItem *> SubmitFileModel::findRow(const QString &text, int column) const
{
// Single item
......
......@@ -55,6 +55,12 @@ public:
// Convenience to obtain a row
QList<QStandardItem *> rowAt(int row) const;
QString state(int row) const;
QString file(int row) const;
bool checked(int row) const;
bool hasCheckedFiles() const;
// Filter for entries contained in the filter list. Returns the
// number of deleted entries.
unsigned filter(const QStringList &filter, int column);
......
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