Auto save: fix case of auto save interval is set to 0 (disabling auto save feature)

This fix allows also the new value of the auto save interval immediately taken in account.
This commit is contained in:
unknown 2016-11-22 11:07:33 +01:00 committed by jean-pierre charras
parent f7cc0a9334
commit 334c50477a
2 changed files with 20 additions and 1 deletions

View File

@ -200,6 +200,25 @@ bool EDA_BASE_FRAME::Enable( bool enable )
}
void EDA_BASE_FRAME::SetAutoSaveInterval( int aInterval )
{
m_autoSaveInterval = aInterval;
if( m_autoSaveTimer->IsRunning() )
{
if( m_autoSaveInterval > 0 )
{
m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
}
else
{
m_autoSaveTimer->Stop();
m_autoSaveState = false;
}
}
}
void EDA_BASE_FRAME::onAutoSaveTimer( wxTimerEvent& aEvent )
{
if( !doAutoSave() )

View File

@ -209,7 +209,7 @@ public:
bool Enable( bool enable ) override;
void SetAutoSaveInterval( int aInterval ) { m_autoSaveInterval = aInterval; }
void SetAutoSaveInterval( int aInterval );
int GetAutoSaveInterval() const { return m_autoSaveInterval; }