[QGIS Commit] r11331 - trunk/qgis/src/plugins/grass

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Aug 10 12:49:03 EDT 2009


Author: rugginoso
Date: 2009-08-10 12:49:02 -0400 (Mon, 10 Aug 2009)
New Revision: 11331

Modified:
   trunk/qgis/src/plugins/grass/qgsgrassattributes.cpp
   trunk/qgis/src/plugins/grass/qgsgrassattributes.h
   trunk/qgis/src/plugins/grass/qgsgrassedittools.cpp
Log:
Changed the behaviour of attribute editor as described into the discussion of ticker #289 to fix it.


Modified: trunk/qgis/src/plugins/grass/qgsgrassattributes.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassattributes.cpp	2009-08-10 16:08:11 UTC (rev 11330)
+++ trunk/qgis/src/plugins/grass/qgsgrassattributes.cpp	2009-08-10 16:49:02 UTC (rev 11331)
@@ -15,7 +15,6 @@
  ***************************************************************************/
 
 #include "qgsgrassattributes.h"
-#include "qgsgrassedit.h"
 #include "qgsgrassprovider.h"
 
 #include "qgslogger.h"
@@ -352,3 +351,12 @@
   QgsDebugMsg( QString( "path = %1 newSize = %2" ).arg( path ).arg( newSize ) );
   settings.setValue( path, newSize );
 }
+
+void QgsGrassAttributes::setCategoryMode(QgsGrassEdit::CatMode mode, const QString &cat)
+{
+    if (mode == QgsGrassEdit::CAT_MODE_NOCAT || (mode == QgsGrassEdit::CAT_MODE_MANUAL && cat.isEmpty())){
+        newButton->setEnabled(false);
+    } else {
+        newButton->setEnabled(true);
+    }
+}

Modified: trunk/qgis/src/plugins/grass/qgsgrassattributes.h
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassattributes.h	2009-08-10 16:08:11 UTC (rev 11330)
+++ trunk/qgis/src/plugins/grass/qgsgrassattributes.h	2009-08-10 16:49:02 UTC (rev 11331)
@@ -19,6 +19,7 @@
 /* First attribute in the table is always field, second attribute is category */
 
 #include "ui_qgsgrassattributesbase.h"
+#include "qgsgrassedit.h"
 
 class QgsGrassProvider;
 class QgsGrassEdit;
@@ -105,6 +106,9 @@
     //! Remove all tabs
     void clear();
 
+    //! Enable/disable buttons depending on the category mode
+    void setCategoryMode(QgsGrassEdit::CatMode mode, const QString &cat);
+
   private:
     //! Pointer to vector provider
     QgsGrassProvider *mProvider;

Modified: trunk/qgis/src/plugins/grass/qgsgrassedittools.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassedittools.cpp	2009-08-10 16:08:11 UTC (rev 11330)
+++ trunk/qgis/src/plugins/grass/qgsgrassedittools.cpp	2009-08-10 16:49:02 UTC (rev 11331)
@@ -916,4 +916,6 @@
     e->mAttributes->show();
     e->mAttributes->raise();
   }
+
+    e->mAttributes->setCategoryMode(static_cast<QgsGrassEdit::CatMode>(e->mCatModeBox->currentIndex()), e->mCatEntry->text());
 }



More information about the QGIS-commit mailing list