diff options
author | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2017-05-22 11:41:20 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2017-05-24 16:08:56 +0200 |
commit | 99b7c4f57d7fe3cac772cce38e2dd6879e128315 (patch) | |
tree | af03eda1104c7d7327cb223ce12931aabcd96dc1 | |
parent | b3f058126b407e8f7d62e9ace68105f2b252e9ac (diff) |
tdf#36019: Dynamically enable/disable extension installation via GUI
Now extension installation via the Extension Manager dialog can be
dynamically enabled/disabled from the expert configurations.
This also affects the installation by double-clicking the extension
file in the file manager, but doesn't affect the unopkg commands.
Change-Id: I70c2c83c2458115b366c7fdcc06f72e11df4726b
Reviewed-on: https://gerrit.libreoffice.org/36688
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Muhammet Kara <muhammet.kara@pardus.org.tr>
-rw-r--r-- | desktop/Library_deploymentgui.mk | 2 | ||||
-rw-r--r-- | desktop/inc/dp_gui.hrc | 1 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_dialog.src | 6 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_dialog2.cxx | 30 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs | 12 |
5 files changed, 50 insertions, 1 deletions
diff --git a/desktop/Library_deploymentgui.mk b/desktop/Library_deploymentgui.mk index a16b567ea5d4..0a92e54d9907 100644 --- a/desktop/Library_deploymentgui.mk +++ b/desktop/Library_deploymentgui.mk @@ -20,6 +20,8 @@ $(eval $(call gb_Library_use_external,deploymentgui,boost_headers)) $(eval $(call gb_Library_set_precompiled_header,deploymentgui,$(SRCDIR)/desktop/inc/pch/precompiled_deploymentgui)) +$(eval $(call gb_Library_use_custom_headers,deploymentgui,\ officecfg/registry \ )) + $(eval $(call gb_Library_use_sdk_api,deploymentgui)) $(eval $(call gb_Library_use_libraries,deploymentgui,\ diff --git a/desktop/inc/dp_gui.hrc b/desktop/inc/dp_gui.hrc index 9bb961474743..b9c9c257bb63 100644 --- a/desktop/inc/dp_gui.hrc +++ b/desktop/inc/dp_gui.hrc @@ -30,6 +30,7 @@ #define RID_STR_WARNING_VERSION_GREATER (RID_DEPLOYMENT_GUI_START + 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_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 9078a353533a..5791c344a04d 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -113,6 +113,12 @@ String RID_STR_WARNING_INSTALL_EXTENSION "Click 'Cancel' to stop the installation."; }; +String RID_STR_WARNING_INSTALL_EXTENSION_DISABLED +{ + Text [en-US] = "Extension installation is currently disabled. " + "Please consult your system administrator for more information."; +}; + String RID_STR_WARNING_REMOVE_EXTENSION { Text [en-US] = "You are about to remove the extension '%NAME'.\n" diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index dc75acbb8264..a2ce1d98bda3 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -71,6 +71,8 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/XComponentContext.hpp> +#include <officecfg/Office/ExtensionManager.hxx> + #include <map> #include <memory> #include <vector> @@ -419,6 +421,17 @@ void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const { const SolarMutexGuard guard; + + // Check if extension installation is disabled in the expert configurations + if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get()) + { + ScopedVclPtrInstance<MessageDialog> aWarn(m_pVCLWindow, getResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED), + VclMessageType::Warning, VclButtonsType::Ok); + aWarn->Execute(); + + return false; + } + ScopedVclPtrInstance<MessageDialog> aInfo(m_pVCLWindow, getResId(RID_STR_WARNING_INSTALL_EXTENSION), VclMessageType::Warning, VclButtonsType::OkCancel); @@ -511,6 +524,12 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager, m_pUpdateBtn->Hide(); #endif + if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get()) + { + m_pAddBtn->Disable(); + m_pAddBtn->SetQuickHelpText(getResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED)); + } + m_aIdle.SetPriority(TaskPriority::LOWEST); m_aIdle.SetInvokeHandler( LINK( this, ExtMgrDialog, TimeOutHdl ) ); } @@ -804,7 +823,16 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void ) } m_pCancelBtn->Enable( bLockInterface ); - m_pAddBtn->Enable( !bLockInterface ); + m_pAddBtn->Enable( !bLockInterface && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get()); + if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get()) + { + m_pAddBtn->SetQuickHelpText(getResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED)); + } + else + { + m_pAddBtn->SetQuickHelpText(""); + } + m_pUpdateBtn->Enable( !bLockInterface && m_pExtensionBox->getItemCount() ); m_pExtensionBox->enableButtons( !bLockInterface ); diff --git a/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs b/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs index 893fd882ac37..f600a39b7087 100644 --- a/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs @@ -47,6 +47,18 @@ <value/> </prop> </group> + <group oor:name="ExtensionSecurity"> + <info> + <desc>Holds settings related to Extension security.</desc> + </info> + <prop oor:name="DisableExtensionInstallation" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Specifies whether to disable extension installation via the Extension Manager dialog.</desc> + <label>Disable Extension Installation</label> + </info> + <value>false</value> + </prop> + </group> <group oor:name="ExtensionUpdateData"> <info> <desc>Contains information about available or ignored updates for extensions."</desc> |