diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-06-15 11:36:29 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-06-15 13:19:13 +0200 |
commit | f1e4a97b03e1eacd679c3ef1dcb7ab4b577dd928 (patch) | |
tree | 3edf6cde59489ad381c14f5f127f42f3b1f7287c /desktop/source | |
parent | 5d92f4dbb6ba0af39693564b83a44cc7610b577d (diff) |
tdf#35568 Repeat "first run" procedure on upgrade
1. In isProductVersionUpgraded, if it was upgraded, set FirstRun. This
will run in runGraphicsRenderTests, early enough in Desktop::Main().
2. This will make sure that Desktop::CheckFirstRun() will do its tasks,
including creation of the quickstart shortcut. It is simplified a
bit, to use a better WinAPI.
3. Setting FirstRun to false is moved to m_firstRunTimer's handler, to
make sure that it gets run eventually, even if the first launch was
terminated before the timer fired.
This will not make installer itself create the quickstart shortcut: it
will happen on the program's first run after an upgrade. But users now
won't have to enable the option manually each time.
Change-Id: Ica6cc41f1e56b8970db27d14e2be3c47910293e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168902
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/app/app.cxx | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index b00dd75a39e6..d30bd0e582f3 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2540,6 +2540,9 @@ IMPL_STATIC_LINK_NOARG(Desktop, AsyncInitFirstRun, Timer *, void) { Reference< XJobExecutor > xExecutor = theJobExecutor::get( ::comphelper::getProcessComponentContext() ); xExecutor->trigger( u"onFirstRunInitialization"_ustr ); + auto batch(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Misc::FirstRun::set(false, batch); + batch->commit(); } catch(const css::uno::Exception&) { @@ -2608,24 +2611,12 @@ void Desktop::CheckFirstRun( ) #ifdef _WIN32 // Check if Quickstarter should be started (on Windows only) OUString sRootKey = ReplaceStringHookProc("Software\\%OOOVENDOR\\%PRODUCTNAME\\%PRODUCTVERSION"); - WCHAR szValue[8192]; - DWORD nValueSize = sizeof(szValue); - HKEY hKey; - if (ERROR_SUCCESS == RegOpenKeyW(HKEY_LOCAL_MACHINE, o3tl::toW(sRootKey.getStr()), &hKey)) + if (ERROR_SUCCESS == RegGetValueW(HKEY_LOCAL_MACHINE, o3tl::toW(sRootKey.getStr()), L"RunQuickstartAtFirstStart", RRF_RT_ANY, nullptr, nullptr, nullptr)) { - if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"RunQuickstartAtFirstStart", nullptr, nullptr, reinterpret_cast<LPBYTE>(szValue), &nValueSize ) ) - { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*bAutostart*/); - RegCloseKey( hKey ); - } + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*bAutostart*/); } #endif - - std::shared_ptr< comphelper::ConfigurationChanges > batch( - comphelper::ConfigurationChanges::create()); - officecfg::Office::Common::Misc::FirstRun::set(false, batch); - batch->commit(); } } |