desktop/source/lib/lokinteractionhandler.cxx | 21 +++++++++++++++++++++ desktop/source/lib/lokinteractionhandler.hxx | 1 + sfx2/source/doc/sfxbasemodel.cxx | 4 +++- uui/source/iahndl.cxx | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-)
New commits: commit 413e7a2e6f0c363938a0a5ee5bd6eb5d56d5a8d8 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Sep 22 11:11:06 2023 +0200 Commit: Ashod Nakashian <a...@collabora.com> CommitDate: Sat Sep 23 14:48:58 2023 +0200 lok: add broken package interaction handler in case of repair don't use template flag to not make file readonly so we can overwrite it and upload to storage updated version Change-Id: Ia460009fc3b77582dde06dd6f94a85aef3aee11b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157168 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Ashod Nakashian <a...@collabora.com> diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx index 8495ac2c8179..8ac3dc7c2aae 100644 --- a/desktop/source/lib/lokinteractionhandler.cxx +++ b/desktop/source/lib/lokinteractionhandler.cxx @@ -23,6 +23,7 @@ #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/document/BrokenPackageRequest.hpp> #include <com/sun/star/task/XInteractionAbort.hpp> #include <com/sun/star/task/XInteractionApprove.hpp> #include <com/sun/star/task/XInteractionPassword2.hpp> @@ -371,6 +372,23 @@ bool LOKInteractionHandler::handleLoadReadOnlyRequest(const uno::Reference<task: return false; } +bool LOKInteractionHandler::handlePackageReparationRequest(const uno::Reference<task::XInteractionRequest>& xRequest) +{ + uno::Any const request(xRequest->getRequest()); + + document::BrokenPackageRequest aBrokenPackageRequest; + if (request >>= aBrokenPackageRequest) + { + auto xInteraction(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), nullptr)); + + if (xInteraction.is()) + xInteraction->handleInteractionRequest(xRequest); + + return true; + } + return false; +} + bool LOKInteractionHandler::handleFilterOptionsRequest(const uno::Reference<task::XInteractionRequest>& xRequest) { document::FilterOptionsRequest aFilterOptionsRequest; @@ -413,6 +431,9 @@ sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest( if (handleLoadReadOnlyRequest(xRequest)) return true; + if (handlePackageReparationRequest(xRequest)) + return true; + // TODO: perform more interactions 'for real' like the above selectApproved(rContinuations); diff --git a/desktop/source/lib/lokinteractionhandler.hxx b/desktop/source/lib/lokinteractionhandler.hxx index f92b88cf11f9..ded410ae5742 100644 --- a/desktop/source/lib/lokinteractionhandler.hxx +++ b/desktop/source/lib/lokinteractionhandler.hxx @@ -79,6 +79,7 @@ private: static bool handleFilterOptionsRequest(const ::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest>& Request); static bool handleLoadReadOnlyRequest(const css::uno::Reference<css::task::XInteractionRequest>& xRequest); + static bool handlePackageReparationRequest(const css::uno::Reference<css::task::XInteractionRequest>& xRequest); public: void SetPassword(char const* pPassword); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index f5759950d29b..30454ce31d3b 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1956,9 +1956,11 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA xHandler->handle( aRequest.GetRequest() ); if( aRequest.isApproved() ) { + // lok: we want to overwrite file in jail, so don't use template flag + bool bIsLOK = comphelper::LibreOfficeKit::isActive(); // broken package: try second loading and allow repair pMedium->GetItemSet()->Put( SfxBoolItem( SID_REPAIRPACKAGE, true ) ); - pMedium->GetItemSet()->Put( SfxBoolItem( SID_TEMPLATE, true ) ); + pMedium->GetItemSet()->Put( SfxBoolItem( SID_TEMPLATE, !bIsLOK ) ); pMedium->GetItemSet()->Put( SfxStringItem( SID_DOCINFO_TITLE, aDocName ) ); // the error must be reset and the storage must be reopened in new mode diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 7bd3fb7104d4..cefb794f7fb2 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -950,7 +950,7 @@ executeMessageBox( SolarMutexGuard aGuard; std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eMessageType, - eMessageType == VclMessageType::Question ? VclButtonsType::YesNo : VclButtonsType::Ok, rMessage)); + eMessageType == VclMessageType::Question ? VclButtonsType::YesNo : VclButtonsType::Ok, rMessage, GetpApp())); xBox->set_title(rTitle); short nMessResult = xBox->run();