Mercurial > trustbridge
diff ui/certificatetablemodel.cpp @ 463:5200b8e9b2ae
Rename tablemodel certificates and add accessors
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 23 Apr 2014 15:33:09 +0000 |
parents | 847fdfd33a22 |
children | 320a64d58e62 |
line wrap: on
line diff
--- a/ui/certificatetablemodel.cpp Wed Apr 23 15:32:24 2014 +0000 +++ b/ui/certificatetablemodel.cpp Wed Apr 23 15:33:09 2014 +0000 @@ -27,8 +27,8 @@ bool editable) { beginInsertRows(QModelIndex(), rowCount(), rowCount()); - certificates.append(certificate); - certificates.last().setEditable(editable); + mCertificates.append(certificate); + mCertificates.last().setEditable(editable); endInsertRows(); } @@ -36,11 +36,11 @@ const QModelIndex &index) { beginRemoveRows(QModelIndex(), row, row + count - 1); - if ((row + count - 1) > certificates.size()) { + if ((row + count - 1) > mCertificates.size()) { return false; } for (int i = row + count - 1; i >= row; i--) { - certificates.removeAt(i); + mCertificates.removeAt(i); } endRemoveRows(); return true; @@ -48,18 +48,18 @@ bool CertificateTabelModel::removeAll() { - return removeRows(0, certificates.size(), QModelIndex()); + return removeRows(0, mCertificates.size(), QModelIndex()); } QVariant CertificateTabelModel::data(const QModelIndex &index, int role) const { - if (index.row() > certificates.size() || index.row() < 0) { + if (index.row() > mCertificates.size() || index.row() < 0) { return QVariant(); } if (role == Qt::DisplayRole) { - Certificate cert = certificates.at(index.row()); + Certificate cert = mCertificates.at(index.row()); QVariant ret; switch(index.column()) { case 0: ret = cert.isInstallCert(); break; @@ -75,7 +75,7 @@ return ret; } if (role == Qt::UserRole) { - Certificate cert = certificates.at(index.row()); + Certificate cert = mCertificates.at(index.row()); return cert.isEditable(); } if (role == Qt::FontRole && index.column() == 7) { @@ -89,12 +89,12 @@ bool CertificateTabelModel::setData(const QModelIndex &index, const QVariant &value, int role) { - if (index.row() > certificates.size() || index.row() < 0) { + if (index.row() > mCertificates.size() || index.row() < 0) { return false; } bool newValue = value.toBool(); - Certificate &cert = certificates[index.row()]; + Certificate &cert = mCertificates[index.row()]; if (!cert.isEditable()) { return false; } @@ -116,7 +116,7 @@ int CertificateTabelModel::rowCount(const QModelIndex&) const { - return certificates.size(); + return mCertificates.size(); } int CertificateTabelModel::columnCount(const QModelIndex&) const