summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-03-02 10:58:39 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-03-02 10:59:19 +0100
commitc6f8eb26c07264103a3e99f79b2dc78f9be6ef57 (patch)
treea9bb586111373304d8656c4af27f9c63afa65434
parent0f56302890e2f587dfc0230a0445199db97b4ffd (diff)
Clean up
-rw-r--r--desktop/source/app/userinstall.cxx107
-rw-r--r--officecfg/registry/data/org/openoffice/Setup.xcu16
-rw-r--r--officecfg/registry/schema/org/openoffice/Setup.xcs8
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 <osl/security.hxx>
#include <rtl/ref.hxx>
+#include <officecfg/Setup.hxx>
#include <unotools/bootstrap.hxx>
#include <svl/languageoptions.hxx>
#include <unotools/syslocaleoptions.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <i18npool/mslangid.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/beans/XHierarchicalPropertySet.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XLocalizable.hpp>
#include <com/sun/star/lang/Locale.hpp>
@@ -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 @@
</prop>
</node>
<node oor:name="Office">
- <prop oor:name="ooSetupInstCompleted">
- <value>false</value>
- </prop>
- <prop oor:name="ooSetupShowIntro">
- <value>true</value>
- </prop>
<node oor:name="Factories">
<node oor:name="com.sun.star.sheet.SpreadsheetDocument" oor:op="replace" install:module="calc">
<prop oor:name="ooSetupFactoryDocumentService" oor:finalized="true">
@@ -774,16 +768,6 @@
</node>
</node>
</node>
- <node oor:name="L10N">
- <prop oor:name="ooLocale" oor:type="xs:string">
- <value/>
- </prop>
- </node>
- <node oor:name="Configuration">
- <prop oor:name="TransferUserSettingsOnce" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
<node oor:name="Migration">
<node oor:name="SupportedVersions">
<node oor:name="OpenOffice.org3+OpenOffice.org2+StarOffice8+StarSuite8+Libreoffice3" oor:op="replace">
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 @@
<value/>
<!-- JB: Empty default inserted into empty property node. Remove if NIL was intended -->
</prop>
- <prop oor:name="ooSetupInstCompleted" oor:type="xs:boolean">
+ <prop oor:name="ooSetupInstCompleted" oor:type="xs:boolean" oor:nillable="false">
<!-- OldPath: Service User/[username] -->
<!-- OldLocation: userdb.ini -->
<info>
@@ -331,6 +331,7 @@
<author>IS/BEI</author>
<desc>Indicates if the user data is copied successfully.</desc>
</info>
+ <value>false</value>
</prop>
<prop oor:name="ooSetupLocales" oor:type="oor:string-list">
<!-- OldLocation: setup.inf-->
@@ -348,7 +349,7 @@
<desc>Enumerates the application languages that are installed, if a multilingual version is used.</desc>
</info>
</set>
- <prop oor:name="ooSetupShowIntro" oor:type="xs:boolean">
+ <prop oor:name="ooSetupShowIntro" oor:type="xs:boolean" oor:nillable="false">
<!-- OldPath: Common/Show-Intro -->
<!-- OldLocation: soffice.ini -->
<!-- UIHints: Tools - Options - General - View -->
@@ -357,6 +358,7 @@
<author>CD</author>
<desc>Specifies whether the splash screen is displayed during startup.</desc>
</info>
+ <value>true</value>
</prop>
<prop oor:name="ooSetupConnectionURL" oor:type="xs:string" oor:nillable="false">
<!-- OldPath: Common-->
@@ -428,7 +430,6 @@
<label>Locale</label>
</info>
<value/>
- <!-- JB: Empty default inserted into empty property node. Remove if NIL was intended -->
</prop>
<prop oor:name="ooSetupSystemLocale" oor:type="xs:string" oor:nillable="false">
<!-- UIHints: Tools - Options - Language Settings - Languages - Language of - Locale setting -->
@@ -468,6 +469,7 @@
<author>JB</author>
<desc>Deprecated</desc>
</info>
+ <value>true</value>
</prop>
</group>
<group oor:name="Migration">