pass an explicit parent for the password dialogs

Change-Id: Ic25d6b61750df9ccf5271df1b4d314ae9cb07550
Reviewed-on: https://gerrit.libreoffice.org/81758
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2019-10-30 10:56:10 +00:00
parent 28ef7a8ce8
commit fee408dd69
7 changed files with 12 additions and 14 deletions

View File

@@ -517,7 +517,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
{ {
OUString aPassword; OUString aPassword;
bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); bOK = QueryPassword(rReq.GetFrameWeld(), xModLibContainer, aLibName, aPassword);
} }
} }

View File

@@ -601,7 +601,7 @@ bool TreeListBox::ExpandingHdl()
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
{ {
OUString aPassword; OUString aPassword;
bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); bOK = QueryPassword(GetFrameWeld(), xModLibContainer, aLibName, aPassword);
} }
} }
} }

View File

@@ -68,7 +68,7 @@ void TreeListBox::RequestingChildren( SvTreeListEntry* pEntry )
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
{ {
OUString aPassword; 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 ) ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
{ {
OUString aPassword; OUString aPassword;
bOK = QueryPassword( xModLibContainer, aOULibName, aPassword ); bOK = QueryPassword(m_pTopLevel, xModLibContainer, aOULibName, aPassword);
} }
} }

View File

@@ -743,7 +743,7 @@ bool QueryDelModule( const OUString& rName, weld::Widget* pParent )
return QueryDel( rName, IDEResId( RID_STR_QUERYDELMODULE ), 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; bool bOK = false;
sal_uInt16 nRet = 0; sal_uInt16 nRet = 0;
@@ -751,8 +751,7 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
do do
{ {
// password dialog // password dialog
vcl::Window* pWin = Application::GetDefDialogParent(); SfxPasswordDialog aDlg(pDialogParent);
SfxPasswordDialog aDlg(pWin ? pWin->GetFrameWeld() : nullptr);
aDlg.SetMinLen(1); aDlg.SetMinLen(1);
// set new title // set new title
@@ -779,8 +778,7 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
if ( !bOK ) if ( !bOK )
{ {
vcl::Window* pParent = Application::GetDefDialogParent(); std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pDialogParent,
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr,
VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_WRONGPASSWORD))); VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_WRONGPASSWORD)));
xErrorBox->run(); xErrorBox->run();
} }

View File

@@ -272,7 +272,7 @@ IMPL_LINK(LibPage, EditingEntryHdl, const weld::TreeIter&, rIter, bool)
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
{ {
OUString aPassword; OUString aPassword;
bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); bOK = QueryPassword(m_pDialog->getDialog(), xModLibContainer, aLibName, aPassword);
} }
if ( !bOK ) if ( !bOK )
return false; return false;
@@ -740,7 +740,7 @@ void LibPage::InsertLib()
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContImport, UNO_QUERY ); Reference< script::XLibraryContainerPassword > xPasswd( xModLibContImport, UNO_QUERY );
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) && !bReference ) 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 ) if ( !bOK )
{ {
@@ -922,7 +922,7 @@ void LibPage::Export()
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
{ {
OUString aPassword; OUString aPassword;
bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); bOK = QueryPassword(m_pDialog->getDialog(), xModLibContainer, aLibName, aPassword);
} }
if ( !bOK ) if ( !bOK )
return; return;

View File

@@ -729,7 +729,7 @@ bool ObjectPage::GetSelection( ScriptDocument& rDocument, OUString& rLibName )
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
{ {
OUString aPassword; OUString aPassword;
bOK = QueryPassword( xModLibContainer, rLibName, aPassword ); bOK = QueryPassword(m_pDialog->getDialog(), xModLibContainer, rLibName, aPassword);
} }
// load library // load library

View File

@@ -294,7 +294,7 @@ bool QueryDelMacro( const OUString& rName, weld::Widget* pParent );
bool QueryDelDialog( const OUString& rName, weld::Widget* pParent ); bool QueryDelDialog( const OUString& rName, weld::Widget* pParent );
bool QueryDelModule( const OUString& rName, weld::Widget* pParent ); bool QueryDelModule( const OUString& rName, weld::Widget* pParent );
bool QueryDelLib( const OUString& rName, bool bRef, weld::Widget* pParent ); bool QueryDelLib( const OUString& rName, bool bRef, weld::Widget* pParent );
bool QueryPassword( const css::uno::Reference< css::script::XLibraryContainer >& xLibContainer, const OUString& rLibName, OUString& rPassword, bool bRepeat = false, bool bNewTitle = false ); bool QueryPassword(weld::Widget* pDialogParent, const css::uno::Reference< css::script::XLibraryContainer >& xLibContainer, const OUString& rLibName, OUString& rPassword, bool bRepeat = false, bool bNewTitle = false);
class ModuleInfoHelper class ModuleInfoHelper
{ {