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

Tamás Zolnai tamas.zolnai at collabora.com
Fri Apr 20 15:54:01 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 6008269b9bcc6e1d6de01a5205e4884a076ff4ee
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Mon Apr 2 22:52:46 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>
    
    Change-Id: I5c7c824b68571048ce870fd5218cb47a333f3ad8
    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)
    Reviewed-on: https://gerrit.libreoffice.org/52506
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 53f4eba57829..672229683144 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 687597eec6cc..8d1ad7dcb084 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1459,7 +1459,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 0fb8a9aa60bd..d5b2876779f7 100644
--- a/desktop/source/app/check_ext_deps.cxx
+++ b/desktop/source/app/check_ext_deps.cxx
@@ -114,7 +114,8 @@ SilentCommandEnv::SilentCommandEnv(
 
 SilentCommandEnv::~SilentCommandEnv()
 {
-    mpDesktop->SetSplashScreenText( OUString() );
+    if (mpDesktop)
+        mpDesktop->SetSplashScreenText(OUString());
 }
 
 
@@ -184,7 +185,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 );
@@ -197,7 +198,7 @@ void SilentCommandEnv::push( uno::Any const & rStatus )
 void SilentCommandEnv::update( uno::Any const & rStatus )
 {
     OUString sText;
-    if ( rStatus.hasValue() && ( rStatus >>= sText) )
+    if (mpDesktop && rStatus.hasValue() && (rStatus >>= sText))
     {
         mpDesktop->SetSplashScreenText( sText );
     }
@@ -407,13 +408,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 5739d3f444c0..0393e934e343 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>
@@ -708,8 +709,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 5e00b5d09ea0..34bb568b8a8e 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -94,6 +94,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>
@@ -3660,6 +3661,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());
@@ -3667,7 +3683,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 << " ";
@@ -3689,6 +3704,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