summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2022-09-08 16:04:10 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-09-16 08:38:35 +0200
commit3f3d39b3ddcda9d6840552b01e808a7e649e61ef (patch)
treeaa2663cc5ea98364d210f170478b89d8511b6fcd /desktop/source
parentfddacb09116f0e6692e70ffac101322d24ed1297 (diff)
Migrating product name related color schemes between different versions
Making work to migrate product name related color schemes with different kind of product names. For example from a product named by LibreOffice to a product named by LibreOfficeDev. (cherry picked from commit 583ea856f2aa227bb04581c5bcdc3a402f5a184f) Change-Id: Iabef982216f126b781df122ed258816af2ae337c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139690 Tested-by: Jenkins Tested-by: Gabor Kelemen <kelemeng@ubuntu.com> Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139875 Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/migration/migration.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index be21788c40d1..c36780a1c229 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -689,6 +689,10 @@ void MigrationImpl::copyConfig()
// check if the shared registrymodifications.xcu file exists
bool bRegistryModificationsXcuExists = false;
OUString regFilePath = m_aInfo.userdata + "/user/registrymodifications.xcu";
+ OUString sMigratedProductName = m_aInfo.productname;
+ // remove version number from the end of pruduct name if exist
+ if (isdigit(sMigratedProductName[sMigratedProductName.getLength() - 1]))
+ sMigratedProductName = (sMigratedProductName.copy(0, m_aInfo.productname.getLength() - 1)).trim();
File regFile(regFilePath);
::osl::FileBase::RC nError = regFile.open(osl_File_OpenFlag_Read);
if ( nError == ::osl::FileBase::E_None ) {
@@ -726,14 +730,41 @@ void MigrationImpl::copyConfig()
comphelper::getProcessComponentContext())->
insertModificationXcuFile(
regFilePath,
+ sMigratedProductName,
comphelper::containerToSequence(comp.second.includedPaths),
comphelper::containerToSequence(comp.second.excludedPaths));
+
} else {
SAL_INFO( "desktop.migration", "configuration migration component " << comp.first << " ignored (only excludes, no includes)" );
}
next:
;
}
+ // checking the migrated (product name related) color scheme name, and replace it to the current version scheme name
+ try
+ {
+ OUString sMigratedColorScheme;
+ uno::Reference<XPropertySet> aPropertySet(
+ getConfigAccess("org.openoffice.Office.UI/ColorScheme", true), uno::UNO_QUERY_THROW);
+ if (aPropertySet->getPropertyValue("CurrentColorScheme") >>= sMigratedColorScheme)
+ {
+ OUString aDarkTheme = " Dark";
+ if (sMigratedColorScheme.equals(sMigratedProductName))
+ {
+ aPropertySet->setPropertyValue("CurrentColorScheme",
+ uno::Any(utl::ConfigManager::getProductName()));
+ uno::Reference<XChangesBatch>(aPropertySet, uno::UNO_QUERY_THROW)->commitChanges();
+ }
+ else if (sMigratedColorScheme.equals(sMigratedProductName + aDarkTheme))
+ {
+ aPropertySet->setPropertyValue("CurrentColorScheme",
+ uno::Any(utl::ConfigManager::getProductName() + aDarkTheme));
+ uno::Reference<XChangesBatch>(aPropertySet, uno::UNO_QUERY_THROW)->commitChanges();
+ }
+ }
+ } catch (const Exception&) {
+ // fail silently...
+ }
}
uno::Reference< XNameAccess > MigrationImpl::getConfigAccess(const sal_Char* pPath, bool bUpdate)