[QGIS Commit] r11808 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Oct 15 05:17:20 EDT 2009
Author: mhugent
Date: 2009-10-15 05:17:18 -0400 (Thu, 15 Oct 2009)
New Revision: 11808
Modified:
trunk/qgis/src/app/qgisapp.cpp
Log:
Use non-native dialog in case the cancel all dialog is needed. Fixes bug #1317
Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp 2009-10-15 08:16:59 UTC (rev 11807)
+++ trunk/qgis/src/app/qgisapp.cpp 2009-10-15 09:17:18 UTC (rev 11808)
@@ -2297,6 +2297,8 @@
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 @@
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 @@
settings.setValue( "/UI/" + filterName, lastUsedFilter );
settings.setValue( "/UI/" + filterName + "Dir", myPath );
- return true;
}
return false;
} // openFilesRememberingFilter_
More information about the QGIS-commit
mailing list