Skip to content

Commit

Permalink
export file, test for existing with suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Aug 9, 2016
1 parent d2b25e9 commit 0c62b7a
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1284,9 +1284,11 @@ void Song::exportProject( bool multiExport )
efd.setAcceptMode( FileDialog::AcceptSave );


if( efd.exec() == QDialog::Accepted && !efd.selectedFiles().isEmpty() && !efd.selectedFiles()[0].isEmpty() )
if( efd.exec() == QDialog::Accepted && !efd.selectedFiles().isEmpty() &&
!efd.selectedFiles()[0].isEmpty() )
{
QString suffix = "";
QString exportFileName = efd.selectedFiles()[0];
if ( !multiExport )
{
int stx = efd.selectedNameFilter().indexOf( "(*." );
Expand All @@ -1304,7 +1306,24 @@ void Song::exportProject( bool multiExport )
}
}

const QString exportFileName = efd.selectedFiles()[0] + suffix;
exportFileName += suffix;
if( QFileInfo( exportFileName ).exists() )
{
QMessageBox mb;
mb.setWindowTitle( tr( "Export project" ) );
mb.setText( exportFileName + tr( " already exists. "
"Do you want to replace it?" ) );
mb.setIcon( QMessageBox::Warning );
mb.setStandardButtons(
QMessageBox::Yes | QMessageBox::No );

int answer = mb.exec();
if( answer == QMessageBox::No )
{
return;
}
}

ExportProjectDialog epd( exportFileName, gui->mainWindow(), multiExport );
epd.exec();
}
Expand Down

0 comments on commit 0c62b7a

Please sign in to comment.