Skip to content
Permalink
Browse files

Prompt before replacing an existing map preset

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 8984d5972101219b428815826bd6f4d0384fc309
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/app/qgsvisibilitypresets.cpp
@@ -30,7 +30,7 @@
#include "qgsnewnamedialog.h"

#include <QInputDialog>

#include <QMessageBox>

QgsVisibilityPresets* QgsVisibilityPresets::sInstance;

@@ -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() );
}

0 comments on commit 8984d59

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