| 213 | } |
| 214 | |
| 215 | void ResultsView::save(const QString &filename, Report::Type type, const QString& productName) const |
| 216 | { |
| 217 | Report *report = nullptr; |
| 218 | |
| 219 | switch (type) { |
| 220 | case Report::CSV: |
| 221 | report = new CsvReport(filename); |
| 222 | break; |
| 223 | case Report::TXT: |
| 224 | report = new TxtReport(filename); |
| 225 | break; |
| 226 | case Report::XMLV2: |
| 227 | report = new XmlReportV2(filename, productName); |
| 228 | break; |
| 229 | } |
| 230 | |
| 231 | if (report) { |
| 232 | if (report->create()) |
| 233 | mUI->mTree->saveResults(report); |
| 234 | else { |
| 235 | QMessageBox msgBox; |
| 236 | msgBox.setText(tr("Failed to save the report.")); |
| 237 | msgBox.setIcon(QMessageBox::Critical); |
| 238 | msgBox.exec(); |
| 239 | } |
| 240 | delete report; |
| 241 | report = nullptr; |
| 242 | } else { |
| 243 | QMessageBox msgBox; |
| 244 | msgBox.setText(tr("Failed to save the report.")); |
| 245 | msgBox.setIcon(QMessageBox::Critical); |
| 246 | msgBox.exec(); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | void ResultsView::print() |
| 251 | { |
nothing calls this directly
no test coverage detected