[QGIS Commit] r15615 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Mar 27 11:41:32 EDT 2011


Author: jef
Date: 2011-03-27 08:41:31 -0700 (Sun, 27 Mar 2011)
New Revision: 15615

Modified:
   trunk/qgis/src/app/qgsvectorlayerproperties.cpp
Log:
fix enabling of field edit buttons in vector properties

Modified: trunk/qgis/src/app/qgsvectorlayerproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsvectorlayerproperties.cpp	2011-03-27 15:39:17 UTC (rev 15614)
+++ trunk/qgis/src/app/qgsvectorlayerproperties.cpp	2011-03-27 15:41:31 UTC (rev 15615)
@@ -398,20 +398,22 @@
 
 void QgsVectorLayerProperties::updateButtons()
 {
+  int cap = layer->dataProvider()->capabilities();
+
+  mToggleEditingButton->setEnabled(( cap & QgsVectorDataProvider::EditingCapabilities ) && !layer->isReadOnly() );
+  mToggleEditingButton->setChecked( layer->isEditable() );
+
   if ( layer->isEditable() )
   {
-    int cap = layer->dataProvider()->capabilities();
     mAddAttributeButton->setEnabled( cap & QgsVectorDataProvider::AddAttributes );
     mDeleteAttributeButton->setEnabled( cap & QgsVectorDataProvider::DeleteAttributes );
     mCalculateFieldButton->setEnabled( cap & QgsVectorDataProvider::ChangeAttributeValues );
-    mToggleEditingButton->setChecked( true );
   }
   else
   {
-    mAddAttributeButton->setEnabled( false );
-    mDeleteAttributeButton->setEnabled( false );
-    mToggleEditingButton->setChecked( false );
-    mCalculateFieldButton->setEnabled( false );
+    mAddAttributeButton->setDisabled( true );
+    mDeleteAttributeButton->setDisabled( true );
+    mCalculateFieldButton->setDisabled( true );
   }
 }
 
@@ -863,7 +865,7 @@
 
   QGis::GeometryType type = layer->geometryType();
 
-  if ( type < 0 || type > QGis::Polygon )
+  if ( type < 0 || type > QGis::NoGeometry )
   {
     QgsDebugMsg( "Invalid vector type" );
   }



More information about the QGIS-commit mailing list