sw/source/ui/dialog/uiregionsw.cxx |   38 +++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

New commits:
commit 207f8efd523aa65b484d18d3ae53066ba0ea8be6
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Jan 19 11:34:56 2026 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue Jan 20 15:50:22 2026 +0100

    make writer section password dialog async
    
    Change-Id: Icc65d0e68a2de01b7d34f0ee2768c8c510ebf1d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197578
    Reviewed-by: Caolán McNamara <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/sw/source/ui/dialog/uiregionsw.cxx 
b/sw/source/ui/dialog/uiregionsw.cxx
index b78cfd7b6bb4..dddce1ed3f0a 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -1657,25 +1657,27 @@ void SwInsertSectionTabPage::ChangePasswd(bool bChange)
     {
         if(!m_aNewPasswd.hasElements() || bChange)
         {
-            SfxPasswordDialog aPasswdDlg(GetFrameWeld());
-            aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
-            if (RET_OK == aPasswdDlg.run())
-            {
-                const OUString sNewPasswd(aPasswdDlg.GetPassword());
-                if (aPasswdDlg.GetConfirm() == sNewPasswd)
-                {
-                    SvPasswordHelper::GetHashPassword( m_aNewPasswd, 
sNewPasswd );
-                }
-                else
-                {
-                    std::shared_ptr<weld::MessageDialog> 
xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
-                                                                  
VclMessageType::Info, VclButtonsType::Ok,
-                                                                  
SwResId(STR_WRONG_PASSWD_REPEAT)));
-                    xInfoBox->runAsync(xInfoBox, [](sal_uInt32) {});
+            auto xPasswdDlg = 
std::make_shared<SfxPasswordDialog>(GetFrameWeld());
+            xPasswdDlg->ShowExtras(SfxShowExtras::CONFIRM);
+            xPasswdDlg->PreRun();
+            weld::GenericDialogController::runAsync(xPasswdDlg, [xPasswdDlg, 
this, bChange](sal_Int32 nResult){
+                if (nResult == RET_OK) {
+                    const OUString sNewPasswd(xPasswdDlg->GetPassword());
+                    if (xPasswdDlg->GetConfirm() == sNewPasswd)
+                    {
+                        SvPasswordHelper::GetHashPassword( m_aNewPasswd, 
sNewPasswd );
+                    }
+                    else
+                    {
+                        std::shared_ptr<weld::MessageDialog> 
xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
+                                                                      
VclMessageType::Info, VclButtonsType::Ok,
+                                                                      
SwResId(STR_WRONG_PASSWD_REPEAT)));
+                        xInfoBox->runAsync(xInfoBox, [](sal_uInt32) {});
+                    }
                 }
-            }
-            else if(!bChange)
-                m_xPasswdCB->set_active(false);
+                else if(!bChange)
+                    m_xPasswdCB->set_active(false);
+            });
         }
     }
     else

Reply via email to