GUI: Clear current results before opening XML.
Currently if there were results in the GUI the results from XML file were imported to list of results. This is confusing and not what users usually want to do. This patch makes GUI to clear the results before opening new results from XML file. Ticket #3829 (Rename open xml to import xml)
This commit is contained in:
parent
64e134a144
commit
e490852476
|
@ -608,6 +608,23 @@ void MainWindow::ClearResults()
|
|||
|
||||
void MainWindow::OpenXML()
|
||||
{
|
||||
if (mUI.mResults->HasResults()) {
|
||||
QMessageBox msgBox(this);
|
||||
msgBox.setWindowTitle(tr("Cppcheck"));
|
||||
const QString msg(tr("Current results will be cleared.\n\n"
|
||||
"Opening a new XML file will clear current results."
|
||||
"Do you want to proceed?"));
|
||||
msgBox.setText(msg);
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.addButton(QMessageBox::Yes);
|
||||
msgBox.addButton(QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||
int dlgResult = msgBox.exec();
|
||||
if (dlgResult == QMessageBox::No) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QString selectedFilter;
|
||||
const QString filter(tr("XML files (*.xml)"));
|
||||
QString selectedFile = QFileDialog::getOpenFileName(this,
|
||||
|
@ -617,6 +634,7 @@ void MainWindow::OpenXML()
|
|||
&selectedFilter);
|
||||
|
||||
if (!selectedFile.isEmpty()) {
|
||||
mUI.mResults->Clear();
|
||||
mUI.mResults->ReadErrorsXml(selectedFile);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue