Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
apply patch 1498
git-svn-id: http://svn.osgeo.org/qgis/trunk@9995 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 21, 2009
1 parent 3c261c6 commit e030ff3
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 115 deletions.
52 changes: 40 additions & 12 deletions src/app/qgsmaptooladdfeature.cpp
Expand Up @@ -28,6 +28,7 @@
#include "qgslogger.h"
#include <QMessageBox>
#include <QMouseEvent>
#include <QSettings>

QgsMapToolAddFeature::QgsMapToolAddFeature( QgsMapCanvas* canvas, enum CaptureTool tool ): QgsMapToolCapture( canvas, tool )
{
Expand Down Expand Up @@ -175,18 +176,28 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
}

// show the dialog to enter attribute values
QgsAttributeDialog * mypDialog = new QgsAttributeDialog( vlayer, f );
if ( mypDialog->exec() )
QSettings settings;
bool isDisabledAttributeValuesDlg = settings.value( "/qgis/digitizing/disable_enter_attribute_values_dialog", false ).toBool();
if ( isDisabledAttributeValuesDlg )
{
qDebug( "Adding feature to layer" );
vlayer->addFeature( *f );
}
else
{
qDebug( "Adding feature to layer failed" );
delete f;
QgsAttributeDialog * mypDialog = new QgsAttributeDialog( vlayer, f );
if ( mypDialog->exec() )
{
qDebug( "Adding feature to layer" );
vlayer->addFeature( *f );
}
else
{
qDebug( "Adding feature to layer failed" );
delete f;
}
delete mypDialog;
}
delete mypDialog;
mCanvas->refresh();
}

Expand Down Expand Up @@ -444,21 +455,38 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
f->addAttribute( it.key(), provider->defaultValue( it.key() ) );
}

QgsAttributeDialog * mypDialog = new QgsAttributeDialog( vlayer, f );
if ( mypDialog->exec() )
QSettings settings;
bool isDisabledAttributeValuesDlg = settings.value( "/qgis/digitizing/disable_enter_attribute_values_dialog", false ).toBool();
if ( isDisabledAttributeValuesDlg )
{
if ( vlayer->addFeature( *f ) )
{
//add points to other features to keep topology up-to-date
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
if ( topologicalEditing )
{
vlayer->addTopologicalPoints( f->geometry() );
}
}
}
else
{
QgsAttributeDialog * mypDialog = new QgsAttributeDialog( vlayer, f );
if ( mypDialog->exec() )
{
//add points to other features to keep topology up-to-date
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
if ( topologicalEditing )
if ( vlayer->addFeature( *f ) )
{
vlayer->addTopologicalPoints( f->geometry() );
//add points to other features to keep topology up-to-date
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
if ( topologicalEditing )
{
vlayer->addTopologicalPoints( f->geometry() );
}
}
}
delete mypDialog;
}
delete f;
delete mypDialog;

delete mRubberBand;
mRubberBand = NULL;
Expand Down
4 changes: 4 additions & 0 deletions src/app/qgsoptions.cpp
Expand Up @@ -205,6 +205,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
mMarkerStyleComboBox->setCurrentIndex( mMarkerStyleComboBox->findText( tr( "Cross" ) ) );
}

chkDisableAttributeValuesDlg->setChecked( settings.value( "/qgis/digitizing/disable_enter_attribute_values_dialog", false ).toBool() );

#ifdef Q_WS_MAC //MH: disable incremental update on Mac for now to avoid problems with resizing
groupBox_5->setEnabled( false );
#endif //Q_WS_MAC
Expand Down Expand Up @@ -363,6 +365,8 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/digitizing/marker_style", "Cross" );
}

settings.setValue( "/qgis/digitizing/disable_enter_attribute_values_dialog", chkDisableAttributeValuesDlg->isChecked() );

//
// Locale settings
//
Expand Down

0 comments on commit e030ff3

Please sign in to comment.