[QGIS Commit] r13335 - trunk/qgis/src/gui/symbology-ng

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Apr 20 10:02:12 EDT 2010


Author: wonder
Date: 2010-04-20 10:02:10 -0400 (Tue, 20 Apr 2010)
New Revision: 13335

Modified:
   trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.cpp
   trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.h
Log:
save style when closing style manager only if it was modified


Modified: trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.cpp
===================================================================
--- trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.cpp	2010-04-20 13:51:23 UTC (rev 13334)
+++ trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.cpp	2010-04-20 14:02:10 UTC (rev 13335)
@@ -33,7 +33,7 @@
 ///////
 
 QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* parent )
-    : QDialog( parent ), mStyle( style )
+    : QDialog( parent ), mStyle( style ), mModified( false )
 {
 
   setupUi( this );
@@ -64,8 +64,10 @@
 
 void QgsStyleV2ManagerDialog::onFinished()
 {
-  // TODO: save only when modified
-  mStyle->save();
+  if ( mModified )
+  {
+    mStyle->save();
+  }
 }
 
 void QgsStyleV2ManagerDialog::populateTypes()
@@ -227,6 +229,7 @@
 
   // add new symbol to style and re-populate the list
   mStyle->addSymbol( name, symbol );
+  mModified = true;
   return true;
 }
 
@@ -292,6 +295,7 @@
 
   // add new symbol to style and re-populate the list
   mStyle->addColorRamp( name, ramp );
+  mModified = true;
   return true;
 }
 
@@ -332,6 +336,7 @@
 
   // by adding symbol to style with the same name the old effectively gets overwritten
   mStyle->addSymbol( symbolName, symbol );
+  mModified = true;
   return true;
 }
 
@@ -379,6 +384,7 @@
   }
 
   mStyle->addColorRamp( name, ramp );
+  mModified = true;
   return true;
 }
 
@@ -410,6 +416,7 @@
 
   // delete from style and update list
   mStyle->removeSymbol( symbolName );
+  mModified = true;
   return true;
 }
 
@@ -419,5 +426,7 @@
   if ( rampName.isEmpty() )
     return false;
 
-  return mStyle->removeColorRamp( rampName );
+  mStyle->removeColorRamp( rampName );
+  mModified = true;
+  return true;
 }

Modified: trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.h
===================================================================
--- trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.h	2010-04-20 13:51:23 UTC (rev 13334)
+++ trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.h	2010-04-20 14:02:10 UTC (rev 13335)
@@ -55,6 +55,8 @@
     QgsStyleV2* mStyle;
 
     QString mStyleFilename;
+
+    bool mModified;
 };
 
 #endif



More information about the QGIS-commit mailing list