sfx2/source/doc/objserv.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 29386030a96f2c8b1c636f4d4bb283109e01de8b
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Thu Nov 24 15:16:28 2022 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Tue Dec 20 14:47:33 2022 +0000

    tdf#142147 saveas: encrypted docs should default to use password
    
    If a document is currently encrypted (pOldEncryptionDataItem),
    when the user saves as a different name, the save dialog should
    BY DEFAULT have the "Save with password" option enabled.
    
    That makes sense, right? If the document was secure enough
    to require a password, then any copies of it should
    AT MINIMUM suggest a password.
    
    Anyway, it worked that way prior to LO 7.0's
    e0cced9d4c94324e834e46d807469a0cd6c1f738.
    
    The concern was that the same password would be applied
    silently. That might have been true with 7.0.
    However, in my current testing that never happened.
    It always prompted the user to create a new password.
    And that is exactly what I would want on a SAVE-AS,
    whether it be from a template or a file I was copying.
    
    I would hope that this has no bad implications for headless RT.
    After all, this is just a "suggestion" passed to guisaveas.cxx.
    I did not find any parameters to provide a password
    via commandline anyway.
    
    Change-Id: Id3535d883cd5d2d1427055f7a21f6ae87e0d5324
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143250
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 35716406cd80..1a0356279c4d 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1007,7 +1007,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
 
                 const SfxStringItem* pOldPasswordItem = 
SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_PASSWORD, 
false);
                 const SfxUnoAnyItem* pOldEncryptionDataItem = 
SfxItemSet::GetItem<SfxUnoAnyItem>(GetMedium()->GetItemSet(), 
SID_ENCRYPTIONDATA, false);
-                bool bPreselectPassword = (pOldPasswordItem && 
pOldEncryptionDataItem);
+                const bool bPreselectPassword = pOldPasswordItem || 
pOldEncryptionDataItem;
 
                 uno::Sequence< beans::PropertyValue > aDispatchArgs;
                 if ( rReq.GetArgs() )

Reply via email to