Skip to content

Commit b1158ff

Browse files
committedFeb 23, 2017
Prompt before replacing an existing map theme
It's too easy to accidently (and unrecoverably) erase an entire theme using the replace preset menu
1 parent f5a3967 commit b1158ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎src/app/qgsmapthemes.cpp

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

3131
#include <QInputDialog>
32-
32+
#include <QMessageBox>
3333

3434
QgsMapThemes* QgsMapThemes::sInstance;
3535

@@ -136,6 +136,12 @@ void QgsMapThemes::replaceTriggered()
136136
if ( !actionPreset )
137137
return;
138138

139+
int res = QMessageBox::question( mMenu, tr( "Replace theme" ),
140+
tr( "Are you sure you want to replace the existing theme “%1”?" ).arg( actionPreset->text() ),
141+
QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
142+
if ( res != QMessageBox::Yes )
143+
return;
144+
139145
//adding preset with same name is effectively a replace
140146
addPreset( actionPreset->text() );
141147
}

0 commit comments

Comments
 (0)
Please sign in to comment.