diff options
Diffstat (limited to 'extensions/source/update')
29 files changed, 106 insertions, 471 deletions
diff --git a/extensions/source/update/check/actionlistener.hxx b/extensions/source/update/check/actionlistener.hxx index 76f942d402d7..6d90357aef85 100644 --- a/extensions/source/update/check/actionlistener.hxx +++ b/extensions/source/update/check/actionlistener.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: actionlistener.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx index 76d4b373a329..9e10abf27a0e 100644 --- a/extensions/source/update/check/download.cxx +++ b/extensions/source/update/check/download.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: download.cxx,v $ - * $Revision: 1.7.88.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/download.hxx b/extensions/source/update/check/download.hxx index 034f39dbe733..ff16ef52f7fb 100644 --- a/extensions/source/update/check/download.hxx +++ b/extensions/source/update/check/download.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: download.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/makefile.mk b/extensions/source/update/check/makefile.mk index 1824a1f63c7d..b87eb0377803 100644 --- a/extensions/source/update/check/makefile.mk +++ b/extensions/source/update/check/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.12 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/transform.pl b/extensions/source/update/check/transform.pl index 79859cb455a4..fb452ae0482c 100644 --- a/extensions/source/update/check/transform.pl +++ b/extensions/source/update/check/transform.pl @@ -6,14 +6,10 @@ eval 'exec perl -wS $0 ${1+"$@"}' # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: transform.pl,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index 09776f1fc1c4..d89233e88dc2 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -2,12 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatecheck.cxx,v $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -264,7 +262,7 @@ protected: virtual void SAL_CALL onTerminated(); /* Wrapper around checkForUpdates */ - bool runCheck(); + bool runCheck( bool & rbExtensionsChecked ); private: @@ -453,7 +451,7 @@ UpdateCheckThread::cancel() //------------------------------------------------------------------------------ bool -UpdateCheckThread::runCheck() +UpdateCheckThread::runCheck( bool & rbExtensionsChecked ) { bool ret = false; UpdateState eUIState = UPDATESTATE_NO_UPDATE_AVAIL; @@ -474,12 +472,14 @@ UpdateCheckThread::runCheck() // and when there was no office update found if ( ( eUIState != UPDATESTATE_UPDATE_AVAIL ) && ( eUIState != UPDATESTATE_UPDATE_NO_DOWNLOAD ) && - !aController->isDialogShowing() ) + !aController->isDialogShowing() && + !rbExtensionsChecked ) { bool bHasExtensionUpdates = checkForExtensionUpdates( m_xContext ); aController->setHasExtensionUpdates( bHasExtensionUpdates ); if ( bHasExtensionUpdates ) aController->setUIState( UPDATESTATE_EXT_UPD_AVAIL ); + rbExtensionsChecked = true; } // joining with this thread is safe again @@ -500,6 +500,11 @@ UpdateCheckThread::onTerminated() void SAL_CALL UpdateCheckThread::run() { + bool bExtensionsChecked = false; + TimeValue systime; + TimeValue nExtCheckTime; + osl_getSystemTime( &nExtCheckTime ); + osl::Condition::Result aResult = osl::Condition::result_timeout; TimeValue tv = { 10, 0 }; @@ -547,7 +552,6 @@ UpdateCheckThread::run() if( ! checkNow ) { - TimeValue systime; osl_getSystemTime(&systime); // Go back to sleep until time has elapsed @@ -563,19 +567,28 @@ UpdateCheckThread::run() static sal_uInt8 n = 0; - if( ! hasInternetConnection() || ! runCheck() ) + if( ! hasInternetConnection() || ! runCheck( bExtensionsChecked ) ) { - // Increase next by 1, 5, 15, 60, .. minutes - static const sal_Int16 nRetryInterval[] = { 60, 300, 900, 3600 }; + // the extension update check should be independent from the office update check + // + osl_getSystemTime( &systime ); + if ( nExtCheckTime.Seconds + offset < systime.Seconds ) + bExtensionsChecked = false; - if( n < sizeof(nRetryInterval) / sizeof(sal_Int16) ) + // Increase next by 15, 60, .. minutes + static const sal_Int32 nRetryInterval[] = { 900, 3600, 14400, 86400 }; + + if( n < sizeof(nRetryInterval) / sizeof(sal_Int32) ) ++n; tv.Seconds = nRetryInterval[n-1]; aResult = m_aCondition.wait(&tv); } else // reset retry counter + { n = 0; + bExtensionsChecked = false; + } } } @@ -591,8 +604,10 @@ UpdateCheckThread::run() void SAL_CALL ManualUpdateCheckThread::run() { + bool bExtensionsChecked = false; + try { - runCheck(); + runCheck( bExtensionsChecked ); m_aCondition.reset(); } catch(const uno::Exception& e) { @@ -1571,6 +1586,8 @@ void UpdateCheck::showExtensionDialog() rtl::Reference<UpdateHandler> UpdateCheck::getUpdateHandler() { + osl::MutexGuard aGuard(m_aMutex); + if( ! m_aUpdateHandler.is() ) m_aUpdateHandler = new UpdateHandler(m_xContext, this); diff --git a/extensions/source/update/check/updatecheck.hxx b/extensions/source/update/check/updatecheck.hxx index ff16fc3ed95b..7283288769e0 100644 --- a/extensions/source/update/check/updatecheck.hxx +++ b/extensions/source/update/check/updatecheck.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatecheck.hxx,v $ - * $Revision: 1.6.70.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index 45a7c15ecb2e..b3e559c5f136 100644 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * diff --git a/extensions/source/update/check/updatecheckconfig.hxx b/extensions/source/update/check/updatecheckconfig.hxx index dc66656314dd..bc1fd0987b18 100644 --- a/extensions/source/update/check/updatecheckconfig.hxx +++ b/extensions/source/update/check/updatecheckconfig.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatecheckconfig.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updatecheckconfiglistener.hxx b/extensions/source/update/check/updatecheckconfiglistener.hxx index 6ff0af2fb457..9d2c406b455a 100644 --- a/extensions/source/update/check/updatecheckconfiglistener.hxx +++ b/extensions/source/update/check/updatecheckconfiglistener.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatecheckconfiglistener.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updatecheckjob.cxx b/extensions/source/update/check/updatecheckjob.cxx index f64ba851e679..3be38dd9888a 100644 --- a/extensions/source/update/check/updatecheckjob.cxx +++ b/extensions/source/update/check/updatecheckjob.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatecheckjob.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index ca9da74d3525..bb38c34a0b4e 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -2,12 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatehdl.cxx,v $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,7 +29,7 @@ #include "precompiled_extensions.hxx" #include "updatehdl.hxx" -#include "extensio.hrc" +#include "update.hrc" #include "osl/diagnose.h" #include "osl/thread.hxx" @@ -202,6 +200,10 @@ void UpdateHandler::setVisible( bool bVisible ) if ( !mxUpdDlg.is() ) createDialog(); + // this should never happen, but if it happens we better return here + if ( !mxUpdDlg.is() ) + return; + updateState( meCurState ); uno::Reference< awt::XWindow > xWindow( mxUpdDlg, uno::UNO_QUERY ); @@ -1135,6 +1137,12 @@ void UpdateHandler::showControls( short nControls ) //-------------------------------------------------------------------- void UpdateHandler::createDialog() { + if ( !mxContext.is() ) + { + OSL_ASSERT( false ); + return; + } + uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager() ); if( xServiceManager.is() ) diff --git a/extensions/source/update/check/updatehdl.hrc b/extensions/source/update/check/updatehdl.hrc index 567269f97e52..ad3d472eaf68 100644 --- a/extensions/source/update/check/updatehdl.hrc +++ b/extensions/source/update/check/updatehdl.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatehdl.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updatehdl.hxx b/extensions/source/update/check/updatehdl.hxx index 5a980228b9e2..bd525853dda1 100644 --- a/extensions/source/update/check/updatehdl.hxx +++ b/extensions/source/update/check/updatehdl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatehdl.hxx,v $ - * $Revision: 1.5.94.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updatehdl.src b/extensions/source/update/check/updatehdl.src index 99e4a6dcbf59..58f88b7e4852 100644 --- a/extensions/source/update/check/updatehdl.src +++ b/extensions/source/update/check/updatehdl.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatehdl.src,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updateinfo.hxx b/extensions/source/update/check/updateinfo.hxx index 3de0fcbea24e..3249a59ad7d0 100644 --- a/extensions/source/update/check/updateinfo.hxx +++ b/extensions/source/update/check/updateinfo.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updateinfo.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx index 2794f299928c..5d51ea14cc6f 100644 --- a/extensions/source/update/check/updateprotocol.cxx +++ b/extensions/source/update/check/updateprotocol.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updateprotocol.cxx,v $ - * $Revision: 1.11.70.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updateprotocol.hxx b/extensions/source/update/check/updateprotocol.hxx index 92fd663612ac..d99ae9e7af2d 100644 --- a/extensions/source/update/check/updateprotocol.hxx +++ b/extensions/source/update/check/updateprotocol.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updateprotocol.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/check/updateprotocoltest.cxx b/extensions/source/update/check/updateprotocoltest.cxx index df1a07430e35..70623cea6224 100644 --- a/extensions/source/update/check/updateprotocoltest.cxx +++ b/extensions/source/update/check/updateprotocoltest.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updateprotocoltest.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/feed/makefile.mk b/extensions/source/update/feed/makefile.mk index ecb5957df9b7..c7d15a2beb74 100644 --- a/extensions/source/update/feed/makefile.mk +++ b/extensions/source/update/feed/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -43,27 +39,21 @@ ENABLE_EXCEPTIONS=TRUE # no "lib" prefix DLLPRE = -.IF "$(SYSTEM_ZLIB)" == "YES" -CFLAGS+=-DSYSTEM_ZLIB -.ENDIF - # --- Files --- - SLOFILES=\ $(SLO)$/updatefeed.obj \ - + SHL1NOCHECK=TRUE -SHL1TARGET=$(TARGET).uno +SHL1TARGET=$(TARGET).uno SHL1OBJS=$(SLOFILES) SHL1IMPLIB=i$(SHL1TARGET) SHL1STDLIBS= \ $(CPPUHELPERLIB) \ $(CPPULIB) \ - $(SALLIB) \ - $(ZLIB3RDLIB) - + $(SALLIB) + SHL1VERSIONMAP=..$/exports.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/extensions/source/update/feed/test/makefile.mk b/extensions/source/update/feed/test/makefile.mk index 6d95cbbf1e7a..3d972a761233 100644 --- a/extensions/source/update/feed/test/makefile.mk +++ b/extensions/source/update/feed/test/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/feed/test/updatefeedtest.cxx b/extensions/source/update/feed/test/updatefeedtest.cxx index df56649fd6c0..025a16dbcd76 100644 --- a/extensions/source/update/feed/test/updatefeedtest.cxx +++ b/extensions/source/update/feed/test/updatefeedtest.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatefeedtest.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx index e7ca93eacc18..e5eb490e29a2 100644 --- a/extensions/source/update/feed/updatefeed.cxx +++ b/extensions/source/update/feed/updatefeed.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatefeed.cxx,v $ - * $Revision: 1.11.52.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -32,7 +29,7 @@ #include "precompiled_extensions.hxx" #include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/implbase4.hxx> #include <cppuhelper/implementationentry.hxx> #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> @@ -44,26 +41,16 @@ #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/task/XPasswordContainer.hpp> -#include "com/sun/star/task/NoMasterException.hpp" -#include "com/sun/star/ucb/AuthenticationRequest.hpp" -#ifndef _COM_SUN_STAR_UCB_XCOMMMANDENVIRONMENT_HPP_ #include <com/sun/star/ucb/XCommandEnvironment.hpp> -#endif -#ifndef _COM_SUN_STAR_UCB_XWEBDAVCOMMMANDENVIRONMENT_HPP_ #include <com/sun/star/ucb/XWebDAVCommandEnvironment.hpp> -#endif -#ifndef _COM_SUN_STAR_UCB_XCOMMMANDPROCESSOR2_HPP_ #include <com/sun/star/ucb/XCommandProcessor2.hpp> -#endif -#ifndef _COM_SUN_STAR_UCB_XCONTENTIDNETIFIERFACTORY_HPP_ #include <com/sun/star/ucb/XContentIdentifierFactory.hpp> -#endif #include <com/sun/star/ucb/XContentProvider.hpp> #include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp" #include <com/sun/star/ucb/OpenCommandArgument2.hpp> #include <com/sun/star/ucb/OpenMode.hpp> #include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/task/PasswordContainerInteractionHandler.hpp> #include <com/sun/star/xml/dom/XDocumentBuilder.hpp> #include <com/sun/star/xml/xpath/XXPathAPI.hpp> @@ -74,14 +61,6 @@ #include <osl/process.h> #include <osl/conditn.hxx> -#ifndef _ZLIB_H -#ifdef SYSTEM_ZLIB -#include "zlib.h" -#else -#include "zlib/zlib.h" -#endif -#endif - namespace beans = com::sun::star::beans ; namespace container = com::sun::star::container ; namespace deployment = com::sun::star::deployment ; @@ -114,14 +93,16 @@ public: throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) { sal_Int32 n = m_xStream->readBytes(aData, nBytesToRead); - OSL_TRACE( aData.get()->elements ); + if ( n ) + OSL_TRACE( "Read [%d] bytes: %s\n", n, aData.get()->elements ); return n; }; virtual sal_Int32 SAL_CALL readSomeBytes(uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) { sal_Int32 n = m_xStream->readSomeBytes(aData, nMaxBytesToRead); - OSL_TRACE( aData.get()->elements ); + if ( n ) + OSL_TRACE( "Read [%d] bytes: %s\n", n, aData.get()->elements ); return n; }; virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) @@ -159,154 +140,11 @@ public: //------------------------------------------------------------------------------ -class InflateInputStream : public ::cppu::WeakImplHelper1< io::XInputStream > -{ - uno::Reference< io::XInputStream > m_xStream; - - uno::Sequence < sal_Int8 > m_aBuffer; - sal_Int32 m_nOffset; - bool m_bRead; - - rtl::OUString m_aContentEncoding; - - void readIntoMemory(); - -public: - InflateInputStream(const uno::Reference< io::XInputStream >& rxStream,const rtl::OUString& rContentEncoding) : - m_xStream(rxStream), m_nOffset(0), m_bRead(false), m_aContentEncoding(rContentEncoding) {}; - - virtual sal_Int32 SAL_CALL readBytes(uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException); - virtual sal_Int32 SAL_CALL readSomeBytes(uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) - { readIntoMemory(); return readBytes(aData, nMaxBytesToRead ); }; - virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) - { - readIntoMemory(); - if( m_nOffset + nBytesToSkip < m_aBuffer.getLength() ) - m_nOffset += nBytesToSkip; - else - m_nOffset = m_aBuffer.getLength(); - }; - virtual sal_Int32 SAL_CALL available() - throw (io::NotConnectedException, io::IOException, uno::RuntimeException) - { readIntoMemory(); return m_aBuffer.getLength() - m_nOffset; }; - virtual void SAL_CALL closeInput( ) - throw (io::NotConnectedException, io::IOException, uno::RuntimeException) - { m_xStream->closeInput(); }; -}; - - -sal_Int32 SAL_CALL -InflateInputStream::readBytes(uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - readIntoMemory(); - sal_Int32 nAvailable = available(); - sal_Int32 nBytesToCopy = nAvailable < nBytesToRead ? nAvailable : nBytesToRead; - if( nBytesToCopy > 0 ) - { - aData.realloc(nBytesToCopy); - rtl_copyMemory(aData.getArray(), m_aBuffer.getConstArray() + m_nOffset, nBytesToCopy); - m_nOffset += nBytesToCopy; - } - - return nBytesToCopy; -}; - -void InflateInputStream::readIntoMemory() -{ - if( !m_bRead && m_xStream.is() ) - { - const sal_Int32 nBytesRequested = 4096; - - uno::Sequence < sal_Int8 > aTempBuffer(nBytesRequested); - uno::Sequence < sal_Int8 > aCompressedBuffer; - sal_Int32 nBytesRead; - - m_bRead = true; - - do - { - nBytesRead = m_xStream->readBytes(aTempBuffer, nBytesRequested); - - if( nBytesRead > 0 ) - { - sal_Int32 nOffset = aCompressedBuffer.getLength(); - aCompressedBuffer.realloc( nOffset + nBytesRead ); - - rtl_copyMemory(aCompressedBuffer.getArray() + nOffset, aTempBuffer.getConstArray(), nBytesRead); - } - } - while( nBytesRead == nBytesRequested ); - - z_stream *pStream = new z_stream; - /* memset to 0 to set zalloc/opaque etc */ - rtl_zeroMemory (pStream, sizeof(*pStream)); - - int windowSize = 15; - int headerOffset = 0; - - if( m_aContentEncoding.equalsAscii("gzip") ) - { - sal_uInt8 magic[2]; - magic[0] = *((sal_uInt8 *) aCompressedBuffer.getConstArray()); - magic[1] = *((sal_uInt8 *) aCompressedBuffer.getConstArray() + 1); - - if( (magic[0] == 0x1f) && (magic[1] == 0x8b) ) - { - windowSize = -14; - headerOffset = 10; - } - } - - pStream->next_in = (unsigned char *) aCompressedBuffer.getConstArray(); - pStream->avail_in = aCompressedBuffer.getLength(); - - pStream->next_in += headerOffset; - pStream->avail_in -= headerOffset; - - if( Z_OK == inflateInit2(pStream, windowSize) ) - { - int result; - - do - { - sal_Int32 nOffset = m_aBuffer.getLength(); - m_aBuffer.realloc(nOffset + 4096); - - pStream->next_out = reinterpret_cast < unsigned char* > ( m_aBuffer.getArray() + nOffset ); - pStream->avail_out = 4096; - - result = ::inflate(pStream, Z_FINISH); - - if( result == Z_STREAM_END ) - break; - - } while( result == Z_BUF_ERROR ); - - inflateEnd(pStream); - m_aBuffer.realloc(pStream->total_out); - - } - - if (pStream != NULL) - { - delete pStream; - pStream = NULL; - } - } -} - -//------------------------------------------------------------------------------ - class UpdateInformationProvider : - public ::cppu::WeakImplHelper5< deployment::XUpdateInformationProvider, + public ::cppu::WeakImplHelper4< deployment::XUpdateInformationProvider, ucb::XCommandEnvironment, ucb::XWebDAVCommandEnvironment, - lang::XServiceInfo, - task::XInteractionHandler > + lang::XServiceInfo > { public: static uno::Reference< uno::XInterface > createInstance(const uno::Reference<uno::XComponentContext>& xContext); @@ -358,10 +196,6 @@ public: virtual uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw (uno::RuntimeException); - // XInteractionHandler - virtual void SAL_CALL handle( const uno::Reference< task::XInteractionRequest >& rRequest ) - throw( uno::RuntimeException ); - protected: virtual ~UpdateInformationProvider(); @@ -373,8 +207,6 @@ private: void storeCommandInfo( sal_Int32 nCommandId, uno::Reference< ucb::XCommandProcessor > const & rxCommandProcessor); - bool initPasswordContainer( uno::Reference< task::XPasswordContainer > * pContainer ); - UpdateInformationProvider(const uno::Reference<uno::XComponentContext>& xContext, const uno::Reference< ucb::XContentIdentifierFactory >& xContentIdFactory, const uno::Reference< ucb::XContentProvider >& xContentProvider, @@ -392,6 +224,7 @@ private: uno::Reference< ucb::XCommandProcessor > m_xCommandProcessor; uno::Reference< task::XInteractionHandler > m_xInteractionHandler; + uno::Reference< task::XInteractionHandler > m_xPwContainerInteractionHandler; osl::Mutex m_aMutex; osl::Condition m_bCancelled; @@ -502,7 +335,7 @@ UpdateInformationProvider::UpdateInformationProvider( const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI ) : m_xContext(xContext), m_xContentIdFactory(xContentIdFactory), m_xContentProvider(xContentProvider), m_xDocumentBuilder(xDocumentBuilder), - m_xXPathAPI(xXPathAPI), m_aRequestHeaderList(2) + m_xXPathAPI(xXPathAPI), m_aRequestHeaderList(1) { uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); if( !xServiceManager.is() ) @@ -579,14 +412,11 @@ UpdateInformationProvider::UpdateInformationProvider( m_aRequestHeaderList[0].Name = UNISTRING("Accept-Language"); m_aRequestHeaderList[0].Value = getConfigurationItem( xConfigurationProvider, UNISTRING("org.openoffice.Setup/L10N"), UNISTRING("ooLocale") ); - m_aRequestHeaderList[1].Name = UNISTRING("Accept-Encoding"); - m_aRequestHeaderList[1].Value = uno::makeAny( UNISTRING("gzip,deflate") ); - if( aUserAgent.getLength() > 0 ) { - m_aRequestHeaderList.realloc(3); - m_aRequestHeaderList[2].Name = UNISTRING("User-Agent"); - m_aRequestHeaderList[2].Value = uno::makeAny(aUserAgent); + m_aRequestHeaderList.realloc(2); + m_aRequestHeaderList[1].Name = UNISTRING("User-Agent"); + m_aRequestHeaderList[1].Value = uno::makeAny(aUserAgent); } } @@ -661,33 +491,6 @@ UpdateInformationProvider::storeCommandInfo( //------------------------------------------------------------------------------ -bool UpdateInformationProvider::initPasswordContainer( uno::Reference< task::XPasswordContainer > * pContainer ) -{ - OSL_ENSURE( pContainer, "specification violation" ); - - if ( !pContainer->is() ) - { - uno::Reference<uno::XComponentContext> xContext(m_xContext); - - if( !xContext.is() ) - throw uno::RuntimeException( UNISTRING( "UpdateInformationProvider: empty component context" ), *this ); - - uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); - - if( !xServiceManager.is() ) - throw uno::RuntimeException( UNISTRING( "UpdateInformationProvider: unable to obtain service manager from component context" ), *this ); - - *pContainer = uno::Reference< task::XPasswordContainer >( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.task.PasswordContainer" ), xContext ), - uno::UNO_QUERY); - } - - OSL_ENSURE(pContainer->is(), "unexpected situation"); - return pContainer->is(); -} - -//------------------------------------------------------------------------------ - uno::Reference< io::XInputStream > UpdateInformationProvider::load(const rtl::OUString& rURL) { @@ -727,43 +530,13 @@ UpdateInformationProvider::load(const rtl::OUString& rURL) throw; } - - uno::Sequence< beans::Property > aProps( 1 ); - aProps[0].Name = UNISTRING( "Content-Encoding" ); - - aCommand.Name = UNISTRING("getPropertyValues"); - aCommand.Argument = uno::makeAny( aProps ); - - sal_Bool bCompressed = sal_False; - rtl::OUString aContentEncoding; - - try - { - uno::Any aResult = xCommandProcessor->execute(aCommand, 0, - static_cast < XCommandEnvironment *> (this)); - uno::Reference< sdbc::XRow > xPropList( aResult, uno::UNO_QUERY ); - if ( xPropList.is() ) { - aContentEncoding = xPropList->getString(1); - if( aContentEncoding.equalsAscii("gzip") || aContentEncoding.equalsAscii("deflate")) - bCompressed = sal_True; - } - } - catch( const uno::Exception &e ) - { - OSL_TRACE( "Caught exception: %s\n", - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr() ); - } - storeCommandInfo(0, uno::Reference< ucb::XCommandProcessor > ()); uno::Reference< ucb::XCommandProcessor2 > xCommandProcessor2(xCommandProcessor, uno::UNO_QUERY); if( xCommandProcessor2.is() ) xCommandProcessor2->releaseCommandIdentifier(nCommandId); - if ( bCompressed ) - return INPUT_STREAM( new InflateInputStream( aSink->getInputStream(), aContentEncoding ) ); - else - return INPUT_STREAM(aSink->getInputStream()); + return INPUT_STREAM(aSink->getInputStream()); } //------------------------------------------------------------------------------ @@ -974,7 +747,26 @@ UpdateInformationProvider::getInteractionHandler() if ( m_xInteractionHandler.is() ) return m_xInteractionHandler; else - return this; + { + try + { + // Supply an interaction handler that uses the password container + // service to obtain credentials without displaying a password gui. + + if ( !m_xPwContainerInteractionHandler.is() ) + m_xPwContainerInteractionHandler + = task::PasswordContainerInteractionHandler::create( + m_xContext ); + } + catch ( uno::RuntimeException const & ) + { + throw; + } + catch ( uno::Exception const & ) + { + } + return m_xPwContainerInteractionHandler; + } } //------------------------------------------------------------------------------ @@ -1024,101 +816,6 @@ UpdateInformationProvider::supportsService( rtl::OUString const & serviceName ) return sal_False; } -//------------------------------------------------------------------------------ - -void SAL_CALL UpdateInformationProvider::handle( uno::Reference< task::XInteractionRequest > const & rRequest) - throw (uno::RuntimeException) -{ - uno::Any aAnyRequest( rRequest->getRequest() ); - ucb::AuthenticationRequest aAuthenticationRequest; - - if ( aAnyRequest >>= aAuthenticationRequest ) - { - uno::Sequence< uno::Reference< task::XInteractionContinuation > > xContinuations = rRequest->getContinuations(); - uno::Reference< task::XInteractionHandler > xIH; - uno::Reference< ucb::XInteractionSupplyAuthentication > xSupplyAuthentication; - uno::Reference< task::XPasswordContainer > xContainer; - - for ( sal_Int32 i = 0; i < xContinuations.getLength(); ++i ) - { - xSupplyAuthentication = uno::Reference< ucb::XInteractionSupplyAuthentication >( - xContinuations[i], uno::UNO_QUERY ); - if ( xSupplyAuthentication.is() ) - break; - } - - // xContainer works with userName passwdSequences pairs: - if ( xSupplyAuthentication.is() && - aAuthenticationRequest.HasUserName && - aAuthenticationRequest.HasPassword && - initPasswordContainer( &xContainer ) ) - { - xIH = getInteractionHandler(); - try - { - if ( aAuthenticationRequest.UserName.getLength() == 0 ) - { - task::UrlRecord aRec( xContainer->find( aAuthenticationRequest.ServerName, xIH ) ); - if ( aRec.UserList.getLength() != 0 ) - { - if ( xSupplyAuthentication->canSetUserName() ) - xSupplyAuthentication->setUserName( aRec.UserList[0].UserName.getStr() ); - if ( xSupplyAuthentication->canSetPassword() ) - { - OSL_ENSURE( aRec.UserList[0].Passwords.getLength() != 0, "empty password list" ); - xSupplyAuthentication->setPassword( aRec.UserList[0].Passwords[0].getStr() ); - } - if ( aRec.UserList[0].Passwords.getLength() > 1 ) - { - if ( aAuthenticationRequest.HasRealm ) - { - if ( xSupplyAuthentication->canSetRealm() ) - xSupplyAuthentication->setRealm( aRec.UserList[0].Passwords[1].getStr() ); - } - else if ( xSupplyAuthentication->canSetAccount() ) - xSupplyAuthentication->setAccount( aRec.UserList[0].Passwords[1].getStr() ); - } - xSupplyAuthentication->select(); - return; - } - } - else - { - task::UrlRecord aRec(xContainer->findForName( aAuthenticationRequest.ServerName, - aAuthenticationRequest.UserName, - xIH)); - if ( aRec.UserList.getLength() != 0 ) - { - OSL_ENSURE( aRec.UserList[0].Passwords.getLength() != 0, "empty password list" ); - if ( !aAuthenticationRequest.HasPassword || - ( aAuthenticationRequest.Password != aRec.UserList[0].Passwords[0] ) ) - { - if ( xSupplyAuthentication->canSetUserName() ) - xSupplyAuthentication->setUserName( aRec.UserList[0].UserName.getStr() ); - if ( xSupplyAuthentication->canSetPassword() ) - xSupplyAuthentication->setPassword(aRec.UserList[0].Passwords[0].getStr()); - if ( aRec.UserList[0].Passwords.getLength() > 1 ) - { - if ( aAuthenticationRequest.HasRealm ) - { - if ( xSupplyAuthentication->canSetRealm() ) - xSupplyAuthentication->setRealm(aRec.UserList[0].Passwords[1].getStr()); - } - else if ( xSupplyAuthentication->canSetAccount() ) - xSupplyAuthentication->setAccount(aRec.UserList[0].Passwords[1].getStr()); - } - xSupplyAuthentication->select(); - return; - } - } - } - } - catch (task::NoMasterException const &) - {} // user did not enter master password - } - } -} - } // anonymous namespace //------------------------------------------------------------------------------ diff --git a/extensions/source/update/tools/makefile.mk b/extensions/source/update/tools/makefile.mk index 1abf7817aa27..c8c41532662e 100644 --- a/extensions/source/update/tools/makefile.mk +++ b/extensions/source/update/tools/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/tools/ztool.cxx b/extensions/source/update/tools/ztool.cxx index 2408b6bf65ce..6bb38c65d59a 100644 --- a/extensions/source/update/tools/ztool.cxx +++ b/extensions/source/update/tools/ztool.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ztool.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/ui/makefile.mk b/extensions/source/update/ui/makefile.mk index 135e7e1e730f..1cf95a52108d 100644 --- a/extensions/source/update/ui/makefile.mk +++ b/extensions/source/update/ui/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index c5ac7f485ca4..a2a8c31908fc 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatecheckui.cxx,v $ - * $Revision: 1.19.18.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/ui/updatecheckui.hrc b/extensions/source/update/ui/updatecheckui.hrc index c1d27546f28f..3d92e4579f58 100644 --- a/extensions/source/update/ui/updatecheckui.hrc +++ b/extensions/source/update/ui/updatecheckui.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatecheckui.hrc,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/extensions/source/update/ui/updatecheckui.src b/extensions/source/update/ui/updatecheckui.src index 8c7b70ab07be..39b6f44dce4d 100644 --- a/extensions/source/update/ui/updatecheckui.src +++ b/extensions/source/update/ui/updatecheckui.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatecheckui.src,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify |