desktop/inc/dp_gui.hrc                                               |    1 
 desktop/source/deployment/gui/dp_gui_dialog.src                      |    6 +++
 desktop/source/deployment/gui/dp_gui_dialog2.cxx                     |   16 
+++++++++-
 officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs |    7 
++++
 4 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit f09be32d0fcb176527b41cedc37814d5ed7ccad5
Author: Muhammet Kara <[email protected]>
Date:   Wed May 24 16:08:36 2017 +0300

    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 <[email protected]>
    Reviewed-by: Muhammet Kara <[email protected]>

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 )
diff --git 
a/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs 
b/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs
index f600a39b7087..eaf840cd90e4 100644
--- a/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs
@@ -58,6 +58,13 @@
         </info>
         <value>false</value>
       </prop>
+      <prop oor:name="DisableExtensionRemoval" oor:type="xs:boolean" 
oor:nillable="false">
+        <info>
+          <desc>Specifies whether to disable extension removal via the 
Extension Manager dialog.</desc>
+          <label>Disable Extension Removal</label>
+        </info>
+        <value>false</value>
+      </prop>
     </group>
     <group oor:name="ExtensionUpdateData">
       <info>
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to