Skip to content

Commit 8984d59

Browse files
committed
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)
1 parent 9883c7d commit 8984d59

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/app/qgsvisibilitypresets.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "qgsnewnamedialog.h"
3131

3232
#include <QInputDialog>
33-
33+
#include <QMessageBox>
3434

3535
QgsVisibilityPresets* QgsVisibilityPresets::sInstance;
3636

@@ -181,6 +181,12 @@ void QgsVisibilityPresets::replaceTriggered()
181181
if ( !actionPreset )
182182
return;
183183

184+
int res = QMessageBox::question( mMenu, tr( "Replace preset" ),
185+
tr( "Are you sure you want to replace the existing preset %1?" ).arg( actionPreset->text() ),
186+
QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
187+
if ( res != QMessageBox::Yes )
188+
return;
189+
184190
//adding preset with same name is effectively a replace
185191
addPreset( actionPreset->text() );
186192
}

0 commit comments

Comments
 (0)