Skip to content
Permalink
Browse files

More safety checks

  • Loading branch information
Marco Hugentobler
Marco Hugentobler committed Jun 6, 2011
1 parent 8084ca7 commit ba39378bcfcae171ba88412edb2043c78a4f3428
Showing with 16 additions and 4 deletions.
  1. +5 −0 src/app/legend/qgslegend.cpp
  2. +10 −0 src/app/qgsembedlayerdialog.cpp
  3. +1 −4 src/core/qgsproject.cpp
@@ -1164,6 +1164,11 @@ bool QgsLegend::readXML( QgsLegendGroup *parent, const QDomNode &node )
theGroup = new QgsLegendGroup( this, name );
}

if( !theGroup )
{
continue;
}

//set the checkbox of the legend group to the right state
blockSignals( true );
QString checked = childelem.attribute( "checked" );
@@ -52,13 +52,17 @@ QList< QPair < QString, QString > > QgsEmbedLayerDialog::embeddedLayers() const

void QgsEmbedLayerDialog::on_mBrowseFileToolButton_clicked()
{
//line edit might emit editingFinished signal when loosing focus
mProjectFileLineEdit->blockSignals( true );

QSettings s;
QString projectFile = QFileDialog::getOpenFileName( 0, tr("Select project file"), s.value("/qgis/last_embedded_project_path").toString() ,tr("QGIS project files (*.qgs)") );
if( !projectFile.isEmpty() )
{
mProjectFileLineEdit->setText( projectFile );
}
changeProjectFile();
mProjectFileLineEdit->blockSignals( false );
}

void QgsEmbedLayerDialog::on_mProjectFileLineEdit_editingFinished()
@@ -74,6 +78,12 @@ void QgsEmbedLayerDialog::changeProjectFile()
return;
}

if( mProjectPath == mProjectFileLineEdit->text() )
{
//already up to date
return;
}

//check we are not embedding from/to the same project
if( mProjectFileLineEdit->text() == QgsProject::instance()->fileName() )
{
@@ -684,10 +684,7 @@ QPair< bool, QList<QDomNode> > QgsProject::_getMapLayers( QDomDocument const &do

if( element.attribute("embedded") == "1" )
{
if( !createEmbeddedLayer( element.attribute( "id" ), readPath( element.attribute( "project" ) ), brokenNodes, vLayerList ) )
{
returnStatus = false;
}
createEmbeddedLayer( element.attribute( "id" ), readPath( element.attribute( "project" ) ), brokenNodes, vLayerList );
continue;
}
else

0 comments on commit ba39378

Please sign in to comment.
You can’t perform that action at this time.