[Libreoffice-commits] core.git: unotools/Library_utl.mk unotools/source

Julien Nabet serval2412 at yahoo.fr
Sat Aug 10 07:22:30 PDT 2013


 unotools/Library_utl.mk            |    4 ++
 unotools/source/config/saveopt.cxx |   59 ++++++-------------------------------
 2 files changed, 14 insertions(+), 49 deletions(-)

New commits:
commit 203951880a4a61b7569eb5878efc8aa5d7ff8652
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Aug 10 16:22:00 2013 +0200

    fdo#46037: 1 less occurrence comphelper/configurationhelper in unotools
    
    Change-Id: If188eecd0f5ea3802ec795866d21c41e643cbd63

diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk
index e364811..2f14d75 100644
--- a/unotools/Library_utl.mk
+++ b/unotools/Library_utl.mk
@@ -13,6 +13,10 @@ $(eval $(call gb_Library_Library,utl))
 
 $(eval $(call gb_Library_use_external,utl,boost_headers))
 
+$(eval $(call gb_Library_use_custom_headers,utl,\
+ officecfg/registry \
+))
+
 # in case UNO services are exported: declare location of component file
 $(eval $(call gb_Library_set_componentfile,utl,unotools/util/utl))
 
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index 6ff1252..a58439b 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -26,9 +26,9 @@
 #include <com/sun/star/uno/Sequence.hxx>
 
 #include <osl/mutex.hxx>
-#include <comphelper/configurationhelper.hxx>
 #include <comphelper/processfactory.hxx>
 #include "itemholder1.hxx"
+#include <officecfg/Office/Recovery.hxx>
 
 using namespace utl;
 using namespace com::sun::star::uno;
@@ -564,30 +564,9 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
         }
     }
 
-    try
-    {
-    css::uno::Reference< css::uno::XInterface > xCFG = ::comphelper::ConfigurationHelper::openConfig(
-        ::comphelper::getProcessComponentContext(),
-        OUString("org.openoffice.Office.Recovery"),
-        ::comphelper::ConfigurationHelper::E_READONLY);
-
-    ::comphelper::ConfigurationHelper::readRelativeKey(
-        xCFG,
-        OUString("AutoSave"),
-        OUString("Enabled")) >>= bAutoSave;
-
-    ::comphelper::ConfigurationHelper::readRelativeKey(
-        xCFG,
-        OUString("AutoSave"),
-        OUString("TimeIntervall")) >>= nAutoSaveTime;
-
-    ::comphelper::ConfigurationHelper::readRelativeKey(
-        xCFG,
-        OUString("AutoSave"),
-        OUString("UserAutoSaveEnabled")) >>= bUserAutoSave;
-    }
-    catch(const css::uno::Exception&)
-        { OSL_FAIL("Could not find needed information for AutoSave feature."); }
+    bAutoSave = officecfg::Office::Recovery::AutoSave::Enabled::get();
+    nAutoSaveTime = officecfg::Office::Recovery::AutoSave::TimeIntervall::get();
+    bUserAutoSave = officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get();
 }
 
 SvtSaveOptions_Impl::~SvtSaveOptions_Impl()
@@ -758,30 +737,12 @@ void SvtSaveOptions_Impl::Commit()
     aValues.realloc(nRealCount);
     PutProperties( aNames, aValues );
 
-    css::uno::Reference< css::uno::XInterface > xCFG = ::comphelper::ConfigurationHelper::openConfig(
-        ::comphelper::getProcessComponentContext(),
-        OUString("org.openoffice.Office.Recovery"),
-        ::comphelper::ConfigurationHelper::E_STANDARD);
-
-    ::comphelper::ConfigurationHelper::writeRelativeKey(
-        xCFG,
-        OUString("AutoSave"),
-        OUString("TimeIntervall"),
-        css::uno::makeAny(nAutoSaveTime));
-
-    ::comphelper::ConfigurationHelper::writeRelativeKey(
-        xCFG,
-        OUString("AutoSave"),
-        OUString("Enabled"),
-        css::uno::makeAny(bAutoSave));
-
-    ::comphelper::ConfigurationHelper::writeRelativeKey(
-        xCFG,
-        OUString("AutoSave"),
-        OUString("UserAutoSaveEnabled"),
-        css::uno::makeAny(bUserAutoSave));
-
-    ::comphelper::ConfigurationHelper::flush(xCFG);
+    boost::shared_ptr< comphelper::ConfigurationChanges > batch(
+    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();
 }
 
 // -----------------------------------------------------------------------


More information about the Libreoffice-commits mailing list