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

#104432# Changed to proxyconfig helper class

üst 7c6b58e4
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpcontent.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -317,6 +317,7 @@ enum ACTION { NOACTION, ...@@ -317,6 +317,7 @@ enum ACTION { NOACTION,
THROWINTERACTIVECONNECT, THROWINTERACTIVECONNECT,
THROWRESOLVENAME, THROWRESOLVENAME,
THROWQUOTE, THROWQUOTE,
THROWNOFILE,
THROWGENERAL }; THROWGENERAL };
...@@ -428,6 +429,19 @@ Any SAL_CALL FTPContent::execute( ...@@ -428,6 +429,19 @@ Any SAL_CALL FTPContent::execute(
ucbhelper::cancelCommandExecution( ucbhelper::cancelCommandExecution(
aRet, aRet,
Environment); 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 || } else if(action == THROWQUOTE ||
action == THROWGENERAL) { action == THROWGENERAL) {
ucbhelper::cancelCommandExecution( ucbhelper::cancelCommandExecution(
...@@ -580,6 +594,8 @@ Any SAL_CALL FTPContent::execute( ...@@ -580,6 +594,8 @@ Any SAL_CALL FTPContent::execute(
action = THROWACCESSDENIED; action = THROWACCESSDENIED;
else if(e.code() == CURLE_FTP_QUOTE_ERROR) else if(e.code() == CURLE_FTP_QUOTE_ERROR)
action = THROWQUOTE; action = THROWQUOTE;
else if(e.code() == CURLE_FTP_COULDNT_RETR_FILE)
action = THROWNOFILE;
else else
// nothing known about the course of the error // nothing known about the course of the error
action = THROWGENERAL; action = THROWGENERAL;
...@@ -647,7 +663,7 @@ FTPContent::getParent( ) ...@@ -647,7 +663,7 @@ FTPContent::getParent( )
throw (RuntimeException) throw (RuntimeException)
{ {
Reference<XContentIdentifier> Reference<XContentIdentifier>
xIdent(new FTPContentIdentifier(m_aFTPURL.parent(),m_pFCP)); xIdent(new FTPContentIdentifier(m_aFTPURL.parent(false)));
Reference<XContent> xContent(m_xProvider->queryContent(xIdent)); Reference<XContent> xContent(m_xProvider->queryContent(xIdent));
return Reference<XInterface>(xContent,UNO_QUERY); return Reference<XInterface>(xContent,UNO_QUERY);
} }
...@@ -861,7 +877,11 @@ Sequence<Any> FTPContent::setPropertyValues( ...@@ -861,7 +877,11 @@ Sequence<Any> FTPContent::setPropertyValues(
} }
} }
if(evt.getLength()) if(evt.getLength()) {
// title has changed
notifyPropertiesChange(evt); notifyPropertiesChange(evt);
exchange(new FTPContentIdentifier(m_aFTPURL.ident(false,false)));
}
return ret; return ret;
} }
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpcontentidentifier.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -70,13 +70,13 @@ ...@@ -70,13 +70,13 @@
using namespace ftp; using namespace ftp;
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
using namespace com::sun::star::ucb; using namespace com::sun::star::ucb;
using namespace com::sun::star::lang;
FTPContentIdentifier::FTPContentIdentifier( FTPContentIdentifier::FTPContentIdentifier(
const rtl::OUString& aIdent, const rtl::OUString& ident
FTPContentProvider* pFCP
) )
: m_pURL(aIdent,pFCP) : m_ident(ident)
{ {
} }
...@@ -96,40 +96,79 @@ FTPContentIdentifier::queryInterface( ...@@ -96,40 +96,79 @@ FTPContentIdentifier::queryInterface(
{ {
Any aRet = Any aRet =
::cppu::queryInterface(rType, ::cppu::queryInterface(rType,
SAL_STATIC_CAST(XTypeProvider*,this),
SAL_STATIC_CAST(XContentIdentifier*,this)); SAL_STATIC_CAST(XContentIdentifier*,this));
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ); return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
} }
void SAL_CALL FTPContentIdentifier::acquire( void ) throw() { void SAL_CALL FTPContentIdentifier::acquire( void ) throw() {
OWeakObject::acquire(); OWeakObject::acquire();
} }
void SAL_CALL FTPContentIdentifier::release( void ) throw() { void SAL_CALL FTPContentIdentifier::release( void ) throw() {
OWeakObject::release(); 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( FTPContentIdentifier::getContentIdentifier(
) )
throw ( 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( FTPContentIdentifier::getContentProviderScheme(
) )
throw ( throw (
::com::sun::star::uno::RuntimeException com::sun::star::uno::RuntimeException
) )
{ {
return rtl::OUString::createFromAscii("ftp"); return rtl::OUString::createFromAscii("ftp");
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpcontentidentifier.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -73,12 +73,12 @@ ...@@ -73,12 +73,12 @@
#include <cppuhelper/weak.hxx> #include <cppuhelper/weak.hxx>
#include <cppuhelper/queryinterface.hxx> #include <cppuhelper/queryinterface.hxx>
#include <com/sun/star/ucb/XContentIdentifier.hpp> #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 "ftpdirp.hxx"
#include "ftpurl.hxx" #include "ftpurl.hxx"
namespace ftp { namespace ftp {
...@@ -87,12 +87,12 @@ namespace ftp { ...@@ -87,12 +87,12 @@ namespace ftp {
class FTPContentIdentifier class FTPContentIdentifier
: public cppu::OWeakObject, : public cppu::OWeakObject,
public com::sun::star::lang::XTypeProvider,
public com::sun::star::ucb::XContentIdentifier public com::sun::star::ucb::XContentIdentifier
{ {
public: public:
FTPContentIdentifier(const rtl::OUString& ident, FTPContentIdentifier(const rtl::OUString& ident);
FTPContentProvider* pFCP = 0);
~FTPContentIdentifier(); ~FTPContentIdentifier();
...@@ -106,6 +106,23 @@ namespace ftp { ...@@ -106,6 +106,23 @@ namespace ftp {
virtual void SAL_CALL release( void ) throw(); 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 // XContentIdentifier
...@@ -113,7 +130,7 @@ namespace ftp { ...@@ -113,7 +130,7 @@ namespace ftp {
getContentIdentifier( getContentIdentifier(
) )
throw ( throw (
::com::sun::star::uno::RuntimeException com::sun::star::uno::RuntimeException
); );
virtual ::rtl::OUString SAL_CALL virtual ::rtl::OUString SAL_CALL
...@@ -126,7 +143,7 @@ namespace ftp { ...@@ -126,7 +143,7 @@ namespace ftp {
private: private:
FTPURL m_pURL; rtl::OUString m_ident;
}; };
} }
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpcontentprovider.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#include <vector> #include <vector>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <ucbhelper/macros.hxx> #include <ucbhelper/macros.hxx>
#include <ucbhelper/proxydecider.hxx>
#include <ucbhelper/providerhelper.hxx> #include <ucbhelper/providerhelper.hxx>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
...@@ -100,8 +101,7 @@ namespace ftp { ...@@ -100,8 +101,7 @@ namespace ftp {
class FTPContentProvider: class FTPContentProvider:
public ::ucb::ContentProviderImplHelper, public ::ucb::ContentProviderImplHelper,
public ::com::sun::star::container::XContainerListener, // public ::com::sun::star::lang::XComponent,
public ::com::sun::star::lang::XComponent,
public FTPHandleProvider public FTPHandleProvider
{ {
public: public:
...@@ -125,62 +125,7 @@ namespace ftp { ...@@ -125,62 +125,7 @@ namespace ftp {
throw( com::sun::star::ucb::IllegalIdentifierException, throw( com::sun::star::ucb::IllegalIdentifierException,
com::sun::star::uno::RuntimeException ); com::sun::star::uno::RuntimeException );
// XComponent // FTPHandleProvider.
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.
*/
virtual CURL* handle(); virtual CURL* handle();
...@@ -209,51 +154,15 @@ namespace ftp { ...@@ -209,51 +154,15 @@ namespace ftp {
osl::Mutex m_aMutex; osl::Mutex m_aMutex;
FTPLoaderThread *m_ftpLoaderThread; FTPLoaderThread *m_ftpLoaderThread;
ucbhelper::InternetProxyDecider *m_pProxyDecider;
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;
std::vector<ServerInfo> m_ServerInfo; std::vector<ServerInfo> m_ServerInfo;
void init(); 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> com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider>
getHttpProvider() getHttpProvider()
throw(com::sun::star::uno::RuntimeException); throw(com::sun::star::uno::RuntimeException);
bool ShouldUseFtpProxy(const FTPURL& aURL) const;
}; // end class FTPContentProvider }; // end class FTPContentProvider
} // end namespace ftp } // end namespace ftp
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpurl.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -460,6 +460,9 @@ extern "C" int no_func(void *client, char *prompt, char* ...@@ -460,6 +460,9 @@ extern "C" int no_func(void *client, char *prompt, char*
FILE* FTPURL::open() FILE* FTPURL::open()
throw(curl_exception) throw(curl_exception)
{ {
if(!m_aPathSegmentVec.size())
throw curl_exception(CURLE_FTP_COULDNT_RETR_FILE);
CURL *curl = m_pFCP->handle(); CURL *curl = m_pFCP->handle();
SET_CONTROL_CONTAINER; 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