Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
layers are now editable by default such that people do not have to se…
…arch for the layer file in the legend

git-svn-id: http://svn.osgeo.org/qgis/trunk@5232 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 8, 2006
1 parent ea91bfb commit b1bc184
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gui/qgsmaptoolcapture.cpp
Expand Up @@ -85,7 +85,7 @@ void QgsMapToolCapture::canvasReleaseEvent(QMouseEvent * e)
if (!vlayer->isEditable())
{
QMessageBox::information(0,"Layer not editable",
"Cannot edit the vector layer. Use 'Start editing' in the legend item menu",
"Cannot edit the vector layer. To make it editable, go to the file item of the layer, right click and check 'Allow Editing'.",
QMessageBox::Ok);
return;
}
Expand Down
15 changes: 15 additions & 0 deletions src/gui/qgsvectorlayer.cpp
Expand Up @@ -138,6 +138,11 @@ QgsVectorLayer::QgsVectorLayer(QString vectorLayerPath,
// have no effect on existing layers
QSettings settings;
updateThreshold = settings.readNumEntry("Map/updateThreshold", 1000);
//editing is now enabled by default
if(dataProvider->capabilities()&QgsVectorDataProvider::AddFeatures)
{
startEditing();
}
} // QgsVectorLayer ctor


Expand Down Expand Up @@ -1265,6 +1270,16 @@ void QgsVectorLayer::initContextMenu_(QgisApp * app)
{
mToggleEditingAction = popMenu->addAction(tr("Allow Editing"),this,SLOT(toggleEditing()));
mToggleEditingAction->setCheckable(true);
mToggleEditingAction->blockSignals(true);
if(mEditable)
{
mToggleEditingAction->setChecked(true);
}
else
{
mToggleEditingAction->setChecked(false);
}
mToggleEditingAction->blockSignals(false);
}

if(cap&QgsVectorDataProvider::SaveAsShapefile)
Expand Down
2 changes: 1 addition & 1 deletion src/legend/qgslegend.cpp
Expand Up @@ -482,7 +482,7 @@ void QgsLegend::addLayer( QgsMapLayer * layer )

setExpanded(indexFromItem(llayer), true);
setExpanded(indexFromItem(llfgroup), false);
//todo: only if qsetting for 'legend layer file visible' is not set
//only if qsetting for 'legend layer file visible' is not set
if(!mShowLegendLayerFiles)
{
setItemHidden(llfgroup, true);
Expand Down

0 comments on commit b1bc184

Please sign in to comment.