[QGIS Commit] r15237 - trunk/qgis/src/gui/symbology-ng
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Feb 21 17:26:35 EST 2011
Author: wonder
Date: 2011-02-21 14:26:35 -0800 (Mon, 21 Feb 2011)
New Revision: 15237
Modified:
trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.cpp
trunk/qgis/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp
Log:
Prompt whether to overwrite a symbol. Contributed by Alex Bruy (#3405)
Modified: trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.cpp
===================================================================
--- trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.cpp 2011-02-21 22:20:23 UTC (rev 15236)
+++ trunk/qgis/src/gui/symbology-ng/qgsstylev2managerdialog.cpp 2011-02-21 22:26:35 UTC (rev 15237)
@@ -15,6 +15,7 @@
#include <QFile>
#include <QFileDialog>
#include <QInputDialog>
+#include <QMessageBox>
#include <QStandardItemModel>
#include "qgsapplication.h"
@@ -239,6 +240,20 @@
return false;
}
+ // check if there is no symbol with same name
+ if ( mStyle->symbolNames().contains( name ) )
+ {
+ int res = QMessageBox::warning( this, tr( "Save symbol" ),
+ tr( "Symbol with name '%1' already exists. Overwrite?" )
+ .arg( name ),
+ QMessageBox::Yes | QMessageBox::No );
+ if ( res != QMessageBox::Yes )
+ {
+ delete symbol;
+ return false;
+ }
+ }
+
// add new symbol to style and re-populate the list
mStyle->addSymbol( name, symbol );
mModified = true;
Modified: trunk/qgis/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp
===================================================================
--- trunk/qgis/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp 2011-02-21 22:20:23 UTC (rev 15236)
+++ trunk/qgis/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp 2011-02-21 22:26:35 UTC (rev 15237)
@@ -14,6 +14,7 @@
#include <QPainter>
#include <QStandardItemModel>
#include <QInputDialog>
+#include <QMessageBox>
#include <QKeyEvent>
#include <QMenu>
@@ -222,6 +223,19 @@
if ( !ok || name.isEmpty() )
return;
+ // check if there is no symbol with same name
+ if ( mStyle->symbolNames().contains( name ) )
+ {
+ int res = QMessageBox::warning( this, tr( "Save symbol" ),
+ tr( "Symbol with name '%1' already exists. Overwrite?" )
+ .arg( name ),
+ QMessageBox::Yes | QMessageBox::No );
+ if ( res != QMessageBox::Yes )
+ {
+ return;
+ }
+ }
+
// add new symbol to style and re-populate the list
mStyle->addSymbol( name, mSymbol->clone() );
More information about the QGIS-commit
mailing list