comparison ui/administratorwindow.cpp @ 570:c9d296f04995

Inform the user when logging fails.
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 23 May 2014 16:16:33 +0000
parents 75e39c52aa94
children 75cd2fbf9ac6
comparison
equal deleted inserted replaced
569:6677d4ecb6fd 570:c9d296f04995
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
233 if (!logFile.open(QIODevice::Append)) { 233 if (!logFile.open(QIODevice::Append)) {
234 QMessageBox::warning(this, tr("Error!"), tr("Failed to open log file: ") +
235 logFilePath + tr(" Changes are not logged!"));
234 qDebug() << "Failed to open log file: " << logFilePath; 236 qDebug() << "Failed to open log file: " << logFilePath;
235 return; 237 return;
236 } 238 }
237 239
238 CertificateList newCertList; 240 CertificateList newCertList;
239 newCertList.readList(currentCerts.toLocal8Bit()); 241 newCertList.readList(currentCerts.toLocal8Bit());
240 QByteArray entries = createLogEntries(newCertList); 242 QByteArray entries = createLogEntries(newCertList);
241 if(logFile.write(entries) != entries.size()) { 243 if(logFile.write(entries) != entries.size()) {
242 qDebug() << "Failed to write log file: " << logFilePath; 244 QMessageBox::warning(this, tr("Error!"), tr("Failed to write log file: ") +
245 logFilePath + tr(" Changes are not logged!"));
243 return; 246 return;
244 } 247 }
245 logFile.close(); 248 logFile.close();
246 } 249 }
247 250

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