Kaydet (Commit) cc506f01 authored tarafından Andreas Bille's avatar Andreas Bille

#104432# Changed to proxyconfig helper class

üst 7c6b58e4
......@@ -2,9 +2,9 @@
*
* $RCSfile: ftpcontent.cxx,v $
*
* $Revision: 1.16 $
* $Revision: 1.17 $
*
* last change: $Author: abi $ $Date: 2002-10-25 08:53:17 $
* last change: $Author: abi $ $Date: 2002-10-29 12:43:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -317,6 +317,7 @@ enum ACTION { NOACTION,
THROWINTERACTIVECONNECT,
THROWRESOLVENAME,
THROWQUOTE,
THROWNOFILE,
THROWGENERAL };
......@@ -428,6 +429,19 @@ Any SAL_CALL FTPContent::execute(
ucbhelper::cancelCommandExecution(
aRet,
Environment);
} else if(action == THROWNOFILE) {
Sequence<Any> seq(1);
PropertyValue value;
value.Name =
rtl::OUString::createFromAscii("Uri");
value.Handle = -1;
value.Value <<= m_aFTPURL.ident(false,false);
value.State = PropertyState_DIRECT_VALUE;
seq[0] <<= value;
ucbhelper::cancelCommandExecution(
IOErrorCode_NO_FILE,
seq,
Environment);
} else if(action == THROWQUOTE ||
action == THROWGENERAL) {
ucbhelper::cancelCommandExecution(
......@@ -580,6 +594,8 @@ Any SAL_CALL FTPContent::execute(
action = THROWACCESSDENIED;
else if(e.code() == CURLE_FTP_QUOTE_ERROR)
action = THROWQUOTE;
else if(e.code() == CURLE_FTP_COULDNT_RETR_FILE)
action = THROWNOFILE;
else
// nothing known about the course of the error
action = THROWGENERAL;
......@@ -647,7 +663,7 @@ FTPContent::getParent( )
throw (RuntimeException)
{
Reference<XContentIdentifier>
xIdent(new FTPContentIdentifier(m_aFTPURL.parent(),m_pFCP));
xIdent(new FTPContentIdentifier(m_aFTPURL.parent(false)));
Reference<XContent> xContent(m_xProvider->queryContent(xIdent));
return Reference<XInterface>(xContent,UNO_QUERY);
}
......@@ -861,7 +877,11 @@ Sequence<Any> FTPContent::setPropertyValues(
}
}
if(evt.getLength())
if(evt.getLength()) {
// title has changed
notifyPropertiesChange(evt);
exchange(new FTPContentIdentifier(m_aFTPURL.ident(false,false)));
}
return ret;
}
......@@ -2,9 +2,9 @@
*
* $RCSfile: ftpcontentidentifier.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: abi $ $Date: 2002-10-15 09:21:16 $
* last change: $Author: abi $ $Date: 2002-10-29 12:43:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -70,13 +70,13 @@
using namespace ftp;
using namespace com::sun::star::uno;
using namespace com::sun::star::ucb;
using namespace com::sun::star::lang;
FTPContentIdentifier::FTPContentIdentifier(
const rtl::OUString& aIdent,
FTPContentProvider* pFCP
const rtl::OUString& ident
)
: m_pURL(aIdent,pFCP)
: m_ident(ident)
{
}
......@@ -96,40 +96,79 @@ FTPContentIdentifier::queryInterface(
{
Any aRet =
::cppu::queryInterface(rType,
SAL_STATIC_CAST(XTypeProvider*,this),
SAL_STATIC_CAST(XContentIdentifier*,this));
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
}
void SAL_CALL FTPContentIdentifier::acquire( void ) throw() {
OWeakObject::acquire();
}
void SAL_CALL FTPContentIdentifier::release( void ) throw() {
OWeakObject::release();
}
::rtl::OUString SAL_CALL
Sequence<sal_Int8> SAL_CALL
FTPContentIdentifier::getImplementationId()
throw(RuntimeException)
{
static cppu::OImplementationId* pId = NULL;
if(!pId)
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pId )
{
static cppu::OImplementationId id( sal_False );
pId = &id;
}
}
return (*pId).getImplementationId();
}
Sequence<Type> SAL_CALL
FTPContentIdentifier::getTypes(
void )
throw(RuntimeException)
{
static cppu::OTypeCollection* pCollection = NULL;
if ( !pCollection ) {
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pCollection )
{
static cppu::OTypeCollection collection(
getCppuType(
static_cast<Reference<XTypeProvider>*>(0)),
getCppuType(
static_cast<Reference<XContentIdentifier>*>(0)));
pCollection = &collection;
}
}
return (*pCollection).getTypes();
}
rtl::OUString SAL_CALL
FTPContentIdentifier::getContentIdentifier(
)
throw (
::com::sun::star::uno::RuntimeException
com::sun::star::uno::RuntimeException
)
{
return m_pURL.ident(false,false);
return m_ident;
}
::rtl::OUString SAL_CALL
rtl::OUString SAL_CALL
FTPContentIdentifier::getContentProviderScheme(
)
throw (
::com::sun::star::uno::RuntimeException
com::sun::star::uno::RuntimeException
)
{
return rtl::OUString::createFromAscii("ftp");
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: ftpcontentidentifier.hxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: abi $ $Date: 2002-10-15 09:21:16 $
* last change: $Author: abi $ $Date: 2002-10-29 12:43:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -73,12 +73,12 @@
#include <cppuhelper/weak.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <com/sun/star/ucb/XContentIdentifier.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include "ftpdirp.hxx"
#include "ftpurl.hxx"
namespace ftp {
......@@ -87,12 +87,12 @@ namespace ftp {
class FTPContentIdentifier
: public cppu::OWeakObject,
public com::sun::star::lang::XTypeProvider,
public com::sun::star::ucb::XContentIdentifier
{
public:
FTPContentIdentifier(const rtl::OUString& ident,
FTPContentProvider* pFCP = 0);
FTPContentIdentifier(const rtl::OUString& ident);
~FTPContentIdentifier();
......@@ -106,6 +106,23 @@ namespace ftp {
virtual void SAL_CALL release( void ) throw();
// XTypeProvider
virtual
com::sun::star::uno::Sequence<com::sun::star::uno::Type> SAL_CALL
getTypes(
)
throw(
com::sun::star::uno::RuntimeException
);
virtual com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
getImplementationId(
)
throw(
com::sun::star::uno::RuntimeException
);
// XContentIdentifier
......@@ -113,7 +130,7 @@ namespace ftp {
getContentIdentifier(
)
throw (
::com::sun::star::uno::RuntimeException
com::sun::star::uno::RuntimeException
);
virtual ::rtl::OUString SAL_CALL
......@@ -126,7 +143,7 @@ namespace ftp {
private:
FTPURL m_pURL;
rtl::OUString m_ident;
};
}
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: ftpcontentprovider.hxx,v $
*
* $Revision: 1.6 $
* $Revision: 1.7 $
*
* last change: $Author: abi $ $Date: 2002-10-23 08:00:07 $
* last change: $Author: abi $ $Date: 2002-10-29 12:43:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -65,6 +65,7 @@
#include <vector>
#include <osl/mutex.hxx>
#include <ucbhelper/macros.hxx>
#include <ucbhelper/proxydecider.hxx>
#include <ucbhelper/providerhelper.hxx>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
......@@ -100,8 +101,7 @@ namespace ftp {
class FTPContentProvider:
public ::ucb::ContentProviderImplHelper,
public ::com::sun::star::container::XContainerListener,
public ::com::sun::star::lang::XComponent,
// public ::com::sun::star::lang::XComponent,
public FTPHandleProvider
{
public:
......@@ -125,62 +125,7 @@ namespace ftp {
throw( com::sun::star::ucb::IllegalIdentifierException,
com::sun::star::uno::RuntimeException );
// XComponent
virtual void SAL_CALL
dispose( )
throw (::com::sun::star::uno::RuntimeException)
{
if(m_xContainer.is())
{
m_xContainer->removeContainerListener(this);
m_xContainer =
com::sun::star::uno::Reference<
com::sun::star::container::XContainer>(0);
}
}
virtual void SAL_CALL
addEventListener(
const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XEventListener >& xListener )
throw (::com::sun::star::uno::RuntimeException) { }
virtual void SAL_CALL
removeEventListener(
const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XEventListener >& aListener )
throw (::com::sun::star::uno::RuntimeException) { }
// XConainerListener ( deriver from XEventListener )
virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject& Source )
throw (::com::sun::star::uno::RuntimeException)
{
m_xContainer =
com::sun::star::uno::Reference<
com::sun::star::container::XContainer>(0);
}
virtual void SAL_CALL
elementInserted(
const ::com::sun::star::container::ContainerEvent& Event )
throw (::com::sun::star::uno::RuntimeException) { }
virtual void SAL_CALL
elementRemoved(
const ::com::sun::star::container::ContainerEvent& Event )
throw (::com::sun::star::uno::RuntimeException) { }
virtual void SAL_CALL
elementReplaced(
const ::com::sun::star::container::ContainerEvent& Event )
throw (::com::sun::star::uno::RuntimeException);
/** FTPHandleProvider.
*/
// FTPHandleProvider.
virtual CURL* handle();
......@@ -209,51 +154,15 @@ namespace ftp {
osl::Mutex m_aMutex;
FTPLoaderThread *m_ftpLoaderThread;
sal_Int32 m_eType;
rtl::OUString m_aFtpProxy;
rtl::OUString m_aNoProxyList;
// used for access to ftp-proxy
com::sun::star::uno::Reference<
com::sun::star::ucb::XContentProviderManager > m_xManager;
com::sun::star::uno::Reference<
com::sun::star::container::XContainer> m_xContainer;
ucbhelper::InternetProxyDecider *m_pProxyDecider;
std::vector<ServerInfo> m_ServerInfo;
void init();
com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory >
getConfiguration() const;
com::sun::star::uno::Reference<
com::sun::star::container::XHierarchicalNameAccess >
getHierAccess(
const com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory >& sProvider,
const char* file ) const;
rtl::OUString
getKey(
const com::sun::star::uno::Reference<
com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
const char* key) const;
sal_Int32
getIntKey(
const com::sun::star::uno::Reference<
com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
const char* key) const;
com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider>
getHttpProvider()
throw(com::sun::star::uno::RuntimeException);
bool ShouldUseFtpProxy(const FTPURL& aURL) const;
}; // end class FTPContentProvider
} // end namespace ftp
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: ftpurl.cxx,v $
*
* $Revision: 1.12 $
* $Revision: 1.13 $
*
* last change: $Author: abi $ $Date: 2002-10-25 12:09:11 $
* last change: $Author: abi $ $Date: 2002-10-29 12:43:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -460,6 +460,9 @@ extern "C" int no_func(void *client, char *prompt, char*
FILE* FTPURL::open()
throw(curl_exception)
{
if(!m_aPathSegmentVec.size())
throw curl_exception(CURLE_FTP_COULDNT_RETR_FILE);
CURL *curl = m_pFCP->handle();
SET_CONTROL_CONTAINER;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment