Skip to content

Commit 735d858

Browse files
author
mhugent
committedFeb 11, 2008
Insert a 'Cancel' button to the dialogs when stop editing, fix for bug #944
git-svn-id: http://svn.osgeo.org/qgis/trunk@8137 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent b3e835e commit 735d858

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed
 

‎src/app/legend/qgslegendlayerfile.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,7 @@ void QgsLegendLayerFile::toggleEditing()
438438
{
439439

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

445443
if(commit==QMessageBox::Save)
446444
{
@@ -461,6 +459,10 @@ void QgsLegendLayerFile::toggleEditing()
461459
tr("Problems during roll back"));
462460
}
463461
}
462+
else //cancel
463+
{
464+
return;
465+
}
464466
}
465467
else //layer not modified
466468
{

‎src/app/qgsattributetabledisplay.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,22 @@ void QgsAttributeTableDisplay::stopEditing()
192192
//commit or roll back?
193193
QMessageBox::StandardButton commit=QMessageBox::information(this,tr("Stop editing"),
194194
tr("Do you want to save the changes?"),
195-
QMessageBox::Save | QMessageBox::Discard);
195+
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
196196
if(commit==QMessageBox::Save)
197197
{
198198
if(!table()->commitChanges(mLayer))
199199
{
200200
QMessageBox::information(this,tr("Error"),tr("Could not commit changes"));
201201
}
202202
}
203-
else
203+
else if(commit == QMessageBox::Discard)
204204
{
205205
table()->rollBack(mLayer);
206206
}
207+
else //cancel
208+
{
209+
return;
210+
}
207211
}
208212
btnStartEditing->setEnabled(true);
209213
btnStopEditing->setEnabled(false);

0 commit comments

Comments
 (0)
Please sign in to comment.