diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-03-04 17:05:19 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-03-05 00:32:13 +0100 |
commit | d6f1c3dece1ab321230cbaf6b5a11318ba04b216 (patch) | |
tree | 9a09218d3fb27dfef8939c8924dd100378196f78 /sc | |
parent | 77db2da61658906c354084b13a95f1102949fbd0 (diff) |
weld SfxPasswordDialog Dialog
Change-Id: If8c9757986f4af7b7927717221860e65c8c7285e
Reviewed-on: https://gerrit.libreoffice.org/50755
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 20 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh3.cxx | 50 |
2 files changed, 35 insertions, 35 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 5091cafd1803..6a7d258c6c71 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1285,17 +1285,16 @@ bool ScDocShell::ExecuteChangeProtectionDialog( bool bJustQueryIfProtected ) OUString aText( ScResId( SCSTR_PASSWORD ) ); OUString aPassword; - ScopedVclPtrInstance<SfxPasswordDialog> pDlg( - GetActiveDialogParent(), &aText ); - pDlg->SetText( aTitle ); - pDlg->SetMinLen( 1 ); - pDlg->SetHelpId( GetStaticInterface()->GetSlot(SID_CHG_PROTECT)->GetCommand() ); - pDlg->SetEditHelpId( HID_CHG_PROTECT ); + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + SfxPasswordDialog aDlg(pWin ? pWin->GetFrameWeld() : nullptr, &aText); + aDlg.set_title(aTitle); + aDlg.SetMinLen(1); + aDlg.set_help_id(GetStaticInterface()->GetSlot(SID_CHG_PROTECT)->GetCommand()); + aDlg.SetEditHelpId( HID_CHG_PROTECT ); if ( !bProtected ) - pDlg->ShowExtras( SfxShowExtras::CONFIRM ); - if ( pDlg->Execute() == RET_OK ) - aPassword = pDlg->GetPassword(); - pDlg.disposeAndClear(); + aDlg.ShowExtras(SfxShowExtras::CONFIRM); + if (aDlg.run() == RET_OK) + aPassword = aDlg.GetPassword(); if (!aPassword.isEmpty()) { @@ -1311,7 +1310,6 @@ bool ScDocShell::ExecuteChangeProtectionDialog( bool bJustQueryIfProtected ) } else { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, VclMessageType::Info, VclButtonsType::Ok, ScResId(SCSTR_WRONGPASSWORD))); diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index a1450c31bf06..dde0b99b3484 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -1050,6 +1050,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) } } + vcl::Window* pWin = GetDialogParent(); ScDocProtection* pProtect = pDoc->GetDocProtection(); if (pProtect && pProtect->isProtected()) { @@ -1060,14 +1061,14 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { OUString aText(ScResId(SCSTR_PASSWORD)); - VclPtrInstance< SfxPasswordDialog > pDlg(GetDialogParent(), &aText); - pDlg->SetText( ScResId(SCSTR_UNPROTECTDOC) ); - pDlg->SetMinLen( 0 ); - pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand() ); - pDlg->SetEditHelpId( HID_PASSWD_DOC ); + SfxPasswordDialog aDlg(pWin ? pWin->GetFrameWeld() : nullptr, &aText); + aDlg.set_title(ScResId(SCSTR_UNPROTECTDOC)); + aDlg.SetMinLen(0); + aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand()); + aDlg.SetEditHelpId(HID_PASSWD_DOC); - if (pDlg->Execute() == RET_OK) - aPassword = pDlg->GetPassword(); + if (aDlg.run() == RET_OK) + aPassword = aDlg.GetPassword(); else bCancel = true; } @@ -1082,17 +1083,17 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { OUString aText(ScResId(SCSTR_PASSWORDOPT)); - VclPtrInstance< SfxPasswordDialog > pDlg(GetDialogParent(), &aText); - pDlg->SetText( ScResId(SCSTR_PROTECTDOC) ); - pDlg->SetMinLen( 0 ); - pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand() ); - pDlg->SetEditHelpId( HID_PASSWD_DOC ); - pDlg->ShowExtras( SfxShowExtras::CONFIRM ); - pDlg->SetConfirmHelpId( HID_PASSWD_DOC_CONFIRM ); + SfxPasswordDialog aDlg(pWin ? pWin->GetFrameWeld() : nullptr, &aText); + aDlg.set_title(ScResId(SCSTR_PROTECTDOC)); + aDlg.SetMinLen( 0 ); + aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand()); + aDlg.SetEditHelpId(HID_PASSWD_DOC); + aDlg.ShowExtras(SfxShowExtras::CONFIRM); + aDlg.SetConfirmHelpId(HID_PASSWD_DOC_CONFIRM); - if (pDlg->Execute() == RET_OK) + if (aDlg.run() == RET_OK) { - OUString aPassword = pDlg->GetPassword(); + OUString aPassword = aDlg.GetPassword(); Protect( TABLEID_DOC, aPassword ); rReq.AppendItem( SfxBoolItem( FID_PROTECT_DOC, true ) ); rReq.Done(); @@ -1129,15 +1130,16 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) if (pProtect && pProtect->isProtectedWithPass()) { OUString aText( ScResId(SCSTR_PASSWORDOPT) ); - VclPtrInstance< SfxPasswordDialog > pDlg(GetDialogParent(), &aText); - pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) ); - pDlg->SetMinLen( 0 ); - pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand() ); - pDlg->SetEditHelpId( HID_PASSWD_TABLE ); - - if (pDlg->Execute() == RET_OK) + vcl::Window* pWin = GetDialogParent(); + SfxPasswordDialog aDlg(pWin ? pWin->GetFrameWeld() : nullptr, &aText); + aDlg.set_title(ScResId(SCSTR_UNPROTECTTAB)); + aDlg.SetMinLen(0); + aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand()); + aDlg.SetEditHelpId(HID_PASSWD_TABLE); + + if (aDlg.run() == RET_OK) { - OUString aPassword = pDlg->GetPassword(); + OUString aPassword = aDlg.GetPassword(); Unprotect(nTab, aPassword); } } |