[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libreoffice-commits
Subject:    [Libreoffice-commits] core.git: dbaccess/source include/sfx2 include/svtools sfx2/source svx/source 
From:       Samuel Mehrbrodt <Samuel.Mehrbrodt () cib ! de>
Date:       2017-01-31 12:22:23
Message-ID: 20170131122223.83FD8761A2 () kemper ! freedesktop ! org
[Download RAW message or body]

 dbaccess/source/core/dataaccess/ModelImpl.cxx |    5 -----
 dbaccess/source/core/dataaccess/ModelImpl.hxx |    1 -
 include/sfx2/docmacromode.hxx                 |   18 ------------------
 include/sfx2/objsh.hxx                        |    2 +-
 include/sfx2/sfx.hrc                          |    2 ++
 include/svtools/sfxecode.hxx                  |    1 -
 sfx2/source/doc/docmacromode.cxx              |    4 ----
 sfx2/source/doc/objmisc.cxx                   |   17 +++--------------
 sfx2/source/inc/objshimp.hxx                  |    1 -
 sfx2/source/view/view.src                     |   10 ++++++++++
 sfx2/source/view/viewfrm.cxx                  |   12 ++++++++++++
 svx/source/src/errtxt.src                     |    4 ----
 uui/source/iahndl.cxx                         |   10 +++-------
 13 files changed, 31 insertions(+), 56 deletions(-)

New commits:
commit 2dff5e856ab343b1296f63d645c47382493fe2fe
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Date:   Tue Jan 31 09:07:14 2017 +0100

    tdf#105566 Show InfoBar when signature is invalid
    
    gpg4libre
    
    Change-Id: I272ac155889e25b9af91ff723a014588a65b045a
    Reviewed-on: https://gerrit.libreoffice.org/33737
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>

diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx \
b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 545b1c9..8c94d9a 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -1335,11 +1335,6 @@ bool ODatabaseModelImpl::hasTrustedScriptingSignature( bool \
/*bAllowUIToAddAutho  return false;
 }
 
-void ODatabaseModelImpl::showBrokenSignatureWarning( const Reference< \
                XInteractionHandler >& /*_rxInteraction*/ ) const
-{
-    OSL_FAIL( "ODatabaseModelImpl::showBrokenSignatureWarning: signatures can't be \
                broken - we do not support them!" );
-}
-
 void ODatabaseModelImpl::storageIsModified()
 {
     setModified( true );
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx \
b/dbaccess/source/core/dataaccess/ModelImpl.hxx index 71ecca9..fb02e0e 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -467,7 +467,6 @@ public:
     virtual css::uno::Reference< css::document::XEmbeddedScripts > \
getEmbeddedDocumentScripts() const override;  virtual SignatureState \
                getScriptingSignatureState() override;
     virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) override;
-    virtual void showBrokenSignatureWarning( const css::uno::Reference< \
css::task::XInteractionHandler >& _rxInteraction ) const override;  
     // IModifiableDocument
     virtual void storageIsModified() override;
diff --git a/include/sfx2/docmacromode.hxx b/include/sfx2/docmacromode.hxx
index 01a1d7a..e2ffeab 100644
--- a/include/sfx2/docmacromode.hxx
+++ b/include/sfx2/docmacromode.hxx
@@ -149,24 +149,6 @@ namespace sfx2
         virtual bool
                     hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) = 0;
 
-        /** shows a warning that the document's signature is broken
-
-            Here, a similar note applies as to getScriptingSignatureState: This \
                method doesn't
-            really belong here. It's just there because \
                SfxObjectShell_Impl::bSignatureErrorIsShown
-            is not accessible where the method is called.
-            So, once the signature handling has been oursourced from \
                SfxObjectShell/_Impl, so it
-            is re-usable in non-SFX contexts as well, this method here is also \
                unneeded, probably.
-
-            @param _rxInteraction
-                the interaction handler to use for showing the warning. It is \
                exactly the same
-                as passed to DocumentMacroMode::adjustMacroMode, so it is <NULL/> if \
                and
-                only if the instance passed to that method was <NULL/>.
-        */
-        virtual void
-                    showBrokenSignatureWarning(
-                        const css::uno::Reference< css::task::XInteractionHandler >& \
                _rxInteraction
-                    ) const = 0;
-
     protected:
         ~IMacroDocumentAccess() {}
     };
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 7a2e133..bd96409 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -684,7 +684,7 @@ public:
     SAL_DLLPRIVATE void InitOwnModel_Impl();
     SAL_DLLPRIVATE void BreakMacroSign_Impl( bool bBreakMacroSing );
     SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl();
-    SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl( const css::uno::Reference< \
css::task::XInteractionHandler >& xHandler ); +    SAL_DLLPRIVATE void \
CheckForBrokenDocSignatures_Impl();  SAL_DLLPRIVATE static SignatureState \
                ImplCheckSignaturesInformation(
                 const css::uno::Sequence< \
                css::security::DocumentSignatureInformation >& aInfos );
     SAL_DLLPRIVATE void CheckEncryption_Impl( const css::uno::Reference< \
                css::task::XInteractionHandler >& xHandler );
diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc
index 5e2c759..25e8355 100644
--- a/include/sfx2/sfx.hrc
+++ b/include/sfx2/sfx.hrc
@@ -120,6 +120,8 @@
 #define STR_CLASSIFIED_EXPORT_CONTROL       (RID_SFX_START+136)
 #define STR_READONLY_SIGN                   (RID_SFX_START+137)
 #define STR_READONLY_PDF                    (RID_SFX_START+138)
+#define STR_SIGNATURE_BROKEN                (RID_SFX_START+139)
+#define STR_SIGNATURE_SHOW                  (RID_SFX_START+140)
 #define STR_ACCTITLE_PRODUCTIVITYTOOLS      (RID_SFX_START+157)
 
 #define SFX_THUMBNAIL_TEXT                  (RID_SFX_START+158)
diff --git a/include/svtools/sfxecode.hxx b/include/svtools/sfxecode.hxx
index 723bf7e..99083f2 100644
--- a/include/svtools/sfxecode.hxx
+++ b/include/svtools/sfxecode.hxx
@@ -72,7 +72,6 @@
 #define ERRCODE_SFX_CANTCREATEBACKUP        (ERRCODE_AREA_SFX | ERRCODE_CLASS_CREATE \
| 50)  #define ERRCODE_SFX_MACROS_SUPPORT_DISABLED (ERRCODE_WARNING_MASK | \
ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 51)  #define \
ERRCODE_SFX_DOCUMENT_MACRO_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | \
                ERRCODE_CLASS_NONE | 52)
-#define ERRCODE_SFX_BROKENSIGNATURE         (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX \
| ERRCODE_CLASS_NONE | 53)  #define ERRCODE_SFX_SHARED_NOPASSWORDCHANGE \
(ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 54)  #define \
ERRCODE_SFX_INCOMPLETE_ENCRYPTION    (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | \
ERRCODE_CLASS_NONE | 55)  #define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED_MAC \
                (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 56)
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index a67a455..4df381c 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -230,10 +230,6 @@ namespace sfx2
                 SignatureState nSignatureState = \
m_xData->m_rDocumentAccess.getScriptingSignatureState();  if ( nSignatureState == \
SignatureState::BROKEN )  {
-                    // the signature is broken, no macro execution
-                    if ( nMacroExecutionMode != \
                MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN )
-                        m_xData->m_rDocumentAccess.showBrokenSignatureWarning( \
                rxInteraction );
-
                     return disallowMacroExecution();
                 }
                 else if ( bHasTrustedMacroSignature )
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 36d8fac..8a56824 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -964,7 +964,7 @@ void SfxObjectShell::CheckSecurityOnLoading_Impl()
         xInteraction = GetMedium()->GetInteractionHandler();
 
     // check if there is a broken signature...
-    CheckForBrokenDocSignatures_Impl( xInteraction );
+    CheckForBrokenDocSignatures_Impl();
 
     CheckEncryption_Impl( xInteraction );
 
@@ -1012,15 +1012,13 @@ void SfxObjectShell::CheckEncryption_Impl( const \
uno::Reference< task::XInteract  }
 
 
-void SfxObjectShell::CheckForBrokenDocSignatures_Impl( const uno::Reference< \
task::XInteractionHandler >& xHandler ) +void \
SfxObjectShell::CheckForBrokenDocSignatures_Impl()  {
     SignatureState nSignatureState = GetDocumentSignatureState();
     bool bSignatureBroken = ( nSignatureState == SignatureState::BROKEN );
     if ( !bSignatureBroken )
         return;
 
-    pImpl->showBrokenSignatureWarning( xHandler );
-
     // broken signatures imply no macro execution at all
     pImpl->aMacroMode.disallowMacroExecution();
 }
@@ -1610,7 +1608,7 @@ bool SfxObjectShell::AdjustMacroMode()
     if ( pMedium )
         xInteraction = pMedium->GetInteractionHandler();
 
-    CheckForBrokenDocSignatures_Impl( xInteraction );
+    CheckForBrokenDocSignatures_Impl();
 
     CheckEncryption_Impl( xInteraction );
 
@@ -1852,15 +1850,6 @@ bool SfxObjectShell_Impl::hasTrustedScriptingSignature( bool \
bAllowUIToAddAuthor  return bResult;
 }
 
-void SfxObjectShell_Impl::showBrokenSignatureWarning( const uno::Reference< \
                task::XInteractionHandler >& _rxInteraction ) const
-{
-    if  ( !bSignatureErrorIsShown )
-    {
-        SfxObjectShell::UseInteractionToHandleError( _rxInteraction, \
                ERRCODE_SFX_BROKENSIGNATURE );
-        const_cast< SfxObjectShell_Impl* >( this )->bSignatureErrorIsShown = true;
-    }
-}
-
 void SfxObjectShell::AddLog( const OUString& aMessage )
 {
     if ( !pImpl->m_xLogRing.is() )
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx
index 52fbb44..916d306 100644
--- a/sfx2/source/inc/objshimp.hxx
+++ b/sfx2/source/inc/objshimp.hxx
@@ -152,7 +152,6 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
     virtual SignatureState getScriptingSignatureState() override;
 
     virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) override;
-    virtual void showBrokenSignatureWarning( const css::uno::Reference< \
css::task::XInteractionHandler >& _rxInteraction ) const override;  };
 
 #endif
diff --git a/sfx2/source/view/view.src b/sfx2/source/view/view.src
index 0826609..56b7fba 100644
--- a/sfx2/source/view/view.src
+++ b/sfx2/source/view/view.src
@@ -140,4 +140,14 @@ String STR_READONLY_SIGN
     Text[ en-US ] = "Sign Document";
 };
 
+String STR_SIGNATURE_BROKEN
+{
+    Text[ en-US ] = "Document has an invalid signature.";
+};
+
+String STR_SIGNATURE_SHOW
+{
+    Text[ en-US ] = "Show signatures";
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 42a259a..ffa0d41 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1178,6 +1178,18 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const \
SfxHint& rHint )  SfxBindings& rBind = GetBindings();
                 rBind.Invalidate( SID_RELOAD );
                 rBind.Invalidate( SID_EDITDOC );
+
+                SignatureState nSignatureState = \
GetObjectShell()->GetDocumentSignatureState(); +                if (nSignatureState \
== SignatureState::BROKEN) { +                    basegfx::BColor aBackgroundColor = \
basegfx::BColor(0.5, 0.0, 0.0); +                    auto pInfoBar = \
AppendInfoBar("signature", SfxResId(STR_SIGNATURE_BROKEN), &aBackgroundColor); +      \
VclPtrInstance<PushButton> xBtn(&GetWindow()); +                    \
xBtn->SetText(SfxResId(STR_SIGNATURE_SHOW)); +                    \
xBtn->SetSizePixel(xBtn->GetOptimalSize()); +                    \
xBtn->SetClickHdl(LINK(this, SfxViewFrame, SignDocumentHandler)); +                   \
pInfoBar->addButton(xBtn); +                }
+
                 const SfxViewShell *pVSh;
                 const SfxShell *pFSh;
                 if ( !m_xObjSh->IsReadOnly() ||
diff --git a/svx/source/src/errtxt.src b/svx/source/src/errtxt.src
index ab00f1b..40ff546 100644
--- a/svx/source/src/errtxt.src
+++ b/svx/source/src/errtxt.src
@@ -467,10 +467,6 @@ Resource RID_ERRHDL
     {
         Text [ en-US ] = "This document contains macros.\n\nMacros may contain \
viruses. Execution of macros is disabled due to the current macro security setting in \
Tools - Options - %PRODUCTNAME - Security.\n\nTherefore, some functionality may not \
be available." ;  };
-    String ERRCODE_SFX_BROKENSIGNATURE
-    {
-        Text [ en-US ] = "The digitally signed document content and/or macros do not \
match the current document signature.\n\nThis could be the result of document \
manipulation or of structural document damage due to data transmission.\n\nWe \
recommend that you do not trust the content of the current document.\nExecution of \
                macros is disabled for this document.\n " ;
-    };
     String ERRCODE_SFX_INCOMPLETE_ENCRYPTION
     {
         Text [ en-US ] = "The encrypted document contains unexpected non-encrypted \
streams.\n\nThis could be the result of document manipulation.\n\nWe recommend that \
you do not trust the content of the current document.\nExecution of macros is \
                disabled for this document.\n " ;
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index e587a83..31074fb 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -1126,8 +1126,7 @@ UUIInteractionHelper::handleGenericErrorRequest(
         ErrCode  nError   = static_cast< ErrCode >(nErrorCode);
         bool bWarning = !ERRCODE_TOERROR(nError);
 
-        if ( nError == ERRCODE_SFX_BROKENSIGNATURE
-             || nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
+        if ( nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
         {
             // the security warning box needs a special title
             OUString aErrorString;
@@ -1137,11 +1136,8 @@ UUIInteractionHelper::handleGenericErrorRequest(
                 ResMgr::CreateResMgr( "uui" ) );
             OUString aTitle( utl::ConfigManager::getProductName() );
 
-            OUString aErrTitle
-                  = ResId( nError == ERRCODE_SFX_BROKENSIGNATURE
-                                       ? STR_WARNING_BROKENSIGNATURE_TITLE
-                                       : STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE,
-                                   *xManager.get() ).toString();
+            OUString aErrTitle = ResId( STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE,
+                *xManager.get() ).toString();
 
             if ( !aTitle.isEmpty() && !aErrTitle.isEmpty() )
                 aTitle += " - " ;
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic