Mercurial > trustbridge
comparison 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 |
comparison
equal
deleted
inserted
replaced
357:d56f952ba817 | 358:9ba7b4b4c1de |
---|---|
93 bottomLayout->setAlignment(Qt::AlignBottom); | 93 bottomLayout->setAlignment(Qt::AlignBottom); |
94 saveButton = new QPushButton(tr("Save")); | 94 saveButton = new QPushButton(tr("Save")); |
95 loadButton = new QPushButton(tr("Load")); | 95 loadButton = new QPushButton(tr("Load")); |
96 connect(loadButton, SIGNAL(clicked()), this, SLOT(loadCertificateFile())); | 96 connect(loadButton, SIGNAL(clicked()), this, SLOT(loadCertificateFile())); |
97 addButton = new QPushButton(tr("Add")); | 97 addButton = new QPushButton(tr("Add")); |
98 connect(addButton, SIGNAL(clicked()), this, SLOT(addCertificates())); | |
98 removeButton = new QPushButton(tr("Remove")); | 99 removeButton = new QPushButton(tr("Remove")); |
99 bottomLayout->addWidget(saveButton); | 100 bottomLayout->addWidget(saveButton); |
100 bottomLayout->addWidget(loadButton); | 101 bottomLayout->addWidget(loadButton); |
101 bottomLayout->addWidget(addButton); | 102 bottomLayout->addWidget(addButton); |
102 bottomLayout->addWidget(removeButton); | 103 bottomLayout->addWidget(removeButton); |
127 else { | 128 else { |
128 loadCertificateTable(); | 129 loadCertificateTable(); |
129 } | 130 } |
130 } | 131 } |
131 | 132 |
133 void AdministratorWindow::addCertificates() | |
134 { | |
135 QString certFile = QFileDialog::getOpenFileName( | |
136 this, tr("Select certificate"), "/home/rrenkert/local-home/projects/m13/src/repo/ui/tests/data/", "*.pem *.der"); | |
137 QList<Certificate> certs = Certificate::fromFileName(certFile); | |
138 addToCertificateTable(certs); | |
139 } | |
140 | |
132 void AdministratorWindow::loadCertificateTable() { | 141 void AdministratorWindow::loadCertificateTable() { |
133 foreach(const Certificate &cert, certList.getCertificates()) { | 142 foreach(const Certificate &cert, certList.getCertificates()) { |
134 certificateModel->addCertificate(cert); | 143 certificateModel->addCertificate(cert, true); |
144 } | |
145 } | |
146 | |
147 void AdministratorWindow::addToCertificateTable(const QList<Certificate> &certs) | |
148 { | |
149 foreach(const Certificate &cert, certs) { | |
150 certificateModel->addCertificate(cert, false); | |
135 } | 151 } |
136 } | 152 } |
137 | 153 |
138 void AdministratorWindow::showSettings() | 154 void AdministratorWindow::showSettings() |
139 { | 155 { |