Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make confirmation on layer deletion optional (fixes #9094)
- Loading branch information
Showing
4 changed files
with
21 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6394,7 +6394,7 @@ void QgisApp::removeAllLayers() | |
QgsMapLayerRegistry::instance()->removeAllMapLayers(); | ||
} | ||
|
||
void QgisApp::removeLayer( bool promptConfirmation ) | ||
void QgisApp::removeLayer() | ||
{ | ||
if ( !mMapLegend ) | ||
{ | ||
|
@@ -6412,20 +6412,22 @@ void QgisApp::removeLayer( bool promptConfirmation ) | |
int numberOfRemovedItems = mMapLegend->selectedItems().size(); | ||
if ( numberOfRemovedItems == 0 ) | ||
{ | ||
messageBar()->pushMessage( tr( "No Object Selected" ), | ||
tr( "To remove objects, you must select them in the legend" ), | ||
messageBar()->pushMessage( tr( "No layers selected" ), | ||
tr( "To remove layers, you must select them in the legend" ), | ||
QgsMessageBar::INFO, messageTimeout() ); | ||
return; | ||
} | ||
|
||
bool promptConfirmation = QSettings().value( "qgis/askToDeleteLayers", true ).toBool(); | ||
//display a warning | ||
if ( promptConfirmation && QMessageBox::warning( this, tr( "Remove objects" ), tr( "Remove %n object(s)?", "number of objects to remove", numberOfRemovedItems ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel ) | ||
if ( promptConfirmation && QMessageBox::warning( this, tr( "Remove layers" ), tr( "Remove %n layers(s)?", "number of layers to remove", numberOfRemovedItems ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel ) | ||
{ | ||
return; | ||
} | ||
|
||
mMapLegend->removeSelectedLayers(); | ||
|
||
showStatusMessage( tr( "%n object(s) removed.", "number of objects removed", numberOfRemovedItems ) ); | ||
showStatusMessage( tr( "%n layers(s) removed.", "number of layers to removed", numberOfRemovedItems ) ); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
3nids
Member
|
||
|
||
mMapCanvas->refresh(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thanks Jurgen!
a small typo - should read "number of layers to remove"