Skip to content

Commit 2832203

Browse files
authoredNov 20, 2017
Merge pull request #5661 from DelazJ/patch-3
Ask confirmation before removing a map theme
2 parents 06bae21 + 06017b9 commit 2832203

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎src/app/qgsmapthemes.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,15 @@ 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+
QgsProject::instance()->mapThemeCollection()->removeMapTheme( actionPreset->text() );
164168
break;
165169
}
166170
}

0 commit comments

Comments
 (0)
Please sign in to comment.