diff options
-rw-r--r-- | comphelper/source/misc/backupfilehelper.cxx | 64 | ||||
-rw-r--r-- | include/comphelper/backupfilehelper.hxx | 7 | ||||
-rw-r--r-- | svx/source/dialog/SafeModeDialog.cxx | 11 | ||||
-rw-r--r-- | svx/source/dialog/SafeModeDialog.hxx | 1 | ||||
-rw-r--r-- | svx/uiconfig/ui/safemodedialog.ui | 17 |
5 files changed, 78 insertions, 22 deletions
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index 98bb029e211f..50ea1903319c 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -557,10 +557,12 @@ namespace { private: ExtensionInfoEntryVector maEntries; + OUString maRegPath; public: ExtensionInfo() - : maEntries() + : maEntries(), + maRegPath("/registry/com.sun.star.comp.deployment.bundle.PackageRegistryBackend/backenddb.xml") { } @@ -680,21 +682,27 @@ namespace } public: - void createUsingExtensionRegistryEntriesFromXML( - const OUString& rUserConfigWorkURL, - bool bUser) - { - // This is looked up for 'user' in the user|shared|bundled deployed Extensions, - // only the user ones seem to be able to be de/activated. The ones for user are in - // uno_packages/cache while the others are in /extensions/shared. - // This also means that all user-deployed Extensions can probably be uninstalled - // in safe mode by deleting the uno_packages directory and the shared|bundled - // ones by deleting the extensions directory. - const OUString aRegPath("/registry/com.sun.star.comp.deployment.bundle.PackageRegistryBackend/backenddb.xml"); - const OUString aExtensionsReg(rUserConfigWorkURL + "/extensions/shared" + aRegPath); - const OUString aUnoPackageReg(rUserConfigWorkURL + "/uno_packages/cache" + aRegPath); - const OUString aPath(bUser ? aUnoPackageReg : aExtensionsReg); + void createUserExtensionRegistryEntriesFromXML(const OUString& rUserConfigWorkURL) + { + const OUString aPath(rUserConfigWorkURL + "/uno_packages/cache" + maRegPath); + createExtensionRegistryEntriesFromXML(aPath); + } + + void createSharedExtensionRegistryEntriesFromXML(const OUString& rUserConfigWorkURL) + { + const OUString aPath(rUserConfigWorkURL + "/extensions/shared" + maRegPath); + createExtensionRegistryEntriesFromXML(aPath); + } + void createBundledExtensionRegistryEntriesFromXML(const OUString& rUserConfigWorkURL) + { + const OUString aPath(rUserConfigWorkURL + "/extensions/bundled" + maRegPath); + createExtensionRegistryEntriesFromXML(aPath); + } + + + void createExtensionRegistryEntriesFromXML(const OUString& aPath) + { if (fileExists(aPath)) { uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); @@ -1986,7 +1994,7 @@ namespace comphelper // extensions are not loaded from XExtensionManager class ExtensionInfo aExtensionInfo; - aExtensionInfo.createUsingExtensionRegistryEntriesFromXML(maUserConfigWorkURL, true); + aExtensionInfo.createUserExtensionRegistryEntriesFromXML(maUserConfigWorkURL); return aExtensionInfo.areThereEnabledExtensions(); } @@ -2000,7 +2008,7 @@ namespace comphelper const ExtensionInfoEntryVector aToBeEnabled{}; ExtensionInfoEntryVector aToBeDisabled; - aCurrentExtensionInfo.createUsingExtensionRegistryEntriesFromXML(maUserConfigWorkURL, true); + aCurrentExtensionInfo.createUserExtensionRegistryEntriesFromXML(maUserConfigWorkURL); const ExtensionInfoEntryVector& rCurrentVector = aCurrentExtensionInfo.getExtensionInfoEntryVector(); @@ -2020,7 +2028,7 @@ namespace comphelper // check if there are User Extensions installed. class ExtensionInfo aExtensionInfo; - aExtensionInfo.createUsingExtensionRegistryEntriesFromXML(maUserConfigWorkURL, true); + aExtensionInfo.createUserExtensionRegistryEntriesFromXML(maUserConfigWorkURL); return !aExtensionInfo.getExtensionInfoEntryVector().empty(); } @@ -2036,7 +2044,7 @@ namespace comphelper // check if there are shared Extensions installed class ExtensionInfo aExtensionInfo; - aExtensionInfo.createUsingExtensionRegistryEntriesFromXML(maUserConfigWorkURL, false); + aExtensionInfo.createSharedExtensionRegistryEntriesFromXML(maUserConfigWorkURL); return !aExtensionInfo.getExtensionInfoEntryVector().empty(); } @@ -2047,6 +2055,22 @@ namespace comphelper deleteDirRecursively(maUserConfigWorkURL + "/extensions/shared"); } + bool BackupFileHelper::isTryResetBundledExtensionsPossible() + { + // check if there are shared Extensions installed + class ExtensionInfo aExtensionInfo; + + aExtensionInfo.createBundledExtensionRegistryEntriesFromXML(maUserConfigWorkURL); + + return !aExtensionInfo.getExtensionInfoEntryVector().empty(); + } + + void BackupFileHelper::tryResetBundledExtensions() + { + // reset shared extension info + deleteDirRecursively(maUserConfigWorkURL + "/extensions/bundled"); + } + const std::vector< OUString >& BackupFileHelper::getCustomizationDirNames() { static std::vector< OUString > aDirNames; @@ -2548,7 +2572,7 @@ namespace comphelper // get current extension info, but from XML config files ExtensionInfo aCurrentExtensionInfo; - aCurrentExtensionInfo.createUsingExtensionRegistryEntriesFromXML(maUserConfigWorkURL, true); + aCurrentExtensionInfo.createUserExtensionRegistryEntriesFromXML(maUserConfigWorkURL); // now we have loaded last_working (aLoadedExtensionInfo) and // current (aCurrentExtensionInfo) ExtensionInfo and may react on diff --git a/include/comphelper/backupfilehelper.hxx b/include/comphelper/backupfilehelper.hxx index 5870f24daa94..68835b866452 100644 --- a/include/comphelper/backupfilehelper.hxx +++ b/include/comphelper/backupfilehelper.hxx @@ -162,11 +162,16 @@ namespace comphelper static bool isTryDeinstallUserExtensionsPossible(); static void tryDeinstallUserExtensions(); - /** Deinstall all Extensions (user|shared|bundled) + /** Reset shared Extensions */ static bool isTryResetSharedExtensionsPossible(); static void tryResetSharedExtensions(); + /** Reset bundled Extensions + */ + static bool isTryResetBundledExtensionsPossible(); + static void tryResetBundledExtensions(); + /// Disables OpenGL and OpenCL static void tryDisableHWAcceleration(); diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx index f3a6960f4888..25ef95756919 100644 --- a/svx/source/dialog/SafeModeDialog.cxx +++ b/svx/source/dialog/SafeModeDialog.cxx @@ -55,6 +55,7 @@ SafeModeDialog::SafeModeDialog(vcl::Window* pParent) mpCBDisableAllExtensions(), mpCBDeinstallUserExtensions(), mpCBResetSharedExtensions(), + mpCBResetBundledExtensions(), mpCBDisableHWAcceleration(), mpCBResetCustomizations(), mpCBResetWholeUserProfile(), @@ -80,6 +81,7 @@ SafeModeDialog::SafeModeDialog(vcl::Window* pParent) get(mpCBDisableAllExtensions, "check_disable_all_extensions"); get(mpCBDeinstallUserExtensions, "check_deinstall_user_extensions"); get(mpCBResetSharedExtensions, "check_reset_shared_extensions"); + get(mpCBResetBundledExtensions, "check_reset_bundled_extensions"); get(mpCBDisableHWAcceleration, "check_disable_hw_acceleration"); get(mpCBResetCustomizations, "check_reset_customizations"); get(mpCBResetWholeUserProfile, "check_reset_whole_userprofile"); @@ -102,6 +104,7 @@ SafeModeDialog::SafeModeDialog(vcl::Window* pParent) mpCBDisableAllExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); mpCBDeinstallUserExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); mpCBResetSharedExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); + mpCBResetBundledExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); mpCBDisableHWAcceleration->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); mpCBResetCustomizations->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); mpCBResetWholeUserProfile->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); @@ -151,6 +154,7 @@ void SafeModeDialog::dispose() mpCBDisableAllExtensions.clear(); mpCBDeinstallUserExtensions.clear(); mpCBResetSharedExtensions.clear(); + mpCBResetBundledExtensions.clear(); mpCBDisableHWAcceleration.clear(); mpCBResetCustomizations.clear(); mpCBResetWholeUserProfile.clear(); @@ -169,6 +173,7 @@ void SafeModeDialog::enableDisableWidgets() mpCBDisableAllExtensions->Enable(comphelper::BackupFileHelper::isTryDisableAllExtensionsPossible()); mpCBDeinstallUserExtensions->Enable(comphelper::BackupFileHelper::isTryDeinstallUserExtensionsPossible()); mpCBResetSharedExtensions->Enable(comphelper::BackupFileHelper::isTryResetSharedExtensionsPossible()); + mpCBResetBundledExtensions->Enable(comphelper::BackupFileHelper::isTryResetBundledExtensionsPossible()); mpCBResetCustomizations->Enable(comphelper::BackupFileHelper::isTryResetCustomizationsPossible()); // no disable of mpCBResetWholeUserProfile, always possible (as last choice) @@ -231,6 +236,11 @@ void SafeModeDialog::applyChanges() // Reset shared Extensions comphelper::BackupFileHelper::tryResetSharedExtensions(); } + if (mpCBResetBundledExtensions->IsChecked()) + { + // Reset bundled Extensions + comphelper::BackupFileHelper::tryResetBundledExtensions(); + } } // Reset @@ -379,6 +389,7 @@ IMPL_LINK(SafeModeDialog, CheckBoxHdl, CheckBox&, /*pCheckBox*/, void) mpCBDisableAllExtensions->IsChecked() || mpCBDeinstallUserExtensions->IsChecked() || mpCBResetSharedExtensions->IsChecked() || + mpCBResetBundledExtensions->IsChecked() || mpCBDisableHWAcceleration->IsChecked() || mpCBResetCustomizations->IsChecked() || mpCBResetWholeUserProfile->IsChecked()); diff --git a/svx/source/dialog/SafeModeDialog.hxx b/svx/source/dialog/SafeModeDialog.hxx index ddba90f9be70..07c82d9c27e8 100644 --- a/svx/source/dialog/SafeModeDialog.hxx +++ b/svx/source/dialog/SafeModeDialog.hxx @@ -52,6 +52,7 @@ private: VclPtr<CheckBox> mpCBDisableAllExtensions; VclPtr<CheckBox> mpCBDeinstallUserExtensions; VclPtr<CheckBox> mpCBResetSharedExtensions; + VclPtr<CheckBox> mpCBResetBundledExtensions; VclPtr<CheckBox> mpCBDisableHWAcceleration; VclPtr<CheckBox> mpCBResetCustomizations; VclPtr<CheckBox> mpCBResetWholeUserProfile; diff --git a/svx/uiconfig/ui/safemodedialog.ui b/svx/uiconfig/ui/safemodedialog.ui index a4d43536bdd4..57161f4c945c 100644 --- a/svx/uiconfig/ui/safemodedialog.ui +++ b/svx/uiconfig/ui/safemodedialog.ui @@ -264,7 +264,7 @@ The proposed changes get more radical from top down so it is recommended to try <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">0</property> </packing> </child> <child> @@ -279,6 +279,21 @@ The proposed changes get more radical from top down so it is recommended to try <packing> <property name="expand">False</property> <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="check_reset_bundled_extensions"> + <property name="label" translatable="yes">Reset state of bundled extensions</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> <property name="position">2</property> </packing> </child> |