From c6f8eb26c07264103a3e99f79b2dc78f9be6ef57 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 2 Mar 2012 10:58:39 +0100 Subject: Clean up --- desktop/source/app/userinstall.cxx | 107 ++++----------------- officecfg/registry/data/org/openoffice/Setup.xcu | 16 --- officecfg/registry/schema/org/openoffice/Setup.xcs | 8 +- 3 files changed, 24 insertions(+), 107 deletions(-) diff --git a/desktop/source/app/userinstall.cxx b/desktop/source/app/userinstall.cxx index 7fe97299b8d6..26d2ef7e5ddc 100644 --- a/desktop/source/app/userinstall.cxx +++ b/desktop/source/app/userinstall.cxx @@ -42,21 +42,14 @@ #include #include +#include #include #include #include #include #include -#include #include -#include #include -#include -#include -#include -#include -#include -#include #include #include @@ -81,10 +74,6 @@ namespace desktop { { try { - OUString sAccessSrvc( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationAccess" ) ); - Reference< XMultiServiceFactory > theConfigProvider( com::sun::star::configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ) ); @@ -95,28 +84,7 @@ namespace desktop { Locale aLocale = LanguageSelection::IsoStringToLocale(aUserLanguage); localizable->setLocale(aLocale); - Sequence< Any > theArgs(1); - NamedValue v; - v.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")); - v.Value = makeAny(OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Setup"))); - theArgs[0] <<= v; - Reference< XHierarchicalNameAccess> hnacc( - theConfigProvider->createInstanceWithArguments( - sAccessSrvc, theArgs), UNO_QUERY_THROW); - - try - { - sal_Bool bValue = sal_False; - hnacc->getByHierarchicalName( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "Office/ooSetupInstCompleted" ) ) ) >>= bValue; - - return bValue ? true : false; - } - catch ( NoSuchElementException const & ) - { - // just return false in this case. - } + return officecfg::Setup::Office::ooSetupInstCompleted::get(); } catch (Exception const & e) { @@ -217,17 +185,6 @@ namespace desktop { return err; } -#ifndef ANDROID - static const char *pszSrcList[] = { - "/presets", - NULL - }; - static const char *pszDstList[] = { - "/user", - NULL - }; -#endif - static UserInstall::UserInstallError create_user_install(OUString& aUserPath) { OUString aBasePath; @@ -239,63 +196,37 @@ namespace desktop { if ((rc != FileBase::E_None) && (rc != FileBase::E_EXIST)) return UserInstall::E_Creation; #ifdef UNIX - // set safer permissions for the user directory by default - File::setAttributes(aUserPath, osl_File_Attribute_OwnWrite| osl_File_Attribute_OwnRead| osl_File_Attribute_OwnExe); + // Set safer permissions for the user directory by default: + File::setAttributes(aUserPath, osl_File_Attribute_OwnWrite| osl_File_Attribute_OwnRead| osl_File_Attribute_OwnExe); #endif #ifndef ANDROID // as of now osl_copyFile does not work on Android => don't do this. - // copy data from shared data directory of base installation - for (sal_Int32 i=0; pszSrcList[i]!=NULL && pszDstList[i]!=NULL; i++) + // Copy data from shared data directory of base installation: + rc = copy_recursive( + aBasePath + rtl::OUString("/presets"), + aUserPath + rtl::OUString("/user")); + if ((rc != FileBase::E_None) && (rc != FileBase::E_EXIST)) { - rc = copy_recursive( - aBasePath + OUString::createFromAscii(pszSrcList[i]), - aUserPath + OUString::createFromAscii(pszDstList[i])); - if ((rc != FileBase::E_None) && (rc != FileBase::E_EXIST)) - { - if ( rc == FileBase::E_NOSPC ) - return UserInstall::E_NoDiskSpace; - else if ( rc == FileBase::E_ACCES ) - return UserInstall::E_NoWriteAccess; - else - return UserInstall::E_Creation; - } + if ( rc == FileBase::E_NOSPC ) + return UserInstall::E_NoDiskSpace; + else if ( rc == FileBase::E_ACCES ) + return UserInstall::E_NoWriteAccess; + else + return UserInstall::E_Creation; } Migration::migrateSettingsIfNecessary(); #endif - try - { - OUString sAccessSrvc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")); - Reference< XMultiServiceFactory > theConfigProvider( - com::sun::star::configuration::theDefaultProvider::get( - comphelper::getProcessComponentContext() ) ); - Sequence< Any > theArgs(1); - NamedValue v(OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), makeAny(OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Setup")))); - theArgs[0] <<= v; - Reference< XHierarchicalPropertySet> hpset( - theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); - hpset->setHierarchicalPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Office/ooSetupInstCompleted")), makeAny(sal_True)); - Reference< XChangesBatch >(hpset, UNO_QUERY_THROW)->commitChanges(); - } - catch ( const PropertyVetoException& ) - { - // we are not allowed to change this - } - catch (const Exception& e) - { - OString aMsg("create_user_install(): "); - aMsg += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US); - OSL_FAIL(aMsg.getStr()); - return UserInstall::E_Creation; - } + boost::shared_ptr< comphelper::ConfigurationChanges > batch( + comphelper::ConfigurationChanges::create()); + officecfg::Setup::Office::ooSetupInstCompleted::set(true, batch); + batch->commit(); return UserInstall::E_None; - } } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index 4163b1b3b8ef..4979ce748b91 100644 --- a/officecfg/registry/data/org/openoffice/Setup.xcu +++ b/officecfg/registry/data/org/openoffice/Setup.xcu @@ -58,12 +58,6 @@ - - false - - - true - @@ -774,16 +768,6 @@ - - - - - - - - true - - diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs index 53ace015933e..2f14b7a81fd0 100644 --- a/officecfg/registry/schema/org/openoffice/Setup.xcs +++ b/officecfg/registry/schema/org/openoffice/Setup.xcs @@ -323,7 +323,7 @@ - + @@ -331,6 +331,7 @@ IS/BEI Indicates if the user data is copied successfully. + false @@ -348,7 +349,7 @@ Enumerates the application languages that are installed, if a multilingual version is used. - + @@ -357,6 +358,7 @@ CD Specifies whether the splash screen is displayed during startup. + true @@ -428,7 +430,6 @@ - @@ -468,6 +469,7 @@ JB Deprecated + true -- cgit