Skip to content
Permalink
Browse files

Prompt whether to overwrite a symbol. Contributed by Alex Bruy (#3405)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15237 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Feb 21, 2011
1 parent 2e01079 commit 498c8ee8a4b7714fed7241f1171745f01381740f
@@ -15,6 +15,7 @@
#include <QFile>
#include <QFileDialog>
#include <QInputDialog>
#include <QMessageBox>
#include <QStandardItemModel>

#include "qgsapplication.h"
@@ -239,6 +240,20 @@ bool QgsStyleV2ManagerDialog::addSymbol()
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;
@@ -14,6 +14,7 @@
#include <QPainter>
#include <QStandardItemModel>
#include <QInputDialog>
#include <QMessageBox>
#include <QKeyEvent>
#include <QMenu>

@@ -222,6 +223,19 @@ void QgsSymbolV2SelectorDialog::addSymbolToStyle()
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() );

0 comments on commit 498c8ee

Please sign in to comment.
You can’t perform that action at this time.