diff options
-rw-r--r-- | desktop/inc/app.hxx | 6 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 16 | ||||
-rw-r--r-- | desktop/source/app/check_ext_deps.cxx | 205 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 1 | ||||
-rw-r--r-- | desktop/source/splash/splash.cxx | 27 | ||||
-rw-r--r-- | desktop/source/splash/splash.hxx | 1 |
6 files changed, 161 insertions, 95 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 4f5a3b176be3..486d280311d9 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -132,7 +132,10 @@ class Desktop : public Application static sal_Bool LicenseNeedsAcceptance(); static sal_Bool IsFirstStartWizardNeeded(); static sal_Bool CheckExtensionDependencies(); - static void SynchronizeExtensionRepositories(); + + void SynchronizeExtensionRepositories(); + void SetSplashScreenText( const ::rtl::OUString& rText ); + void SetSplashScreenProgress( sal_Int32 ); private: // Bootstrap methods @@ -165,7 +168,6 @@ class Desktop : public Application Reference<XStatusIndicator> m_rSplashScreen; void OpenSplashScreen(); - void SetSplashScreenProgress(sal_Int32); void CloseSplashScreen(); void EnableOleAutomation(); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index b82915871566..8e610fb0e141 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1392,12 +1392,14 @@ void Desktop::Main() tools::InitTestToolLib(); RTL_LOGFILE_CONTEXT_TRACE( aLog, "} tools::InitTestToolLib" ); + // Check if bundled or shared extensions were added /removed + // and process those extensions (has to be done before checking + // the extension dependencies! + SynchronizeExtensionRepositories(); + bool bAbort = CheckExtensionDependencies(); if ( bAbort ) return; - //Check if bundled or shared extensions were added /removed - //and process those extensions - SynchronizeExtensionRepositories(); // First Start Wizard allowed ? if ( ! pCmdLineArgs->IsNoFirstStartWizard()) @@ -2919,6 +2921,14 @@ void Desktop::SetSplashScreenProgress(sal_Int32 iProgress) } } +void Desktop::SetSplashScreenText( const ::rtl::OUString& rText ) +{ + if( m_rSplashScreen.is() ) + { + m_rSplashScreen->setText( rText ); + } +} + void Desktop::CloseSplashScreen() { if(m_rSplashScreen.is()) diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index f487e0dfc96f..6a9beae58ccd 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -27,12 +27,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_desktop.hxx" -#include <osl/file.hxx> +#include "osl/file.hxx" +#include "osl/mutex.hxx" + #include <rtl/bootstrap.hxx> #include <rtl/ustring.hxx> #include <rtl/logfile.hxx> #include "cppuhelper/compbase3.hxx" +#include "vcl/wrkwin.hxx" +#include "vcl/timer.hxx" + #include <unotools/configmgr.hxx> #include <comphelper/processfactory.hxx> @@ -59,7 +64,7 @@ using rtl::OUString; using namespace desktop; using namespace com::sun::star; -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +#define UNISTRING(s) OUString(RTL_CONSTASCII_USTRINGPARAM(s)) namespace { @@ -69,9 +74,13 @@ class SilentCommandEnv task::XInteractionHandler, ucb::XProgressHandler > { + Desktop *mpDesktop; + sal_Int32 mnLevel; + sal_Int32 mnProgress; + public: - virtual ~SilentCommandEnv(){}; - SilentCommandEnv(){}; + SilentCommandEnv( Desktop* pDesktop ); + virtual ~SilentCommandEnv(); // XCommandEnvironment virtual uno::Reference<task::XInteractionHandler > SAL_CALL @@ -91,21 +100,38 @@ public: throw (uno::RuntimeException); virtual void SAL_CALL pop() throw (uno::RuntimeException); }; + +//----------------------------------------------------------------------------- +SilentCommandEnv::SilentCommandEnv( Desktop* pDesktop ) +{ + mpDesktop = pDesktop; + mnLevel = 0; + mnProgress = 25; +} + +//----------------------------------------------------------------------------- +SilentCommandEnv::~SilentCommandEnv() +{ + mpDesktop->SetSplashScreenText( OUString() ); +} + +//----------------------------------------------------------------------------- Reference<task::XInteractionHandler> SilentCommandEnv::getInteractionHandler() -throw (uno::RuntimeException) + throw (uno::RuntimeException) { return this; } +//----------------------------------------------------------------------------- Reference<ucb::XProgressHandler> SilentCommandEnv::getProgressHandler() -throw (uno::RuntimeException) + throw (uno::RuntimeException) { return this; } +//----------------------------------------------------------------------------- // XInteractionHandler -void SilentCommandEnv::handle( - Reference< task::XInteractionRequest> const & xRequest ) +void SilentCommandEnv::handle( Reference< task::XInteractionRequest> const & xRequest ) throw (uno::RuntimeException) { uno::Any request( xRequest->getRequest() ); @@ -127,23 +153,45 @@ void SilentCommandEnv::handle( } } +//----------------------------------------------------------------------------- // XProgressHandler -void SilentCommandEnv::push( uno::Any const & /*Status*/ ) -throw (uno::RuntimeException) +void SilentCommandEnv::push( uno::Any const & rStatus ) + throw (uno::RuntimeException) { -} + OUString sText; + mnLevel += 1; + if ( rStatus.hasValue() && ( rStatus >>= sText) ) + { + if ( mnLevel == 1 ) + mpDesktop->SetSplashScreenText( sText ); + else + mpDesktop->SetSplashScreenProgress( ++mnProgress ); + } +} -void SilentCommandEnv::update( uno::Any const & /*Status */) -throw (uno::RuntimeException) +//----------------------------------------------------------------------------- +void SilentCommandEnv::update( uno::Any const & rStatus ) + throw (uno::RuntimeException) { + OUString sText; + if ( rStatus.hasValue() && ( rStatus >>= sText) ) + { + mpDesktop->SetSplashScreenText( sText ); + } } +//----------------------------------------------------------------------------- void SilentCommandEnv::pop() throw (uno::RuntimeException) { + mnLevel -= 1; } } // end namespace + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ); //------------------------------------------------------------------------------ @@ -169,55 +217,75 @@ static sal_Int16 impl_showExtensionDialog( uno::Reference< uno::XComponentContex //------------------------------------------------------------------------------ // Check dependencies of all packages //------------------------------------------------------------------------------ -static bool impl_checkDependencies( const uno::Reference< deployment::XPackageManager > &xPackageManager ) +static bool impl_checkDependencies( const uno::Reference< uno::XComponentContext > &xContext ) { - uno::Sequence< uno::Reference< deployment::XPackage > > packages; + uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages; + uno::Reference< deployment::XExtensionManager > xExtensionManager = deployment::ExtensionManager::get( xContext ); + + if ( !xExtensionManager.is() ) + { + OSL_ENSURE( 0, "Could not get the Extension Manager!" ); + return true; + } try { - packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(), - uno::Reference< ucb::XCommandEnvironment >() ); + xAllPackages = xExtensionManager->getAllExtensions( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ); } - catch ( deployment::DeploymentException & ) { /* handleGeneralError(e.Cause);*/ } - catch ( ucb::CommandFailedException & ) { /* handleGeneralError(e.Reason);*/ } - catch ( ucb::CommandAbortedException & ) {} + catch ( deployment::DeploymentException & ) { return true; } + catch ( ucb::CommandFailedException & ) { return true; } + catch ( ucb::CommandAbortedException & ) { return true; } catch ( lang::IllegalArgumentException & e ) { throw uno::RuntimeException( e.Message, e.Context ); } - for ( sal_Int32 i = 0; i < packages.getLength(); ++i ) + sal_Int32 nMax = 2; +#ifdef DEBUG + nMax = 3; +#endif + + for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i ) { - bool bRegistered = false; - try { - beans::Optional< beans::Ambiguous< sal_Bool > > option( packages[i]->isRegistered( uno::Reference< task::XAbortChannel >(), - uno::Reference< ucb::XCommandEnvironment >() ) ); - if ( option.IsPresent ) - { - ::beans::Ambiguous< sal_Bool > const & reg = option.Value; - if ( reg.IsAmbiguous ) - bRegistered = false; - else - bRegistered = reg.Value ? true : false; - } - else - bRegistered = false; - } - catch ( uno::RuntimeException & ) { throw; } - catch ( uno::Exception & exc) { - (void) exc; - OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - bRegistered = false; - } + uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i]; - if ( bRegistered ) + for ( sal_Int32 j = 0; (j<nMax) && (j < xPackageList.getLength()); ++j ) { - bool bDependenciesValid = false; - try { - bDependenciesValid = packages[i]->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() ); - } - catch ( deployment::DeploymentException & ) {} - if ( ! bDependenciesValid ) + uno::Reference< deployment::XPackage > xPackage = xPackageList[j]; + if ( xPackage.is() ) { - return false; + bool bRegistered = false; + try { + beans::Optional< beans::Ambiguous< sal_Bool > > option( xPackage->isRegistered( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ) ); + if ( option.IsPresent ) + { + ::beans::Ambiguous< sal_Bool > const & reg = option.Value; + if ( reg.IsAmbiguous ) + bRegistered = false; + else + bRegistered = reg.Value ? true : false; + } + else + bRegistered = false; + } + catch ( uno::RuntimeException & ) { throw; } + catch ( uno::Exception & exc) { + (void) exc; + OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + } + + if ( bRegistered ) + { + bool bDependenciesValid = false; + try { + bDependenciesValid = xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() ); + } + catch ( deployment::DeploymentException & ) {} + if ( ! bDependenciesValid ) + { + return false; + } + } } } } @@ -254,31 +322,11 @@ static void impl_setNeedsCompatCheck() static bool impl_check() { uno::Reference< uno::XComponentContext > xContext = comphelper_getProcessComponentContext(); - uno::Reference< deployment::XPackageManager > xManager; - bool bDependenciesValid = true; - try { - xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("user") ); - } - catch ( ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} - - if ( xManager.is() ) - bDependenciesValid = impl_checkDependencies( xManager ); - - if ( bDependenciesValid ) - { - try { - xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("shared") ); - } - catch ( ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} - - if ( xManager.is() ) - bDependenciesValid = impl_checkDependencies( xManager ); - } + bool bDependenciesValid = impl_checkDependencies( xContext ); short nRet = 0; + if ( !bDependenciesValid ) nRet = impl_showExtensionDialog( xContext ); @@ -292,7 +340,7 @@ static bool impl_check() } //------------------------------------------------------------------------------ -// to check, if we need checking the dependencies of the extensions again, we compare +// to check if we need checking the dependencies of the extensions again, we compare // the build id of the office with the one of the last check //------------------------------------------------------------------------------ static bool impl_needsCompatCheck() @@ -325,6 +373,9 @@ static bool impl_needsCompatCheck() pset->setPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID"), result ); Reference< util::XChangesBatch >( pset, UNO_QUERY_THROW )->commitChanges(); } +#ifdef DEBUG + bNeedsCheck = true; +#endif } catch (const Exception&) {} @@ -348,11 +399,9 @@ void Desktop::SynchronizeExtensionRepositories() { RTL_LOGFILE_CONTEXT(aLog,"desktop (jl97489) ::Desktop::SynchronizeExtensionRepositories"); OUString sDisable; - ::rtl::Bootstrap::get( - OUString(RTL_CONSTASCII_USTRINGPARAM("DISABLE_SYNC_EXTENSIONS")), - sDisable, - OUString(RTL_CONSTASCII_USTRINGPARAM(""))); + ::rtl::Bootstrap::get( UNISTRING( "DISABLE_SYNC_EXTENSIONS" ), sDisable, OUString() ); if (sDisable.getLength() > 0) return; - dp_misc::syncRepositories(new SilentCommandEnv()); + + dp_misc::syncRepositories( new SilentCommandEnv( this ) ); } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index fef6d36c7165..cd37f07729bb 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -243,7 +243,6 @@ bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bPare { TUpdateListEntry pEntry( new UpdateListEntry( xPackage, m_sPackageManagers[j] ) ); vEntries.push_back( pEntry ); - break; } } } diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 5fee3028b4f6..381a98ce008f 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -135,14 +135,21 @@ void SAL_CALL SplashScreen::reset() } } -void SAL_CALL SplashScreen::setText(const OUString&) +void SAL_CALL SplashScreen::setText(const OUString& rText) throw (RuntimeException) { - if (_bVisible && !_bProgressEnd) { - if ( _eBitmapMode == BM_FULLSCREEN ) - ShowFullScreenMode( TRUE ); - Show(); - Flush(); + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + if ( _sProgressText != rText ) + { + _sProgressText = rText; + + if (_bVisible && !_bProgressEnd) + { + if ( _eBitmapMode == BM_FULLSCREEN ) + ShowFullScreenMode( TRUE ); + Show(); + updateStatus(); + } } } @@ -647,7 +654,7 @@ void SplashScreen::Paint( const Rectangle&) } if( (bNativeOK = DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aControlRegion, - CTRL_STATE_ENABLED, aValue, rtl::OUString() )) != FALSE ) + CTRL_STATE_ENABLED, aValue, _sProgressText )) != FALSE ) { return; } @@ -668,10 +675,8 @@ void SplashScreen::Paint( const Rectangle&) _vdev.DrawRect(Rectangle(_tlx, _tly, _tlx+_barwidth, _tly+_barheight)); _vdev.SetFillColor( _cProgressBarColor ); _vdev.SetLineColor(); - Rectangle aRect(_tlx+_barspace, _tly+_barspace, _tlx+_barspace+length, _tly+_barheight-_barspace); - _vdev.DrawRect(Rectangle(_tlx+_barspace, _tly+_barspace, - _tlx+_barspace+length, _tly+_barheight-_barspace)); - + _vdev.DrawRect(Rectangle(_tlx+_barspace, _tly+_barspace, _tlx+_barspace+length, _tly+_barheight-_barspace)); + _vdev.DrawText( Rectangle(_tlx, _tly+_barheight+5, _tlx+_barwidth, _tly+_barheight+5+20), _sProgressText, TEXT_DRAW_CENTER ); } Size aSize = GetOutputSizePixel(); Size bSize = _vdev.GetOutputSizePixel(); diff --git a/desktop/source/splash/splash.hxx b/desktop/source/splash/splash.hxx index 99677aa107f1..8480ed3df9ae 100644 --- a/desktop/source/splash/splash.hxx +++ b/desktop/source/splash/splash.hxx @@ -91,6 +91,7 @@ private: Color _cProgressBarColor; bool _bNativeProgress; OUString _sAppName; + OUString _sProgressText; std::vector< FullScreenProgressRatioValue > _sFullScreenProgressRatioValues; sal_Int32 _iMax; |