Kaydet (Commit) 7cf4eeed authored tarafından Caolán McNamara's avatar Caolán McNamara

set dbus id for existing DbusSessionHelper users

Change-Id: I64329e21ae79b6607856de9781bee0274b9cb136
Reviewed-on: https://gerrit.libreoffice.org/46854Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 9c435044
......@@ -98,6 +98,19 @@ struct SystemEnvData
}
};
inline sal_uInt32 GetDbusId(const SystemEnvData& rData)
{
#if defined(_WIN32) || defined( MACOSX ) || defined( ANDROID ) || defined( IOS )
(void)rData;
return 0;
#elif defined( UNX )
return rData.aWindow;
#else
(void)rData;
return 0;
#endif
}
struct SystemParentData
{
sal_uInt32 nSize; // size in bytes of this structure
......
......@@ -60,6 +60,7 @@
#include <tools/svlibrary.h>
#include <tools/diagnose_ex.h>
#include <vcl/layout.hxx>
#include <vcl/sysdata.hxx>
#include <svl/intitem.hxx>
#include <svl/eitem.hxx>
#include <svl/stritem.hxx>
......@@ -185,7 +186,7 @@ namespace
return false;
}
}
void lcl_tryLoadBibliography()
void lcl_tryLoadBibliography(const vcl::Window* pTopWindow)
{
// lp#527938, debian#602953, fdo#33266, i#105408
// make sure we actually can instantiate services from base first
......@@ -197,7 +198,11 @@ namespace
using namespace svtools;
Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
Sequence< OUString > vPackages { "libreoffice-base" };
xSyncDbusSessionHelper->InstallPackageNames(0, vPackages, OUString());
const SystemEnvData* pEnvData = pTopWindow ? pTopWindow->GetSystemData() : nullptr;
sal_uInt32 nDbusId = pEnvData ? GetDbusId(*pEnvData) : 0;
xSyncDbusSessionHelper->InstallPackageNames(nDbusId, vPackages, OUString());
// Ill be back (hopefully)!
SolarMutexGuard aGuard;
executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, RESTART_REASON_BIBLIOGRAPHY_INSTALL);
......@@ -1662,7 +1667,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
break;
case SID_COMP_BIBLIOGRAPHY:
lcl_tryLoadBibliography();
lcl_tryLoadBibliography(GetTopWindow());
break;
}
}
......
......@@ -44,6 +44,7 @@
#include <svl/ctloptions.hxx>
#include <unotools/useroptions.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/wrkwin.hxx>
#include <svx/insctrl.hxx>
#include <svx/selctrl.hxx>
......@@ -420,7 +421,14 @@ void SwMailMergeWizardExecutor::ExecuteMailMergeWizard( const SfxItemSet * pArgs
using namespace svtools;
css::uno::Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
const css::uno::Sequence< OUString > vPackages{ "libreoffice-base" };
xSyncDbusSessionHelper->InstallPackageNames(0, vPackages, OUString());
vcl::Window* pTopWindow = Application::GetActiveTopWindow();
if (!pTopWindow)
pTopWindow = Application::GetFirstTopLevelWindow();
const SystemEnvData* pEnvData = pTopWindow ? pTopWindow->GetSystemData() : nullptr;
sal_uInt32 nDbusId = pEnvData ? GetDbusId(*pEnvData) : 0;
xSyncDbusSessionHelper->InstallPackageNames(nDbusId, vPackages, OUString());
SolarMutexGuard aGuard;
executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, RESTART_REASON_MAILMERGE_INSTALL);
}
......
......@@ -866,11 +866,13 @@ namespace
#if ENABLE_GIO
guint get_xid_for_dbus()
{
// FIXME: Application::GetActiveTopWindow only returns something sensible if LO currently has the focus
// (which is not the case when you are trying to debug this...). It should instead return the last active window.
const vcl::Window *pTopWindow = Application::IsHeadlessModeEnabled() ? nullptr : Application::GetActiveTopWindow();
if (Application::IsHeadlessModeEnabled())
return 0;
const vcl::Window *pTopWindow = Application::GetActiveTopWindow();
if (!pTopWindow)
pTopWindow = Application::GetFirstTopLevelWindow();
const SystemEnvData* pEnvData = pTopWindow ? pTopWindow->GetSystemData() : nullptr;
return pEnvData ? pEnvData->aWindow : 0;
return pEnvData ? GetDbusId(*pEnvData) : 0;
}
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment