diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-01-31 09:07:14 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-01-31 12:21:48 +0000 |
commit | 2dff5e856ab343b1296f63d645c47382493fe2fe (patch) | |
tree | 6b548f9aebff0f48f276372a1dc03ed59e38df51 /sfx2 | |
parent | 95db32acabaae2a1d32874ecb8429e828c52a7ae (diff) |
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>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/docmacromode.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/inc/objshimp.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/view/view.src | 10 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 12 |
5 files changed, 25 insertions, 19 deletions
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index a67a455284e0..4df381c8e1fe 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 36d8fac7098e..8a568240bdbf 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 52fbb448ceec..916d306caaf2 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 0826609e5339..56b7fbaf91fc 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 42a259abaa95..ffa0d419e6aa 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() || |