diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2012-11-24 20:06:26 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2012-11-24 20:12:00 +0100 |
commit | a6c1e4186a4f7e246103f541beccbc7d8a027ef0 (patch) | |
tree | 9a7fa3566cf5c8d0659284a37d4ea6df5450f608 /extensions/source | |
parent | db160a3cd5aa8d42ac90efd91b4c1825a9fe3156 (diff) |
lp#527938: use new-style service and session installer in bibliography
Change-Id: Id06e64ffb6c63cfba2f9948579dc03a4f54b6d45
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/bibliography/bibload.cxx | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 94e35cfa6d1f..58c1b014cc70 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/sdbc/DriverManager.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/frame/XFrameLoader.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -43,6 +44,7 @@ #include <com/sun/star/form/XLoadListener.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/uno/XAggregation.hpp> +#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp> #include <toolkit/awt/vclxwindow.hxx> #include <vcl/window.hxx> #include <vcl/edit.hxx> @@ -239,9 +241,9 @@ namespace { try { - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - Reference< XAggregation > xAggregate = Reference< XAggregation >( xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY); - return xAggregate.is(); + // if we get com::sun::star::sdbc::DriverManager, libsdbc2 is there + // and the bibliography is assumed to work + return com::sun::star::sdbc::DriverManager::create(comphelper::getProcessComponentContext()).is(); } catch(...) { @@ -256,7 +258,25 @@ void BibliographyLoader::load(const Reference< XFrame > & rFrame, const rtl::OUS // lp#527938, debian#602953, fdo#33266, i#105408 // make sure we actually can instanciate services from base first if(!lcl_isBaseAvailable()) + { + try + { + using namespace org::freedesktop::PackageKit; + Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()), UNO_QUERY); + Sequence< ::rtl::OUString > vPackages(1); + vPackages[0] = "libreoffice-base"; + ::rtl::OUString sInteraction(""); + xSyncDbusSessionHelper->InstallPackageNames(0, vPackages, sInteraction); + // FIXME: notify user to restart here + } + catch (Exception & e) + { + SAL_INFO( + "extensions.bibliography", + "trying to install LibreOffice Base, caught " << e.Message); + } return; + } SolarMutexGuard aGuard; |