summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2016-10-13 14:16:56 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2016-10-13 14:43:37 +0000
commit5f55b7d00a70db5dddaa0e74ccef52c021770f95 (patch)
tree040d9170f878d260e49df2ae0f319391bd2ba604 /desktop/source
parent83cc9a3fae1cf8fa8b6753d1db8ccf7226797613 (diff)
profilesafe: extended to three modes
Saving configuration is now extended to three basic modes, from just saving registrymodifiications to adding user-defined config stuff to saving all information in the user profile, additionally configuration information for Extensions is saved. Added configuration entries for this and tested saving/restoring. Change-Id: I79b09c37617803bf656826f76a7e3db79cda49ac Reviewed-on: https://gerrit.libreoffice.org/29770 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/app/app.cxx99
1 files changed, 25 insertions, 74 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index b9e5401c7246..cd3fbfa96326 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -818,42 +818,6 @@ OUString Desktop::CreateErrorMsgString(
return MakeStartupErrorMessage( aMsg );
}
-// helper method to test if SecureUserConfig is active, detect the num copies
-// and extract the User's config directory URL
-bool testSecureUserConfigActive(sal_uInt16& rnSecureUserConfigNumCopies, OUString& raUserConfigDir)
-{
- // read configuration from soffice.ini
- if(comphelper::BackupFileHelper::getSecureUserConfig(rnSecureUserConfigNumCopies))
- {
- // try to asccess user layer configuration file
- OUString conf("${CONFIGURATION_LAYERS}");
- rtl::Bootstrap::expandMacros(conf);
- const OUString aTokenUser("user:");
- sal_Int32 nStart(conf.indexOf(aTokenUser));
-
- if (-1 != nStart)
- {
- nStart += aTokenUser.getLength();
- sal_Int32 nEnd(conf.indexOf(' ', nStart));
-
- if (-1 == nEnd)
- {
- nEnd = conf.getLength();
- }
-
- raUserConfigDir = conf.copy(nStart, nEnd - nStart);
- raUserConfigDir.startsWith("!", &raUserConfigDir);
- }
-
- if (!raUserConfigDir.isEmpty())
- {
- return true;
- }
- }
-
- return false;
-}
-
void Desktop::HandleBootstrapErrors(
BootstrapError aBootstrapError, OUString const & aErrorMessage )
{
@@ -987,43 +951,37 @@ void Desktop::HandleBootstrapErrors(
}
else if ( aBootstrapError == BE_OFFICECONFIG_BROKEN )
{
- // test if SecureUserConfig is active
- sal_uInt16 nSecureUserConfigNumCopies(0);
- OUString aUserConfigDir;
bool bFireOriginalError(true);
+ comphelper::BackupFileHelper aBackupFileHelper;
- if (testSecureUserConfigActive(nSecureUserConfigNumCopies, aUserConfigDir))
+ // crerate BackupFileHelper and check if active and if pop is possible
+ if (aBackupFileHelper.isPopPossible())
{
- comphelper::BackupFileHelper aBackupFileHelper(aUserConfigDir, nSecureUserConfigNumCopies);
+ // for linux (and probably others?) we need to instantiate XDesktop2
+ // to be able to open a *.ui-file based dialog, so do this here locally.
+ // does no harm on win, so better always do this (in error case only anyways)
+ Reference< XComponentContext > xLocalContext = ::comphelper::getProcessComponentContext();
+ Reference< XDesktop2 > xDesktop = css::frame::Desktop::create(xLocalContext);
+
+ ScopedVclPtrInstance< MessageDialog > aQueryShouldRestore(
+ Application::GetDefDialogParent(),
+ "QueryTryToRestoreConfigurationDialog",
+ "desktop/ui/querytrytorestoreconfigurationdialog.ui");
- if (aBackupFileHelper.isPopPossible())
+ if (aQueryShouldRestore.get())
{
- // for linux (and probably others?) we need to instantiate XDesktop2
- // to be able to open a *.ui-file based dialog, so do this here locally.
- // does no harm on win, so better always do this (in error case only anyways)
- Reference< XComponentContext > xLocalContext = ::comphelper::getProcessComponentContext();
- Reference< XDesktop2 > xDesktop = css::frame::Desktop::create(xLocalContext);
-
- ScopedVclPtrInstance< MessageDialog > aQueryShouldRestore(
- Application::GetDefDialogParent(),
- "QueryTryToRestoreConfigurationDialog",
- "desktop/ui/querytrytorestoreconfigurationdialog.ui");
-
- if (aQueryShouldRestore.get())
+ if (!aErrorMessage.isEmpty())
{
- if (!aErrorMessage.isEmpty())
- {
- OUString aPrimaryText(aQueryShouldRestore->get_primary_text());
+ OUString aPrimaryText(aQueryShouldRestore->get_primary_text());
- aPrimaryText += "\n(\"" + aErrorMessage + "\")";
- aQueryShouldRestore->set_primary_text(aPrimaryText);
- }
+ aPrimaryText += "\n(\"" + aErrorMessage + "\")";
+ aQueryShouldRestore->set_primary_text(aPrimaryText);
+ }
- if (RET_YES == aQueryShouldRestore->Execute())
- {
- aBackupFileHelper.tryPop();
- bFireOriginalError = false;
- }
+ if (RET_YES == aQueryShouldRestore->Execute())
+ {
+ aBackupFileHelper.tryPop();
+ bFireOriginalError = false;
}
}
}
@@ -1863,16 +1821,9 @@ int Desktop::doShutdown()
// Test if SecureUserConfig is active. If yes and we are at this point, regular shutdown
// is in progress and the currently used configuration was working. Try to secure this
// working configuration for later eventually necessary restores
- sal_uInt16 nSecureUserConfigNumCopies(0);
- OUString aUserConfigDir;
+ comphelper::BackupFileHelper aBackupFileHelper;
- if (testSecureUserConfigActive(nSecureUserConfigNumCopies, aUserConfigDir))
- {
- // try to push registrymodifications.xcu
- comphelper::BackupFileHelper aBackupFileHelper(aUserConfigDir, nSecureUserConfigNumCopies);
-
- aBackupFileHelper.tryPush();
- }
+ aBackupFileHelper.tryPush();
}
// The acceptors in the AcceptorMap must be released (in DeregisterServices)