From f09be32d0fcb176527b41cedc37814d5ed7ccad5 Mon Sep 17 00:00:00 2001 From: Muhammet Kara Date: Wed, 24 May 2017 16:08:36 +0300 Subject: tdf#36019: Dynamically enable/disable extension removal via GUI Now extension removal via the Extension Manager dialog can be dynamically enabled/disabled from the expert configurations. This doesn't affect the unopkg commands. Change-Id: I2b718d48977ca18cc3d808e98cf7804d4a47dcff Reviewed-on: https://gerrit.libreoffice.org/37990 Tested-by: Jenkins Reviewed-by: Muhammet Kara --- desktop/inc/dp_gui.hrc | 1 + desktop/source/deployment/gui/dp_gui_dialog.src | 6 ++++++ desktop/source/deployment/gui/dp_gui_dialog2.cxx | 16 +++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'desktop') diff --git a/desktop/inc/dp_gui.hrc b/desktop/inc/dp_gui.hrc index b9c9c257bb63..a22629cb1e7a 100644 --- a/desktop/inc/dp_gui.hrc +++ b/desktop/inc/dp_gui.hrc @@ -31,6 +31,7 @@ #define RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES (RID_DEPLOYMENT_GUI_START + 8) #define RID_STR_WARNING_INSTALL_EXTENSION (RID_DEPLOYMENT_GUI_START + 9) #define RID_STR_WARNING_INSTALL_EXTENSION_DISABLED (RID_DEPLOYMENT_GUI_START + 10) +#define RID_STR_WARNING_REMOVE_EXTENSION_DISABLED (RID_DEPLOYMENT_GUI_START + 11) #define RID_DLG_UPDATE_NONE (RID_DEPLOYMENT_GUI_START + 13) #define RID_DLG_UPDATE_NOINSTALLABLE (RID_DEPLOYMENT_GUI_START + 14) diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src index 5791c344a04d..27ebb4b7f6f1 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -126,6 +126,12 @@ String RID_STR_WARNING_REMOVE_EXTENSION "Click 'Cancel' to stop removing the extension."; }; +String RID_STR_WARNING_REMOVE_EXTENSION_DISABLED +{ + Text [en-US] = "Extension removal is currently disabled. " + "Please consult your system administrator for more information."; +}; + String RID_STR_WARNING_REMOVE_SHARED_EXTENSION { Text [en-US] = "Make sure that no further users are working with the same " diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index a2ce1d98bda3..8acde7cc8172 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -529,6 +529,11 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager, m_pAddBtn->Disable(); m_pAddBtn->SetQuickHelpText(getResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED)); } + if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get()) + { + m_pRemoveBtn->Disable(); + m_pRemoveBtn->SetQuickHelpText(getResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED)); + } m_aIdle.SetPriority(TaskPriority::LOWEST); m_aIdle.SetInvokeHandler( LINK( this, ExtMgrDialog, TimeOutHdl ) ); @@ -758,7 +763,16 @@ void ExtMgrDialog::enableOptionsButton( bool bEnable ) void ExtMgrDialog::enableRemoveButton( bool bEnable ) { - m_pRemoveBtn->Enable( bEnable ); + m_pRemoveBtn->Enable( bEnable && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get()); + + if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get()) + { + m_pRemoveBtn->SetQuickHelpText(getResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED)); + } + else + { + m_pRemoveBtn->SetQuickHelpText(""); + } } void ExtMgrDialog::enableEnableButton( bool bEnable ) -- cgit