Skip to content

Commit

Permalink
Prompt before replacing an existing map preset
Browse files Browse the repository at this point in the history
It's too easy to accidently (and unrecoverably) erase an
entire preset using the replace preset menu

(cherry-picked from b1158ff)
  • Loading branch information
nyalldawson committed Mar 4, 2017
1 parent 9883c7d commit 8984d59
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/qgsvisibilitypresets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "qgsnewnamedialog.h"

#include <QInputDialog>

#include <QMessageBox>

QgsVisibilityPresets* QgsVisibilityPresets::sInstance;

Expand Down Expand Up @@ -181,6 +181,12 @@ void QgsVisibilityPresets::replaceTriggered()
if ( !actionPreset )
return;

int res = QMessageBox::question( mMenu, tr( "Replace preset" ),
tr( "Are you sure you want to replace the existing preset %1?" ).arg( actionPreset->text() ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
if ( res != QMessageBox::Yes )
return;

//adding preset with same name is effectively a replace
addPreset( actionPreset->text() );
}
Expand Down

0 comments on commit 8984d59

Please sign in to comment.