VCS: Add some convenience methods to SubmitFileModel

Change-Id: I7b425883472e00bbdce7f5fcbab3bb6e0e9807e4
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Tobias Hunger
2011-10-19 14:58:12 +00:00
parent e733cb2155
commit 4245774cf2
2 changed files with 36 additions and 0 deletions

View File

@@ -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