Mercurial > trustbridge
comparison ui/certificatetablemodel.cpp @ 376:9731d28b95af
Implemented 'remove certificate' in administrator app.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 15 Apr 2014 12:32:34 +0200 |
parents | 9ba7b4b4c1de |
children | 31079bd54036 |
comparison
equal
deleted
inserted
replaced
369:78eec57bc133 | 376:9731d28b95af |
---|---|
16 { | 16 { |
17 beginInsertRows(QModelIndex(), rowCount(), rowCount()); | 17 beginInsertRows(QModelIndex(), rowCount(), rowCount()); |
18 certificates.append(certificate); | 18 certificates.append(certificate); |
19 certificates.last().setEditable(editable); | 19 certificates.last().setEditable(editable); |
20 endInsertRows(); | 20 endInsertRows(); |
21 } | |
22 | |
23 bool CertificateTabelModel::removeRows(int row, int count, | |
24 const QModelIndex &index) | |
25 { | |
26 beginRemoveRows(QModelIndex(), row, row + count - 1); | |
27 if ((row + count - 1) > certificates.size()) { | |
28 return false; | |
29 } | |
30 for (int i = row + count - 1; i >= row; i--) { | |
31 if (!certificates.at(i).isEditable()) { | |
32 certificates.removeAt(i); | |
33 } | |
34 } | |
35 endRemoveRows(); | |
36 return true; | |
21 } | 37 } |
22 | 38 |
23 QVariant CertificateTabelModel::data(const QModelIndex &index, | 39 QVariant CertificateTabelModel::data(const QModelIndex &index, |
24 int role) const | 40 int role) const |
25 { | 41 { |