diff ui/certificatetablemodel.cpp @ 358:9ba7b4b4c1de

Implemented the load from certificate file and set the edit state of certificates.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 10 Apr 2014 17:06:37 +0200
parents 666abcfab229
children 9731d28b95af
line wrap: on
line diff
--- a/ui/certificatetablemodel.cpp	Thu Apr 10 17:04:41 2014 +0200
+++ b/ui/certificatetablemodel.cpp	Thu Apr 10 17:06:37 2014 +0200
@@ -11,10 +11,12 @@
 
 }
 
-void CertificateTabelModel::addCertificate(const Certificate& certificate)
+void CertificateTabelModel::addCertificate(const Certificate& certificate,
+    bool editable)
 {
     beginInsertRows(QModelIndex(), rowCount(), rowCount());
     certificates.append(certificate);
+    certificates.last().setEditable(editable);
     endInsertRows();
 }
 
@@ -38,6 +40,10 @@
         }
         return ret;
     }
+    if (role == Qt::UserRole) {
+        Certificate cert = certificates.at(index.row());
+        return cert.isEditable();
+    }
 
     return QVariant();
 }
@@ -51,6 +57,9 @@
 
     bool newValue = value.toBool();
     Certificate &cert = certificates[index.row()];
+    if (!cert.isEditable()) {
+        return false;
+    }
     cert.setInstallCert(newValue);
 
     emit dataChanged(index, index);

http://wald.intevation.org/projects/trustbridge/