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
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1266,26 +1266,28 @@ void QgsGrassNewMapset::createMapset()
G__setenv(( char * ) "GISDBASE", mDatabaseLineEdit->text().toAscii().data() ); G__setenv(( char * ) "GISDBASE", mDatabaseLineEdit->text().toAscii().data() );
#endif #endif


int ret = 0;

QgsGrass::resetError(); QgsGrass::resetError();
int ret = G_make_location( location.toAscii().data(), &mCellHead, if ( setjmp( QgsGrass::fatalErrorEnv() ) == 0 )
mProjInfo, mProjUnits, stdout ); {
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" ), QMessageBox::warning( this, tr( "Create location" ),
tr( "Cannot create new location: %1" ).arg( QgsGrass::getErrorMessage() ) ); tr( "Cannot create new location: %1" ).arg( QgsGrass::getErrorMessage() ) );

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


delete this; deleteLater();
} }


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


void QgsGrassNewMapset::pageSelected( int index ) 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 ) switch ( index )
{ {
Expand Down Expand Up @@ -1474,7 +1476,7 @@ void QgsGrassNewMapset::close( void )


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


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

0 comments on commit acd619f

Please sign in to comment.