Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Prompt before replacing an existing map theme
It's too easy to accidently (and unrecoverably) erase an
entire theme using the replace preset menu
  • Loading branch information
nyalldawson committed Feb 23, 2017
1 parent f5a3967 commit b1158ff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/qgsmapthemes.cpp
Expand Up @@ -29,7 +29,7 @@
#include "qgsnewnamedialog.h"

#include <QInputDialog>

#include <QMessageBox>

QgsMapThemes* QgsMapThemes::sInstance;

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

int res = QMessageBox::question( mMenu, tr( "Replace theme" ),
tr( "Are you sure you want to replace the existing theme “%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 b1158ff

Please sign in to comment.