Commit 08062ae3 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Comments.

parent 1c64dc6d
...@@ -246,9 +246,11 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg ) ...@@ -246,9 +246,11 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
{ {
if( p_arg == NULL ) if( p_arg == NULL )
{ {
msg_Dbg( p_intf, "openFileGenericDialog() called with NULL arg" ); msg_Warn( p_intf, "openFileGenericDialog() called with NULL arg" );
return; return;
} }
/* Replace the extensions to a Qt format */
int i = 0; int i = 0;
QString extensions = qfu( p_arg->psz_extensions ); QString extensions = qfu( p_arg->psz_extensions );
while ( ( i = extensions.indexOf( "|", i ) ) != -1 ) while ( ( i = extensions.indexOf( "|", i ) ) != -1 )
...@@ -260,29 +262,38 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg ) ...@@ -260,29 +262,38 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
} }
extensions.replace(QString(";*"), QString(" *")); extensions.replace(QString(";*"), QString(" *"));
extensions.append( ")" ); extensions.append( ")" );
/* Save */
if( p_arg->b_save ) if( p_arg->b_save )
{ {
QString file = QFileDialog::getSaveFileName( NULL, p_arg->psz_title, qfu( p_intf->p_sys->psz_filepath ), extensions ); QString file = QFileDialog::getSaveFileName( NULL, p_arg->psz_title,
qfu( p_intf->p_sys->psz_filepath ), extensions );
if( !file.isEmpty() ) if( !file.isEmpty() )
{ {
p_arg->i_results = 1; p_arg->i_results = 1;
p_arg->psz_results = ( char ** )malloc( p_arg->i_results * sizeof( char * ) ); p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
p_arg->psz_results[0] = strdup( qtu( file ) ); p_arg->psz_results[0] = strdup( qtu( file ) );
} }
else else
p_arg->i_results = 0; p_arg->i_results = 0;
} }
else else /* non-save mode */
{ {
QStringList files = QFileDialog::getOpenFileNames( NULL, p_arg->psz_title, qfu( p_intf->p_sys->psz_filepath ), extensions ); QStringList files = QFileDialog::getOpenFileNames( NULL,
p_arg->psz_title, qfu( p_intf->p_sys->psz_filepath ),
extensions );
p_arg->i_results = files.count(); p_arg->i_results = files.count();
p_arg->psz_results = ( char ** )malloc( p_arg->i_results * sizeof( char * ) ); p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
i = 0; i = 0;
foreach( QString file, files ) foreach( QString file, files )
p_arg->psz_results[i++] = strdup( qtu( file ) ); p_arg->psz_results[i++] = strdup( qtu( file ) );
} }
/* Callback */
if( p_arg->pf_callback ) if( p_arg->pf_callback )
p_arg->pf_callback( p_arg ); p_arg->pf_callback( p_arg );
/* Clean afterwards */
if( p_arg->psz_results ) if( p_arg->psz_results )
{ {
for( i = 0; i < p_arg->i_results; i++ ) for( i = 0; i < p_arg->i_results; i++ )
...@@ -293,6 +304,7 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg ) ...@@ -293,6 +304,7 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
free( p_arg->psz_extensions ); free( p_arg->psz_extensions );
free( p_arg ); free( p_arg );
} }
void DialogsProvider::openFileDialog() void DialogsProvider::openFileDialog()
{ {
openDialog( OPEN_FILE_TAB ); openDialog( OPEN_FILE_TAB );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment