Fixed issue #8.

--HG--
branch : develop
This commit is contained in:
dismine 2014-01-15 11:04:53 +02:00
parent 6d0302feaf
commit 129f9b9e24

View File

@ -979,17 +979,17 @@ void MainWindow::ActionDetails(bool checked)
void MainWindow::ActionSaveAs() void MainWindow::ActionSaveAs()
{ {
QString filters(tr("Lekalo files (*.xml);;All files (*.*)")); QString filters(tr("Pattern files (*.val)"));
QString defaultFilter(tr("Lekalo files (*.xml)")); QString fName = QFileDialog::getSaveFileName(this, tr("Save as"), QDir::homePath(), filters);
QString fName = QFileDialog::getSaveFileName(this, tr("Save as"), QDir::homePath(),
filters, &defaultFilter);
if (fName.isEmpty()) if (fName.isEmpty())
{ {
return; return;
} }
if (fName.indexOf(".xml", fName.size()-4)<0) QFileInfo f( fName );
if (f.suffix().isEmpty() && f.suffix() != "val")
{ {
fName.append(".xml"); fName += ".val";
} }
fileName = fName; fileName = fName;
@ -1025,7 +1025,7 @@ void MainWindow::ActionSave()
void MainWindow::ActionOpen() void MainWindow::ActionOpen()
{ {
QString filter(tr("Lekalo files (*.xml)")); QString filter(tr("Pattern files (*.val)"));
QString fName = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter); QString fName = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
if (fName.isEmpty()) if (fName.isEmpty())
{ {