Related tdf#158839: pw and GPG encryption, add comments and TODOs

Change-Id: I53dbc43dcd5dbf594b7cd562bfff0bd3bdcb8ec7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168000
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
diff --git a/include/comphelper/documentconstants.hxx b/include/comphelper/documentconstants.hxx
index 929a494..c4372c2 100644
--- a/include/comphelper/documentconstants.hxx
+++ b/include/comphelper/documentconstants.hxx
@@ -111,7 +111,7 @@ enum class SfxFilterFlags
    EXOTIC            = 0x00200000,
    COMBINED          = 0x00800000,

    ENCRYPTION        = 0x01000000,
    ENCRYPTION        = 0x01000000,  // password encryption
    PASSWORDTOMODIFY  = 0x02000000,
    GPGENCRYPTION     = 0x04000000,
    PREFERED          = 0x10000000,
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 2629bae..3fa8768 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1417,6 +1417,7 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
        if( mbHasPassword )
        {
            const SfxBoolItem* pPassItem = SfxItemSet::GetItem<SfxBoolItem>(&*rpSet, SID_PASSWORDINTERACTION, false);
            // TODO: tdf#158839 problem: Is also true if the file is GPG encrypted. (not with a password)
            mbPwdCheckBoxState = ( pPassItem != nullptr && pPassItem->GetValue() );

            // in case the document has password to modify, the dialog should be shown
@@ -1535,6 +1536,8 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
                {
                    // ask for a password
                    OUString aDocName(rpURLList[0]);
                    // TODO: tdf#158839 problem: Also asks for a password if CHECKBOX_GPGENCRYPTION && CHECKBOX_PASSWORD
                    //       are checked. But only encrypts using GPG and discards the password.
                    ErrCode errCode = RequestPassword(pCurrentFilter, aDocName, &*rpSet, GetFrameInterface());
                    if (errCode != ERRCODE_NONE)
                        return errCode;
diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx
index 20a4cc4..fe9e8f7 100644
--- a/sfx2/source/dialog/filedlgimpl.hxx
+++ b/sfx2/source/dialog/filedlgimpl.hxx
@@ -74,8 +74,8 @@ namespace sfx2

        FileDialogHelper::Context   meContext;

        bool                    mbHasPassword           : 1;
        bool                    mbIsPwdEnabled          : 1;
        bool                    mbHasPassword           : 1;  // checkbox is visible
        bool                    mbIsPwdEnabled          : 1;  // password checkbox is not grayed out
        bool                    m_bHaveFilterOptions    : 1;
        bool                    mbHasVersions           : 1;
        bool                    mbHasAutoExt            : 1;