Skip to content

Commit

Permalink
Merge pull request #5661 from DelazJ/patch-3
Browse files Browse the repository at this point in the history
Ask confirmation before removing a map theme
  • Loading branch information
m-kuhn authored Nov 20, 2017
2 parents 06bae21 + 06017b9 commit 2832203
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/qgsmapthemes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,15 @@ void QgsMapThemes::applyState( const QString &presetName )

void QgsMapThemes::removeCurrentPreset()
{
Q_FOREACH ( QAction *a, mMenuPresetActions )
for ( QAction *actionPreset : qgis::as_const( mMenuPresetActions ) )
{
if ( a->isChecked() )
if ( actionPreset->isChecked() )
{
QgsProject::instance()->mapThemeCollection()->removeMapTheme( a->text() );
int res = QMessageBox::question( mMenu, tr( "Remove Theme" ),
trUtf8( "Are you sure you want to remove the existing theme “%1”?" ).arg( actionPreset->text() ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
if ( res == QMessageBox::Yes )
QgsProject::instance()->mapThemeCollection()->removeMapTheme( actionPreset->text() );
break;
}
}
Expand Down

0 comments on commit 2832203

Please sign in to comment.