Kaydet (Commit) 0f5d4da2 authored tarafından Armin Le Grand's avatar Armin Le Grand

profilesafe: Deeper integration with SafeMode

Added deeper integration by saving at SaveMode content of user dir
completely to a user/SafeMode dir, including the whole stack
of pack files. Repair happens in that safe directory, so that
the user dir is resetted to default when re-started in SafeMode.
All changes (including complete deletion) are played back to
the user config at first restart with disabled SafeMode

Change-Id: I5114c7d5d04582be62090707bc9b97afa55fc1f1
Reviewed-on: https://gerrit.libreoffice.org/30003Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarArmin Le Grand <Armin.Le.Grand@cib.de>
üst 17b94a61
......@@ -556,6 +556,15 @@ void Desktop::Init()
SetBootstrapError( BE_UNO_SERVICEMANAGER, e.Message );
}
// When we are in SafeMode we need to do changes before the configuration
// gets read (langselect::prepareLocale() by UNO API -> Components::Components)
const CommandLineArgs& rArgs = GetCommandLineArgs();
const bool bSafeMode(rArgs.IsSafeMode() || sfx2::SafeMode::hasFlag());
// this may prepare SafeMode or restore from it by moving data in
// the UserConfiguration directory
comphelper::BackupFileHelper::reactOnSafeMode(bSafeMode);
if ( m_aBootstrapError == BE_OK )
{
try
......
......@@ -60,11 +60,6 @@ namespace comphelper
{
private:
// internal data
OUString maInitialBaseURL;
OUString maUserConfigBaseURL;
OUString maRegModName;
OUString maExt;
std::set< OUString > maDirs;
std::set< std::pair< OUString, OUString > > maFiles;
......@@ -84,9 +79,25 @@ namespace comphelper
// after _exit()
static bool mbExitWasCalled;
// internal detector if SafeModeName dir exists
static bool mbSafeModeDirExists;
// internal upper limit (max) of allowed backups
static sal_uInt16 mnMaxAllowedBackups;
// path to User's configuration directory and derived strings
static OUString maInitialBaseURL;
static OUString maUserConfigBaseURL;
static OUString maUserConfigWorkURL;
static OUString maRegModName;
static OUString maExt;
// get path to User's configuration directory (created on-demand)
static const OUString& getInitialBaseURL();
// the name of the SafeMode directory for temporary processing
static const OUString& getSafeModeName();
public:
/** Constructor to handle Backups of the given file, will internally
* detect configuration values and URL to initial registrymodifications
......@@ -98,6 +109,11 @@ namespace comphelper
static void setExitWasCalled();
static bool getExitWasCalled();
// This call initializes the state of the UserDirectory as needed, it may
// initialize to SafeMode configuration or return from it by moving files
// in that directory
static void reactOnSafeMode(bool bSafeMode);
/** tries to create a new backup, if there is none yet, or if the
* last differs from the base file. It will then put a new verion
* on the 'stack' of copies and evtl. delete the oldest backup.
......@@ -142,16 +158,16 @@ namespace comphelper
/** resets User-Customizations like Settings and UserInterface modifications
*/
bool isTryResetCustomizationsPossible();
void tryResetCustomizations();
static bool isTryResetCustomizationsPossible();
static void tryResetCustomizations();
/** resets the whole UserProfile
*/
void tryResetUserProfile();
static void tryResetUserProfile();
private:
// internal helper methods
const rtl::OUString getPackURL() const;
static const rtl::OUString getPackURL();
// file push helpers
bool tryPush_Files(const std::set< OUString >& rDirs, const std::set< std::pair< OUString, OUString > >& rFiles, const OUString& rSourceURL, const OUString& rTargetURL);
......
......@@ -82,12 +82,12 @@ SafeModeDialog::SafeModeDialog(vcl::Window* pParent)
mpCBCheckProfilesafeExtensions->Disable();
}
if (comphelper::BackupFileHelper::isTryDisableAllExtensionsPossible())
if (!comphelper::BackupFileHelper::isTryDisableAllExtensionsPossible())
{
mpCBDisableAllExtensions->Disable();
}
if (maBackupFileHelper.isTryResetCustomizationsPossible())
if (!comphelper::BackupFileHelper::isTryResetCustomizationsPossible())
{
mpCBResetCustomizations->Disable();
}
......@@ -153,13 +153,13 @@ void SafeModeDialog::applyChanges()
if (mpCBResetCustomizations->IsChecked())
{
// Reset customizations (Settings and UserInterface modifications)
maBackupFileHelper.tryResetCustomizations();
comphelper::BackupFileHelper::tryResetCustomizations();
}
if (mpCBResetWholeUserProfile->IsChecked())
{
// Reset the whole UserProfile
maBackupFileHelper.tryResetUserProfile();
comphelper::BackupFileHelper::tryResetUserProfile();
}
// Then restart
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment