From 12e1a0d94ca1bacc399b3a58d416d21c035c3122 Mon Sep 17 00:00:00 2001 From: Release Engineers Date: Thu, 6 Aug 2009 09:32:55 +0000 Subject: CWS-TOOLING: integrate CWS extmgr01 2009-07-28 15:37:52 +0200 dv r274410 : #i103856# Create dialog before using it 2009-07-27 15:24:42 +0200 dv r274368 : #i103831# Made selectEntry virtual so the correct function will be used from the listbox with buttons 2009-07-27 14:17:08 +0200 dv r274366 : #i103831# Made selectEntry virtual so the correct function will be used from the listbox with buttons 2009-07-07 08:23:17 +0200 dv r273765 : #i102666# Extension check on startup after office update -> fixed repaint problem 2009-07-06 11:28:28 +0200 dv r273729 : #i102666# Extension check on startup after office update -> fixed Mac OS X issues 2009-07-02 15:01:35 +0200 dv r273654 : #i102666# Extension check on startup after office update -> set last checked to never when aborting 2009-07-01 12:18:52 +0200 dv r273564 : Removed unused variable 2009-07-01 07:25:01 +0200 dv r273542 : #i102666# Extension check on startup after office update -> better layout 2009-06-30 14:56:16 +0200 dv r273506 : #i102666# Extension check on startup after office update -> mark incompatible extensions in extension manager 2009-06-30 12:43:55 +0200 dv r273502 : CWS-TOOLING: rebase CWS extmgr01 to trunk@273468 (milestone: DEV300:m51) 2009-06-29 13:26:54 +0200 dv r273469 : Now with newline at the end 2009-06-29 11:54:07 +0200 dv r273462 : #i102666# Extension check on startup after office update -> exit button of dialog disables extensions, too 2009-06-26 16:26:02 +0200 dv r273428 : #i102666# Extension check on startup after office update -> better progress handling 2009-06-26 14:50:34 +0200 dv r273417 : fixed crash when shutting down while initial waiting 2009-06-26 14:46:40 +0200 dv r273416 : #i102666# Extension check on startup after office update 2009-06-24 07:30:57 +0200 dv r273306 : #i102666# Extension check on startup after update 2009-06-11 12:03:10 +0200 dv r272863 : #i102666# Extension check on startup after update 2009-06-11 11:59:29 +0200 dv r272862 : #i102666# Extension check on startup after update 2009-06-09 15:50:05 +0200 dv r272773 : CWS-TOOLING: rebase CWS extmgr01 to trunk@272291 (milestone: DEV300:m49) --- extensions/source/update/check/updatecheckjob.cxx | 62 +++++++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-) (limited to 'extensions/source') diff --git a/extensions/source/update/check/updatecheckjob.cxx b/extensions/source/update/check/updatecheckjob.cxx index 3bc292e4c8ef..f64ba851e679 100644 --- a/extensions/source/update/check/updatecheckjob.cxx +++ b/extensions/source/update/check/updatecheckjob.cxx @@ -36,12 +36,15 @@ #include "updatehdl.hxx" #include "updateprotocol.hxx" -#include +#include #include +#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/XTerminateListener.hpp" #include namespace beans = com::sun::star::beans ; +namespace frame = com::sun::star::frame ; namespace lang = com::sun::star::lang ; namespace task = com::sun::star::task ; namespace uno = com::sun::star::uno ; @@ -61,6 +64,7 @@ public: virtual void SAL_CALL onTerminated(); void showDialog(); + void setTerminating() { m_bTerminating = true; } protected: ~InitUpdateCheckJobThread(); @@ -70,10 +74,11 @@ private: uno::Reference m_xContext; uno::Sequence m_xParameters; bool m_bShowDialog; + bool m_bTerminating; }; class UpdateCheckJob : - public ::cppu::WeakImplHelper2< task::XJob, lang::XServiceInfo > + public ::cppu::WeakImplHelper3< task::XJob, lang::XServiceInfo, frame::XTerminateListener > { virtual ~UpdateCheckJob(); @@ -100,8 +105,19 @@ public: virtual uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw (uno::RuntimeException); + // XEventListener + virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt ) + throw (::com::sun::star::uno::RuntimeException); + + // XTerminateListener + virtual void SAL_CALL queryTermination( lang::EventObject const & evt ) + throw ( frame::TerminationVetoException, uno::RuntimeException ); + virtual void SAL_CALL notifyTermination( lang::EventObject const & evt ) + throw ( uno::RuntimeException ); + private: uno::Reference m_xContext; + uno::Reference< frame::XDesktop > m_xDesktop; InitUpdateCheckJobThread *m_pInitThread; void handleExtensionUpdates( const uno::Sequence< beans::NamedValue > &rListProp ); @@ -115,7 +131,8 @@ InitUpdateCheckJobThread::InitUpdateCheckJobThread( const uno::Sequence< beans::NamedValue > &xParameters ) : m_xContext( xContext ), m_xParameters( xParameters ), - m_bShowDialog( false ) + m_bShowDialog( false ), + m_bTerminating( false ) { create(); } @@ -132,6 +149,9 @@ void SAL_CALL InitUpdateCheckJobThread::run() m_aCondition.wait( &tv ); + if ( m_bTerminating ) + return; + rtl::Reference< UpdateCheck > aController( UpdateCheck::get() ); aController->initialize( m_xParameters, m_xContext ); @@ -156,10 +176,13 @@ void InitUpdateCheckJobThread::showDialog() //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ -UpdateCheckJob::UpdateCheckJob(const uno::Reference& xContext) : +UpdateCheckJob::UpdateCheckJob( const uno::Reference& xContext ) : m_xContext(xContext), m_pInitThread( NULL ) { + m_xDesktop.set( xContext->getServiceManager()->createInstanceWithContext( UNISTRING("com.sun.star.frame.Desktop"), xContext ), uno::UNO_QUERY ); + if ( m_xDesktop.is() ) + m_xDesktop->addTerminateListener( this ); } //------------------------------------------------------------------------------ @@ -301,6 +324,37 @@ UpdateCheckJob::supportsService( rtl::OUString const & serviceName ) throw (uno: return sal_False; } +//------------------------------------------------------------------------------ +// XEventListener +void SAL_CALL UpdateCheckJob::disposing( lang::EventObject const & rEvt ) + throw ( uno::RuntimeException ) +{ + bool shutDown = ( rEvt.Source == m_xDesktop ); + + if ( shutDown && m_xDesktop.is() ) + { + m_xDesktop->removeTerminateListener( this ); + m_xDesktop.clear(); + } +} + +//------------------------------------------------------------------------------ +// XTerminateListener +void SAL_CALL UpdateCheckJob::queryTermination( lang::EventObject const & ) + throw ( frame::TerminationVetoException, uno::RuntimeException ) +{ +} + +//------------------------------------------------------------------------------ +void SAL_CALL UpdateCheckJob::notifyTermination( lang::EventObject const & rEvt ) + throw ( uno::RuntimeException ) +{ + if ( m_pInitThread ) + m_pInitThread->setTerminating(); + + disposing( rEvt ); +} + } // anonymous namespace //------------------------------------------------------------------------------ -- cgit