12#include <osl/file.hxx>
20#include <svx/strings.hrc>
22#include <officecfg/Office/Common.hxx>
24#include <com/sun/star/task/OfficeRestartManager.hpp>
25#include <com/sun/star/task/XInteractionHandler.hpp>
30 : GenericDialogController(pParent,
"svx/ui/safemodedialog.ui",
"SafeModeDialog")
31 , mxBtnContinue(m_xBuilder->weld_button(
"btn_continue"))
32 , mxBtnRestart(m_xBuilder->weld_button(
"btn_restart"))
33 , mxBtnApply(m_xBuilder->weld_button(
"btn_apply"))
34 , mxBoxRestore(m_xBuilder->weld_container(
"group_restore"))
35 , mxBoxConfigure(m_xBuilder->weld_container(
"group_configure"))
36 , mxBoxDeinstall(m_xBuilder->weld_container(
"group_deinstall"))
37 , mxBoxReset(m_xBuilder->weld_container(
"group_reset"))
38 , mxRadioRestore(m_xBuilder->weld_radio_button(
"radio_restore"))
39 , mxRadioConfigure(m_xBuilder->weld_radio_button(
"radio_configure"))
40 , mxRadioExtensions(m_xBuilder->weld_radio_button(
"radio_extensions"))
41 , mxRadioReset(m_xBuilder->weld_radio_button(
"radio_reset"))
42 , mxCBCheckProfilesafeConfig(m_xBuilder->weld_check_button(
"check_profilesafe_config"))
43 , mxCBCheckProfilesafeExtensions(m_xBuilder->weld_check_button(
"check_profilesafe_extensions"))
44 , mxCBDisableAllExtensions(m_xBuilder->weld_check_button(
"check_disable_all_extensions"))
45 , mxCBDeinstallUserExtensions(m_xBuilder->weld_check_button(
"check_deinstall_user_extensions"))
46 , mxCBResetSharedExtensions(m_xBuilder->weld_check_button(
"check_reset_shared_extensions"))
47 , mxCBResetBundledExtensions(m_xBuilder->weld_check_button(
"check_reset_bundled_extensions"))
48 , mxCBDisableHWAcceleration(m_xBuilder->weld_check_button(
"check_disable_hw_acceleration"))
49 , mxCBResetCustomizations(m_xBuilder->weld_check_button(
"check_reset_customizations"))
50 , mxCBResetWholeUserProfile(m_xBuilder->weld_check_button(
"check_reset_whole_userprofile"))
51 , mxBugLink(m_xBuilder->weld_link_button(
"linkbutton_bugs"))
52 , mxUserProfileLink(m_xBuilder->weld_link_button(
"linkbutton_profile"))
53 , mxBtnCreateZip(m_xBuilder->weld_button(
"btn_create_zip"))
86 OUString sURL(officecfg::Office::Common::Menus::SendFeedbackURL::get()
193 css::uno::Reference< css::task::XInteractionHandler >());
198 if (!rButton.get_active())
200 if (mxRadioRestore->get_active())
203 mxBoxRestore->set_sensitive(
true);
205 enableDisableWidgets();
207 mxBoxReset->set_sensitive(
false);
208 mxBoxConfigure->set_sensitive(
false);
209 mxBoxDeinstall->set_sensitive(
false);
211 else if (mxRadioConfigure->get_active())
214 mxBoxConfigure->set_sensitive(
true);
216 enableDisableWidgets();
218 mxBoxRestore->set_sensitive(
false);
219 mxBoxReset->set_sensitive(
false);
220 mxBoxDeinstall->set_sensitive(
false);
223 else if (mxRadioExtensions->get_active())
226 mxBoxDeinstall->set_sensitive(
true);
228 enableDisableWidgets();
230 mxBoxRestore->set_sensitive(
false);
231 mxBoxConfigure->set_sensitive(
false);
232 mxBoxReset->set_sensitive(
false);
234 else if (mxRadioReset->get_active())
237 mxBoxReset->set_sensitive(
true);
239 enableDisableWidgets();
241 mxBoxConfigure->set_sensitive(
false);
242 mxBoxRestore->set_sensitive(
false);
243 mxBoxDeinstall->set_sensitive(
false);
249 if (&rBtn == mxBtnContinue.get())
253 else if (&rBtn == mxBtnRestart.get())
258 css::task::OfficeRestartManager::get(xContext)->requestRestart(
259 css::uno::Reference< css::task::XInteractionHandler >());
261 else if (&rBtn == mxBtnApply.get())
272 osl::File::remove(zipFileURL);
279 catch (
const uno::Exception &)
282 VclMessageType::Warning, VclButtonsType::Ok,
283 SvxResId(RID_SVXSTR_SAFEMODE_ZIP_FAILURE)));
295 mxCBCheckProfilesafeConfig->get_active() ||
296 mxCBCheckProfilesafeExtensions->get_active() ||
297 mxCBDisableAllExtensions->get_active() ||
298 mxCBDeinstallUserExtensions->get_active() ||
299 mxCBResetSharedExtensions->get_active() ||
300 mxCBResetBundledExtensions->get_active() ||
301 mxCBDisableHWAcceleration->get_active() ||
302 mxCBResetCustomizations->get_active() ||
303 mxCBResetWholeUserProfile->get_active());
305 mxBtnApply->set_sensitive(bEnable);
IMPL_LINK(SafeModeDialog, RadioBtnHdl, weld::Toggleable &, rButton, void)
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
std::unique_ptr< weld::RadioButton > mxRadioConfigure
std::unique_ptr< weld::Button > mxBtnContinue
std::unique_ptr< weld::Button > mxBtnApply
SafeModeDialog(weld::Window *pParent)
std::unique_ptr< weld::CheckButton > mxCBResetWholeUserProfile
std::unique_ptr< weld::CheckButton > mxCBDeinstallUserExtensions
std::unique_ptr< weld::CheckButton > mxCBResetCustomizations
std::unique_ptr< weld::CheckButton > mxCBCheckProfilesafeConfig
std::unique_ptr< weld::LinkButton > mxUserProfileLink
std::unique_ptr< weld::CheckButton > mxCBResetBundledExtensions
std::unique_ptr< weld::RadioButton > mxRadioRestore
virtual ~SafeModeDialog() override
virtual short run() override
std::unique_ptr< weld::LinkButton > mxBugLink
std::unique_ptr< weld::RadioButton > mxRadioExtensions
comphelper::BackupFileHelper maBackupFileHelper
std::unique_ptr< weld::CheckButton > mxCBCheckProfilesafeExtensions
std::unique_ptr< weld::Button > mxBtnCreateZip
std::unique_ptr< weld::Button > mxBtnRestart
std::unique_ptr< weld::RadioButton > mxRadioReset
void enableDisableWidgets()
std::unique_ptr< weld::CheckButton > mxCBDisableHWAcceleration
std::unique_ptr< weld::CheckButton > mxCBDisableAllExtensions
std::unique_ptr< weld::CheckButton > mxCBResetSharedExtensions
static void tryResetSharedExtensions()
static void tryResetBundledExtensions()
static bool isTryResetCustomizationsPossible()
static const OUString & getUserProfileWorkURL()
static bool isTryDisableAllExtensionsPossible()
static bool isTryResetBundledExtensionsPossible()
static void tryDisableHWAcceleration()
static void tryDisableAllExtensions()
bool isPopPossibleExtensionInfo() const
static void tryDeinstallUserExtensions()
static void tryResetUserProfile()
void tryPopExtensionInfo()
static bool isTryResetSharedExtensionsPossible()
static const OUString & getUserProfileURL()
static bool isTryDeinstallUserExtensionsPossible()
static void tryResetCustomizations()
static bool putRestartFlag()
static OUString getUILocale()
static OUString getAboutBoxProductVersion()
void addFolderWithContent(css::uno::Reference< css::uno::XInterface > const &xRootFolder, const OUString &rDirURL)
css::uno::Reference< css::uno::XInterface > & getRootFolder()
std::shared_ptr< weld::Dialog > m_xDialog
OUString SvxResId(TranslateId aId)
#define LINK(Instance, Class, Member)
Reference< XComponentContext > getProcessComponentContext()