Skip to content

Commit

Permalink
fix #1678
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10748 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed May 6, 2009
1 parent b6ff318 commit acd619f
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/plugins/grass/qgsgrassnewmapset.cpp
Expand Up @@ -1266,26 +1266,28 @@ void QgsGrassNewMapset::createMapset()
G__setenv(( char * ) "GISDBASE", mDatabaseLineEdit->text().toAscii().data() );
#endif

int ret = 0;

QgsGrass::resetError();
int ret = G_make_location( location.toAscii().data(), &mCellHead,
mProjInfo, mProjUnits, stdout );
if ( setjmp( QgsGrass::fatalErrorEnv() ) == 0 )
{
ret = G_make_location( location.toAscii().data(), &mCellHead, mProjInfo, mProjUnits, stdout );
}
QgsGrass::clearErrorEnv();

if ( ret != 0 )
if ( QgsGrass::getError() == QgsGrass::FATAL || ret != 0 )
{
QMessageBox::warning( this, tr( "Create location" ),
tr( "Cannot create new location: %1" ).arg( QgsGrass::getErrorMessage() ) );

return;
}
else
{
// Location created -> reset widgets
setLocations();
mSelectLocationRadioButton->setChecked( true );
mLocationComboBox->setItemText( mLocationComboBox->currentIndex(), location );
mLocationLineEdit->setText( "" );
locationRadioSwitched(); // calls also checkLocation()
}

// Location created -> reset widgets
setLocations();
mSelectLocationRadioButton->setChecked( true );
mLocationComboBox->setItemText( mLocationComboBox->currentIndex(), location );
mLocationLineEdit->setText( "" );
locationRadioSwitched(); // calls also checkLocation()
}
else
{
Expand Down Expand Up @@ -1352,7 +1354,7 @@ void QgsGrassNewMapset::createMapset()
mPlugin->mapsetChanged();
}

delete this;
deleteLater();
}

void QgsGrassNewMapset::accept()
Expand Down Expand Up @@ -1388,7 +1390,7 @@ void QgsGrassNewMapset::keyPressEvent( QKeyEvent * e )

void QgsGrassNewMapset::pageSelected( int index )
{
QgsDebugMsg( QString( "title = %1" ).arg( page( index )->title() ) );
QgsDebugMsg( QString( "title = %1" ).arg( page( index ) ? page( index )->title() : "(null)" ) );

switch ( index )
{
Expand Down Expand Up @@ -1474,7 +1476,7 @@ void QgsGrassNewMapset::close( void )

hide();
mRunning = false;
delete this;
deleteLater();
}

void QgsGrassNewMapset::closeEvent( QCloseEvent *e )
Expand Down

0 comments on commit acd619f

Please sign in to comment.