Skip to content
Permalink
Browse files

Stop editing before layer remove if necessary

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8205 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 11, 2008
1 parent 9da6874 commit a45bf797579b8b17df362b57d3d31bc6ba1c7ce6
Showing with 14 additions and 0 deletions.
  1. +6 −0 src/app/legend/qgslegendlayerfile.cpp
  2. +3 −0 src/app/legend/qgslegendlayerfile.h
  3. +5 −0 src/app/qgisapp.cpp
@@ -476,6 +476,12 @@ void QgsLegendLayerFile::toggleEditing()

}

bool QgsLegendLayerFile::isEditing()
{
QgsVectorLayer* vlayer = dynamic_cast<QgsVectorLayer*>(mLyr.layer());
return vlayer && vlayer->isEditable();
}

void QgsLegendLayerFile::layerNameChanged()
{
QString name = mLyr.layer()->name();
@@ -89,6 +89,9 @@ class QgsLegendLayerFile : public QgsLegendItem
/**Toggle editing for layer*/
void toggleEditing();

/**Return editing status for layer*/
bool isEditing();

/**Toggle show in overview*/
void showInOverview();

@@ -3774,6 +3774,11 @@ void QgisApp::inOverview()

void QgisApp::removeLayer()
{
QgsLegendLayerFile* currentLayerFile = mMapLegend->currentLayerFile();
if(currentLayerFile && currentLayerFile->isEditing() )
{
currentLayerFile->toggleEditing();
}
mMapLegend->legendLayerRemove();
}

0 comments on commit a45bf79

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