Kaydet (Commit) f797fe11 authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS ucpgio1 (1.1.2); FILE ADDED

2008/04/30 16:35:18 cmc 1.1.2.1: #i88090# add gio content provider
üst 725290a5
This diff is collapsed.
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gio_datasupplier.cxx,v $
* $Revision: 1.2 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include <vector>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/providerhelper.hxx>
#include <com/sun/star/ucb/OpenMode.hpp>
#include "gio_datasupplier.hxx"
#include "gio_content.hxx"
#include "gio_provider.hxx"
#include <stdio.h>
using namespace com::sun::star;
using namespace gio;
namespace gio
{
typedef std::vector< ResultListEntry* > ResultList;
DataSupplier::DataSupplier( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
const uno::Reference< ::gio::Content >& rContent, sal_Int32 nOpenMode )
: mxContent(rContent), m_xSMgr(rxSMgr), mnOpenMode(nOpenMode), mbCountFinal(false)
{
}
bool DataSupplier::getData()
{
if (mbCountFinal)
return true;
GFile *pFile = mxContent->getGFile();
GFileEnumerator* pEnumerator = g_file_enumerate_children(pFile, "*",
G_FILE_QUERY_INFO_NONE, NULL, NULL);
if (!pEnumerator)
return sal_False;
GFileInfo *pInfo = NULL;
while ((pInfo = g_file_enumerator_next_file (pEnumerator, NULL, NULL)))
{
switch ( mnOpenMode )
{
case ucb::OpenMode::FOLDERS:
if (g_file_info_get_file_type(pInfo) != G_FILE_TYPE_DIRECTORY)
continue;
break;
case ucb::OpenMode::DOCUMENTS:
if (g_file_info_get_file_type(pInfo) != G_FILE_TYPE_REGULAR)
continue;
break;
case ucb::OpenMode::ALL:
default:
break;
}
maResults.push_back( new ResultListEntry( pInfo ) );
g_object_unref(pInfo);
}
mbCountFinal = sal_True;
g_file_enumerator_close(pEnumerator, NULL, NULL);
return true;
}
DataSupplier::~DataSupplier()
{
ResultList::const_iterator it = maResults.begin();
ResultList::const_iterator end = maResults.end();
while ( it != end )
{
delete (*it);
it++;
}
}
::rtl::OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
{
if ( nIndex < maResults.size() )
{
::rtl::OUString aId = maResults[ nIndex ]->aId;
if ( aId.getLength() )
{
// Already cached.
return aId;
}
}
if ( getResult( nIndex ) )
{
GFile *pFile = mxContent->getGFile();
char* parent = g_file_get_uri(pFile);
rtl::OUString aId = rtl::OUString::createFromAscii( parent );
g_free(parent);
char *escaped_name =
g_uri_escape_string( g_file_info_get_name(maResults[ nIndex ]->pInfo) , NULL, false);
if ( ( aId.lastIndexOf( '/' ) + 1 ) != aId.getLength() )
aId += rtl::OUString::createFromAscii( "/" );
aId += rtl::OUString::createFromAscii( escaped_name );
g_free( escaped_name );
maResults[ nIndex ]->aId = aId;
return aId;
return aId;
}
return ::rtl::OUString();
}
uno::Reference< ucb::XContentIdentifier > DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
{
if ( nIndex < maResults.size() )
{
uno::Reference< ucb::XContentIdentifier > xId = maResults[ nIndex ]->xId;
if ( xId.is() )
{
// Already cached.
return xId;
}
}
::rtl::OUString aId = queryContentIdentifierString( nIndex );
if ( aId.getLength() )
{
uno::Reference< ucb::XContentIdentifier > xId = new ucbhelper::ContentIdentifier( aId );
maResults[ nIndex ]->xId = xId;
return xId;
}
return uno::Reference< ucb::XContentIdentifier >();
}
uno::Reference< ucb::XContent > DataSupplier::queryContent( sal_uInt32 nIndex )
{
if ( nIndex < maResults.size() )
{
uno::Reference< ucb::XContent > xContent = maResults[ nIndex ]->xContent;
if ( xContent.is() )
{
// Already cached.
return xContent;
}
}
uno::Reference< ucb::XContentIdentifier > xId = queryContentIdentifier( nIndex );
if ( xId.is() )
{
try
{
uno::Reference< ucb::XContent > xContent = mxContent->getProvider()->queryContent( xId );
maResults[ nIndex ]->xContent = xContent;
return xContent;
}
catch ( ucb::IllegalIdentifierException& )
{
}
}
return uno::Reference< ucb::XContent >();
}
sal_Bool DataSupplier::getResult( sal_uInt32 nIndex )
{
if ( maResults.size() > nIndex ) // Result already present.
return sal_True;
if ( getData() && maResults.size() > nIndex )
return sal_True;
return sal_False;
}
sal_uInt32 DataSupplier::totalCount()
{
getData();
return maResults.size();
}
sal_uInt32 DataSupplier::currentCount()
{
return maResults.size();
}
sal_Bool DataSupplier::isCountFinal()
{
return mbCountFinal;
}
uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
{
if ( nIndex < maResults.size() )
{
uno::Reference< sdbc::XRow > xRow = maResults[ nIndex ]->xRow;
if ( xRow.is() )
{
// Already cached.
return xRow;
}
}
if ( getResult( nIndex ) )
{
uno::Reference< sdbc::XRow > xRow = Content::getPropertyValuesFromGFileInfo(
maResults[ nIndex ]->pInfo, m_xSMgr, getResultSet()->getProperties());
maResults[ nIndex ]->xRow = xRow;
return xRow;
}
return uno::Reference< sdbc::XRow >();
}
void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
{
if ( nIndex < maResults.size() )
maResults[ nIndex ]->xRow = uno::Reference< sdbc::XRow >();
}
void DataSupplier::close()
{
}
void DataSupplier::validate() throw( ucb::ResultSetException )
{
}
}
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gio_datasupplier.hxx,v $
* $Revision: 1.2 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef GIO_DATASUPPLIER_HXX
#define GIO_DATASUPPLIER_HXX
#include <ucbhelper/resultset.hxx>
#include "gio_content.hxx"
#include <vector>
namespace gio
{
class Content;
struct ResultListEntry
{
::rtl::OUString aId;
com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > xId;
com::sun::star::uno::Reference< com::sun::star::ucb::XContent > xContent;
com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > xRow;
GFileInfo *pInfo;
ResultListEntry( GFileInfo *pInInfo ) : pInfo(pInInfo)
{
g_object_ref( pInfo );
}
~ResultListEntry()
{
g_object_unref( pInfo );
}
};
typedef std::vector< ResultListEntry* > ResultList;
class DataSupplier : public ucbhelper::ResultSetDataSupplier
{
private:
com::sun::star::uno::Reference< ::gio::Content > mxContent;
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
sal_Int32 mnOpenMode;
bool mbCountFinal;
bool getData();
ResultList maResults;
public:
DataSupplier( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
const com::sun::star::uno::Reference< Content >& rContent, sal_Int32 nOpenMode );
virtual ~DataSupplier();
virtual rtl::OUString queryContentIdentifierString( sal_uInt32 nIndex );
virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >
queryContentIdentifier( sal_uInt32 nIndex );
virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
queryContent( sal_uInt32 nIndex );
virtual sal_Bool getResult( sal_uInt32 nIndex );
virtual sal_uInt32 totalCount();
virtual sal_uInt32 currentCount();
virtual sal_Bool isCountFinal();
virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
queryPropertyValues( sal_uInt32 nIndex );
virtual void releasePropertyValues( sal_uInt32 nIndex );
virtual void close();
virtual void validate()
throw( com::sun::star::ucb::ResultSetException );
};
}
#endif
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gio_inputstream.cxx,v $
* $Revision: 1.2 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include <rtl/memory.h>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
#include <ucbhelper/cancelcommandexecution.hxx>
#include <string.h>
#include "gio_inputstream.hxx"
#include "gio_content.hxx"
using namespace com::sun::star;
namespace gio
{
InputStream::InputStream(GFileInputStream *pStream) : Seekable(G_SEEKABLE(pStream)), mpStream(pStream)
{
if (!mpStream)
throw io::NotConnectedException();
}
InputStream::~InputStream( void )
{
closeInput();
}
sal_Int32 SAL_CALL InputStream::available()
throw( io::NotConnectedException, io::IOException, uno::RuntimeException )
{
return 0;
}
void SAL_CALL InputStream::closeInput()
throw( io::NotConnectedException, io::IOException, uno::RuntimeException )
{
if (mpStream)
g_input_stream_close(G_INPUT_STREAM(mpStream), NULL, NULL);
}
void SAL_CALL InputStream::skipBytes( sal_Int32 nBytesToSkip )
throw( io::NotConnectedException, io::BufferSizeExceededException,
io::IOException, uno::RuntimeException )
{
if (!mpStream)
throw io::NotConnectedException();
if (!g_seekable_can_seek(G_SEEKABLE(mpStream)))
throw io::IOException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Seek unsupported")),
static_cast< cppu::OWeakObject * >(this));
GError *pError=NULL;
if (!g_seekable_seek(G_SEEKABLE(mpStream), nBytesToSkip, G_SEEK_CUR, NULL, &pError))
convertToException(pError, static_cast< cppu::OWeakObject * >(this));
}
sal_Int32 SAL_CALL InputStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
throw( io::NotConnectedException, io::BufferSizeExceededException,
io::IOException, uno::RuntimeException )
{
if (!mpStream)
throw io::NotConnectedException();
try
{
aData.realloc( nBytesToRead );
}
catch ( const uno::Exception &e )
{
throw io::BufferSizeExceededException();
}
gsize nBytesRead = 0;
GError *pError=NULL;
if (!g_input_stream_read_all(G_INPUT_STREAM(mpStream), aData.getArray(), nBytesToRead, &nBytesRead, NULL, &pError))
convertToException(pError, static_cast< cppu::OWeakObject * >(this));
aData.realloc(nBytesRead);
return nBytesRead;
}
sal_Int32 SAL_CALL InputStream::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
throw( io::NotConnectedException, io::BufferSizeExceededException,
io::IOException, uno::RuntimeException )
{
return readBytes(aData, nMaxBytesToRead);
}
uno::Any InputStream::queryInterface( const uno::Type &type ) throw( uno::RuntimeException )
{
uno::Any aRet = ::cppu::queryInterface ( type,
static_cast< XInputStream * >( this ) );
return aRet.hasValue() ? aRet : Seekable::queryInterface( type );
}
}
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gio_inputstream.hxx,v $
* $Revision: 1.2 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef GIO_INPUTSTREAM_HXX
#define GIO_INPUTSTREAM_HXX
#include <sal/types.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/weak.hxx>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include "gio_seekable.hxx"
namespace gio
{
class InputStream :
public ::com::sun::star::io::XInputStream,
public Seekable
{
private:
GFileInputStream *mpStream;
public:
InputStream ( GFileInputStream *pStream );
virtual ~InputStream();
// XInterface
virtual com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & type )
throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL acquire( void ) throw () { OWeakObject::acquire(); }
virtual void SAL_CALL release( void ) throw() { OWeakObject::release(); }
// XInputStream
virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 > & aData,
sal_Int32 nBytesToRead )
throw( ::com::sun::star::io::NotConnectedException,
::com::sun::star::io::BufferSizeExceededException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException );
virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 > & aData,
sal_Int32 nMaxBytesToRead )
throw( ::com::sun::star::io::NotConnectedException,
::com::sun::star::io::BufferSizeExceededException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
throw( ::com::sun::star::io::NotConnectedException,
::com::sun::star::io::BufferSizeExceededException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException );
virtual sal_Int32 SAL_CALL available( void )
throw( ::com::sun::star::io::NotConnectedException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL closeInput( void )
throw( ::com::sun::star::io::NotConnectedException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException );
};
} // namespace gio
#endif
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gio_mount.cxx,v $
* $Revision: 1.2 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "gio_mount.hxx"
#include <ucbhelper/simpleauthenticationrequest.hxx>
#include <stdio.h>
#include <string.h>
G_DEFINE_TYPE (OOoMountOperation, ooo_mount_operation, G_TYPE_MOUNT_OPERATION);
static void ooo_mount_operation_ask_password (GMountOperation *op,
const char *message, const char *default_user, const char *default_domain,
GAskPasswordFlags flags);
static void ooo_mount_operation_init (OOoMountOperation *op)
{
op->m_pPrevPassword = NULL;
op->m_pPrevUsername = NULL;
}
static void ooo_mount_operation_finalize (GObject *object)
{
OOoMountOperation *mount_op = OOO_MOUNT_OPERATION (object);
if (mount_op->m_pPrevUsername)
free(mount_op->m_pPrevUsername);
if (mount_op->m_pPrevPassword)
free(mount_op->m_pPrevPassword);
G_OBJECT_CLASS (ooo_mount_operation_parent_class)->finalize (object);
}
static void ooo_mount_operation_class_init (OOoMountOperationClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = ooo_mount_operation_finalize;
GMountOperationClass *mount_op_class = G_MOUNT_OPERATION_CLASS (klass);
mount_op_class->ask_password = ooo_mount_operation_ask_password;
}
using namespace com::sun::star;
static void ooo_mount_operation_ask_password (GMountOperation *op,
const char *message, const char *default_user,
const char *default_domain, GAskPasswordFlags flags)
{
uno::Reference< task::XInteractionHandler > xIH;
OOoMountOperation *pThis = (OOoMountOperation*)op;
const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > &xEnv = *(pThis->pEnv);
if (xEnv.is())
xIH = xEnv->getInteractionHandler();
if (!xIH.is())
{
g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
return;
}
::rtl::OUString aHostName, aDomain, aUserName, aPassword;
ucbhelper::SimpleAuthenticationRequest::EntityType eUserName =
(flags & G_ASK_PASSWORD_NEED_USERNAME)
? ucbhelper::SimpleAuthenticationRequest::ENTITY_MODIFY
: ucbhelper::SimpleAuthenticationRequest::ENTITY_NA;
if (default_user)
aUserName = rtl::OUString(default_user, strlen(default_user), RTL_TEXTENCODING_UTF8);
ucbhelper::SimpleAuthenticationRequest::EntityType ePassword =
(flags & G_ASK_PASSWORD_NEED_PASSWORD)
? ucbhelper::SimpleAuthenticationRequest::ENTITY_MODIFY
: ucbhelper::SimpleAuthenticationRequest::ENTITY_NA;
rtl::OUString aPrevPassword, aPrevUsername;
if (pThis->m_pPrevUsername)
aPrevUsername = rtl::OUString(pThis->m_pPrevUsername, strlen(pThis->m_pPrevUsername), RTL_TEXTENCODING_UTF8);
if (pThis->m_pPrevPassword)
aPrevPassword = rtl::OUString(pThis->m_pPrevPassword, strlen(pThis->m_pPrevPassword), RTL_TEXTENCODING_UTF8);
//The damn dialog is stupidly broken, so do like webdav, i.e. "#102871#"
if ( aUserName.getLength() == 0 )
aUserName = aPrevUsername;
if ( aPassword.getLength() == 0 )
aPassword = aPrevPassword;
ucbhelper::SimpleAuthenticationRequest::EntityType eDomain =
(flags & G_ASK_PASSWORD_NEED_DOMAIN)
? ucbhelper::SimpleAuthenticationRequest::ENTITY_MODIFY
: ucbhelper::SimpleAuthenticationRequest::ENTITY_NA;
if (default_domain)
aDomain = rtl::OUString(default_domain, strlen(default_domain), RTL_TEXTENCODING_UTF8);
uno::Reference< ucbhelper::SimpleAuthenticationRequest > xRequest
= new ucbhelper::SimpleAuthenticationRequest (aHostName, eDomain, aDomain, eUserName, aUserName, ePassword, aPassword);
xIH->handle( xRequest.get() );
rtl::Reference< ucbhelper::InteractionContinuation > xSelection = xRequest->getSelection();
if ( !xSelection.is() )
{
g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
return;
}
uno::Reference< task::XInteractionAbort > xAbort(xSelection.get(), uno::UNO_QUERY );
if ( xAbort.is() )
{
g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
return;
}
const rtl::Reference< ucbhelper::InteractionSupplyAuthentication > & xSupp = xRequest->getAuthenticationSupplier();
aUserName = xSupp->getUserName();
aPassword = xSupp->getPassword();
if (flags & G_ASK_PASSWORD_NEED_USERNAME)
g_mount_operation_set_username(op, rtl::OUStringToOString(aUserName, RTL_TEXTENCODING_UTF8).getStr());
if (flags & G_ASK_PASSWORD_NEED_PASSWORD)
g_mount_operation_set_password(op, rtl::OUStringToOString(aPassword, RTL_TEXTENCODING_UTF8).getStr());
if (flags & G_ASK_PASSWORD_NEED_DOMAIN)
g_mount_operation_set_domain(op, rtl::OUStringToOString(xSupp->getRealm(), RTL_TEXTENCODING_UTF8).getStr());
switch (xSupp->getRememberPasswordMode())
{
default:
case ucb::RememberAuthentication_NO:
g_mount_operation_set_password_save(op, G_PASSWORD_SAVE_NEVER);
break;
case ucb::RememberAuthentication_SESSION:
g_mount_operation_set_password_save(op, G_PASSWORD_SAVE_FOR_SESSION);
break;
case ucb::RememberAuthentication_PERSISTENT:
g_mount_operation_set_password_save(op, G_PASSWORD_SAVE_PERMANENTLY);
break;
}
if (pThis->m_pPrevPassword)
free(pThis->m_pPrevPassword);
pThis->m_pPrevPassword = strdup(rtl::OUStringToOString(aPassword, RTL_TEXTENCODING_UTF8).getStr());
if (pThis->m_pPrevUsername)
free(pThis->m_pPrevUsername);
pThis->m_pPrevUsername = strdup(rtl::OUStringToOString(aUserName, RTL_TEXTENCODING_UTF8).getStr());
g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED);
}
GMountOperation *ooo_mount_operation_new(const uno::Reference< ucb::XCommandEnvironment >& rEnv)
{
OOoMountOperation *pRet = (OOoMountOperation*)g_object_new (OOO_TYPE_MOUNT_OPERATION, NULL);
pRet->pEnv = &rEnv;
return (GMountOperation*)pRet;
}
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