Skip to content

Commit

Permalink
[StyleManager] show confirmation messagebox before removing item(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDieBln committed Jan 6, 2016
1 parent 4d2d001 commit 2031ce0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gui/symbology-ng/qgsstylev2managerdialog.cpp
Expand Up @@ -713,6 +713,12 @@ void QgsStyleV2ManagerDialog::removeItem()
bool QgsStyleV2ManagerDialog::removeSymbol()
{
QModelIndexList indexes = listItems->selectionModel()->selectedIndexes();
if ( QMessageBox::Yes != QMessageBox::question( this, tr( "Confirm removal" ),
QString( tr( "Do you really want to remove %n symbol(s)?", nullptr, indexes.count() ) ),
QMessageBox::Yes,
QMessageBox::No ) )
return false;

Q_FOREACH ( const QModelIndex& index, indexes )
{
QString symbolName = index.data().toString();
Expand All @@ -729,6 +735,11 @@ bool QgsStyleV2ManagerDialog::removeColorRamp()
QString rampName = currentItemName();
if ( rampName.isEmpty() )
return false;
if ( QMessageBox::Yes != QMessageBox::question( this, tr( "Confirm removal" ),
QString( tr( "Do you really want to remove the colorramp '%1'?" ) ).arg( rampName ),
QMessageBox::Yes,
QMessageBox::No ) )
return false;

mStyle->removeColorRamp( rampName );
mModified = true;
Expand Down

0 comments on commit 2031ce0

Please sign in to comment.