summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2018-04-02 22:52:46 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2018-04-03 14:00:38 +0200
commitecfd40a1bcc1fc8cdc40bdd27ea1f00ba652707e (patch)
treee149af56e34badd83966d09fa743b37ca2ef29e7 /desktop
parent86e54f2d757fe300ba634cdcbf0ee8a589dbc2ae (diff)
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@collabora.com> Change-Id: I5c7c824b68571048ce870fd5218cb47a333f3ad8 Reviewed-on: https://gerrit.libreoffice.org/49495 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/inc/app.hxx2
-rw-r--r--desktop/source/app/app.cxx2
-rw-r--r--desktop/source/app/check_ext_deps.cxx13
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configuration.cxx5
-rw-r--r--desktop/source/lib/init.cxx20
5 files changed, 31 insertions, 11 deletions
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 175a12304b26..c238d53529d8 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1451,7 +1451,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 8193dd5d3446..5959f4237738 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>
@@ -3627,6 +3628,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());
@@ -3634,7 +3650,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 << " ";
@@ -3656,6 +3671,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());