Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More safety checks
  • Loading branch information
Marco Hugentobler authored and mhugent committed Jun 9, 2011
1 parent 0735436 commit fba3086
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -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" );
Expand Down
10 changes: 10 additions & 0 deletions src/app/qgsembedlayerdialog.cpp
Expand Up @@ -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()
Expand All @@ -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() )
{
Expand Down
5 changes: 1 addition & 4 deletions src/core/qgsproject.cpp
Expand Up @@ -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
Expand Down

0 comments on commit fba3086

Please sign in to comment.