Allow disabling saving wxFileConfig data when it is destroyed

This can be useful to avoid saving the changes performed by the user if
this turns out to be undesirable, for whatever reason.

Closes https://github.com/wxWidgets/wxWidgets/pull/1451

Closes #13788.
This commit is contained in:
Igor Korot
2019-07-30 00:01:32 -05:00
committed by Vadim Zeitlin
parent e31938c314
commit c525784f77
3 changed files with 30 additions and 1 deletions

View File

@@ -182,6 +182,9 @@ public:
virtual bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto());
#endif // wxUSE_STREAMS
void EnableAutoSave() { m_autosave = true; }
void DisableAutoSave() { m_autosave = false; }
public:
// functions to work with this list
wxFileConfigLineList *LineListAppend(const wxString& str);
@@ -250,6 +253,7 @@ private:
#endif // __UNIX__
bool m_isDirty; // if true, we have unsaved changes
bool m_autosave; // if true, save changes on destruction
wxDECLARE_NO_COPY_CLASS(wxFileConfig);
wxDECLARE_ABSTRACT_CLASS(wxFileConfig);