diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2016-10-13 18:31:51 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2016-10-14 10:37:30 +0000 |
commit | a1b7231a33322bbbb8352e2cd6aeff3b473b01d4 (patch) | |
tree | 5f4ff9e277889f8aa44067328d667c6aa16d7406 /svx | |
parent | 876fcb5461bb1fdb151a4457ccacaed6904238a2 (diff) |
profilesafe: Adapted to UI
Adaptions to UI, added more modes what the user
can do in SafeMode. Adapted locations to write
pack information and added places where to enter
SafeMode. Implemented basically all five
possible user choices
Change-Id: Ic5324a8f77ab434309e840949c3803e65a75c538
Reviewed-on: https://gerrit.libreoffice.org/29785
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/SafeModeDialog.cxx | 102 | ||||
-rw-r--r-- | svx/source/dialog/SafeModeDialog.hxx | 14 | ||||
-rw-r--r-- | svx/uiconfig/ui/safemodedialog.ui | 155 |
3 files changed, 192 insertions, 79 deletions
diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx index 53d99119e51d..a2e6ca2c3cfa 100644 --- a/svx/source/dialog/SafeModeDialog.cxx +++ b/svx/source/dialog/SafeModeDialog.cxx @@ -22,26 +22,63 @@ using namespace css; -SafeModeDialog::SafeModeDialog(vcl::Window* pParent): - Dialog(pParent, "SafeModeDialog", "svx/ui/safemodedialog.ui") +SafeModeDialog::SafeModeDialog(vcl::Window* pParent) +: Dialog(pParent, "SafeModeDialog", "svx/ui/safemodedialog.ui"), + + mpBtnContinue(), + mpBtnQuit(), + mpBtnRestart(), + + mpCBCheckProfilesafeConfig(), + mpCBCheckProfilesafeExtensions(), + mpCBDisableAllExtensions(), + mpCBResetCustomizations(), + mpCBResetWholeUserProfile(), + + maBackupFileHelper() { get(mpBtnContinue, "btn_continue"); get(mpBtnQuit, "btn_quit"); get(mpBtnRestart, "btn_restart"); - get(mpCBCustomizations, "check_customizations"); - get(mpCBExtensions, "check_extensions"); - get(mpCBFull, "check_full"); + + get(mpCBCheckProfilesafeConfig, "check_profilesafe_config"); + get(mpCBCheckProfilesafeExtensions, "check_profilesafe_extensions"); + get(mpCBDisableAllExtensions, "check_disable_all_extensions"); + get(mpCBResetCustomizations, "check_reset_customizations"); + get(mpCBResetWholeUserProfile, "check_reset_whole_userprofile"); mpBtnContinue->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl)); mpBtnQuit->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl)); mpBtnRestart->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl)); - mpCBCustomizations->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); - mpCBExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); - mpCBFull->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); + mpCBCheckProfilesafeConfig->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); + mpCBCheckProfilesafeExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); + mpCBDisableAllExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); + mpCBResetCustomizations->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); + mpCBResetWholeUserProfile->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl)); // Disable restart btn until some checkbox is active mpBtnRestart->Disable(); + + if (!maBackupFileHelper.isPopPossible()) + { + mpCBCheckProfilesafeConfig->Disable(); + } + + if (!maBackupFileHelper.isPopPossibleExtensionInfo()) + { + mpCBCheckProfilesafeExtensions->Disable(); + } + + if (comphelper::BackupFileHelper::isTryDisableAllExtensionsPossible()) + { + mpCBDisableAllExtensions->Disable(); + } + + if (maBackupFileHelper.isTryResetCustomizationsPossible()) + { + mpCBResetCustomizations->Disable(); + } } SafeModeDialog::~SafeModeDialog() @@ -54,9 +91,12 @@ void SafeModeDialog::dispose() mpBtnContinue.clear(); mpBtnQuit.clear(); mpBtnRestart.clear(); - mpCBCustomizations.clear(); - mpCBExtensions.clear(); - mpCBFull.clear(); + + mpCBCheckProfilesafeConfig.clear(); + mpCBCheckProfilesafeExtensions.clear(); + mpCBDisableAllExtensions.clear(); + mpCBResetCustomizations.clear(); + mpCBResetWholeUserProfile.clear(); Dialog::dispose(); } @@ -80,7 +120,37 @@ void SafeModeDialog::terminateOffice() void SafeModeDialog::applyChanges() { - // TODO: Apply apply changes + 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()) + { + // Disable all extensions + comphelper::BackupFileHelper::tryDisableAllExtensions(); + } + + if (mpCBResetCustomizations->IsChecked()) + { + // Reset customizations (Settings and UserInterface modifications) + maBackupFileHelper.tryResetCustomizations(); + } + + if (mpCBResetWholeUserProfile->IsChecked()) + { + // Reset the whole UserProfile + maBackupFileHelper.tryResetUserProfile(); + } // Then restart css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext())->requestRestart( @@ -106,7 +176,13 @@ IMPL_LINK(SafeModeDialog, BtnHdl, Button*, pBtn, void) IMPL_LINK(SafeModeDialog, CheckBoxHdl, CheckBox&, /*pCheckBox*/, void) { - bool bEnable = mpCBCustomizations->IsChecked() || mpCBExtensions->IsChecked() || mpCBFull->IsChecked(); + const bool bEnable( + mpCBCheckProfilesafeConfig->IsChecked() || + mpCBCheckProfilesafeExtensions->IsChecked() || + mpCBDisableAllExtensions->IsChecked() || + mpCBResetCustomizations->IsChecked() || + mpCBResetWholeUserProfile->IsChecked()); + mpBtnRestart->Enable(bEnable); } diff --git a/svx/source/dialog/SafeModeDialog.hxx b/svx/source/dialog/SafeModeDialog.hxx index dd0036ef7e19..6f2e4af6d600 100644 --- a/svx/source/dialog/SafeModeDialog.hxx +++ b/svx/source/dialog/SafeModeDialog.hxx @@ -15,6 +15,7 @@ #include <vcl/fixed.hxx> #include <vcl/edit.hxx> #include <vcl/vclmedit.hxx> +#include <comphelper/backupfilehelper.hxx> class SafeModeDialog : public Dialog { @@ -34,12 +35,17 @@ private: VclPtr<Button> mpBtnQuit; VclPtr<Button> mpBtnRestart; - VclPtr<CheckBox> mpCBExtensions; - VclPtr<CheckBox> mpCBCustomizations; - VclPtr<CheckBox> mpCBFull; + VclPtr<CheckBox> mpCBCheckProfilesafeConfig; + VclPtr<CheckBox> mpCBCheckProfilesafeExtensions; + VclPtr<CheckBox> mpCBDisableAllExtensions; + VclPtr<CheckBox> mpCBResetCustomizations; + VclPtr<CheckBox> mpCBResetWholeUserProfile; + + // local BackupFileHelper for handling possible restores + comphelper::BackupFileHelper maBackupFileHelper; static void terminateOffice(); - static void applyChanges(); + void applyChanges(); DECL_LINK(CheckBoxHdl, CheckBox&, void); DECL_LINK(BtnHdl, Button*, void); diff --git a/svx/uiconfig/ui/safemodedialog.ui b/svx/uiconfig/ui/safemodedialog.ui index 8ac77b2c7400..a1a352addc47 100644 --- a/svx/uiconfig/ui/safemodedialog.ui +++ b/svx/uiconfig/ui/safemodedialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.16.1 --> <interface> <requires lib="gtk+" version="3.12"/> <object class="GtkDialog" id="SafeModeDialog"> @@ -13,123 +13,153 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area1"> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="layout_style">end</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="label" translatable="yes">%PRODUCTNAME is now running in Safe Mode. You can make one or more of the following changes to return to a working state. + +The offered possible changes get more radical from top to bottom, so it is recommended to try them thoroughly one after the other.</property> + <property name="wrap">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> - <object class="GtkButton" id="btn_continue"> - <property name="label" translatable="yes">_Continue in Safe Mode</property> + <object class="GtkCheckButton" id="check_profilesafe_config"> + <property name="label" translatable="yes">Reset UserConfiguration to last known working state</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkButton" id="btn_quit"> - <property name="label" translatable="yes">_Quit</property> + <object class="GtkCheckButton" id="check_profilesafe_extensions"> + <property name="label" translatable="yes">Reset State of installed Extensions to last known working state</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> <property name="fill">True</property> <property name="position">1</property> </packing> </child> <child> - <object class="GtkButton" id="btn_restart"> - <property name="label" translatable="yes">_Make Changes and Restart</property> + <object class="GtkCheckButton" id="check_disable_all_extensions"> + <property name="label" translatable="yes">Disable all extensions</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="check_reset_customizations"> + <property name="label" translatable="yes">Reset customizations (Settings and User Interface modifications)</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">3</property> </packing> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">%PRODUCTNAME is now running in Safe Mode, which temporarily disables your custom settings and extensions. - -You can make some or all these changes permanent:</property> - <property name="wrap">True</property> - <property name="xalign">0</property> - <property name="yalign">0</property> + <child> + <object class="GtkCheckButton" id="check_reset_whole_userprofile"> + <property name="label" translatable="yes">Reset the whole User Profile</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">4</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> - <child> - <object class="GtkBox" id="box1"> - <property name="visible">True</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> - <property name="orientation">vertical</property> + <property name="layout_style">end</property> <child> - <object class="GtkCheckButton" id="check_extensions"> - <property name="label" translatable="yes">Disable all extensions</property> + <object class="GtkButton" id="btn_continue"> + <property name="label" translatable="yes">_Continue in Safe Mode</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> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkCheckButton" id="check_customizations"> - <property name="label" translatable="yes">Reset customizations (Settings and User Interface modifications)</property> + <object class="GtkButton" id="btn_quit"> + <property name="label" translatable="yes">_Quit</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> + <property name="receives_default">True</property> + <property name="use_underline">True</property> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> <property name="position">1</property> </packing> </child> <child> - <object class="GtkCheckButton" id="check_full"> - <property name="label" translatable="yes">Reset the whole User Profile</property> + <object class="GtkButton" id="btn_restart"> + <property name="label" translatable="yes">_Make Changes and Restart</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> + <property name="receives_default">True</property> + <property name="use_underline">True</property> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> <property name="position">3</property> </packing> @@ -137,8 +167,9 @@ You can make some or all these changes permanent:</property> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">4</property> </packing> </child> </object> |