diff ui/administratorwindow.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 e6aa82466420
children 857ae1ffdd6f
line wrap: on
line diff
--- a/ui/administratorwindow.cpp	Thu Apr 10 17:04:41 2014 +0200
+++ b/ui/administratorwindow.cpp	Thu Apr 10 17:06:37 2014 +0200
@@ -95,6 +95,7 @@
     loadButton = new QPushButton(tr("Load"));
     connect(loadButton, SIGNAL(clicked()), this, SLOT(loadCertificateFile()));
     addButton = new QPushButton(tr("Add"));
+    connect(addButton, SIGNAL(clicked()), this, SLOT(addCertificates()));
     removeButton = new QPushButton(tr("Remove"));
     bottomLayout->addWidget(saveButton);
     bottomLayout->addWidget(loadButton);
@@ -129,9 +130,24 @@
     }
 }
 
+void AdministratorWindow::addCertificates()
+{
+    QString certFile = QFileDialog::getOpenFileName(
+        this, tr("Select certificate"), "/home/rrenkert/local-home/projects/m13/src/repo/ui/tests/data/", "*.pem *.der");
+    QList<Certificate> certs = Certificate::fromFileName(certFile);
+    addToCertificateTable(certs);
+}
+
 void AdministratorWindow::loadCertificateTable() {
     foreach(const Certificate &cert, certList.getCertificates()) {
-        certificateModel->addCertificate(cert);
+        certificateModel->addCertificate(cert, true);
+    }
+}
+
+void AdministratorWindow::addToCertificateTable(const QList<Certificate> &certs)
+{
+    foreach(const Certificate &cert, certs) {
+        certificateModel->addCertificate(cert, false);
     }
 }
 

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