From fee408dd695b9ddca8333688879d1ba52faff8fb Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 30 Oct 2019 10:56:10 +0000 Subject: pass an explicit parent for the password dialogs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic25d6b61750df9ccf5271df1b4d314ae9cb07550 Reviewed-on: https://gerrit.libreoffice.org/81758 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- basctl/source/basicide/basides1.cxx | 2 +- basctl/source/basicide/bastype2.cxx | 2 +- basctl/source/basicide/bastype3.cxx | 4 ++-- basctl/source/basicide/bastypes.cxx | 8 +++----- basctl/source/basicide/moduldl2.cxx | 6 +++--- basctl/source/basicide/moduldlg.cxx | 2 +- 6 files changed, 11 insertions(+), 13 deletions(-) (limited to 'basctl/source/basicide') diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index a6f74b646595..a59fbcca7048 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -517,7 +517,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) { OUString aPassword; - bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); + bOK = QueryPassword(rReq.GetFrameWeld(), xModLibContainer, aLibName, aPassword); } } diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index e450c04a0425..feb45f3d4206 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -601,7 +601,7 @@ bool TreeListBox::ExpandingHdl() if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) { OUString aPassword; - bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); + bOK = QueryPassword(GetFrameWeld(), xModLibContainer, aLibName, aPassword); } } } diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx index 68d5fb1c47c3..8098925a6b67 100644 --- a/basctl/source/basicide/bastype3.cxx +++ b/basctl/source/basicide/bastype3.cxx @@ -68,7 +68,7 @@ void TreeListBox::RequestingChildren( SvTreeListEntry* pEntry ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) { OUString aPassword; - bOK = QueryPassword( xModLibContainer, aOULibName, aPassword ); + bOK = QueryPassword(GetFrameWeld(), xModLibContainer, aOULibName, aPassword); } } @@ -157,7 +157,7 @@ IMPL_LINK(SbTreeListBox, RequestingChildrenHdl, const weld::TreeIter&, rEntry, b if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) { OUString aPassword; - bOK = QueryPassword( xModLibContainer, aOULibName, aPassword ); + bOK = QueryPassword(m_pTopLevel, xModLibContainer, aOULibName, aPassword); } } diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 5e642673cf8e..f38ba5d33e8c 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -743,7 +743,7 @@ bool QueryDelModule( const OUString& rName, weld::Widget* pParent ) return QueryDel( rName, IDEResId( RID_STR_QUERYDELMODULE ), pParent ); } -bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer, const OUString& rLibName, OUString& rPassword, bool bRepeat, bool bNewTitle ) +bool QueryPassword(weld::Widget* pDialogParent, const Reference< script::XLibraryContainer >& xLibContainer, const OUString& rLibName, OUString& rPassword, bool bRepeat, bool bNewTitle) { bool bOK = false; sal_uInt16 nRet = 0; @@ -751,8 +751,7 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer, do { // password dialog - vcl::Window* pWin = Application::GetDefDialogParent(); - SfxPasswordDialog aDlg(pWin ? pWin->GetFrameWeld() : nullptr); + SfxPasswordDialog aDlg(pDialogParent); aDlg.SetMinLen(1); // set new title @@ -779,8 +778,7 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer, if ( !bOK ) { - vcl::Window* pParent = Application::GetDefDialogParent(); - std::unique_ptr xErrorBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + std::unique_ptr xErrorBox(Application::CreateMessageDialog(pDialogParent, VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_WRONGPASSWORD))); xErrorBox->run(); } diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index c2633699b66a..34db6905702f 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -272,7 +272,7 @@ IMPL_LINK(LibPage, EditingEntryHdl, const weld::TreeIter&, rIter, bool) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) { OUString aPassword; - bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); + bOK = QueryPassword(m_pDialog->getDialog(), xModLibContainer, aLibName, aPassword); } if ( !bOK ) return false; @@ -740,7 +740,7 @@ void LibPage::InsertLib() Reference< script::XLibraryContainerPassword > xPasswd( xModLibContImport, UNO_QUERY ); if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) && !bReference ) { - bOK = QueryPassword( xModLibContImport, aLibName, aPassword, true, true ); + bOK = QueryPassword(m_pDialog->getDialog(), xModLibContImport, aLibName, aPassword, true, true); if ( !bOK ) { @@ -922,7 +922,7 @@ void LibPage::Export() if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) { OUString aPassword; - bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); + bOK = QueryPassword(m_pDialog->getDialog(), xModLibContainer, aLibName, aPassword); } if ( !bOK ) return; diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 0812647911f0..02259ed4314b 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -729,7 +729,7 @@ bool ObjectPage::GetSelection( ScriptDocument& rDocument, OUString& rLibName ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) { OUString aPassword; - bOK = QueryPassword( xModLibContainer, rLibName, aPassword ); + bOK = QueryPassword(m_pDialog->getDialog(), xModLibContainer, rLibName, aPassword); } // load library -- cgit