Correct file name if user did not specify correct suffix.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-23 13:38:01 +03:00
parent 28fa14cff2
commit af62578652

View File

@ -245,12 +245,13 @@ void TableWindow::saveScene()
return; return;
} }
// what if the users did not specify a suffix...? // what if the user did not specify a suffix...?
QString suf = extByMessage.value(sf);
suf.replace(".", "");
QFileInfo f( name ); QFileInfo f( name );
if (f.suffix().isEmpty() && f.suffix() != "svg" && f.suffix() != "png" && f.suffix() != "pdf" if (f.suffix().isEmpty() || f.suffix() != suf)
&& f.suffix() != "eps" && f.suffix() != "ps")
{ {
name += extByMessage[sf]; name += extByMessage.value(sf);
} }
QBrush *brush = new QBrush(); QBrush *brush = new QBrush();
@ -281,7 +282,7 @@ void TableWindow::saveScene()
PsFile(name); PsFile(name);
break; break;
default: default:
qDebug() << "Bad file suffix"<<Q_FUNC_INFO; qDebug() << "Bad file suffix. File name is "<<name<<Q_FUNC_INFO;
break; break;
} }
paper->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); paper->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));