When hitting 'save as' ask for a filename even if one is set.

This commit is contained in:
dfighter1985 2014-07-30 15:55:09 +02:00
parent 6386c5aac4
commit ab2e54a3c8
2 changed files with 14 additions and 8 deletions

View file

@ -200,23 +200,28 @@ TileEditorMainWindow::~TileEditorMainWindow()
void TileEditorMainWindow::save()
{
if( m_fileName.isEmpty() )
saveAs();
else
saveAs( m_fileName );
}
void TileEditorMainWindow::saveAs()
{
if( m_fileName.isEmpty() )
{
m_fileName = QFileDialog::getSaveFileName( this,
QString fn = QFileDialog::getSaveFileName( this,
tr( "Save TileBank as..." ),
"",
tr( "TileBank files (*.tilebank)" ) );
if( m_fileName.isEmpty() )
if( fn.isEmpty() )
return;
saveAs( fn );
}
void TileEditorMainWindow::saveAs( const QString &fn )
{
QList< QString > landNames;
int c = m_ui->landLW->count();
@ -227,7 +232,7 @@ void TileEditorMainWindow::saveAs()
}
TileBankSaver saver;
bool ok = saver.save( m_fileName.toUtf8().constData(), m_tileModel, m_lands );
bool ok = saver.save( fn.toUtf8().constData(), m_tileModel, m_lands );
if( !ok )
{

View file

@ -47,6 +47,7 @@ public:
public Q_SLOTS:
void save();
void saveAs();
void saveAs( const QString &fn );
void open();
private Q_SLOTS: