cui/source/dialogs/passwdomdlg.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 49e34144a8148bf3c77bcfd70bf6c628dcefeedd
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Fri Nov 25 15:51:34 2022 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Jun 28 22:53:14 2023 +0200

    tdf#148416 password dialog: suggest current loadreadonly status
    
    If a document is set to load readonly,
    and the user saves with a password,
    then suggest LoadReadOnly status
    by pre-populating and displaying the checkbox for that setting
    
    Change-Id: I3e848b6f97ed4218d066e8f1790cb8fbea8b208c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153725
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/cui/source/dialogs/passwdomdlg.cxx 
b/cui/source/dialogs/passwdomdlg.cxx
index 579af0edc9aa..e4981f442fbf 100644
--- a/cui/source/dialogs/passwdomdlg.cxx
+++ b/cui/source/dialogs/passwdomdlg.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sfx2/objsh.hxx>
 #include <vcl/svapp.hxx>
 #include <passwdomdlg.hxx>
 #include <strings.hrc>
@@ -133,6 +134,14 @@ 
PasswordToOpenModifyDialog::PasswordToOpenModifyDialog(weld::Window * pParent, s
     m_xOptionsExpander->set_sensitive(bIsPasswordToModify);
     if (!bIsPasswordToModify)
         m_xOptionsExpander->hide();
+    else if (SfxObjectShell* pSh = SfxObjectShell::Current())
+    {
+        if (pSh->IsLoadReadonly())
+        {
+            m_xOpenReadonlyCB->set_active(true);
+            m_xOptionsExpander->set_expanded(true);
+        }
+    }
 
     m_xOpenReadonlyCB->connect_toggled(LINK(this, PasswordToOpenModifyDialog, 
ReadonlyOnOffHdl));
     ReadonlyOnOffHdl(*m_xOpenReadonlyCB);

Reply via email to