diff options
author | Carsten Driesner <cd@openoffice.org> | 2010-03-04 17:16:24 +0100 |
---|---|---|
committer | Carsten Driesner <cd@openoffice.org> | 2010-03-04 17:16:24 +0100 |
commit | 2c8fde956e8c62e1284ad60ad3abed7666ecd3f0 (patch) | |
tree | bbc46c30690745fef8811840d7a281823c8de17c /desktop/source | |
parent | afc4751875ec560e49ce0c5832fb382f7b5a4787 (diff) |
native0: #161735# Set accept date and patch level after migration
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/migration/wizard.cxx | 49 | ||||
-rw-r--r-- | desktop/source/migration/wizard.hxx | 1 |
2 files changed, 49 insertions, 1 deletions
diff --git a/desktop/source/migration/wizard.cxx b/desktop/source/migration/wizard.cxx index db9c859d70..658224027e 100644 --- a/desktop/source/migration/wizard.cxx +++ b/desktop/source/migration/wizard.cxx @@ -100,6 +100,21 @@ static uno::Reference< uno::XComponentContext > getComponentContext( const uno:: return rContext; } +static sal_Int32 getBuildId() +{ + ::rtl::OUString aDefault; + ::rtl::OUString aBuildIdData = utl::Bootstrap::getBuildIdData( aDefault ); + sal_Int32 nBuildId( 0 ); + sal_Int32 nIndex1 = aBuildIdData.indexOf(':'); + sal_Int32 nIndex2 = aBuildIdData.indexOf(')'); + if (( nIndex1 > 0 ) && ( nIndex2 > 0 ) && ( nIndex2-1 > nIndex1+1 )) + { + ::rtl::OUString aBuildId = aBuildIdData.copy( nIndex1+1, nIndex2-nIndex1-1 ); + nBuildId = aBuildId.toInt32(); + } + return nBuildId; +} + WizardResId::WizardResId( USHORT nId ) : ResId( nId, *FirstStartWizard::GetResManager() ) { @@ -409,13 +424,21 @@ sal_Bool FirstStartWizard::prepareLeaveCurrentState( CommitPageReason _eReason ) storeAcceptDate(); m_bLicenseWasAccepted = sal_True; - } + } return svt::RoadmapWizard::prepareLeaveCurrentState(_eReason); } sal_Bool FirstStartWizard::leaveState(WizardState) { + if (( getCurrentState() == STATE_MIGRATION ) && m_bLicenseWasAccepted ) + { + // Store accept date and patch level now as it has been + // overwritten by the migration process! + storeAcceptDate(); + setPatchLevel(); + } + return sal_True; } @@ -502,6 +525,30 @@ void FirstStartWizard::storeAcceptDate() } +void FirstStartWizard::setPatchLevel() +{ + try { + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + // get configuration provider + Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( + xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + Sequence< Any > theArgs(1); + NamedValue v(OUString::createFromAscii("NodePath"), + makeAny(OUString::createFromAscii("org.openoffice.Office.Common/Help/Registration"))); + theArgs[0] <<= v; + Reference< XPropertySet > pset = Reference< XPropertySet >( + theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); + Any result = pset->getPropertyValue(OUString::createFromAscii("ReminderDate")); + + OUString aPatchLevel( RTL_CONSTASCII_USTRINGPARAM( "Patch" )); + aPatchLevel += OUString::valueOf( getBuildId(), 10 ); + pset->setPropertyValue(OUString::createFromAscii("ReminderDate"), makeAny(aPatchLevel)); + Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); + } catch (const Exception&) + { + } +} + #ifdef WNT typedef int ( __stdcall * CleanCurUserRegProc ) ( wchar_t* ); #endif diff --git a/desktop/source/migration/wizard.hxx b/desktop/source/migration/wizard.hxx index 72cb24d7e7..edbae53318 100644 --- a/desktop/source/migration/wizard.hxx +++ b/desktop/source/migration/wizard.hxx @@ -85,6 +85,7 @@ private: rtl::OUString m_aLicensePath; void storeAcceptDate(); + void setPatchLevel(); void disableWizard(); void enableQuickstart(); |