| 1463 | } |
| 1464 | |
| 1465 | void MainWindow::openResults() |
| 1466 | { |
| 1467 | if (mUI->mResults->hasResults()) { |
| 1468 | QMessageBox msgBox(this); |
| 1469 | msgBox.setWindowTitle(tr("Cppcheck")); |
| 1470 | const QString msg(tr("Current results will be cleared.\n\n" |
| 1471 | "Opening a new XML file will clear current results.\n" |
| 1472 | "Do you want to proceed?")); |
| 1473 | msgBox.setText(msg); |
| 1474 | msgBox.setIcon(QMessageBox::Warning); |
| 1475 | msgBox.addButton(QMessageBox::Yes); |
| 1476 | msgBox.addButton(QMessageBox::No); |
| 1477 | msgBox.setDefaultButton(QMessageBox::Yes); |
| 1478 | const int dlgResult = msgBox.exec(); |
| 1479 | if (dlgResult == QMessageBox::No) { |
| 1480 | return; |
| 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | QString selectedFilter; |
| 1485 | const QString filter(tr("XML files (*.xml)")); |
| 1486 | QString selectedFile = QFileDialog::getOpenFileName(this, |
| 1487 | tr("Open the report file"), |
| 1488 | getPath(SETTINGS_LAST_RESULT_PATH), |
| 1489 | filter, |
| 1490 | &selectedFilter); |
| 1491 | |
| 1492 | if (!selectedFile.isEmpty()) { |
| 1493 | loadResults(selectedFile); |
| 1494 | } |
| 1495 | } |
| 1496 | |
| 1497 | void MainWindow::loadResults(const QString &selectedFile) |
| 1498 | { |
nothing calls this directly
no test coverage detected