2016-10-07 18:19:25 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "SafeModeDialog.hxx"
|
|
|
|
|
|
|
|
#include <config_folders.h>
|
|
|
|
#include <rtl/bootstrap.hxx>
|
|
|
|
#include <osl/file.hxx>
|
2016-10-11 16:07:37 +02:00
|
|
|
#include <sfx2/safemode.hxx>
|
2016-10-17 11:45:27 +02:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <vcl/layout.hxx>
|
|
|
|
#include <comphelper/anytostring.hxx>
|
|
|
|
#include <comphelper/processfactory.hxx>
|
2016-11-02 10:26:39 +01:00
|
|
|
#include <unotools/ZipPackageHelper.hxx>
|
2016-10-17 11:45:27 +02:00
|
|
|
#include <cppuhelper/exc_hlp.hxx>
|
|
|
|
#include <unotools/configmgr.hxx>
|
2016-11-02 10:26:39 +01:00
|
|
|
#include <svx/dialmgr.hxx>
|
2017-06-11 20:56:30 +01:00
|
|
|
#include <svx/strings.hrc>
|
2016-10-07 18:19:25 +02:00
|
|
|
|
2016-10-12 13:26:10 +02:00
|
|
|
#include <com/sun/star/task/OfficeRestartManager.hpp>
|
|
|
|
#include <com/sun/star/task/XInteractionHandler.hpp>
|
2016-10-17 11:45:27 +02:00
|
|
|
#include <com/sun/star/system/XSystemShellExecute.hpp>
|
|
|
|
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
|
|
|
|
#include <com/sun/star/system/SystemShellExecute.hpp>
|
2016-10-12 13:01:15 +02:00
|
|
|
|
|
|
|
using namespace css;
|
|
|
|
|
2016-10-13 18:31:51 +02:00
|
|
|
SafeModeDialog::SafeModeDialog(vcl::Window* pParent)
|
|
|
|
: Dialog(pParent, "SafeModeDialog", "svx/ui/safemodedialog.ui"),
|
|
|
|
|
|
|
|
mpBtnContinue(),
|
|
|
|
mpBtnRestart(),
|
2017-01-13 23:17:52 +01:00
|
|
|
mpBtnApply(),
|
2016-10-13 18:31:51 +02:00
|
|
|
|
2016-11-01 09:46:26 +01:00
|
|
|
mpBoxRestore(),
|
|
|
|
mpBoxConfigure(),
|
2016-11-03 12:11:12 +01:00
|
|
|
mpBoxDeinstall(),
|
2016-11-01 09:46:26 +01:00
|
|
|
mpBoxReset(),
|
|
|
|
|
|
|
|
mpRadioRestore(),
|
|
|
|
mpRadioConfigure(),
|
2016-12-06 21:23:13 +01:00
|
|
|
mpRadioExtensions(),
|
2016-11-01 09:46:26 +01:00
|
|
|
mpRadioReset(),
|
|
|
|
|
2016-10-13 18:31:51 +02:00
|
|
|
mpCBCheckProfilesafeConfig(),
|
|
|
|
mpCBCheckProfilesafeExtensions(),
|
|
|
|
mpCBDisableAllExtensions(),
|
2016-10-20 13:30:40 +02:00
|
|
|
mpCBDeinstallUserExtensions(),
|
2016-12-06 17:23:27 +01:00
|
|
|
mpCBResetSharedExtensions(),
|
2016-12-06 18:31:07 +01:00
|
|
|
mpCBResetBundledExtensions(),
|
2016-10-20 18:15:05 +02:00
|
|
|
mpCBDisableHWAcceleration(),
|
2016-10-13 18:31:51 +02:00
|
|
|
mpCBResetCustomizations(),
|
|
|
|
mpCBResetWholeUserProfile(),
|
|
|
|
|
|
|
|
maBackupFileHelper()
|
2016-10-07 18:19:25 +02:00
|
|
|
{
|
|
|
|
get(mpBtnContinue, "btn_continue");
|
|
|
|
get(mpBtnRestart, "btn_restart");
|
2017-01-13 23:17:52 +01:00
|
|
|
get(mpBtnApply, "btn_apply");
|
2016-10-13 18:31:51 +02:00
|
|
|
|
2016-11-01 09:46:26 +01:00
|
|
|
get(mpBoxRestore, "group_restore");
|
|
|
|
get(mpBoxConfigure, "group_configure");
|
2016-11-03 12:11:12 +01:00
|
|
|
get(mpBoxDeinstall, "group_deinstall");
|
2016-11-01 09:46:26 +01:00
|
|
|
get(mpBoxReset, "group_reset");
|
|
|
|
|
|
|
|
get(mpRadioRestore, "radio_restore");
|
|
|
|
get(mpRadioConfigure, "radio_configure");
|
2016-12-06 21:23:13 +01:00
|
|
|
get(mpRadioExtensions, "radio_extensions");
|
2016-11-01 09:46:26 +01:00
|
|
|
get(mpRadioReset, "radio_reset");
|
|
|
|
|
2016-10-13 18:31:51 +02:00
|
|
|
get(mpCBCheckProfilesafeConfig, "check_profilesafe_config");
|
|
|
|
get(mpCBCheckProfilesafeExtensions, "check_profilesafe_extensions");
|
|
|
|
get(mpCBDisableAllExtensions, "check_disable_all_extensions");
|
2016-10-20 13:30:40 +02:00
|
|
|
get(mpCBDeinstallUserExtensions, "check_deinstall_user_extensions");
|
2016-12-06 17:23:27 +01:00
|
|
|
get(mpCBResetSharedExtensions, "check_reset_shared_extensions");
|
2016-12-06 18:31:07 +01:00
|
|
|
get(mpCBResetBundledExtensions, "check_reset_bundled_extensions");
|
2016-10-20 18:15:05 +02:00
|
|
|
get(mpCBDisableHWAcceleration, "check_disable_hw_acceleration");
|
2016-10-13 18:31:51 +02:00
|
|
|
get(mpCBResetCustomizations, "check_reset_customizations");
|
|
|
|
get(mpCBResetWholeUserProfile, "check_reset_whole_userprofile");
|
2016-10-07 18:19:25 +02:00
|
|
|
|
2016-10-17 11:45:27 +02:00
|
|
|
get(mpBugLink, "linkbutton_bugs");
|
2016-10-31 16:20:47 +01:00
|
|
|
get(mpUserProfileLink, "linkbutton_profile");
|
2016-11-02 10:26:39 +01:00
|
|
|
get(mpBtnCreateZip, "btn_create_zip");
|
2016-10-17 11:45:27 +02:00
|
|
|
|
2016-11-01 09:46:26 +01:00
|
|
|
mpRadioRestore->SetClickHdl(LINK(this, SafeModeDialog, RadioBtnHdl));
|
|
|
|
mpRadioConfigure->SetClickHdl(LINK(this, SafeModeDialog, RadioBtnHdl));
|
2016-12-06 21:23:13 +01:00
|
|
|
mpRadioExtensions->SetClickHdl(LINK(this, SafeModeDialog, RadioBtnHdl));
|
2016-11-01 09:46:26 +01:00
|
|
|
mpRadioReset->SetClickHdl(LINK(this, SafeModeDialog, RadioBtnHdl));
|
|
|
|
|
2016-11-02 10:26:39 +01:00
|
|
|
mpBtnContinue->SetClickHdl(LINK(this, SafeModeDialog, DialogBtnHdl));
|
|
|
|
mpBtnRestart->SetClickHdl(LINK(this, SafeModeDialog, DialogBtnHdl));
|
2017-01-13 23:17:52 +01:00
|
|
|
mpBtnApply->SetClickHdl(LINK(this, SafeModeDialog, DialogBtnHdl));
|
2016-10-12 13:35:52 +02:00
|
|
|
|
2016-10-13 18:31:51 +02:00
|
|
|
mpCBCheckProfilesafeConfig->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
|
|
|
|
mpCBCheckProfilesafeExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
|
|
|
|
mpCBDisableAllExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
|
2016-10-20 13:30:40 +02:00
|
|
|
mpCBDeinstallUserExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
|
2016-12-06 17:23:27 +01:00
|
|
|
mpCBResetSharedExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
|
2016-12-06 18:31:07 +01:00
|
|
|
mpCBResetBundledExtensions->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
|
2016-10-20 18:15:05 +02:00
|
|
|
mpCBDisableHWAcceleration->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
|
2016-10-13 18:31:51 +02:00
|
|
|
mpCBResetCustomizations->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
|
|
|
|
mpCBResetWholeUserProfile->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
|
2016-10-12 13:35:52 +02:00
|
|
|
|
2016-11-02 10:26:39 +01:00
|
|
|
mpBtnCreateZip->SetClickHdl(LINK(this, SafeModeDialog, CreateZipBtnHdl));
|
|
|
|
|
2016-10-12 13:35:52 +02:00
|
|
|
// Disable restart btn until some checkbox is active
|
2017-01-13 23:17:52 +01:00
|
|
|
mpBtnApply->Disable();
|
2016-10-13 18:31:51 +02:00
|
|
|
|
2017-01-11 14:47:47 +01:00
|
|
|
// Check the first radio button and call its handler,
|
|
|
|
// it'll disable the relevant parts
|
2016-11-01 09:46:26 +01:00
|
|
|
mpRadioRestore->Check();
|
2017-01-11 14:47:47 +01:00
|
|
|
RadioBtnHdl( mpRadioRestore );
|
2016-11-01 09:46:26 +01:00
|
|
|
|
2016-10-17 11:45:27 +02:00
|
|
|
// 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");
|
|
|
|
mpBugLink->SetURL(sURL);
|
2016-10-31 16:20:47 +01:00
|
|
|
|
|
|
|
mpUserProfileLink->SetURL(comphelper::BackupFileHelper::getUserProfileURL());
|
2016-10-07 18:19:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
SafeModeDialog::~SafeModeDialog()
|
|
|
|
{
|
|
|
|
disposeOnce();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SafeModeDialog::dispose()
|
|
|
|
{
|
2016-11-01 09:46:26 +01:00
|
|
|
mpRadioRestore.clear();
|
|
|
|
mpRadioConfigure.clear();
|
2016-12-06 21:23:13 +01:00
|
|
|
mpRadioExtensions.clear();
|
2016-11-01 09:46:26 +01:00
|
|
|
mpRadioReset.clear();
|
|
|
|
|
|
|
|
mpBoxRestore.clear();
|
|
|
|
mpBoxConfigure.clear();
|
2016-11-03 12:11:12 +01:00
|
|
|
mpBoxDeinstall.clear();
|
2016-11-01 09:46:26 +01:00
|
|
|
mpBoxReset.clear();
|
|
|
|
|
2016-10-07 18:19:25 +02:00
|
|
|
mpBtnContinue.clear();
|
|
|
|
mpBtnRestart.clear();
|
2017-01-13 23:17:52 +01:00
|
|
|
mpBtnApply.clear();
|
2016-10-13 18:31:51 +02:00
|
|
|
|
|
|
|
mpCBCheckProfilesafeConfig.clear();
|
|
|
|
mpCBCheckProfilesafeExtensions.clear();
|
|
|
|
mpCBDisableAllExtensions.clear();
|
2016-10-20 13:30:40 +02:00
|
|
|
mpCBDeinstallUserExtensions.clear();
|
2016-12-06 17:23:27 +01:00
|
|
|
mpCBResetSharedExtensions.clear();
|
2016-12-06 18:31:07 +01:00
|
|
|
mpCBResetBundledExtensions.clear();
|
2016-10-20 18:15:05 +02:00
|
|
|
mpCBDisableHWAcceleration.clear();
|
2016-10-13 18:31:51 +02:00
|
|
|
mpCBResetCustomizations.clear();
|
|
|
|
mpCBResetWholeUserProfile.clear();
|
2016-10-07 18:19:25 +02:00
|
|
|
|
2016-10-17 11:45:27 +02:00
|
|
|
mpBugLink.clear();
|
2016-10-31 16:20:47 +01:00
|
|
|
mpUserProfileLink.clear();
|
2016-11-02 10:26:39 +01:00
|
|
|
mpBtnCreateZip.clear();
|
2016-10-17 11:45:27 +02:00
|
|
|
|
2016-10-07 18:19:25 +02:00
|
|
|
Dialog::dispose();
|
|
|
|
}
|
|
|
|
|
2016-11-03 11:33:47 +01:00
|
|
|
void SafeModeDialog::enableDisableWidgets()
|
|
|
|
{
|
2016-12-06 16:57:19 +01:00
|
|
|
mpCBCheckProfilesafeConfig->Enable(maBackupFileHelper.isPopPossible());
|
|
|
|
mpCBCheckProfilesafeExtensions->Enable(maBackupFileHelper.isPopPossibleExtensionInfo());
|
|
|
|
mpCBDisableAllExtensions->Enable(comphelper::BackupFileHelper::isTryDisableAllExtensionsPossible());
|
|
|
|
mpCBDeinstallUserExtensions->Enable(comphelper::BackupFileHelper::isTryDeinstallUserExtensionsPossible());
|
2016-12-06 17:23:27 +01:00
|
|
|
mpCBResetSharedExtensions->Enable(comphelper::BackupFileHelper::isTryResetSharedExtensionsPossible());
|
2016-12-06 18:31:07 +01:00
|
|
|
mpCBResetBundledExtensions->Enable(comphelper::BackupFileHelper::isTryResetBundledExtensionsPossible());
|
2016-12-06 16:57:19 +01:00
|
|
|
mpCBResetCustomizations->Enable(comphelper::BackupFileHelper::isTryResetCustomizationsPossible());
|
2016-11-03 11:33:47 +01:00
|
|
|
|
2016-11-07 12:18:56 +01:00
|
|
|
// no disable of mpCBResetWholeUserProfile, always possible (as last choice)
|
2016-11-03 11:33:47 +01:00
|
|
|
}
|
|
|
|
|
2016-10-12 11:18:08 +02:00
|
|
|
bool SafeModeDialog::Close()
|
|
|
|
{
|
|
|
|
// Remove the safe mode flag before exiting this dialog
|
|
|
|
sfx2::SafeMode::removeFlag();
|
|
|
|
|
|
|
|
return Dialog::Close();
|
|
|
|
}
|
|
|
|
|
2016-10-12 13:26:10 +02:00
|
|
|
void SafeModeDialog::applyChanges()
|
|
|
|
{
|
2016-11-03 14:24:00 +01:00
|
|
|
// Restore
|
2016-11-01 09:46:26 +01:00
|
|
|
if (mpRadioRestore->IsChecked())
|
2016-10-13 18:31:51 +02:00
|
|
|
{
|
2016-11-01 09:46:26 +01:00
|
|
|
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();
|
|
|
|
}
|
2016-10-13 18:31:51 +02:00
|
|
|
}
|
|
|
|
|
2016-11-01 09:46:26 +01:00
|
|
|
// Configure
|
|
|
|
if (mpRadioConfigure->IsChecked())
|
2016-10-13 18:31:51 +02:00
|
|
|
{
|
2016-11-01 09:46:26 +01:00
|
|
|
if (mpCBDisableAllExtensions->IsChecked())
|
|
|
|
{
|
|
|
|
// Disable all extensions
|
|
|
|
comphelper::BackupFileHelper::tryDisableAllExtensions();
|
|
|
|
}
|
|
|
|
|
2016-11-03 12:11:12 +01:00
|
|
|
if (mpCBDisableHWAcceleration->IsChecked())
|
|
|
|
{
|
|
|
|
comphelper::BackupFileHelper::tryDisableHWAcceleration();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-03 14:24:00 +01:00
|
|
|
// Deinstall
|
2016-12-06 21:23:13 +01:00
|
|
|
if (mpRadioExtensions->IsChecked())
|
2016-11-03 12:11:12 +01:00
|
|
|
{
|
2016-11-01 09:46:26 +01:00
|
|
|
if (mpCBDeinstallUserExtensions->IsChecked())
|
|
|
|
{
|
|
|
|
// Deinstall all User Extensions (installed for User only)
|
|
|
|
comphelper::BackupFileHelper::tryDeinstallUserExtensions();
|
|
|
|
}
|
|
|
|
|
2016-12-06 17:23:27 +01:00
|
|
|
if (mpCBResetSharedExtensions->IsChecked())
|
2016-11-01 09:46:26 +01:00
|
|
|
{
|
2016-12-06 17:23:27 +01:00
|
|
|
// Reset shared Extensions
|
|
|
|
comphelper::BackupFileHelper::tryResetSharedExtensions();
|
2016-11-01 09:46:26 +01:00
|
|
|
}
|
2016-12-06 18:31:07 +01:00
|
|
|
if (mpCBResetBundledExtensions->IsChecked())
|
|
|
|
{
|
|
|
|
// Reset bundled Extensions
|
|
|
|
comphelper::BackupFileHelper::tryResetBundledExtensions();
|
|
|
|
}
|
2016-10-13 18:31:51 +02:00
|
|
|
}
|
|
|
|
|
2016-11-01 09:46:26 +01:00
|
|
|
// Reset
|
|
|
|
if (mpRadioReset->IsChecked())
|
2016-10-20 13:30:40 +02:00
|
|
|
{
|
2016-11-01 09:46:26 +01:00
|
|
|
if (mpCBResetCustomizations->IsChecked())
|
|
|
|
{
|
|
|
|
// Reset customizations (Settings and UserInterface modifications)
|
|
|
|
comphelper::BackupFileHelper::tryResetCustomizations();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mpCBResetWholeUserProfile->IsChecked())
|
|
|
|
{
|
|
|
|
// Reset the whole UserProfile
|
|
|
|
comphelper::BackupFileHelper::tryResetUserProfile();
|
|
|
|
}
|
2016-10-20 13:30:40 +02:00
|
|
|
}
|
|
|
|
|
2016-11-03 14:24:00 +01:00
|
|
|
// finally, restart
|
2016-11-01 09:46:26 +01:00
|
|
|
css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext())->requestRestart(
|
|
|
|
css::uno::Reference< css::task::XInteractionHandler >());
|
|
|
|
}
|
2016-10-20 13:30:40 +02:00
|
|
|
|
2016-11-01 09:46:26 +01:00
|
|
|
IMPL_LINK(SafeModeDialog, RadioBtnHdl, Button*, pBtn, void)
|
|
|
|
{
|
2016-11-03 12:11:12 +01:00
|
|
|
if (pBtn == mpRadioRestore.get())
|
|
|
|
{
|
|
|
|
// Enable the currently selected box
|
|
|
|
mpBoxRestore->Enable();
|
|
|
|
// Make sure only possible choices are active
|
|
|
|
enableDisableWidgets();
|
|
|
|
// Disable the unselected boxes
|
|
|
|
mpBoxReset->Disable();
|
|
|
|
mpBoxConfigure->Disable();
|
|
|
|
mpBoxDeinstall->Disable();
|
|
|
|
}
|
|
|
|
else if (pBtn == mpRadioConfigure.get())
|
2016-10-20 18:15:05 +02:00
|
|
|
{
|
2016-11-03 11:33:47 +01:00
|
|
|
// Enable the currently selected box
|
2016-11-01 09:46:26 +01:00
|
|
|
mpBoxConfigure->Enable();
|
2016-11-03 11:33:47 +01:00
|
|
|
// Make sure only possible choices are active
|
|
|
|
enableDisableWidgets();
|
|
|
|
// Disable the unselected boxes
|
2016-11-01 09:46:26 +01:00
|
|
|
mpBoxRestore->Disable();
|
|
|
|
mpBoxReset->Disable();
|
2016-11-03 12:11:12 +01:00
|
|
|
mpBoxDeinstall->Disable();
|
2016-11-03 11:33:47 +01:00
|
|
|
|
2016-10-20 18:15:05 +02:00
|
|
|
}
|
2016-12-06 21:23:13 +01:00
|
|
|
else if (pBtn == mpRadioExtensions.get())
|
2016-10-13 18:31:51 +02:00
|
|
|
{
|
2016-11-03 11:33:47 +01:00
|
|
|
// Enable the currently selected box
|
2016-11-03 12:11:12 +01:00
|
|
|
mpBoxDeinstall->Enable();
|
2016-11-03 11:33:47 +01:00
|
|
|
// Make sure only possible choices are active
|
|
|
|
enableDisableWidgets();
|
|
|
|
// Disable the unselected boxes
|
2016-11-01 09:46:26 +01:00
|
|
|
mpBoxRestore->Disable();
|
2016-11-03 12:11:12 +01:00
|
|
|
mpBoxConfigure->Disable();
|
|
|
|
mpBoxReset->Disable();
|
2016-10-13 18:31:51 +02:00
|
|
|
}
|
2016-11-03 12:11:12 +01:00
|
|
|
else if (pBtn == mpRadioReset.get())
|
2016-10-13 18:31:51 +02:00
|
|
|
{
|
2016-11-03 11:33:47 +01:00
|
|
|
// Enable the currently selected box
|
2016-11-03 12:11:12 +01:00
|
|
|
mpBoxReset->Enable();
|
2016-11-03 11:33:47 +01:00
|
|
|
// Make sure only possible choices are active
|
|
|
|
enableDisableWidgets();
|
|
|
|
// Disable the unselected boxes
|
2016-11-01 09:46:26 +01:00
|
|
|
mpBoxConfigure->Disable();
|
2016-11-03 12:11:12 +01:00
|
|
|
mpBoxRestore->Disable();
|
|
|
|
mpBoxDeinstall->Disable();
|
2016-10-13 18:31:51 +02:00
|
|
|
}
|
2016-10-12 13:26:10 +02:00
|
|
|
}
|
|
|
|
|
2016-11-02 10:26:39 +01:00
|
|
|
IMPL_LINK(SafeModeDialog, DialogBtnHdl, Button*, pBtn, void)
|
2016-10-07 18:19:25 +02:00
|
|
|
{
|
|
|
|
if (pBtn == mpBtnContinue.get())
|
|
|
|
{
|
|
|
|
Close();
|
|
|
|
}
|
2017-01-13 23:17:52 +01:00
|
|
|
else if (pBtn == mpBtnRestart.get())
|
2016-10-07 18:19:25 +02:00
|
|
|
{
|
2017-01-13 23:17:52 +01:00
|
|
|
sfx2::SafeMode::putRestartFlag();
|
2016-10-18 13:11:02 +02:00
|
|
|
Close();
|
2017-01-13 23:17:52 +01:00
|
|
|
uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
|
|
|
|
css::task::OfficeRestartManager::get(xContext)->requestRestart(
|
|
|
|
css::uno::Reference< css::task::XInteractionHandler >());
|
2016-10-07 18:19:25 +02:00
|
|
|
}
|
2017-01-13 23:17:52 +01:00
|
|
|
else if (pBtn == mpBtnApply.get())
|
2016-10-07 18:19:25 +02:00
|
|
|
{
|
2016-12-12 17:29:28 +01:00
|
|
|
sfx2::SafeMode::putRestartFlag();
|
2016-11-01 16:51:23 +01:00
|
|
|
Close();
|
2016-10-12 13:26:10 +02:00
|
|
|
applyChanges();
|
2016-10-07 18:19:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-02 10:26:39 +01:00
|
|
|
namespace {
|
|
|
|
class ProfileExportedDialog : public ModalDialog
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
DECL_LINK(OpenHdl, Button*, void);
|
|
|
|
public:
|
|
|
|
explicit ProfileExportedDialog();
|
|
|
|
};
|
|
|
|
|
|
|
|
ProfileExportedDialog::ProfileExportedDialog()
|
2016-11-16 13:51:35 +01:00
|
|
|
: ModalDialog(nullptr, "ProfileExportedDialog", "svx/ui/profileexporteddialog.ui")
|
2016-11-02 10:26:39 +01:00
|
|
|
{
|
|
|
|
get<Button>("openfolder")->SetClickHdl(LINK(this, ProfileExportedDialog, OpenHdl));
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK_NOARG(ProfileExportedDialog, OpenHdl, Button*, void)
|
|
|
|
{
|
|
|
|
const OUString uri(comphelper::BackupFileHelper::getUserProfileURL());
|
|
|
|
css::uno::Reference< css::system::XSystemShellExecute > exec(
|
|
|
|
css::system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
|
|
|
|
try {
|
|
|
|
exec->execute(uri, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY);
|
|
|
|
} catch (css::uno::Exception) {
|
|
|
|
}
|
|
|
|
EndDialog(RET_OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK(SafeModeDialog, CreateZipBtnHdl, Button*, /*pBtn*/, void)
|
|
|
|
{
|
|
|
|
const OUString zipFileName("libreoffice-profile.zip");
|
|
|
|
const OUString zipFileURL(comphelper::BackupFileHelper::getUserProfileURL() + "/" + zipFileName);
|
|
|
|
osl::File::remove(zipFileURL); // Remove previous exports
|
|
|
|
try
|
|
|
|
{
|
|
|
|
utl::ZipPackageHelper aZipHelper(comphelper::getProcessComponentContext(), zipFileURL);
|
|
|
|
aZipHelper.addFolderWithContent(aZipHelper.getRootFolder(), comphelper::BackupFileHelper::getUserProfileWorkURL());
|
|
|
|
aZipHelper.savePackage();
|
|
|
|
}
|
|
|
|
catch (uno::Exception)
|
|
|
|
{
|
2017-05-18 21:14:00 +01:00
|
|
|
ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SvxResId(RID_SVXSTR_SAFEMODE_ZIP_FAILURE));
|
2016-11-02 10:26:39 +01:00
|
|
|
aErrorBox->Execute();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScopedVclPtrInstance< ProfileExportedDialog > aDialog;
|
|
|
|
aDialog->Execute();
|
|
|
|
}
|
|
|
|
|
2016-10-12 13:35:52 +02:00
|
|
|
IMPL_LINK(SafeModeDialog, CheckBoxHdl, CheckBox&, /*pCheckBox*/, void)
|
|
|
|
{
|
2016-10-13 18:31:51 +02:00
|
|
|
const bool bEnable(
|
|
|
|
mpCBCheckProfilesafeConfig->IsChecked() ||
|
|
|
|
mpCBCheckProfilesafeExtensions->IsChecked() ||
|
|
|
|
mpCBDisableAllExtensions->IsChecked() ||
|
2016-10-20 13:30:40 +02:00
|
|
|
mpCBDeinstallUserExtensions->IsChecked() ||
|
2016-12-06 17:23:27 +01:00
|
|
|
mpCBResetSharedExtensions->IsChecked() ||
|
2016-12-06 18:31:07 +01:00
|
|
|
mpCBResetBundledExtensions->IsChecked() ||
|
2016-10-20 18:15:05 +02:00
|
|
|
mpCBDisableHWAcceleration->IsChecked() ||
|
2016-10-13 18:31:51 +02:00
|
|
|
mpCBResetCustomizations->IsChecked() ||
|
|
|
|
mpCBResetWholeUserProfile->IsChecked());
|
|
|
|
|
2017-01-13 23:17:52 +01:00
|
|
|
mpBtnApply->Enable(bEnable);
|
2016-10-12 13:35:52 +02:00
|
|
|
}
|
|
|
|
|
2016-10-07 18:19:25 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|