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 <jluth@mail.com>
diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx
index 579af0e..e4981f4 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);