Skip to content

Commit ecde835

Browse files
committedNov 18, 2017
Ask confirmation before removing a map theme
1 parent af6b4cc commit ecde835

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed
 

‎src/app/qgsmapthemes.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,17 @@ void QgsMapThemes::applyState( const QString &presetName )
156156

157157
void QgsMapThemes::removeCurrentPreset()
158158
{
159-
Q_FOREACH ( QAction *a, mMenuPresetActions )
159+
for ( QAction *actionPreset : qgis::as_const( mMenuPresetActions ) )
160160
{
161-
if ( a->isChecked() )
161+
if ( actionPreset->isChecked() )
162162
{
163-
QgsProject::instance()->mapThemeCollection()->removeMapTheme( a->text() );
163+
int res = QMessageBox::question( mMenu, tr( "Remove Theme" ),
164+
trUtf8( "Are you sure you want to remove the existing theme “%1”?" ).arg( actionPreset->text() ),
165+
QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
166+
if ( res != QMessageBox::Yes )
167+
return;
168+
//remove the selected preset
169+
QgsProject::instance()->mapThemeCollection()->removeMapTheme( actionPreset->text() );
164170
break;
165171
}
166172
}

0 commit comments

Comments
 (0)
Please sign in to comment.