[Libreoffice-commits] core.git: cui/source cui/uiconfig include/vcl uui/source

Caolán McNamara caolanm at redhat.com
Thu Mar 22 17:28:54 UTC 2018


 cui/source/dialogs/passwdomdlg.cxx   |  158 +++++++++++------------------------
 cui/source/factory/dlgfact.cxx       |   21 ++--
 cui/source/factory/dlgfact.hxx       |   12 +-
 cui/source/inc/passwdomdlg.hxx       |   28 ++++--
 cui/uiconfig/ui/password.ui          |   49 ++++------
 include/vcl/abstdlg.hxx              |    8 +
 uui/source/iahndl-authentication.cxx |   12 +-
 7 files changed, 127 insertions(+), 161 deletions(-)

New commits:
commit da9aa49f360c1351f5b5ce8bcf4a9df2db8c4f15
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 22 09:32:51 2018 +0000

    weld PasswordToOpenModifyDialog
    
    Change-Id: I42ebbd1c94a54fb1d4c755fbcc6758c93614bc33
    Reviewed-on: https://gerrit.libreoffice.org/51729
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx
index fab6b3caa6cc..a5efbd0d6428 100644
--- a/cui/source/dialogs/passwdomdlg.cxx
+++ b/cui/source/dialogs/passwdomdlg.cxx
@@ -17,163 +17,111 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <vcl/svapp.hxx>
 #include <passwdomdlg.hxx>
-
 #include <strings.hrc>
 #include <dialmgr.hxx>
 
-#include <sfx2/tabdlg.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/button.hxx>
-#include <vcl/weld.hxx>
-#include <vcl/settings.hxx>
-
-struct PasswordToOpenModifyDialog_Impl
-{
-    VclPtr<PasswordToOpenModifyDialog>    m_pParent;
-
-    VclPtr<Edit>                       m_pPasswdToOpenED;
-    VclPtr<Edit>                       m_pReenterPasswdToOpenED;
-    VclPtr<VclExpander>                m_pOptionsExpander;
-    VclPtr<OKButton>                   m_pOk;
-    VclPtr<CheckBox>                   m_pOpenReadonlyCB;
-    VclPtr<Edit>                       m_pPasswdToModifyED;
-    VclPtr<Edit>                       m_pReenterPasswdToModifyED;
-
-    OUString                    m_aOneMismatch;
-    OUString                    m_aTwoMismatch;
-    OUString                    m_aInvalidStateForOkButton;
-    OUString                    m_aInvalidStateForOkButton_v2;
-
-    bool                        m_bIsPasswordToModify;
-
-
-    DECL_LINK( OkBtnClickHdl, Button*, void );
-
-    PasswordToOpenModifyDialog_Impl( PasswordToOpenModifyDialog * pParent,
-            sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify );
-};
-
-PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl(
-        PasswordToOpenModifyDialog * pParent,
-        sal_uInt16 nMaxPasswdLen,
-        bool bIsPasswordToModify )
-    : m_pParent( pParent )
-    , m_aOneMismatch( CuiResId( RID_SVXSTR_ONE_PASSWORD_MISMATCH ) )
-    , m_aTwoMismatch( CuiResId( RID_SVXSTR_TWO_PASSWORDS_MISMATCH ) )
-    , m_aInvalidStateForOkButton( CuiResId( RID_SVXSTR_INVALID_STATE_FOR_OK_BUTTON ) )
-    , m_aInvalidStateForOkButton_v2( CuiResId( RID_SVXSTR_INVALID_STATE_FOR_OK_BUTTON_V2 ) )
-    , m_bIsPasswordToModify( bIsPasswordToModify )
-{
-    pParent->get(m_pPasswdToOpenED, "newpassEntry");
-    pParent->get(m_pReenterPasswdToOpenED, "confirmpassEntry");
-    pParent->get(m_pOk, "ok");
-    pParent->get(m_pOpenReadonlyCB, "readonly");
-    pParent->get(m_pPasswdToModifyED, "newpassroEntry");
-    pParent->get(m_pReenterPasswdToModifyED, "confirmropassEntry");
-    pParent->get(m_pOptionsExpander, "expander");
-
-    m_pOk->SetClickHdl( LINK( this, PasswordToOpenModifyDialog_Impl, OkBtnClickHdl ) );
-
-    if (nMaxPasswdLen)
-    {
-        m_pPasswdToOpenED->SetMaxTextLen( nMaxPasswdLen );
-        m_pReenterPasswdToOpenED->SetMaxTextLen( nMaxPasswdLen );
-        m_pPasswdToModifyED->SetMaxTextLen( nMaxPasswdLen );
-        m_pReenterPasswdToModifyED->SetMaxTextLen( nMaxPasswdLen );
-    }
-
-    m_pPasswdToOpenED->GrabFocus();
-
-    m_pOptionsExpander->Enable(bIsPasswordToModify);
-    if (!bIsPasswordToModify)
-        m_pOptionsExpander->Hide();
-}
-
-IMPL_LINK(PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, Button *, pButton, void)
+IMPL_LINK_NOARG(PasswordToOpenModifyDialog, OkBtnClickHdl, weld::Button&, void)
 {
-    bool bInvalidState = !m_pOpenReadonlyCB->IsChecked() &&
-            m_pPasswdToOpenED->GetText().isEmpty() &&
-            m_pPasswdToModifyED->GetText().isEmpty();
+    bool bInvalidState = !m_xOpenReadonlyCB->get_active() &&
+            m_xPasswdToOpenED->get_text().isEmpty() &&
+            m_xPasswdToModifyED->get_text().isEmpty();
     if (bInvalidState)
     {
-        std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pButton->GetFrameWeld(),
+        std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                        VclMessageType::Warning, VclButtonsType::Ok,
                                                        m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2));
         xErrorBox->run();
     }
     else // check for mismatched passwords...
     {
-        const bool bToOpenMatch     = m_pPasswdToOpenED->GetText()   == m_pReenterPasswdToOpenED->GetText();
-        const bool bToModifyMatch   = m_pPasswdToModifyED->GetText() == m_pReenterPasswdToModifyED->GetText();
+        const bool bToOpenMatch     = m_xPasswdToOpenED->get_text()   == m_xReenterPasswdToOpenED->get_text();
+        const bool bToModifyMatch   = m_xPasswdToModifyED->get_text() == m_xReenterPasswdToModifyED->get_text();
         const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1);
         if (nMismatch > 0)
         {
-            std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pButton->GetFrameWeld(),
+            std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                            VclMessageType::Warning, VclButtonsType::Ok,
                                                            nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch));
             xErrorBox->run();
 
-            Edit* pEdit = !bToOpenMatch ? m_pPasswdToOpenED.get() : m_pPasswdToModifyED.get();
-            Edit* pRepeatEdit = !bToOpenMatch? m_pReenterPasswdToOpenED.get() : m_pReenterPasswdToModifyED.get();
+            weld::Entry* pEdit = !bToOpenMatch ? m_xPasswdToOpenED.get() : m_xPasswdToModifyED.get();
+            weld::Entry* pRepeatEdit = !bToOpenMatch? m_xReenterPasswdToOpenED.get() : m_xReenterPasswdToModifyED.get();
             if (nMismatch == 1)
             {
-                pEdit->SetText( "" );
-                pRepeatEdit->SetText( "" );
+                pEdit->set_text( "" );
+                pRepeatEdit->set_text( "" );
             }
             else if (nMismatch == 2)
             {
-                m_pPasswdToOpenED->SetText( "" );
-                m_pReenterPasswdToOpenED->SetText( "" );
-                m_pPasswdToModifyED->SetText( "" );
-                m_pReenterPasswdToModifyED->SetText( "" );
+                m_xPasswdToOpenED->set_text( "" );
+                m_xReenterPasswdToOpenED->set_text( "" );
+                m_xPasswdToModifyED->set_text( "" );
+                m_xReenterPasswdToModifyED->set_text( "" );
             }
-            pEdit->GrabFocus();
+            pEdit->grab_focus();
         }
         else
         {
-            m_pParent->EndDialog( RET_OK );
+            m_xDialog->response(RET_OK);
         }
     }
 }
 
-PasswordToOpenModifyDialog::PasswordToOpenModifyDialog(
-    vcl::Window * pParent,
-    sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify)
-    : SfxModalDialog( pParent, "PasswordDialog", "cui/ui/password.ui" )
+PasswordToOpenModifyDialog::PasswordToOpenModifyDialog(weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify)
+    : GenericDialogController(pParent, "cui/ui/password.ui", "PasswordDialog")
+    , m_xPasswdToOpenED(m_xBuilder->weld_entry("newpassEntry"))
+    , m_xReenterPasswdToOpenED(m_xBuilder->weld_entry("confirmpassEntry"))
+    , m_xOptionsExpander(m_xBuilder->weld_expander("expander"))
+    , m_xOk(m_xBuilder->weld_button("ok"))
+    , m_xOpenReadonlyCB(m_xBuilder->weld_check_button("readonly"))
+    , m_xPasswdToModifyED(m_xBuilder->weld_entry("newpassroEntry"))
+    , m_xReenterPasswdToModifyED(m_xBuilder->weld_entry("confirmropassEntry"))
+    , m_aOneMismatch( CuiResId( RID_SVXSTR_ONE_PASSWORD_MISMATCH ) )
+    , m_aTwoMismatch( CuiResId( RID_SVXSTR_TWO_PASSWORDS_MISMATCH ) )
+    , m_aInvalidStateForOkButton( CuiResId( RID_SVXSTR_INVALID_STATE_FOR_OK_BUTTON ) )
+    , m_aInvalidStateForOkButton_v2( CuiResId( RID_SVXSTR_INVALID_STATE_FOR_OK_BUTTON_V2 ) )
+    , m_bIsPasswordToModify( bIsPasswordToModify )
 {
-    m_pImpl.reset(new PasswordToOpenModifyDialog_Impl(this,
-        nMaxPasswdLen, bIsPasswordToModify ) );
-}
+    m_xOk->connect_clicked(LINK(this, PasswordToOpenModifyDialog, OkBtnClickHdl));
 
+    if (nMaxPasswdLen)
+    {
+        m_xPasswdToOpenED->set_max_length( nMaxPasswdLen );
+        m_xReenterPasswdToOpenED->set_max_length( nMaxPasswdLen );
+        m_xPasswdToModifyED->set_max_length( nMaxPasswdLen );
+        m_xReenterPasswdToModifyED->set_max_length( nMaxPasswdLen );
+    }
 
-PasswordToOpenModifyDialog::~PasswordToOpenModifyDialog()
-{
-    disposeOnce();
+    m_xPasswdToOpenED->grab_focus();
+
+    m_xOptionsExpander->set_sensitive(bIsPasswordToModify);
+    if (!bIsPasswordToModify)
+        m_xOptionsExpander->hide();
 }
 
 OUString PasswordToOpenModifyDialog::GetPasswordToOpen() const
 {
     const bool bPasswdOk =
-            !m_pImpl->m_pPasswdToOpenED->GetText().isEmpty() &&
-            m_pImpl->m_pPasswdToOpenED->GetText() == m_pImpl->m_pReenterPasswdToOpenED->GetText();
-    return bPasswdOk ? m_pImpl->m_pPasswdToOpenED->GetText() : OUString();
+            !m_xPasswdToOpenED->get_text().isEmpty() &&
+            m_xPasswdToOpenED->get_text() == m_xReenterPasswdToOpenED->get_text();
+    return bPasswdOk ? m_xPasswdToOpenED->get_text() : OUString();
 }
 
 
 OUString PasswordToOpenModifyDialog::GetPasswordToModify() const
 {
     const bool bPasswdOk =
-            !m_pImpl->m_pPasswdToModifyED->GetText().isEmpty() &&
-            m_pImpl->m_pPasswdToModifyED->GetText() == m_pImpl->m_pReenterPasswdToModifyED->GetText();
-    return bPasswdOk ? m_pImpl->m_pPasswdToModifyED->GetText() : OUString();
+            !m_xPasswdToModifyED->get_text().isEmpty() &&
+            m_xPasswdToModifyED->get_text() == m_xReenterPasswdToModifyED->get_text();
+    return bPasswdOk ? m_xPasswdToModifyED->get_text() : OUString();
 }
 
 
 bool PasswordToOpenModifyDialog::IsRecommendToOpenReadonly() const
 {
-    return m_pImpl->m_pOpenReadonlyCB->IsChecked();
+    return m_xOpenReadonlyCB->get_active();
 }
 
 
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index f8ed8b406591..b6b81359c9a0 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -143,7 +143,12 @@ IMPL_ABSTDLG_BASE(AbstractInsertObjectDialog_Impl);
 IMPL_ABSTDLG_BASE(AbstractLinksDialog_Impl);
 IMPL_ABSTDLG_BASE(AbstractSpellDialog_Impl);
 IMPL_ABSTDLG_BASE(AbstractSvxPostItDialog_Impl);
-IMPL_ABSTDLG_BASE(AbstractPasswordToOpenModifyDialog_Impl);
+
+short AbstractPasswordToOpenModifyDialog_Impl::Execute()
+{
+    return m_xDlg->run();
+}
+
 IMPL_ABSTDLG_BASE(AbstractScreenshotAnnotationDlg_Impl);
 
 
@@ -785,15 +790,17 @@ vcl::Window * AbstractSvxPostItDialog_Impl::GetWindow()
 
 OUString AbstractPasswordToOpenModifyDialog_Impl::GetPasswordToOpen() const
 {
-    return pDlg->GetPasswordToOpen();
+    return m_xDlg->GetPasswordToOpen();
 }
+
 OUString AbstractPasswordToOpenModifyDialog_Impl::GetPasswordToModify() const
 {
-    return pDlg->GetPasswordToModify();
+    return m_xDlg->GetPasswordToModify();
 }
+
 bool AbstractPasswordToOpenModifyDialog_Impl::IsRecommendToOpenReadonly() const
 {
-    return pDlg->IsRecommendToOpenReadonly();
+    return m_xDlg->IsRecommendToOpenReadonly();
 }
 
 // Create dialogs with simplest interface
@@ -1515,11 +1522,9 @@ VclPtr<SvxAbstractInsRowColDlg> AbstractDialogFactory_Impl::CreateSvxInsRowColDl
 }
 
 VclPtr<AbstractPasswordToOpenModifyDialog> AbstractDialogFactory_Impl::CreatePasswordToOpenModifyDialog(
-    vcl::Window * pParent,
-    sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify )
+    weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify)
 {
-    VclPtrInstance<PasswordToOpenModifyDialog> pDlg( pParent, nMaxPasswdLen, bIsPasswordToModify );
-    return VclPtr<AbstractPasswordToOpenModifyDialog_Impl>::Create( pDlg );
+    return VclPtr<AbstractPasswordToOpenModifyDialog_Impl>::Create(new PasswordToOpenModifyDialog(pParent, nMaxPasswdLen, bIsPasswordToModify));
 }
 
 VclPtr<AbstractScreenshotAnnotationDlg> AbstractDialogFactory_Impl::CreateScreenshotAnnotationDlg(
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 7d74cb2d9dd9..346d80311d9e 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -458,8 +458,14 @@ private:
 class PasswordToOpenModifyDialog;
 class AbstractPasswordToOpenModifyDialog_Impl : public AbstractPasswordToOpenModifyDialog
 {
-    DECL_ABSTDLG_BASE( AbstractPasswordToOpenModifyDialog_Impl, PasswordToOpenModifyDialog )
-
+protected:
+    std::unique_ptr<PasswordToOpenModifyDialog> m_xDlg;
+public:
+    explicit AbstractPasswordToOpenModifyDialog_Impl(PasswordToOpenModifyDialog* p)
+        : m_xDlg(p)
+    {
+    }
+    virtual short Execute() override;
     virtual OUString  GetPasswordToOpen() const override;
     virtual OUString  GetPasswordToModify() const override;
     virtual bool      IsRecommendToOpenReadonly() const override;
@@ -648,7 +654,7 @@ public:
 
     virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId) override;
 
-    virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(vcl::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) override;
+    virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) override;
 
     virtual VclPtr<AbstractScreenshotAnnotationDlg> CreateScreenshotAnnotationDlg(vcl::Window * pParent, Dialog& rParentDialog) override;
 };
diff --git a/cui/source/inc/passwdomdlg.hxx b/cui/source/inc/passwdomdlg.hxx
index 529b67fb06ed..2d56f3b480ce 100644
--- a/cui/source/inc/passwdomdlg.hxx
+++ b/cui/source/inc/passwdomdlg.hxx
@@ -19,26 +19,37 @@
 #ifndef INCLUDED_CUI_SOURCE_INC_PASSWDOMDLG_HXX
 #define INCLUDED_CUI_SOURCE_INC_PASSWDOMDLG_HXX
 
+#include <vcl/weld.hxx>
+#include <memory>
 
-#include <sfx2/basedlgs.hxx>
 
-#include <memory>
+class PasswordToOpenModifyDialog : public weld::GenericDialogController
+{
+    std::unique_ptr<weld::Entry> m_xPasswdToOpenED;
+    std::unique_ptr<weld::Entry> m_xReenterPasswdToOpenED;
+    std::unique_ptr<weld::Expander> m_xOptionsExpander;
+    std::unique_ptr<weld::Button> m_xOk;
+    std::unique_ptr<weld::CheckButton> m_xOpenReadonlyCB;
+    std::unique_ptr<weld::Entry> m_xPasswdToModifyED;
+    std::unique_ptr<weld::Entry> m_xReenterPasswdToModifyED;
 
+    OUString                    m_aOneMismatch;
+    OUString                    m_aTwoMismatch;
+    OUString                    m_aInvalidStateForOkButton;
+    OUString                    m_aInvalidStateForOkButton_v2;
 
-struct PasswordToOpenModifyDialog_Impl;
+    bool                        m_bIsPasswordToModify;
 
-class PasswordToOpenModifyDialog : public SfxModalDialog
-{
-    std::unique_ptr< PasswordToOpenModifyDialog_Impl >  m_pImpl;
+
+    DECL_LINK(OkBtnClickHdl, weld::Button&, void);
 
     PasswordToOpenModifyDialog( const PasswordToOpenModifyDialog & ) = delete;
     PasswordToOpenModifyDialog & operator = ( const PasswordToOpenModifyDialog & ) = delete;
 
 public:
-    PasswordToOpenModifyDialog( vcl::Window * pParent,
+    PasswordToOpenModifyDialog(weld::Window* pParent,
             sal_uInt16 nMaxPasswdLen /* 0 -> no max len enforced */,
             bool bIsPasswordToModify );
-    virtual ~PasswordToOpenModifyDialog() override;
 
     // AbstractPasswordToOpenModifyDialog
     OUString  GetPasswordToOpen() const;
@@ -46,7 +57,6 @@ public:
     bool    IsRecommendToOpenReadonly() const;
 };
 
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/uiconfig/ui/password.ui b/cui/uiconfig/ui/password.ui
index c738242b5076..7f529182a5f9 100644
--- a/cui/uiconfig/ui/password.ui
+++ b/cui/uiconfig/ui/password.ui
@@ -1,11 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.20.2 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="PasswordDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="password|PasswordDialog">Set Password</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">normal</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
@@ -86,32 +89,28 @@
                           <object class="GtkLabel" id="label5">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes" context="password|label5">Confirm password</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">confirmpassEntry</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">2</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkLabel" id="label4">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes" context="password|label4">_Enter password to open</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">newpassEntry</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -120,12 +119,13 @@
                             <property name="can_focus">True</property>
                             <property name="hexpand">True</property>
                             <property name="visibility">False</property>
+                            <property name="activates_default">True</property>
+                            <property name="width_chars">50</property>
+                            <property name="input_purpose">password</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">1</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -134,28 +134,26 @@
                             <property name="can_focus">True</property>
                             <property name="hexpand">True</property>
                             <property name="visibility">False</property>
+                            <property name="activates_default">True</property>
+                            <property name="input_purpose">password</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">3</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkLabel" id="label1">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes" context="password|label1">Note: After a password has been set, the document will only open with the password. Should you lose the password, there will be no way to recover the document. Please also note that this password is case-sensitive.</property>
                             <property name="wrap">True</property>
                             <property name="max_width_chars">60</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">4</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -192,24 +190,20 @@
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">0</property>
-                                            <property name="width">1</property>
-                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                         <child>
                                           <object class="GtkLabel" id="label7">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="xalign">0</property>
                                             <property name="label" translatable="yes" context="password|label7">Enter password to allow editing</property>
                                             <property name="use_underline">True</property>
                                             <property name="mnemonic_widget">newpassroEntry</property>
+                                            <property name="xalign">0</property>
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">1</property>
-                                            <property name="width">1</property>
-                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -218,28 +212,26 @@
                                             <property name="can_focus">True</property>
                                             <property name="hexpand">True</property>
                                             <property name="visibility">False</property>
+                                            <property name="activates_default">True</property>
+                                            <property name="input_purpose">password</property>
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">2</property>
-                                            <property name="width">1</property>
-                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                         <child>
                                           <object class="GtkLabel" id="label8">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="xalign">0</property>
                                             <property name="label" translatable="yes" context="password|label8">Confirm password</property>
                                             <property name="use_underline">True</property>
                                             <property name="mnemonic_widget">confirmropassEntry</property>
+                                            <property name="xalign">0</property>
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">3</property>
-                                            <property name="width">1</property>
-                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -248,12 +240,12 @@
                                             <property name="can_focus">True</property>
                                             <property name="hexpand">True</property>
                                             <property name="visibility">False</property>
+                                            <property name="activates_default">True</property>
+                                            <property name="input_purpose">password</property>
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">4</property>
-                                            <property name="width">1</property>
-                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                       </object>
@@ -284,8 +276,6 @@
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">5</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                       </object>
@@ -322,6 +312,9 @@
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
   <object class="GtkSizeGroup" id="sizegroup1"/>
 </interface>
diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx
index af676785b295..29eeaaf71147 100644
--- a/include/vcl/abstdlg.hxx
+++ b/include/vcl/abstdlg.hxx
@@ -31,7 +31,11 @@
 namespace vcl { class Window; }
 class Dialog;
 class Bitmap;
-namespace weld { class DialogController; }
+namespace weld
+{
+    class DialogController;
+    class Window;
+}
 
 /**
 * Some things multiple-inherit from VclAbstractDialog and OutputDevice,
@@ -120,7 +124,7 @@ public:
     virtual VclPtr<VclAbstractDialog> CreateVclDialog(vcl::Window* pParent, sal_uInt32 nId) = 0;
 
     // creates instance of PasswordToOpenModifyDialog from cui
-    virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog( vcl::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ) = 0;
+    virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) = 0;
 
     // creates instance of ScreenshotAnnotationDlg from cui
     virtual VclPtr<AbstractScreenshotAnnotationDlg> CreateScreenshotAnnotationDlg(
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index 2351cdbc395d..2e88d43191db 100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -500,7 +500,7 @@ handleMasterPasswordRequest_(
 
 void
 executePasswordDialog(
-    vcl::Window * pParent,
+    weld::Window * pParent,
     LoginErrorInfo & rInfo,
     task::PasswordRequestMode nMode,
     const OUString& aDocName,
@@ -517,7 +517,7 @@ executePasswordDialog(
         {
             if (bIsSimplePasswordRequest)
             {
-                std::unique_ptr<PasswordDialog> xDialog(new PasswordDialog(pParent ? pParent->GetFrameWeld() : nullptr, nMode,
+                std::unique_ptr<PasswordDialog> xDialog(new PasswordDialog(pParent, nMode,
                     aResLocale, aDocName, bIsPasswordToModify, bIsSimplePasswordRequest));
                 xDialog->SetMinLen(0);
 
@@ -540,7 +540,7 @@ executePasswordDialog(
         }
         else // enter password or reenter password
         {
-            std::unique_ptr<PasswordDialog> xDialog(new PasswordDialog(pParent ? pParent->GetFrameWeld() : nullptr, nMode,
+            std::unique_ptr<PasswordDialog> xDialog(new PasswordDialog(pParent, nMode,
                 aResLocale, aDocName, bIsPasswordToModify, bIsSimplePasswordRequest));
             xDialog->SetMinLen(0);
 
@@ -558,7 +558,7 @@ executePasswordDialog(
 
 void
 handlePasswordRequest_(
-    vcl::Window * pParent,
+    weld::Window * pParent,
     task::PasswordRequestMode nMode,
     uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
         rContinuations,
@@ -723,7 +723,7 @@ UUIInteractionHelper::handlePasswordRequest(
 
     if (bDoHandleRequest)
     {
-        handlePasswordRequest_( pParent, nMode, rContinuations,
+        handlePasswordRequest_( pParent ? pParent->GetFrameWeld() : nullptr, nMode, rContinuations,
                 aDocumentName, bMSCryptoMode, bIsPasswordToModify );
         return true;
     }
@@ -731,7 +731,7 @@ UUIInteractionHelper::handlePasswordRequest(
     task::PasswordRequest aPasswordRequest;
     if( aAnyRequest >>= aPasswordRequest )
     {
-        handlePasswordRequest_(getParentProperty(),
+        handlePasswordRequest_(pParent ? pParent->GetFrameWeld() : nullptr,
                                aPasswordRequest.Mode,
                                rRequest->getContinuations(),
                                OUString(),


More information about the Libreoffice-commits mailing list