[QGIS Commit] r9287 - trunk/qgis/src/plugins/grass
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Sep 9 17:17:33 EDT 2008
Author: telwertowski
Date: 2008-09-09 17:17:32 -0400 (Tue, 09 Sep 2008)
New Revision: 9287
Modified:
trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp
Log:
Use QFile to determine if a proposed filename already exists. It will allow or disallow names which differ only in case depending upon platform. Fix for #1044.
Modified: trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp 2008-09-09 17:18:48 UTC (rev 9286)
+++ trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp 2008-09-09 21:17:32 UTC (rev 9287)
@@ -360,18 +360,10 @@
}
else
{
- QDir d( mDatabaseLineEdit->text() );
-
- for ( unsigned int i = 0; i < d.count(); i++ )
+ if ( QFile::exists( mDatabaseLineEdit->text() + "/" + location ) )
{
- if ( d[i] == "." || d[i] == ".." ) continue;
-
- if ( d[i] == location )
- {
- setNextEnabled( page( LOCATION ), false );
- setError( mLocationErrorLabel, tr( "The location exists!" ) );
- break;
- }
+ setNextEnabled( page( LOCATION ), false );
+ setError( mLocationErrorLabel, tr( "The location exists!" ) );
}
}
}
@@ -1229,23 +1221,12 @@
// Check if exists
if ( mSelectLocationRadioButton->isChecked() )
{
- bool exists = false;
QString locationPath = mDatabaseLineEdit->text() + "/" + mLocationComboBox->currentText();
- QDir d( locationPath );
-
- for ( unsigned int i = 0; i < d.count(); i++ )
+ if ( QFile::exists( locationPath + "/" + mapset ) )
{
- if ( d[i] == "." || d[i] == ".." ) continue;
-
- if ( d[i] == mapset )
- {
- setError( mMapsetErrorLabel, tr( "The mapset already exists" ) );
- exists = true;
- break;
- }
+ setError( mMapsetErrorLabel, tr( "The mapset already exists" ) );
}
-
- if ( !exists )
+ else
{
setNextEnabled( page( MAPSET ), true );
}
More information about the QGIS-commit
mailing list