[Libreoffice-commits] core.git: sfx2/source

Thorsten Behrens Thorsten.Behrens at CIB.de
Wed Aug 30 11:46:18 UTC 2017


 sfx2/source/dialog/filedlghelper.cxx |   21 +++++++++++++++++++++
 sfx2/source/dialog/filedlgimpl.hxx   |    1 +
 2 files changed, 22 insertions(+)

New commits:
commit 546915797286b0e1744c25b1b0d7e13fb1bbe94e
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Fri Aug 18 22:01:13 2017 +0200

    gpg4libre: request key from filepicker
    
    Change-Id: I3a20f293bd12fc3de76fb1e846452c0a574e8794
    Reviewed-on: https://gerrit.libreoffice.org/41503
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index fa52ce51b90b..d6a5489f85ce 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -880,6 +880,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl(
     mbHasPassword           = false;
     m_bHaveFilterOptions    = false;
     mbIsPwdEnabled          = true;
+    mbIsGpgEnabled          = true;
     mbHasVersions           = false;
     mbHasPreview            = false;
     mbShowPreview           = false;
@@ -1511,6 +1512,26 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
             }
             catch( const IllegalArgumentException& ){}
         }
+        // check, whether or not we have to display a key selection box
+        if ( pCurrentFilter && mbHasPassword && mbIsGpgEnabled && xCtrlAccess.is() )
+        {
+            try
+            {
+                Any aValue = xCtrlAccess->getValue( ExtendedFilePickerElementIds::CHECKBOX_GPGENCRYPTION, 0 );
+                bool bGpg = false;
+                if ( ( aValue >>= bGpg ) && bGpg )
+                {
+                    // ask for a key
+                    OUString aDocName(rpURLList[0]);
+                    // ErrCode errCode = RequestKey(pCurrentFilter, aDocName, rpSet);
+                    //if (errCode != ERRCODE_NONE)
+                    rpSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( ::comphelper::OStorageHelper::CreatePackageEncryptionData( aDocName ) ) ) );
+
+                    return ERRCODE_IO_NOTSUPPORTED; //errCode;
+                }
+            }
+            catch( const IllegalArgumentException& ){}
+        }
 
         SaveLastUsedFilter();
         return ERRCODE_NONE;
diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx
index 736d00d41e10..595afd2fca39 100644
--- a/sfx2/source/dialog/filedlgimpl.hxx
+++ b/sfx2/source/dialog/filedlgimpl.hxx
@@ -76,6 +76,7 @@ namespace sfx2
 
         bool                    mbHasPassword           : 1;
         bool                    mbIsPwdEnabled          : 1;
+        bool                    mbIsGpgEnabled          : 1;
         bool                    m_bHaveFilterOptions    : 1;
         bool                    mbHasVersions           : 1;
         bool                    mbHasAutoExt            : 1;


More information about the Libreoffice-commits mailing list