[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - desktop/inc desktop/source

Tamás Zolnai tamas.zolnai at collabora.com
Fri Apr 6 12:41:06 UTC 2018


 desktop/inc/app.hxx                                                   |    2 -
 desktop/source/app/app.cxx                                            |    2 -
 desktop/source/app/check_ext_deps.cxx                                 |   13 +++---
 desktop/source/deployment/registry/configuration/dp_configuration.cxx |    5 +-
 desktop/source/lib/init.cxx                                           |   20 +++++++++-
 5 files changed, 31 insertions(+), 11 deletions(-)

New commits:
commit 8674c0999bea80c0234c1e3bae1bc12f53b27c45
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Tue Apr 3 17:57:04 2018 +0200

    lok: Make the bundled dictionaries work.
    
    Create the user directory temporary in the temp directory and
    use that to load the dictionaries (bundled extensions).
    
    Co-author; Jan Holesovsky <kendy at collabora.com>
    
    Reviewed-on: https://gerrit.libreoffice.org/49495
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit ecfd40a1bcc1fc8cdc40bdd27ea1f00ba652707e)
    
    Change-Id: I5c7c824b68571048ce870fd5218cb47a333f3ad8
    Reviewed-on: https://gerrit.libreoffice.org/52347
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 9ea716fc3e3f..aeb20959748c 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -117,7 +117,7 @@ class Desktop : public Application
         // first-start (ever) related methods
         static bool             CheckExtensionDependencies();
 
-        void                    SynchronizeExtensionRepositories();
+        static void             SynchronizeExtensionRepositories(bool bCleanedExtensionCache, Desktop* pDesktop = nullptr);
         void                    SetSplashScreenText( const OUString& rText );
         void                    SetSplashScreenProgress( sal_Int32 );
 
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 53934e47a050..64377666f62e 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1545,7 +1545,7 @@ int Desktop::Main()
         // Check if bundled or shared extensions were added /removed
         // and process those extensions (has to be done before checking
         // the extension dependencies!
-        SynchronizeExtensionRepositories();
+        SynchronizeExtensionRepositories(m_bCleanedExtensionCache, this);
         bool bAbort = CheckExtensionDependencies();
         if ( bAbort )
             return EXIT_FAILURE;
diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx
index f22a3e1a63d3..f071083fa74d 100644
--- a/desktop/source/app/check_ext_deps.cxx
+++ b/desktop/source/app/check_ext_deps.cxx
@@ -115,7 +115,8 @@ SilentCommandEnv::SilentCommandEnv(
 
 SilentCommandEnv::~SilentCommandEnv()
 {
-    mpDesktop->SetSplashScreenText( OUString() );
+    if (mpDesktop)
+        mpDesktop->SetSplashScreenText(OUString());
 }
 
 
@@ -189,7 +190,7 @@ void SilentCommandEnv::push( uno::Any const & rStatus )
     OUString sText;
     mnLevel += 1;
 
-    if ( rStatus.hasValue() && ( rStatus >>= sText) )
+    if (mpDesktop && rStatus.hasValue() && (rStatus >>= sText))
     {
         if ( mnLevel <= 3 )
             mpDesktop->SetSplashScreenText( sText );
@@ -203,7 +204,7 @@ void SilentCommandEnv::update( uno::Any const & rStatus )
     throw (uno::RuntimeException, std::exception)
 {
     OUString sText;
-    if ( rStatus.hasValue() && ( rStatus >>= sText) )
+    if (mpDesktop && rStatus.hasValue() && (rStatus >>= sText))
     {
         mpDesktop->SetSplashScreenText( sText );
     }
@@ -413,13 +414,13 @@ bool Desktop::CheckExtensionDependencies()
         return false;
 }
 
-void Desktop::SynchronizeExtensionRepositories()
+void Desktop::SynchronizeExtensionRepositories(bool bCleanedExtensionCache, Desktop* pDesktop)
 {
     uno::Reference< uno::XComponentContext > context(
         comphelper::getProcessComponentContext());
     uno::Reference< ucb::XCommandEnvironment > silent(
-        new SilentCommandEnv(context, this));
-    if (m_bCleanedExtensionCache) {
+        new SilentCommandEnv(context, pDesktop));
+    if (bCleanedExtensionCache) {
         deployment::ExtensionManager::get(context)->reinstallDeployedExtensions(
             true, "user", Reference<task::XAbortChannel>(), silent);
 #if !HAVE_FEATURE_MACOSX_SANDBOX
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 81ef9588b334..d8c75741fc50 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -38,6 +38,7 @@
 #include <comphelper/anytostring.hxx>
 #include <comphelper/servicedecl.hxx>
 #include <xmlscript/xml_helper.hxx>
+#include <comphelper/lok.hxx>
 #include <svl/inettype.hxx>
 #include <com/sun/star/configuration/Update.hpp>
 #include <com/sun/star/ucb/NameClash.hpp>
@@ -710,8 +711,8 @@ void BackendImpl::PackageImpl::processPackage_(
             }
             //No need for live-deployment for bundled extension, because OOo
             //restarts after installation
-            if (that->m_eContext != CONTEXT_BUNDLED
-                && !startup)
+            if ((that->m_eContext != CONTEXT_BUNDLED && !startup)
+                || comphelper::LibreOfficeKit::isActive())
             {
                 if (m_isSchema)
                 {
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index a3b77270aaa9..1b2a95416081 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -93,6 +93,7 @@
 #include <unotools/syslocaleoptions.hxx>
 #include <unotools/mediadescriptor.hxx>
 #include <unotools/pathoptions.hxx>
+#include <unotools/tempfile.hxx>
 #include <osl/module.hxx>
 #include <comphelper/sequence.hxx>
 #include <sfx2/sfxbasemodel.hxx>
@@ -3573,6 +3574,21 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit:
 /// Used only by LibreOfficeKit when used by Online to pre-initialize
 static void preloadData()
 {
+    std::cerr << "Preloading dictionaries: ";
+
+    // Create user profile in the temp directory for loading the dictionaries
+    OUString sUserPath;
+    rtl::Bootstrap::get("UserInstallation", sUserPath);
+    utl::TempFile aTempDir(nullptr, true);
+    aTempDir.EnableKillingFile();
+    rtl::Bootstrap::set("UserInstallation", aTempDir.GetURL());
+
+    // Register the bundled extensions
+    desktop::Desktop::SynchronizeExtensionRepositories(true);
+    bool bAbort = desktop::Desktop::CheckExtensionDependencies();
+    if(bAbort)
+        std::cerr << "CheckExtensionDependencies failed" << std::endl;
+
     // preload all available dictionaries
     css::uno::Reference<css::linguistic2::XLinguServiceManager> xLngSvcMgr =
         css::linguistic2::LinguServiceManager::create(comphelper::getProcessComponentContext());
@@ -3580,7 +3596,6 @@ static void preloadData()
 
     css::uno::Reference<linguistic2::XSupportedLocales> xSpellLocales(xSpellChecker, css::uno::UNO_QUERY_THROW);
     uno::Sequence< css::lang::Locale > aLocales = xSpellLocales->getLocales();
-    std::cerr << "Preloading dictionaries: ";
     for (auto &it : aLocales)
     {
         std::cerr << it.Language << "_" << it.Country << " ";
@@ -3602,6 +3617,9 @@ static void preloadData()
     }
     std::cerr << "\n";
 
+    // Set user profile's path back to the original one
+    rtl::Bootstrap::set("UserInstallation", sUserPath);
+
     css::uno::Reference< css::ui::XAcceleratorConfiguration > xGlobalCfg;
     xGlobalCfg = css::ui::GlobalAcceleratorConfiguration::create(
         comphelper::getProcessComponentContext());


More information about the Libreoffice-commits mailing list