Skip to content

Commit 3339af5

Browse files
author
g_j_m
committed
Provide the enhancement in ticket #207 (option of whether to
ask the user to save a project when exiting, etc). git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6381 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 6185a19 commit 3339af5

File tree

3 files changed

+60
-6
lines changed

3 files changed

+60
-6
lines changed

src/gui/qgisapp.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -4391,7 +4391,7 @@ void QgisApp::setExtent(QgsRect theRect)
43914391

43924392
int QgisApp::saveDirty()
43934393
{
4394-
int answer = 0;
4394+
int answer(QMessageBox::No);
43954395
mMapCanvas->freeze(true);
43964396

43974397
#ifdef QGISDEBUG
@@ -4418,7 +4418,10 @@ int QgisApp::saveDirty()
44184418
}
44194419
#endif
44204420

4421-
if ((QgsProject::instance()->dirty() || (mMapCanvas->isDirty()) && mMapCanvas->layerCount() > 0))
4421+
QSettings settings;
4422+
bool askThem = settings.value("qgis/askToSaveProjectChanges", true).toBool();
4423+
4424+
if (askThem && (QgsProject::instance()->dirty() || (mMapCanvas->isDirty()) && mMapCanvas->layerCount() > 0))
44224425
{
44234426
// flag project as dirty since dirty state of canvas is reset if "dirty"
44244427
// is based on a zoom or pan

src/gui/qgsoptions.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ QgsOptions::QgsOptions(QWidget *parent, Qt::WFlags fl) :
130130
pbnMeasureColour->setColor( QColor(myRed,myGreen,myBlue) );
131131

132132
capitaliseCheckBox->setChecked(settings.value("qgis/capitaliseLayerName", QVariant(false)).toBool());
133+
134+
chbAskToSaveProjectChanges->setChecked(settings.value("qgis/askToSaveProjectChanges", QVariant(true)).toBool());
133135

134136
cmbWheelAction->setCurrentIndex(settings.value("/qgis/wheel_action", 0).toInt());
135137
spinZoomFactor->setValue(settings.value("/qgis/zoom_factor", 2).toDouble());
@@ -189,6 +191,7 @@ void QgsOptions::saveOptions()
189191
settings.writeEntry("/qgis/enable_anti_aliasing",chkAntiAliasing->isChecked());
190192
settings.writeEntry("/qgis/use_qimage_to_render", !(chkUseQPixmap->isChecked()));
191193
settings.setValue("qgis/capitaliseLayerName", capitaliseCheckBox->isChecked());
194+
settings.setValue("qgis/askToSaveProjectChanges", chbAskToSaveProjectChanges->isChecked());
192195

193196
if(cmbTheme->currentText().length() == 0)
194197
{

src/ui/qgsoptionsbase.ui

+52-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<x>0</x>
77
<y>0</y>
88
<width>590</width>
9-
<height>454</height>
9+
<height>463</height>
1010
</rect>
1111
</property>
1212
<property name="windowTitle" >
@@ -31,8 +31,56 @@
3131
<item row="0" column="0" >
3232
<widget class="QTabWidget" name="tabWidget" >
3333
<property name="currentIndex" >
34-
<number>2</number>
34+
<number>0</number>
3535
</property>
36+
<widget class="QWidget" name="tabGeneral" >
37+
<attribute name="title" >
38+
<string>&amp;General</string>
39+
</attribute>
40+
<layout class="QVBoxLayout" >
41+
<property name="margin" >
42+
<number>9</number>
43+
</property>
44+
<property name="spacing" >
45+
<number>6</number>
46+
</property>
47+
<item>
48+
<widget class="QGroupBox" name="groupBox_11" >
49+
<property name="title" >
50+
<string>General</string>
51+
</property>
52+
<layout class="QVBoxLayout" >
53+
<property name="margin" >
54+
<number>9</number>
55+
</property>
56+
<property name="spacing" >
57+
<number>6</number>
58+
</property>
59+
<item>
60+
<widget class="QCheckBox" name="chbAskToSaveProjectChanges" >
61+
<property name="text" >
62+
<string>Ask to save project changes when required</string>
63+
</property>
64+
</widget>
65+
</item>
66+
</layout>
67+
</widget>
68+
</item>
69+
<item>
70+
<spacer>
71+
<property name="orientation" >
72+
<enum>Qt::Vertical</enum>
73+
</property>
74+
<property name="sizeHint" >
75+
<size>
76+
<width>20</width>
77+
<height>40</height>
78+
</size>
79+
</property>
80+
</spacer>
81+
</item>
82+
</layout>
83+
</widget>
3684
<widget class="QWidget" name="tabAppearance" >
3785
<attribute name="title" >
3886
<string>&amp;Appearance</string>
@@ -258,7 +306,7 @@
258306
</item>
259307
</layout>
260308
</widget>
261-
<widget class="QWidget" name="TabPage" >
309+
<widget class="QWidget" name="tabRendering" >
262310
<attribute name="title" >
263311
<string>&amp;Rendering</string>
264312
</attribute>
@@ -603,7 +651,7 @@ p, li { white-space: pre-wrap; }
603651
</item>
604652
</layout>
605653
</widget>
606-
<widget class="QWidget" name="TabPage" >
654+
<widget class="QWidget" name="tabProjection" >
607655
<attribute name="title" >
608656
<string>Pro&amp;jection</string>
609657
</attribute>

0 commit comments

Comments
 (0)