officecfg/registry/data/org/openoffice/Office/Common.xcu   |    3 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    6 +
 sfx2/source/appl/appserv.cxx                               |   29 ++++----
 sw/source/uibase/app/apphdl.cxx                            |   45 ++++++++-----
 4 files changed, 56 insertions(+), 27 deletions(-)

New commits:
commit f62e4fb51d72641896b6b8f38fbffb35e6c1b695
Author:     Rene Engelhard <r...@debian.org>
AuthorDate: Mon Feb 3 19:26:56 2020 +0100
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Feb 11 18:33:33 2020 +0100

    make Base install via packagekit also confgurable (like fonts/langpacks)
    
    Change-Id: I72f98e89d1c8e92f10da8e3843956658d035528d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87907
    Tested-by: Rene Engelhard <r...@debian.org>
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu 
b/officecfg/registry/data/org/openoffice/Office/Common.xcu
index 5f99ddc036bd..3d138551b593 100644
--- a/officecfg/registry/data/org/openoffice/Office/Common.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu
@@ -556,6 +556,9 @@
       <prop oor:name="EnableLangpackInstallation" oor:type="xs:boolean">
         <value install:module="unx">true</value>
       </prop>
+      <prop oor:name="EnableBaseInstallation" oor:type="xs:boolean">
+        <value install:module="unx">true</value>
+      </prop>
   </node>
   <node oor:name="Classification">
       <prop oor:name="Policy" oor:type="xs:short">
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 87839ae3cd9d..b217416756da 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6621,6 +6621,12 @@
         </info>
         <value>true</value>
       </prop>
+      <prop oor:name="EnableBaseInstallation" oor:type="xs:boolean" 
oor:nillable="false">
+        <info>
+           <desc>Specifies if missing LibreOffice Base installation should be 
triggered.</desc>
+        </info>
+        <value>true</value>
+      </prop>
     </group>
     <group oor:name="Classification">
       <info>
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index aee61e671f14..459d482cbf68 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -174,20 +174,23 @@ namespace
         // make sure we actually can instantiate services from base first
         if(!lcl_isBaseAvailable())
         {
-            try
-            {
-                using namespace org::freedesktop::PackageKit;
-                using namespace svtools;
-                Reference< XSyncDbusSessionHelper > 
xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
-                Sequence< OUString > vPackages { "libreoffice-base" };
-                xSyncDbusSessionHelper->InstallPackageNames(vPackages, 
OUString());
-                // Ill be back (hopefully)!
-                SolarMutexGuard aGuard;
-                executeRestartDialog(comphelper::getProcessComponentContext(), 
nullptr, RESTART_REASON_BIBLIOGRAPHY_INSTALL);
-            }
-            catch (const Exception &)
+            if 
(officecfg::Office::Common::PackageKit::EnableBaseInstallation::get())
             {
-                TOOLS_INFO_EXCEPTION("sfx.appl", "trying to install 
LibreOffice Base");
+                try
+                {
+                    using namespace org::freedesktop::PackageKit;
+                    using namespace svtools;
+                    Reference< XSyncDbusSessionHelper > 
xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
+                    Sequence< OUString > vPackages { "libreoffice-base" };
+                    xSyncDbusSessionHelper->InstallPackageNames(vPackages, 
OUString());
+                    // I'll be back (hopefully)!
+                    SolarMutexGuard aGuard;
+                    
executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, 
RESTART_REASON_BIBLIOGRAPHY_INSTALL);
+                }
+                catch (const Exception &)
+                {
+                    TOOLS_INFO_EXCEPTION("sfx.appl", "trying to install 
LibreOffice Base");
+                }
             }
             return;
         }
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 073b9d4a911a..aa8111004ab4 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -80,6 +80,8 @@
 #include <salhelper/simplereferenceobject.hxx>
 #include <rtl/ref.hxx>
 
+#include <officecfg/Office/Common.hxx>
+
 using namespace ::com::sun::star;
 
 // Slotmaps for the application's methods
@@ -414,21 +416,36 @@ void SwMailMergeWizardExecutor::ExecuteMailMergeWizard( 
const SfxItemSet * pArgs
 {
     if(!lcl_hasAllComponentsAvailable())
     {
-        try
-        {
-            using namespace org::freedesktop::PackageKit;
-            using namespace svtools;
-            css::uno::Reference< XSyncDbusSessionHelper > 
xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
-            const css::uno::Sequence< OUString > vPackages{ "libreoffice-base" 
};
-            xSyncDbusSessionHelper->InstallPackageNames(vPackages, OUString());
-            SolarMutexGuard aGuard;
-            executeRestartDialog(comphelper::getProcessComponentContext(), 
nullptr, RESTART_REASON_MAILMERGE_INSTALL);
-        }
-        catch (const css::uno::Exception &)
+        if 
(officecfg::Office::Common::PackageKit::EnableBaseInstallation::get())
         {
-            TOOLS_INFO_EXCEPTION(
-                "sw.core",
-                "trying to install LibreOffice Base, caught");
+            try
+            {
+                using namespace org::freedesktop::PackageKit;
+                using namespace svtools;
+                css::uno::Reference< XSyncDbusSessionHelper > 
xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
+                const css::uno::Sequence< OUString > vPackages{ 
"libreoffice-base" };
+                xSyncDbusSessionHelper->InstallPackageNames(vPackages, 
OUString());
+                SolarMutexGuard aGuard;
+                executeRestartDialog(comphelper::getProcessComponentContext(), 
nullptr, RESTART_REASON_MAILMERGE_INSTALL);
+            }
+            catch (const css::uno::Exception &)
+            {
+                TOOLS_INFO_EXCEPTION(
+                    "sw.core",
+                    "trying to install LibreOffice Base, caught");
+                auto xRestartManager
+                    = 
css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext());
+                if (!xRestartManager->isRestartRequested(false))
+                {
+                    // Base is absent, and could not initiate its install - 
ask user to do that manually
+                    // Only show the dialog if restart is not initiated yet
+                    std::unique_ptr<weld::MessageDialog> 
xWarnBox(Application::CreateMessageDialog(
+                        nullptr, VclMessageType::Info, VclButtonsType::Ok,
+                        SwResId(STR_NO_BASE_FOR_MERGE)));
+                    xWarnBox->run();
+                }
+            }
+        } else {
             auto xRestartManager
                 = 
css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext());
             if (!xRestartManager->isRestartRequested(false))
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to