From e13827070cdcdf7bbf96678e7527c684519124d8 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Tue, 1 Nov 2016 09:46:26 +0100 Subject: [PATCH] SafeModeDialog: Group options Change-Id: Ife0903c90f17efb2a1c6681ece8dd9af257873cd Reviewed-on: https://gerrit.libreoffice.org/30453 Reviewed-by: Samuel Mehrbrodt Tested-by: Samuel Mehrbrodt --- svx/source/dialog/SafeModeDialog.cxx | 140 +++++++++++++++++------- svx/source/dialog/SafeModeDialog.hxx | 10 ++ svx/uiconfig/ui/safemodedialog.ui | 203 +++++++++++++++++++++++++---------- 3 files changed, 262 insertions(+), 91 deletions(-) diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx index 4a3a83515a91..0dc4c47372bc 100644 --- a/svx/source/dialog/SafeModeDialog.cxx +++ b/svx/source/dialog/SafeModeDialog.cxx @@ -37,6 +37,14 @@ SafeModeDialog::SafeModeDialog(vcl::Window* pParent) mpBtnQuit(), mpBtnRestart(), + mpBoxRestore(), + mpBoxConfigure(), + mpBoxReset(), + + mpRadioRestore(), + mpRadioConfigure(), + mpRadioReset(), + mpCBCheckProfilesafeConfig(), mpCBCheckProfilesafeExtensions(), mpCBDisableAllExtensions(), @@ -52,6 +60,14 @@ SafeModeDialog::SafeModeDialog(vcl::Window* pParent) get(mpBtnQuit, "btn_quit"); get(mpBtnRestart, "btn_restart"); + get(mpBoxRestore, "group_restore"); + get(mpBoxConfigure, "group_configure"); + get(mpBoxReset, "group_reset"); + + get(mpRadioRestore, "radio_restore"); + get(mpRadioConfigure, "radio_configure"); + get(mpRadioReset, "radio_reset"); + get(mpCBCheckProfilesafeConfig, "check_profilesafe_config"); get(mpCBCheckProfilesafeExtensions, "check_profilesafe_extensions"); get(mpCBDisableAllExtensions, "check_disable_all_extensions"); @@ -64,6 +80,10 @@ SafeModeDialog::SafeModeDialog(vcl::Window* pParent) get(mpBugLink, "linkbutton_bugs"); get(mpUserProfileLink, "linkbutton_profile"); + mpRadioRestore->SetClickHdl(LINK(this, SafeModeDialog, RadioBtnHdl)); + mpRadioConfigure->SetClickHdl(LINK(this, SafeModeDialog, RadioBtnHdl)); + mpRadioReset->SetClickHdl(LINK(this, SafeModeDialog, RadioBtnHdl)); + mpBtnContinue->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl)); mpBtnQuit->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl)); mpBtnRestart->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl)); @@ -109,9 +129,13 @@ SafeModeDialog::SafeModeDialog(vcl::Window* pParent) { mpCBResetCustomizations->Disable(); } - // no disabe of mpCBResetWholeUserProfile, always possible (as last choice) + // Check the first radio button and disable the other parts + mpRadioRestore->Check(); + mpBoxConfigure->Disable(); + mpBoxReset->Disable(); + // Set URL for help button (module=safemode) OUString sURL("http://hub.libreoffice.org/send-feedback/?LOversion=" + utl::ConfigManager::getAboutBoxProductVersion() + "&LOlocale=" + utl::ConfigManager::getLocale() + "&LOmodule=safemode"); @@ -127,6 +151,14 @@ SafeModeDialog::~SafeModeDialog() void SafeModeDialog::dispose() { + mpRadioRestore.clear(); + mpRadioConfigure.clear(); + mpRadioReset.clear(); + + mpBoxRestore.clear(); + mpBoxConfigure.clear(); + mpBoxReset.clear(); + mpBtnContinue.clear(); mpBtnQuit.clear(); mpBtnRestart.clear(); @@ -156,58 +188,92 @@ bool SafeModeDialog::Close() void SafeModeDialog::applyChanges() { - if (mpCBCheckProfilesafeConfig->IsChecked()) - { - // reset UserConfiguration to last known working state - // ProfileSafeMode/BackupFileHelper - maBackupFileHelper.tryPop(); - } - - if (mpCBCheckProfilesafeExtensions->IsChecked()) + /// Restore + if (mpRadioRestore->IsChecked()) { - // reset State of installed Extensions to last known working state - // ProfileSafeMode/BackupFileHelper - maBackupFileHelper.tryPopExtensionInfo(); + if (mpCBCheckProfilesafeConfig->IsChecked()) + { + // reset UserConfiguration to last known working state + // ProfileSafeMode/BackupFileHelper + maBackupFileHelper.tryPop(); + } + + if (mpCBCheckProfilesafeExtensions->IsChecked()) + { + // reset State of installed Extensions to last known working state + // ProfileSafeMode/BackupFileHelper + maBackupFileHelper.tryPopExtensionInfo(); + } } - if (mpCBDisableAllExtensions->IsChecked()) + // Configure + if (mpRadioConfigure->IsChecked()) { - // Disable all extensions - comphelper::BackupFileHelper::tryDisableAllExtensions(); + if (mpCBDisableAllExtensions->IsChecked()) + { + // Disable all extensions + comphelper::BackupFileHelper::tryDisableAllExtensions(); + } + + if (mpCBDeinstallUserExtensions->IsChecked()) + { + // Deinstall all User Extensions (installed for User only) + comphelper::BackupFileHelper::tryDeinstallUserExtensions(); + } + + if (mpCBDeinstallAllExtensions->IsChecked()) + { + // Deinstall all Extensions (user|shared|bundled) + comphelper::BackupFileHelper::tryDeinstallAllExtensions(); + } + + if (mpCBDisableHWAcceleration->IsChecked()) + { + comphelper::BackupFileHelper::tryDisableHWAcceleration(); + } } - if (mpCBDeinstallUserExtensions->IsChecked()) + // Reset + if (mpRadioReset->IsChecked()) { - // Deinstall all User Extensions (installed for User only) - comphelper::BackupFileHelper::tryDeinstallUserExtensions(); + if (mpCBResetCustomizations->IsChecked()) + { + // Reset customizations (Settings and UserInterface modifications) + comphelper::BackupFileHelper::tryResetCustomizations(); + } + + if (mpCBResetWholeUserProfile->IsChecked()) + { + // Reset the whole UserProfile + comphelper::BackupFileHelper::tryResetUserProfile(); + } } - if (mpCBDeinstallAllExtensions->IsChecked()) - { - // Deinstall all Extensions (user|shared|bundled) - comphelper::BackupFileHelper::tryDeinstallAllExtensions(); - } + // Then restart + css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext())->requestRestart( + css::uno::Reference< css::task::XInteractionHandler >()); +} - if (mpCBDisableHWAcceleration->IsChecked()) +IMPL_LINK(SafeModeDialog, RadioBtnHdl, Button*, pBtn, void) +{ + if (pBtn == mpRadioConfigure.get()) { - comphelper::BackupFileHelper::tryDisableHWAcceleration(); + mpBoxConfigure->Enable(); + mpBoxRestore->Disable(); + mpBoxReset->Disable(); } - - if (mpCBResetCustomizations->IsChecked()) + else if (pBtn == mpRadioReset.get()) { - // Reset customizations (Settings and UserInterface modifications) - comphelper::BackupFileHelper::tryResetCustomizations(); + mpBoxReset->Enable(); + mpBoxConfigure->Disable(); + mpBoxRestore->Disable(); } - - if (mpCBResetWholeUserProfile->IsChecked()) + else if (pBtn == mpRadioRestore.get()) { - // Reset the whole UserProfile - comphelper::BackupFileHelper::tryResetUserProfile(); + mpBoxRestore->Enable(); + mpBoxReset->Disable(); + mpBoxConfigure->Disable(); } - - // Then restart - css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext())->requestRestart( - css::uno::Reference< css::task::XInteractionHandler >()); } IMPL_LINK(SafeModeDialog, BtnHdl, Button*, pBtn, void) diff --git a/svx/source/dialog/SafeModeDialog.hxx b/svx/source/dialog/SafeModeDialog.hxx index f770c535e41d..05ee6a2dd2d8 100644 --- a/svx/source/dialog/SafeModeDialog.hxx +++ b/svx/source/dialog/SafeModeDialog.hxx @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -36,6 +37,14 @@ private: VclPtr