[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - 2 commits - include/svtools svtools/source ucb/source
Caolán McNamara
caolanm at redhat.com
Thu May 26 16:14:43 UTC 2016
include/svtools/ServerDetailsControls.hxx | 4 +++-
svtools/source/contnr/fileview.cxx | 5 +++--
svtools/source/contnr/foldertree.cxx | 5 +++--
svtools/source/dialogs/PlaceEditDialog.cxx | 2 +-
svtools/source/dialogs/ServerDetailsControls.cxx | 10 ++++++----
svtools/source/dialogs/addresstemplate.cxx | 2 +-
ucb/source/ucp/cmis/auth_provider.cxx | 14 ++++++++++++--
ucb/source/ucp/cmis/auth_provider.hxx | 7 ++++---
8 files changed, 33 insertions(+), 16 deletions(-)
New commits:
commit a75c8e8dce22facea5eae454d050515f169a3f8b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu May 26 15:24:54 2016 +0100
Resolves: tdf#96279 set correct parents for password dialogs
otherwise on Dialog::Execute before it becomes visible and
a password dialog is needed the new dialog will automatically
look for a parent, but will be parented by the main window
because the dialog it should be a parent of is not visible
yet.
Change-Id: Ia34e43d7ef2b204b348f2eb5aab542ee8ffe840e
(cherry picked from commit 7417311fc0f888223ae05f1cfc750de1735c5c9e)
diff --git a/include/svtools/ServerDetailsControls.hxx b/include/svtools/ServerDetailsControls.hxx
index 181c756..b6ceaa2 100644
--- a/include/svtools/ServerDetailsControls.hxx
+++ b/include/svtools/ServerDetailsControls.hxx
@@ -18,6 +18,7 @@
#include <tools/urlobj.hxx>
#include <vcl/builder.hxx>
#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
#include <vcl/edit.hxx>
#include <vcl/field.hxx>
#include <vcl/fixed.hxx>
@@ -136,9 +137,10 @@ class CmisDetailsContainer : public DetailsContainer
VclPtr<FixedText> m_pFTRepository;
VclPtr<ListBox> m_pLBRepository;
VclPtr<Button> m_pBTRepoRefresh;
+ css::uno::Reference< css::awt::XWindow > m_xParentDialog;
public:
- CmisDetailsContainer( VclBuilderContainer* pBuilder, OUString const & sBinding );
+ CmisDetailsContainer(VclBuilderContainer* pBuilder, Dialog* pParentDialog, OUString const & sBinding);
virtual ~CmisDetailsContainer( ) { };
virtual void show( bool bShow = true ) override;
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index d7b4a89..bf8bdae 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -29,6 +29,7 @@
#include <svtools/svtabbx.hxx>
#include <svtools/svtools.hrc>
#include <svtools/viewdataentry.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include "fileview.hrc"
#include "contentenumeration.hxx"
#include <svtools/AccessibleBrowseBoxObjType.hxx>
@@ -533,7 +534,7 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin,
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference< XInteractionHandler > xInteractionHandler(
- InteractionHandler::createWithParent(xContext, nullptr), UNO_QUERY_THROW );
+ InteractionHandler::createWithParent(xContext, VCLUnoHelper::GetInterface(GetParentDialog())), UNO_QUERY_THROW );
mxCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
@@ -977,7 +978,7 @@ SvtFileView::SvtFileView( vcl::Window* pParent, WinBits nBits,
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference< XInteractionHandler > xInteractionHandler(
- InteractionHandler::createWithParent(xContext, nullptr), UNO_QUERY_THROW );
+ InteractionHandler::createWithParent(xContext, VCLUnoHelper::GetInterface(GetParentDialog())), UNO_QUERY_THROW );
Reference < XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
mpImp = new SvtFileView_Impl( this, xCmdEnv, nFlags, bOnlyFolder );
diff --git a/svtools/source/contnr/foldertree.cxx b/svtools/source/contnr/foldertree.cxx
index 40ed9d5..086ba62 100644
--- a/svtools/source/contnr/foldertree.cxx
+++ b/svtools/source/contnr/foldertree.cxx
@@ -8,7 +8,8 @@
*/
#include <svtools/foldertree.hxx>
-
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/dialog.hxx>
#include "contentenumeration.hxx"
FolderTree::FolderTree( vcl::Window* pParent, WinBits nBits )
@@ -18,7 +19,7 @@ FolderTree::FolderTree( vcl::Window* pParent, WinBits nBits )
{
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference< XInteractionHandler > xInteractionHandler(
- InteractionHandler::createWithParent( xContext, nullptr ), UNO_QUERY_THROW );
+ InteractionHandler::createWithParent(xContext, VCLUnoHelper::GetInterface(GetParentDialog())), UNO_QUERY_THROW );
m_xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
SetDefaultCollapsedEntryBmp( m_aFolderImage );
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx
index 137cec3..c054380 100644
--- a/svtools/source/dialogs/PlaceEditDialog.cxx
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -184,7 +184,7 @@ void PlaceEditDialog::InitDetails( )
nPos = m_pLBServerType->InsertEntry( aTypesNamesList[i], nPos );
- std::shared_ptr<DetailsContainer> xCmisDetails(std::make_shared<CmisDetailsContainer>(this, sUrl));
+ std::shared_ptr<DetailsContainer> xCmisDetails(std::make_shared<CmisDetailsContainer>(this, this, sUrl));
xCmisDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
m_aDetailsContainers.push_back(xCmisDetails);
diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx
index be071d5..2fc608b 100644
--- a/svtools/source/dialogs/ServerDetailsControls.cxx
+++ b/svtools/source/dialogs/ServerDetailsControls.cxx
@@ -19,6 +19,7 @@
#include <rtl/uri.hxx>
#include <ucbhelper/content.hxx>
#include <ucbhelper/commandenvironment.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <svtools/PlaceEditDialog.hxx>
#include <svtools/ServerDetailsControls.hxx>
@@ -271,17 +272,18 @@ void SmbDetailsContainer::show( bool bShow )
m_pFTPort->Enable( !bShow );
}
-CmisDetailsContainer::CmisDetailsContainer( VclBuilderContainer* pBuilder, OUString const & sBinding ) :
+CmisDetailsContainer::CmisDetailsContainer(VclBuilderContainer* pBuilder, Dialog* pParentDialog, OUString const & sBinding) :
DetailsContainer( pBuilder ),
m_sUsername( ),
m_xCmdEnv( ),
m_aRepoIds( ),
m_sRepoId( ),
- m_sBinding( sBinding )
+ m_sBinding( sBinding ),
+ m_xParentDialog( VCLUnoHelper::GetInterface(pParentDialog) )
{
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference< XInteractionHandler > xGlobalInteractionHandler(
- InteractionHandler::createWithParent(xContext, nullptr), UNO_QUERY );
+ InteractionHandler::createWithParent(xContext, m_xParentDialog), UNO_QUERY);
m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() );
pBuilder->get( m_pFTRepository, "repositoryLabel" );
@@ -436,7 +438,7 @@ IMPL_LINK_NOARG_TYPED( CmisDetailsContainer, RefreshReposHdl, Button*, void )
if( !sUrl.isEmpty() && !m_sUsername.isEmpty() && !m_sPassword.isEmpty() )
{
Reference< XInteractionHandler > xInteractionHandler(
- InteractionHandler::createWithParent( xContext, nullptr ),
+ InteractionHandler::createWithParent(xContext, m_xParentDialog),
UNO_QUERY );
Sequence<OUString> aPasswd { m_sPassword };
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 073d890..456274e 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -798,7 +798,7 @@ void AssignmentPersistentData::ImplCommit()
try
{
xHandler.set(
- InteractionHandler::createWithParent(m_xORB, nullptr),
+ InteractionHandler::createWithParent(m_xORB, VCLUnoHelper::GetInterface(this)),
UNO_QUERY_THROW );
}
catch(const Exception&) { }
commit feb5eb180de5e25ee6ee630b66f9cd876df60652
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu May 26 17:02:09 2016 +0100
avoid a global uno::Reference to the current XCommandEnvironment
because the Env is kept until we exit, which we get away with now. But we won't
get away with it if we set the parent window property of the InteractionHandler
belonging to the Env. Because we then end up trying to destroy the vcl dialog
well after all the vcl, etc infrastructure is torn down and crash on exit.
Here I'm assuming that its safe to use a WeakReference because we're just using
this to smuggle into the c-style callbacks a Reference to a Env currently
belonging to something else
Change-Id: I2d6b90ae23d5a24431dc49d4316bdc3194560403
(cherry picked from commit 8cce65007b506da38ca79ee8b5cdd62a1460fddd)
diff --git a/ucb/source/ucp/cmis/auth_provider.cxx b/ucb/source/ucp/cmis/auth_provider.cxx
index 0c3e4c0..ea833b1 100644
--- a/ucb/source/ucp/cmis/auth_provider.cxx
+++ b/ucb/source/ucp/cmis/auth_provider.cxx
@@ -22,8 +22,6 @@ using namespace std;
namespace cmis
{
- css::uno::Reference< css::ucb::XCommandEnvironment>
- AuthProvider::sm_xEnv;
bool AuthProvider::authenticationQuery( string& username, string& password )
{
if ( m_xEnv.is() )
@@ -66,6 +64,18 @@ namespace cmis
return false;
}
+ css::uno::WeakReference< css::ucb::XCommandEnvironment> AuthProvider::sm_xEnv;
+
+ void AuthProvider::setXEnv(const css::uno::Reference< css::ucb::XCommandEnvironment>& xEnv )
+ {
+ sm_xEnv = xEnv;
+ }
+
+ css::uno::Reference< css::ucb::XCommandEnvironment> AuthProvider::getXEnv()
+ {
+ return sm_xEnv;
+ }
+
char* AuthProvider::onedriveAuthCodeFallback( const char* url,
const char* /*username*/,
const char* /*password*/ )
diff --git a/ucb/source/ucp/cmis/auth_provider.hxx b/ucb/source/ucp/cmis/auth_provider.hxx
index e633e95..c2d1e18 100644
--- a/ucb/source/ucp/cmis/auth_provider.hxx
+++ b/ucb/source/ucp/cmis/auth_provider.hxx
@@ -12,13 +12,14 @@
#include <libcmis/libcmis.hxx>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <cppuhelper/weakref.hxx>
namespace cmis
{
class AuthProvider : public libcmis::AuthProvider
{
const css::uno::Reference< css::ucb::XCommandEnvironment>& m_xEnv;
- static css::uno::Reference< css::ucb::XCommandEnvironment> sm_xEnv;
+ static css::uno::WeakReference< css::ucb::XCommandEnvironment> sm_xEnv;
OUString m_sUrl;
OUString m_sBindingUrl;
@@ -38,9 +39,9 @@ namespace cmis
const char* /*username*/,
const char* /*password*/ );
- static void setXEnv( const css::uno::Reference< css::ucb::XCommandEnvironment>& xEnv ) { sm_xEnv = xEnv; }
+ static void setXEnv( const css::uno::Reference< css::ucb::XCommandEnvironment>& xEnv );
+ static css::uno::Reference< css::ucb::XCommandEnvironment> getXEnv();
- static const css::uno::Reference< css::ucb::XCommandEnvironment>& getXEnv( ) { return sm_xEnv; }
};
}
More information about the Libreoffice-commits
mailing list