diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-04-26 16:30:48 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-04-30 10:39:01 +0200 |
commit | 43459bac67363f49aadd851e686d4a74b8ddc256 (patch) | |
tree | c5bddbad746e981c0434db3a75e804396d2ec07e /sfx2/source/doc | |
parent | a0329f7c60b457405058404dececd4d8479ef1d5 (diff) |
tdf#117039: update infobar instead of removing and re-adding it
Apparently AppendInfoBar ends up calling back into SID_SIGNATURE
status function at some point, creating an endless recursion. I'm
too lazy to debug why so I'm cowardly avoiding it
Change-Id: Ib1e4b7f12fea197887b099e9a9f03b4e58884ec1
Reviewed-on: https://gerrit.libreoffice.org/53519
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sfx2/source/doc')
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 7485cfe04a5f..1bee627d11d6 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1058,21 +1058,28 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) break; } - if ( pFrame->HasInfoBarWithID("signature") ) - pFrame->RemoveInfoBar("signature"); - - if ( eState != SignatureState::NOSIGNATURES ) + // new info bar + if ( !pFrame->HasInfoBarWithID("signature") ) + { + if ( !sMessage.isEmpty() ) + { + auto pInfoBar = pFrame->AppendInfoBar("signature", sMessage, aInfoBarType); + if (pInfoBar == nullptr) + return; + VclPtrInstance<PushButton> xBtn(&(pFrame->GetWindow())); + xBtn->SetText(SfxResId(STR_SIGNATURE_SHOW)); + xBtn->SetSizePixel(xBtn->GetOptimalSize()); + xBtn->SetClickHdl(LINK(this, SfxObjectShell, SignDocumentHandler)); + pInfoBar->addButton(xBtn); + } + } + else // info bar exists already { - auto pInfoBar = pFrame->AppendInfoBar("signature", sMessage, aInfoBarType); - if (pInfoBar == nullptr) - return; - VclPtrInstance<PushButton> xBtn(&(pFrame->GetWindow())); - xBtn->SetText(SfxResId(STR_SIGNATURE_SHOW)); - xBtn->SetSizePixel(xBtn->GetOptimalSize()); - xBtn->SetClickHdl(LINK(this, SfxObjectShell, SignDocumentHandler)); - pInfoBar->addButton(xBtn); + if ( eState == SignatureState::NOSIGNATURES ) + pFrame->RemoveInfoBar("signature"); + else + pFrame->UpdateInfoBar("signature", sMessage, aInfoBarType); } - } rSet.Put( SfxUInt16Item( SID_SIGNATURE, static_cast<sal_uInt16>(GetDocumentSignatureState()) ) ); |