diff options
author | Krisztian Pinter <pin.terminator@gmail.com> | 2013-02-26 16:43:48 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-03-07 10:11:47 +0100 |
commit | 895898596c72fd14db2abec3aeaab74d583769e5 (patch) | |
tree | 61587b3cb2638b20931ede8114b6fc3ae5a32f87 /framework/source/services | |
parent | add copy() to OUStringBuffer (diff) | |
download | core-895898596c72fd14db2abec3aeaab74d583769e5.tar.gz core-895898596c72fd14db2abec3aeaab74d583769e5.zip |
WIP: fdo#47011 autosave feature
Change-Id: Ib2cbcc33e6188c60c183b5f47e9ae9c9d4c91b95
Diffstat (limited to 'framework/source/services')
-rw-r--r-- | framework/source/services/autorecovery.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index f5e464f4986b..d0f1fab43739 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -21,6 +21,8 @@ #include "services/autorecovery.hxx" #include <loadenv/loadenv.hxx> +#include <sfx2/sfxbasemodel.hxx> //? + #include <loadenv/targethelper.hxx> #include <pattern/frame.hxx> #include <threadhelp/readguard.hxx> @@ -124,6 +126,8 @@ static const char CFG_ENTRY_SESSIONDATA[] = "SessionData"; static const char CFG_ENTRY_AUTOSAVE_ENABLED[] = "AutoSave/Enabled"; static const char CFG_ENTRY_AUTOSAVE_TIMEINTERVALL[] = "AutoSave/TimeIntervall"; //sic! +static const char CFG_ENTRY_USERAUTOSAVE_ENABLED[] = "AutoSave/UserAutoSaveEnabled"; + static const char CFG_PATH_AUTOSAVE[] = "AutoSave"; static const char CFG_ENTRY_MINSPACE_DOCSAVE[] = "MinSpaceDocSave"; static const char CFG_ENTRY_MINSPACE_CONFIGSAVE[] = "MinSpaceConfigSave"; @@ -977,12 +981,21 @@ void AutoRecovery::implts_readAutoSaveConfig() sal_Bool bEnabled = sal_False; xCommonRegistry->getByHierarchicalName(rtl::OUString(CFG_ENTRY_AUTOSAVE_ENABLED)) >>= bEnabled; + // UserAutoSave [bool] + sal_Bool bUserEnabled = sal_False; + xCommonRegistry->getByHierarchicalName(rtl::OUString(CFG_ENTRY_USERAUTOSAVE_ENABLED)) >>= bUserEnabled; + // SAFE -> ------------------------------ WriteGuard aWriteLock(m_aLock); if (bEnabled) { m_eJob |= AutoRecovery::E_AUTO_SAVE; m_eTimerType = AutoRecovery::E_NORMAL_AUTOSAVE_INTERVALL; + + if (bUserEnabled) + m_eJob |= AutoRecovery::E_USER_AUTO_SAVE; + else + m_eJob &= ~AutoRecovery::E_USER_AUTO_SAVE; } else { @@ -2328,6 +2341,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& // Mark AutoSave state as "INCOMPLETE" if it failed. // Because the last temp file is to old and does not include all changes. Reference< XDocumentRecovery > xDocRecover(rInfo.Document, css::uno::UNO_QUERY_THROW); + Reference< XStorable > xDocSave(rInfo.Document, css::uno::UNO_QUERY_THROW); // safe the state about "trying to save" // ... we need it for recovery if e.g. a crash occures inside next line! @@ -2342,6 +2356,12 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& { xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() ); + // if userautosave is enabled, also save to the original file + if((m_eJob & AutoRecovery::E_USER_AUTO_SAVE) == AutoRecovery::E_USER_AUTO_SAVE) + { + xDocSave->store(); + } + #ifdef TRIGGER_FULL_DISC_CHECK throw css::uno::Exception(); #else // TRIGGER_FULL_DISC_CHECK |