use officecfg to retrieve UserAutoSave
Change-Id: I11f45c43bed9ea9a380026d84a91f48629dffac7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119461 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
6f07012a34
commit
e192e1542a
4 changed files with 11 additions and 42 deletions
|
@ -40,6 +40,7 @@
|
|||
#include <osl/diagnose.h>
|
||||
#include <tools/diagnose_ex.h>
|
||||
#include <officecfg/Office/Common.hxx>
|
||||
#include <officecfg/Office/Recovery.hxx>
|
||||
|
||||
#include <sfx2/fcontnr.hxx>
|
||||
|
||||
|
@ -438,8 +439,8 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
|
|||
m_xAutoSaveCB->set_active(officecfg::Office::Common::Save::Document::AutoSave::get());
|
||||
m_xAutoSaveCB->set_sensitive(!officecfg::Office::Common::Save::Document::AutoSave::isReadOnly());
|
||||
|
||||
m_xUserAutoSaveCB->set_active(aSaveOpt.IsUserAutoSave());
|
||||
m_xUserAutoSaveCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::UserAutoSave));
|
||||
m_xUserAutoSaveCB->set_active(officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get());
|
||||
m_xUserAutoSaveCB->set_sensitive(!officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::isReadOnly());
|
||||
|
||||
m_xWarnAlienFormatCB->set_active(aSaveOpt.IsWarnAlienFormat());
|
||||
m_xWarnAlienFormatCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::WarnAlienFormat));
|
||||
|
|
|
@ -36,8 +36,7 @@ public:
|
|||
Backup,
|
||||
WarnAlienFormat,
|
||||
LoadDocPrinter,
|
||||
OdfDefaultVersion,
|
||||
UserAutoSave,
|
||||
OdfDefaultVersion
|
||||
};
|
||||
|
||||
/** Keep enum values sorted that a less or greater compare maps to older
|
||||
|
@ -92,9 +91,6 @@ public:
|
|||
void SetBackup( bool b );
|
||||
bool IsBackup() const;
|
||||
|
||||
void SetUserAutoSave( bool b );
|
||||
bool IsUserAutoSave() const;
|
||||
|
||||
void SetLoadUserSettings(bool b);
|
||||
bool IsLoadUserSettings() const;
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include <officecfg/Inet.hxx>
|
||||
#include <officecfg/Office/Common.hxx>
|
||||
#include <officecfg/Office/Recovery.hxx>
|
||||
#include <unotools/saveopt.hxx>
|
||||
#include <svtools/helpopt.hxx>
|
||||
#include <unotools/securityoptions.hxx>
|
||||
|
@ -186,8 +187,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet )
|
|||
case SID_ATTR_USERAUTOSAVE :
|
||||
{
|
||||
bRet = true;
|
||||
if (!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::UserAutoSave))
|
||||
if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_USERAUTOSAVE ), aSaveOptions.IsUserAutoSave())))
|
||||
if (!officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::isReadOnly())
|
||||
if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_USERAUTOSAVE ),
|
||||
officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get() )))
|
||||
bRet = false;
|
||||
}
|
||||
break;
|
||||
|
@ -481,7 +483,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
|
|||
if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_USERAUTOSAVE), true, &pItem))
|
||||
{
|
||||
DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected");
|
||||
aSaveOptions.SetUserAutoSave( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
|
||||
officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::set(
|
||||
static_cast<const SfxBoolItem*>(pItem)->GetValue(),
|
||||
batch);
|
||||
}
|
||||
|
||||
// DocInfo
|
||||
|
|
|
@ -62,7 +62,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
|
|||
bool bUseUserData,
|
||||
bBackup,
|
||||
bAutoSave,
|
||||
bUserAutoSave,
|
||||
bWarnAlienFormat,
|
||||
bLoadDocPrinter;
|
||||
|
||||
|
@ -71,7 +70,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
|
|||
bool bROAutoSaveTime,
|
||||
bROUseUserData,
|
||||
bROBackup,
|
||||
bROUserAutoSave,
|
||||
bROWarnAlienFormat,
|
||||
bROLoadDocPrinter,
|
||||
bROODFDefaultVersion;
|
||||
|
@ -86,7 +84,6 @@ public:
|
|||
sal_Int32 GetAutoSaveTime() const { return nAutoSaveTime; }
|
||||
bool IsUseUserData() const { return bUseUserData; }
|
||||
bool IsBackup() const { return bBackup; }
|
||||
bool IsUserAutoSave() const { return bUserAutoSave; }
|
||||
bool IsWarnAlienFormat() const { return bWarnAlienFormat; }
|
||||
bool IsLoadDocPrinter() const { return bLoadDocPrinter; }
|
||||
|
||||
|
@ -96,7 +93,6 @@ public:
|
|||
void SetAutoSaveTime( sal_Int32 n );
|
||||
void SetUseUserData( bool b );
|
||||
void SetBackup( bool b );
|
||||
void SetUserAutoSave( bool b );
|
||||
void SetWarnAlienFormat( bool _bDoPP );
|
||||
void SetLoadDocPrinter( bool bNew );
|
||||
void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew );
|
||||
|
@ -134,16 +130,6 @@ void SvtSaveOptions_Impl::SetBackup( bool b )
|
|||
}
|
||||
}
|
||||
|
||||
void SvtSaveOptions_Impl::SetUserAutoSave( bool b )
|
||||
{
|
||||
if (!bROUserAutoSave && bUserAutoSave!=b)
|
||||
{
|
||||
bUserAutoSave = b;
|
||||
SetModified();
|
||||
Commit();
|
||||
}
|
||||
}
|
||||
|
||||
void SvtSaveOptions_Impl::SetWarnAlienFormat( bool _bDoPP )
|
||||
{
|
||||
if (!bROWarnAlienFormat && bWarnAlienFormat!=_bDoPP)
|
||||
|
@ -185,9 +171,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
|
|||
case SvtSaveOptions::EOption::Backup :
|
||||
bReadOnly = bROBackup;
|
||||
break;
|
||||
case SvtSaveOptions::EOption::UserAutoSave :
|
||||
bReadOnly = bROUserAutoSave;
|
||||
break;
|
||||
case SvtSaveOptions::EOption::WarnAlienFormat :
|
||||
bReadOnly = bROWarnAlienFormat;
|
||||
break;
|
||||
|
@ -236,14 +219,12 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
|
|||
, nAutoSaveTime( 0 )
|
||||
, bUseUserData( false )
|
||||
, bBackup( false )
|
||||
, bUserAutoSave( false )
|
||||
, bWarnAlienFormat( true )
|
||||
, bLoadDocPrinter( true )
|
||||
, eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST )
|
||||
, bROAutoSaveTime( CFG_READONLY_DEFAULT )
|
||||
, bROUseUserData( CFG_READONLY_DEFAULT )
|
||||
, bROBackup( CFG_READONLY_DEFAULT )
|
||||
, bROUserAutoSave( CFG_READONLY_DEFAULT )
|
||||
, bROWarnAlienFormat( CFG_READONLY_DEFAULT )
|
||||
, bROLoadDocPrinter( CFG_READONLY_DEFAULT )
|
||||
, bROODFDefaultVersion( CFG_READONLY_DEFAULT )
|
||||
|
@ -339,13 +320,11 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
|
|||
{
|
||||
bAutoSave = officecfg::Office::Recovery::AutoSave::Enabled::get();
|
||||
nAutoSaveTime = officecfg::Office::Recovery::AutoSave::TimeIntervall::get();
|
||||
bUserAutoSave = officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get();
|
||||
}
|
||||
else
|
||||
{
|
||||
bAutoSave = false;
|
||||
nAutoSaveTime = 0;
|
||||
bUserAutoSave = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -430,7 +409,6 @@ void SvtSaveOptions_Impl::ImplCommit()
|
|||
comphelper::ConfigurationChanges::create());
|
||||
officecfg::Office::Recovery::AutoSave::TimeIntervall::set(nAutoSaveTime, batch);
|
||||
officecfg::Office::Recovery::AutoSave::Enabled::set(bAutoSave, batch);
|
||||
officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::set(bUserAutoSave, batch);
|
||||
batch->commit();
|
||||
}
|
||||
|
||||
|
@ -549,16 +527,6 @@ bool SvtSaveOptions::IsBackup() const
|
|||
return pImp->pSaveOpt->IsBackup();
|
||||
}
|
||||
|
||||
void SvtSaveOptions::SetUserAutoSave( bool b )
|
||||
{
|
||||
pImp->pSaveOpt->SetUserAutoSave( b );
|
||||
}
|
||||
|
||||
bool SvtSaveOptions::IsUserAutoSave() const
|
||||
{
|
||||
return pImp->pSaveOpt->IsUserAutoSave();
|
||||
}
|
||||
|
||||
void SvtSaveOptions::SetLoadUserSettings(bool b)
|
||||
{
|
||||
pImp->pLoadOpt->SetLoadUserSettings(b);
|
||||
|
|
Loading…
Reference in a new issue