Index: src/gui/symbology-ng/qgsstylev2managerdialog.cpp =================================================================== --- src/gui/symbology-ng/qgsstylev2managerdialog.cpp (revision 15013) +++ src/gui/symbology-ng/qgsstylev2managerdialog.cpp (working copy) @@ -13,6 +13,7 @@ #include #include +#include #include #include "qgsapplication.h" @@ -231,6 +232,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; Index: src/gui/symbology-ng/qgssymbolv2selectordialog.cpp =================================================================== --- src/gui/symbology-ng/qgssymbolv2selectordialog.cpp (revision 15013) +++ src/gui/symbology-ng/qgssymbolv2selectordialog.cpp (working copy) @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -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() );