Skip to content
Permalink
Browse files

Use non-native dialog in case the cancel all dialog is needed. Fixes …

…bug #1317

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11808 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Oct 15, 2009
1 parent 178065b commit 34f0f6f53a4cb50914e88f093243a6cbb2bc65d3
Showing with 30 additions and 2 deletions.
  1. +30 −2 src/app/qgisapp.cpp
@@ -2297,6 +2297,8 @@ static void buildSupportedVectorFileFilter_( QString & fileFilters )
the current working directory if this is the first time invoked
with the current filter name.
This method returns true if cancel all was clicked, otherwise false
*/

static bool openFilesRememberingFilter_( QString const &filterName,
@@ -2317,7 +2319,34 @@ static bool openFilesRememberingFilter_( QString const &filterName,
QString lastUsedDir = settings.value( "/UI/" + filterName + "Dir", "." ).toString();

QgsDebugMsg( "Opening file dialog with filters: " + filters );
selectedFiles = QFileDialog::getOpenFileNames( 0, title, lastUsedDir, filters, &lastUsedFilter );
if ( !cancelAll )
{
selectedFiles = QFileDialog::getOpenFileNames( 0, title, lastUsedDir, filters, &lastUsedFilter );
}
else //we have to use non-native dialog to add cancel all button
{
QgsEncodingFileDialog* openFileDialog = new QgsEncodingFileDialog( 0, title, lastUsedDir, filters, QString( "" ) );
// allow for selection of more than one file
openFileDialog->setFileMode( QFileDialog::ExistingFiles );
if ( haveLastUsedFilter ) // set the filter to the last one used
{
openFileDialog->selectFilter( lastUsedFilter );
}
openFileDialog->addCancelAll();
if ( openFileDialog->exec() == QDialog::Accepted )
{
selectedFiles = openFileDialog->selectedFiles();
}
else
{
//cancel or cancel all?
if ( openFileDialog->cancelAll() )
{
return true;
}
}
}

if ( !selectedFiles.isEmpty() )
{
// Fix by Tim - getting the dirPath from the dialog
@@ -2331,7 +2360,6 @@ static bool openFilesRememberingFilter_( QString const &filterName,

settings.setValue( "/UI/" + filterName, lastUsedFilter );
settings.setValue( "/UI/" + filterName + "Dir", myPath );
return true;
}
return false;
} // openFilesRememberingFilter_

0 comments on commit 34f0f6f

Please sign in to comment.
You can’t perform that action at this time.