[Libreoffice-commits] .: desktop/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Fri Mar 2 03:49:19 PST 2012


 desktop/source/app/app.cxx         |   34 +++++++++++++++++++---------------
 desktop/source/app/userinstall.cxx |   13 +++++--------
 desktop/source/app/userinstall.hxx |    7 ++++---
 3 files changed, 28 insertions(+), 26 deletions(-)

New commits:
commit f97c9c25396fb6487da3b9b5284c6250c7927156
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Mar 2 12:48:46 2012 +0100

    migrateSettingsIfNecessary must be called later after all
    
    ...once e.g. UCB is already initialized, as the invoked migration services use it.

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 61746be..5610637 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -36,6 +36,7 @@
 #include "userinstall.hxx"
 #include "desktopcontext.hxx"
 #include "exithelper.hxx"
+#include "migration.hxx"
 
 #include <svtools/javacontext.hxx>
 #include <com/sun/star/frame/XSessionManagerListener.hpp>
@@ -1476,23 +1477,21 @@ int Desktop::Main()
 
     SetSplashScreenProgress(10);
 
+    UserInstall::UserInstallStatus inst_fin = UserInstall::finalize();
+    if (inst_fin != UserInstall::Ok && inst_fin != UserInstall::Created)
     {
-        UserInstall::UserInstallError instErr_fin = UserInstall::finalize();
-        if ( instErr_fin != UserInstall::E_None)
-        {
-            OSL_FAIL("userinstall failed");
-            if ( instErr_fin == UserInstall::E_NoDiskSpace )
-                HandleBootstrapErrors( BE_USERINSTALL_NOTENOUGHDISKSPACE );
-            else if ( instErr_fin == UserInstall::E_NoWriteAccess )
-                HandleBootstrapErrors( BE_USERINSTALL_NOWRITEACCESS );
-            else
-                HandleBootstrapErrors( BE_USERINSTALL_FAILED );
-            return EXIT_FAILURE;
-        }
-        // refresh path information
-        utl::Bootstrap::reloadData();
-        SetSplashScreenProgress(20);
+        OSL_FAIL("userinstall failed");
+        if ( inst_fin == UserInstall::E_NoDiskSpace )
+            HandleBootstrapErrors( BE_USERINSTALL_NOTENOUGHDISKSPACE );
+        else if ( inst_fin == UserInstall::E_NoWriteAccess )
+            HandleBootstrapErrors( BE_USERINSTALL_NOWRITEACCESS );
+        else
+            HandleBootstrapErrors( BE_USERINSTALL_FAILED );
+        return EXIT_FAILURE;
     }
+    // refresh path information
+    utl::Bootstrap::reloadData();
+    SetSplashScreenProgress(20);
 
     Reference< XMultiServiceFactory > xSMgr =
         ::comphelper::getProcessServiceFactory();
@@ -1623,6 +1622,11 @@ int Desktop::Main()
 
         // check whether the shutdown is caused by restart
         pExecGlobals->bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
+
+        if (inst_fin == UserInstall::Created)
+        {
+            Migration::migrateSettingsIfNecessary();
+        }
 #endif
 
         // keep a language options instance...
diff --git a/desktop/source/app/userinstall.cxx b/desktop/source/app/userinstall.cxx
index 26d2ef7..f6d0c7b 100644
--- a/desktop/source/app/userinstall.cxx
+++ b/desktop/source/app/userinstall.cxx
@@ -28,7 +28,6 @@
 
 #include "sal/config.h"
 
-#include "migration.hxx"
 #include "userinstall.hxx"
 #include "langselect.hxx"
 
@@ -68,7 +67,7 @@ using namespace com::sun::star::util;
 
 namespace desktop {
 
-    static UserInstall::UserInstallError create_user_install(OUString&);
+    static UserInstall::UserInstallStatus create_user_install(OUString&);
 
     static bool is_user_install()
     {
@@ -95,7 +94,7 @@ namespace desktop {
         return false;
     }
 
-    UserInstall::UserInstallError UserInstall::finalize()
+    UserInstall::UserInstallStatus UserInstall::finalize()
     {
         OUString aUserInstallPath;
         utl::Bootstrap::PathStatus aLocateResult =
@@ -114,7 +113,7 @@ namespace desktop {
                 // path exists, check if an installation lives there
                 if ( is_user_install() )
                 {
-                    return E_None;
+                    return Ok;
                 }
                 // Note: fall-thru intended.
             }
@@ -185,7 +184,7 @@ namespace desktop {
         return err;
     }
 
-    static UserInstall::UserInstallError create_user_install(OUString& aUserPath)
+    static UserInstall::UserInstallStatus create_user_install(OUString& aUserPath)
     {
         OUString aBasePath;
         if (utl::Bootstrap::locateBaseInstallation(aBasePath) != utl::Bootstrap::PATH_EXISTS)
@@ -216,8 +215,6 @@ namespace desktop {
             else
                 return UserInstall::E_Creation;
         }
-
-        Migration::migrateSettingsIfNecessary();
 #endif
 
         boost::shared_ptr< comphelper::ConfigurationChanges > batch(
@@ -225,7 +222,7 @@ namespace desktop {
         officecfg::Setup::Office::ooSetupInstCompleted::set(true, batch);
         batch->commit();
 
-        return UserInstall::E_None;
+        return UserInstall::Created;
     }
 }
 
diff --git a/desktop/source/app/userinstall.hxx b/desktop/source/app/userinstall.hxx
index 6dcb5e9..5fa1a2d 100644
--- a/desktop/source/app/userinstall.hxx
+++ b/desktop/source/app/userinstall.hxx
@@ -36,8 +36,9 @@ namespace desktop
 class UserInstall
 {
 public:
-    enum UserInstallError {
-        E_None,                 // no error
+    enum UserInstallStatus {
+        Ok,                     // no error, existing user installation found
+        Created,                // no error, new user installation created
         E_Creation,             // error while creating user install
         E_InvalidBaseinstall,   // corrupt base installation
         E_SetupFailed,          // external setup did not run correctly
@@ -48,7 +49,7 @@ public:
         E_Unknown               // unknown error
     };
 
-    static UserInstallError finalize();
+    static UserInstallStatus finalize();
 };
 }
 


More information about the Libreoffice-commits mailing list