diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-05-19 13:58:13 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-05-19 13:59:16 +0200 |
commit | 76c61ced4eaa5f69b948dca7537028eaa88225b3 (patch) | |
tree | ed8d00436051f02e73456af547cbf4a2a4a5382b /sw/source | |
parent | 4ab498fd50d94f2d84b5794f0a75d621a701e622 (diff) |
check for and handle missing base in mail merge (related: fdo#33266)
Change-Id: I3e362a873c28026cbecf005c07def1295aa920e0
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/uibase/app/apphdl.cxx | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index cccc8b7bd8a0..9b32ae77e7d0 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -21,17 +21,19 @@ #include <hintids.hxx> +#include <comphelper/processfactory.hxx> #include <osl/diagnose.h> #include <tools/link.hxx> #include <svl/urihelper.hxx> #include <unotools/pathoptions.hxx> -#include <svtools/accessibilityoptions.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/event.hxx> #include <sfx2/objitem.hxx> #include <svx/dataaccessdescriptor.hxx> #include <svl/srchitem.hxx> +#include <svtools/accessibilityoptions.hxx> #include <svtools/colorcfg.hxx> +#include <svtools/restartdialog.hxx> #include <svl/eitem.hxx> #include <svl/whiter.hxx> #include <svl/isethint.hxx> @@ -92,7 +94,9 @@ #include <com/sun/star/beans/XPropertyContainer.hpp> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/sdbc/XConnection.hpp> +#include <com/sun/star/sdb/TextConnectionSettings.hpp> #include <com/sun/star/sdbc/XDataSource.hpp> +#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp> #include <swabstdlg.hxx> #include <vcl/status.hxx> @@ -115,6 +119,24 @@ using namespace ::com::sun::star; #include <shells.hrc> +namespace +{ + static bool lcl_hasAllComponentsAvailable() + { + try + { + return css::sdb::TextConnectionSettings::create(comphelper::getProcessComponentContext()).is(); + } + catch (css::uno::Exception & e) + { + SAL_INFO( + "sw.core", + "assuming Base to be missing; caught " << e.Message); + return false; + } + } +} + SFX_IMPL_INTERFACE(SwModule, SfxModule) void SwModule::InitInterface_Impl() @@ -278,6 +300,27 @@ SwMailMergeWizardExecutor::~SwMailMergeWizardExecutor() 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" }; + OUString sInteraction; + xSyncDbusSessionHelper->InstallPackageNames(0, vPackages, sInteraction); + SolarMutexGuard aGuard; + executeRestartDialog(comphelper::getProcessComponentContext(), NULL, RESTART_REASON_MAILMERGE_INSTALL); + } + catch (const css::uno::Exception & e) + { + SAL_INFO( + "sw.core", + "trying to install LibreOffice Base, caught " << e.Message); + } + return; + } if ( m_pView ) { OSL_FAIL("SwMailMergeWizardExecutor::ExecuteMailMergeWizard: Already executing the wizard!" ); |