comparison ui/administratorwindow.cpp @ 681:5e25159d7025

Merged
author Sascha Wilde <wilde@intevation.de>
date Mon, 30 Jun 2014 18:35:22 +0200
parents 75cd2fbf9ac6
children 0b7bb4f68f5a
comparison
equal deleted inserted replaced
680:a5a709c6ce93 681:5e25159d7025
222 else { 222 else {
223 removeButton->setEnabled(true); 223 removeButton->setEnabled(true);
224 } 224 }
225 } 225 }
226 226
227 void AdministratorWindow::logChanges(const QString &currentCerts) 227 void AdministratorWindow::logChanges(const QString &currentCerts, const QString& keyFingerprint)
228 { 228 {
229 QDir logDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); 229 QDir logDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
230 QString logFilePath = logDir.filePath("log.txt"); 230 QString logFilePath = logDir.filePath("log.txt");
231 QFile logFile(logFilePath); 231 QFile logFile(logFilePath);
232 232
237 return; 237 return;
238 } 238 }
239 239
240 CertificateList newCertList; 240 CertificateList newCertList;
241 newCertList.readList(currentCerts.toLocal8Bit()); 241 newCertList.readList(currentCerts.toLocal8Bit());
242 QByteArray entries = createLogEntries(newCertList); 242 QByteArray entries = createLogEntries(newCertList, keyFingerprint);
243 if(logFile.write(entries) != entries.size()) { 243 if(logFile.write(entries) != entries.size()) {
244 QMessageBox::warning(this, tr("Error!"), tr("Failed to write log file: ") + 244 QMessageBox::warning(this, tr("Error!"), tr("Failed to write log file: ") +
245 logFilePath + tr(" Changes are not logged!")); 245 logFilePath + tr(" Changes are not logged!"));
246 return; 246 return;
247 } 247 }
248 logFile.close(); 248 logFile.close();
249 } 249 }
250 250
251 QByteArray AdministratorWindow::createLogEntries(const CertificateList &list) 251 QByteArray AdministratorWindow::createLogEntries(const CertificateList &list, const QString& keyFingerprint)
252 { 252 {
253 QByteArray entries; 253 QByteArray entries;
254 QByteArray removeListEntries; 254 QByteArray removeListEntries;
255 255
256 QDateTime currentDate = QDateTime::currentDateTime(); 256 QDateTime currentDate = QDateTime::currentDateTime();
263 newListDate.toString(Qt::ISODate) + 263 newListDate.toString(Qt::ISODate) +
264 tr(" based on list from ") + 264 tr(" based on list from ") +
265 listDate.toString(Qt::ISODate) + 265 listDate.toString(Qt::ISODate) +
266 "#####\r\n"); 266 "#####\r\n");
267 entries.append(tr("signing certificate: \r\n")); 267 entries.append(tr("signing certificate: \r\n"));
268 entries.append(tr("new certificates:\r\n")); 268 entries.append(keyFingerprint);
269
270 entries.append(tr("\r\nnew certificates:\r\n"));
269 271
270 foreach (const Certificate& cert, list.getCertificates()) { 272 foreach (const Certificate& cert, list.getCertificates()) {
271 if (!mCertList.getCertificates().contains(cert)) { 273 if (!mCertList.getCertificates().contains(cert)) {
272 QString certEntry(cert.subjectCN() + ": " + cert.base64Line() + "\r\n"); 274 QString certEntry(cert.subjectCN() + ": " + cert.base64Line() + "\r\n");
273 if (cert.isInstallCert()) { 275 if (cert.isInstallCert()) {

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