Skip to content

Commit

Permalink
Insert a 'Cancel' button to the dialogs when stop editing, fix for bug
Browse files Browse the repository at this point in the history
…#944

git-svn-id: http://svn.osgeo.org/qgis/trunk@8137 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Feb 11, 2008
1 parent b3e835e commit 735d858
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/app/legend/qgslegendlayerfile.cpp
Expand Up @@ -438,9 +438,7 @@ void QgsLegendLayerFile::toggleEditing()
{

// commit or roll back?
QMessageBox::StandardButton commit = QMessageBox::information(0,tr("Stop editing"),
tr("Do you want to save the changes?"),
QMessageBox::Save | QMessageBox::Discard);
QMessageBox::StandardButton commit = QMessageBox::information(0,tr("Stop editing"), tr("Do you want to save the changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);

if(commit==QMessageBox::Save)
{
Expand All @@ -461,6 +459,10 @@ void QgsLegendLayerFile::toggleEditing()
tr("Problems during roll back"));
}
}
else //cancel
{
return;
}
}
else //layer not modified
{
Expand Down
8 changes: 6 additions & 2 deletions src/app/qgsattributetabledisplay.cpp
Expand Up @@ -192,18 +192,22 @@ void QgsAttributeTableDisplay::stopEditing()
//commit or roll back?
QMessageBox::StandardButton commit=QMessageBox::information(this,tr("Stop editing"),
tr("Do you want to save the changes?"),
QMessageBox::Save | QMessageBox::Discard);
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
if(commit==QMessageBox::Save)
{
if(!table()->commitChanges(mLayer))
{
QMessageBox::information(this,tr("Error"),tr("Could not commit changes"));
}
}
else
else if(commit == QMessageBox::Discard)
{
table()->rollBack(mLayer);
}
else //cancel
{
return;
}
}
btnStartEditing->setEnabled(true);
btnStopEditing->setEnabled(false);
Expand Down

0 comments on commit 735d858

Please sign in to comment.