Fix #981 (GUI saves report with wrong extension)

Apply patch from robertreif
http://sourceforge.net/apps/trac/cppcheck/ticket/981
This commit is contained in:
Reijo Tomperi 2009-11-20 00:19:44 +02:00
parent 5369965e55
commit 74cefb7f3a
1 changed files with 11 additions and 2 deletions

View File

@ -529,7 +529,7 @@ void MainWindow::Save()
if (!selectedFile.isEmpty())
{
Report::Type type;
Report::Type type = Report::TXT;
if (selectedFilter == tr("XML files (*.xml)"))
{
type = Report::XML;
@ -542,12 +542,21 @@ void MainWindow::Save()
if (!selectedFile.endsWith(".txt", Qt::CaseInsensitive))
selectedFile += ".txt";
}
else
else if (selectedFilter == tr("CSV files (*.csv)"))
{
type = Report::CSV;
if (!selectedFile.endsWith(".csv", Qt::CaseInsensitive))
selectedFile += ".csv";
}
else
{
if (selectedFile.endsWith(".xml", Qt::CaseInsensitive))
type = Report::XML;
else if (selectedFile.endsWith(".txt", Qt::CaseInsensitive))
type = Report::TXT;
else if (selectedFile.endsWith(".csv", Qt::CaseInsensitive))
type = Report::CSV;
}
mUI.mResults->Save(selectedFile, type);
}