ditch gnome-vfs2 support

Change-Id: I882c04fd3a255f55511b1884157de26e7574e6db
Reviewed-on: https://gerrit.libreoffice.org/18262
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2015-09-02 12:02:11 +01:00
parent daa869222e
commit b40b601007
33 changed files with 6 additions and 3499 deletions

View File

@@ -248,7 +248,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,gnome, \
$(if $(ENABLE_SYSTRAY_GTK),qstart_gtk) \
$(if $(ENABLE_GIO),losessioninstall) \
$(if $(ENABLE_GIO),ucpgio1) \
$(if $(ENABLE_GNOMEVFS),ucpgvfs1) \
))
$(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,kde, \

View File

@@ -11,7 +11,6 @@ Settings about which X11 desktops have support enabled.
#define ENABLE_KDE 0
#define ENABLE_KDE4 0
#define ENABLE_TDE 0
#define ENABLE_GNOME_VFS 0
#define ENABLE_GIO 0
#endif

View File

@@ -1166,12 +1166,6 @@ AC_ARG_ENABLE(gconf,
[Determines whether to use the GConf support.]),
,enable_gconf=yes)
AC_ARG_ENABLE(gnome-vfs,
AS_HELP_STRING([--enable-gnome-vfs],
[Determines whether to use the Gnome Virtual Filing System on platforms
where that VFS is available.]),
,enable_gnome_vfs=no)
AC_ARG_ENABLE(gio,
AS_HELP_STRING([--disable-gio],
[Determines whether to use the GIO support.]),
@@ -10069,25 +10063,6 @@ AC_SUBST(GCONF_LIBS)
AC_SUBST(GCONF_CFLAGS)
AC_SUBST(ENABLE_GCONF)
dnl ===================================================================
dnl Gnome VFS check
dnl ===================================================================
ENABLE_GNOMEVFS=""
AC_MSG_CHECKING([whether to enable GNOME VFS support])
if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
ENABLE_GNOMEVFS="TRUE"
AC_MSG_RESULT([yes])
PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
AC_DEFINE(ENABLE_GNOME_VFS)
else
AC_MSG_RESULT([no])
fi
AC_SUBST(GNOMEVFS_LIBS)
AC_SUBST(GNOMEVFS_CFLAGS)
AC_SUBST(ENABLE_GNOMEVFS)
dnl ===================================================================
dnl check for dbus support
dnl ===================================================================
@@ -10218,9 +10193,6 @@ if test "$test_gtk" = "yes"; then
AC_MSG_CHECKING([whether to enable GIO support])
if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
if test "$ENABLE_GNOMEVFS" = "TRUE"; then
AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
fi
dnl Need at least 2.26 for the dbus support.
PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
[ENABLE_GIO="TRUE"], [ENABLE_GIO=""])

View File

@@ -72,33 +72,6 @@ static void configureUcb()
// For backwards compatibility, in case some code still uses plain
// createInstance w/o args directly to obtain an instance:
UniversalContentBroker::create(comphelper::getProcessComponentContext());
#if ENABLE_GNOME_VFS
try {
// Instantiate GNOME-VFS UCP in the thread that initialized GNOME in order
// to avoid a deadlock that may occur in case the UCP gets initialized from
// a different thread (which may happen when calling remotely via UNO); this
// is not a fix, just a workaround:
Reference< XCurrentContext > xCurrentContext(getCurrentContext());
Any aValue(xCurrentContext->getValueByName("system.desktop-environment"));
OUString aDesktopEnvironment;
if ((aValue >>= aDesktopEnvironment) && aDesktopEnvironment == "GNOME")
{
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
UniversalContentBroker::create(xContext)
->registerContentProvider(
Reference<XContentProvider>(
xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.ucb.GnomeVFSContentProvider", xContext),
UNO_QUERY_THROW),
".*", false);
}
}
catch ( const Exception & )
{
SAL_WARN( "desktop.app", "missing gnome-vfs component to initialize thread workaround" );
}
#endif // ENABLE_GNOME_VFS
}
void Desktop::InitApplicationServiceManager()

View File

@@ -2,7 +2,6 @@
--disable-cairo-canvas
--disable-cups
--disable-gconf
--disable-gnome-vfs
--disable-gstreamer-0-10
--disable-gstreamer-1-0
--disable-liblangtag

View File

@@ -2,7 +2,6 @@
--disable-cairo-canvas
--disable-cups
--disable-gconf
--disable-gnome-vfs
--disable-gstreamer-0-10
--disable-gstreamer-1-0
--disable-liblangtag

View File

@@ -2,7 +2,6 @@
--disable-cairo-canvas
--disable-cups
--disable-gconf
--disable-gnome-vfs
--disable-gstreamer-0-10
--disable-gstreamer-1-0
--disable-liblangtag

View File

@@ -1,7 +1,6 @@
--enable-assert-always-abort
--without-help
--enable-gio
--disable-gnome-vfs
--without-myspell-dicts
--disable-ccache
--disable-gstreamer-0-10

View File

@@ -27,7 +27,6 @@
--enable-gstreamer-0-10
--disable-gstreamer-1-0
--enable-evolution2
--disable-gnome-vfs
--enable-gio
--enable-scripting-beanshell
--enable-scripting-javascript

View File

@@ -1,6 +1,5 @@
--disable-dbus
--disable-epm
--disable-gnome-vfs
--disable-kde
--disable-kde4
--disable-nss-module

View File

@@ -26,7 +26,6 @@
--enable-extra-font
--with-lang=en-US hu de fr it tr ka fi pl nl pt-BR es ja zh-CN sv cs ko sl
--enable-dbus
--enable-gnome-vfs
--enable-extensions
--enable-extension-integration
--enable-ext-wiki-publisher

View File

@@ -354,7 +354,6 @@ certain functionality.
@li @c ucb.ucp.file
@li @c ucb.ucp.ftp
@li @c ucb.ucp.gio
@li @c ucb.ucp.gvfs
@li @c ucb.ucp.webdav
@section unotools

View File

@@ -19,13 +19,6 @@
cat > /dev/null
[[ "${PLATFORMID}" == "linux_x86_64" ]] && mark64="()(64bit)"
if [[ "${ENABLE_GNOMEVFS}" == "TRUE" ]]; then
if [[ "${OS}" == "AIX" ]]; then
echo "libgnomevfs-2.a(libgnomevfs-2.so.0${mark64})"
else
echo "libgnomevfs-2.so.0${mark64}"
fi
fi
if [[ "${OS}" == "AIX" ]]; then
echo "libgconf-2.a(libgconf-2.so.4${mark64})"
else

View File

@@ -329,11 +329,6 @@ postprocess_DRIVERS += ado
endif
ifneq ($(WITH_WEBDAV),)
postprocess_FILES_main += $(postprocess_MOD)/org/openoffice/ucb/Configuration-webdav.xcu
ifeq ($(WITH_WEBDAV),neon)
ifeq ($(ENABLE_GNOMEVFS),TRUE)
postprocess_FILES_main += $(postprocess_MOD)/org/openoffice/ucb/Configuration-webdav_neon_gnomevfs.xcu
endif
endif
endif
ifeq ($(ENABLE_EVOAB2),TRUE)
postprocess_FILES_main += $(call gb_XcuModuleTarget_get_target,connectivity/registry/evoab2)/org/openoffice/Office/DataAccess/Drivers-evoab2.xcu

View File

@@ -199,9 +199,6 @@ $(eval $(call gb_Rdb_add_components,services,\
shell/source/sessioninstall/losessioninstall \
ucb/source/ucp/gio/ucpgio \
) \
$(if $(ENABLE_GNOMEVFS), \
ucb/source/ucp/gvfs/ucpgvfs \
) \
$(if $(ENABLE_GSTREAMER_1_0), \
avmedia/source/gstreamer/avmediagstreamer \
) \

View File

@@ -13,9 +13,8 @@ $(eval $(call gb_InstallModule_use_auto_install_libs,scp2/gnome,gnome))
$(eval $(call gb_InstallModule_define_if_set,scp2/gnome,\
ENABLE_GIO \
ENABLE_GNOMEVFS \
ENABLE_LOCKDOWN \
ENABLE_GTK \
ENABLE_GTK \
))
$(eval $(call gb_InstallModule_add_scpfiles,scp2/gnome,\

View File

@@ -33,7 +33,7 @@ $(eval $(call gb_InstallScript_use_modules,setup_osl,\
$(if $(WITH_EXTENSION_INTEGRATION),\
scp2/extensions \
) \
$(if $(filter TRUE,$(ENABLE_EVOAB2) $(ENABLE_GCONF) $(ENABLE_GNOMEVFS) $(ENABLE_GIO) $(ENABLE_GTK) $(ENABLE_GTK3)),\
$(if $(filter TRUE,$(ENABLE_EVOAB2) $(ENABLE_GCONF) $(ENABLE_GIO) $(ENABLE_GTK) $(ENABLE_GTK3)),\
scp2/gnome \
) \
$(if $(filter TRUE,$(ENABLE_KDE) $(ENABLE_KDE4)),\

View File

@@ -39,7 +39,7 @@ $(eval $(call gb_Module_add_targets,scp2,\
InstallModule_winexplorerext \
) \
) \
$(if $(filter TRUE,$(ENABLE_EVOAB2) $(ENABLE_GCONF) $(ENABLE_GNOMEVFS) $(ENABLE_GIO) $(ENABLE_GTK) $(ENABLE_GTK3)),\
$(if $(filter TRUE,$(ENABLE_EVOAB2) $(ENABLE_GCONF) $(ENABLE_GIO) $(ENABLE_GTK) $(ENABLE_GTK3)),\
InstallModule_gnome \
) \
$(if $(filter TRUE,$(ENABLE_KDE) $(ENABLE_KDE4)),\

View File

@@ -26,11 +26,8 @@ Module gid_Module_Optional_Gnome
PackageInfo = "packinfo_office.txt";
MOD_NAME_DESC(MODULE_OPTIONAL_GNOME);
Styles = ();
#ifdef ENABLE_GNOMEVFS
XpdCheckSolaris = "SUNWgnome-vfs";
#endif
Files = (auto_gnome_ALL,
#if (defined ENABLE_GNOMEVFS && defined ENABLE_LOCKDOWN) || defined ENABLE_GIO
#if defined ENABLE_GIO
gid_File_Share_Registry_Gnome_Xcd,
#endif
gid_File_Bin_Gnome_Open_Url

View File

@@ -12,8 +12,6 @@ include $(SRCDIR)/sysui/productlist.mk
ifeq ($(ENABLE_GIO),TRUE)
brand_URIPARAM := --urls
else ifeq ($(ENABLE_GNOMEVFS),TRUE)
brand_URIPARAM := --urls
else ifeq ($(ENABLE_TDE),TRUE)
brand_URIPARAM := --urls
else ifeq ($(ENABLE_KDE),TRUE)

View File

@@ -1,42 +0,0 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Library_Library,ucpgvfs1))
$(eval $(call gb_Library_set_componentfile,ucpgvfs1,ucb/source/ucp/gvfs/ucpgvfs))
$(eval $(call gb_Library_set_include,ucpgvfs1,\
$(GNOMEVFS_CFLAGS) \
$$(INCLUDE) \
))
$(eval $(call gb_Library_use_sdk_api,ucpgvfs1))
$(eval $(call gb_Library_add_libs,ucpgvfs1,\
$(GNOMEVFS_LIBS) \
))
$(eval $(call gb_Library_use_libraries,ucpgvfs1,\
comphelper \
cppu \
cppuhelper \
sal \
salhelper \
ucbhelper \
))
$(eval $(call gb_Library_add_exception_objects,ucpgvfs1,\
ucb/source/ucp/gvfs/gvfs_content \
ucb/source/ucp/gvfs/gvfs_directory \
ucb/source/ucp/gvfs/gvfs_provider \
ucb/source/ucp/gvfs/gvfs_stream \
))
# vim: set noet sw=4 ts=4:

View File

@@ -30,12 +30,6 @@ $(eval $(call gb_Module_add_targets,ucb,\
))
endif
ifeq ($(ENABLE_GNOMEVFS),TRUE)
$(eval $(call gb_Module_add_targets,ucb,\
Library_ucpgvfs1 \
))
endif
$(eval $(call gb_Module_add_subsequentcheck_targets,ucb,\
JunitTest_ucb_complex \
JunitTest_ucb_unoapi \

File diff suppressed because it is too large Load Diff

View File

@@ -1,272 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_CONTENT_HXX
#define INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_CONTENT_HXX
#include <memory>
#include <list>
#include <rtl/ref.hxx>
#include <com/sun/star/ucb/ContentCreationException.hpp>
#include <com/sun/star/ucb/XContentCreator.hpp>
#include <ucbhelper/contenthelper.hxx>
#include <glib.h>
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomevfs/gnome-vfs-directory.h>
namespace com { namespace sun { namespace star { namespace beans {
struct Property;
struct PropertyValue;
} } } }
namespace com { namespace sun { namespace star { namespace io {
class XInputStream;
class XOutputStream;
} } } }
namespace com { namespace sun { namespace star { namespace sdbc {
class XRow;
} } } }
namespace com { namespace sun { namespace star { namespace ucb {
struct TransferInfo;
} } } }
namespace gvfs
{
class ContentProvider;
// Random made up names - AFAICS
#define GVFS_FILE_TYPE "application/vnd.sun.staroffice.gvfs-file"
#define GVFS_FOLDER_TYPE "application/vnd.sun.staroffice.gvfs-folder"
class Authentication
{
public:
// Helper class to make exceptions pleasant
explicit Authentication( const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment > & xEnv );
~Authentication();
};
class Content : public ::ucbhelper::ContentImplHelper,
public com::sun::star::ucb::XContentCreator
{
// Internals
private:
typedef rtl::Reference< Content > ContentRef;
typedef std::list< ContentRef > ContentRefList;
// Instance data
ContentProvider *m_pProvider; // No need for a ref, base class holds object
sal_Bool m_bTransient; // A non-existent (as yet) item
GnomeVFSFileInfo m_info; // cached status information
// Internal helpers
void queryChildren ( ContentRefList& rChildren );
::com::sun::star::uno::Any getBadArgExcept ();
GnomeVFSResult getInfo ( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& xEnv );
sal_Bool isFolder ( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& xEnv );
sal_Bool exchangeIdentity( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContentIdentifier >& xNewId);
GnomeVFSResult doSetFileInfo ( const GnomeVFSFileInfo *newInfo,
GnomeVFSSetFileInfoMask setMask,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& xEnv );
OUString makeNewURL ( const char *newName );
// End Internal helpers
// For ucbhelper
virtual OUString getParentURL() SAL_OVERRIDE;
// For ucbhelper
virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
getProperties( const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
// For ucbhelper
virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
getCommands( const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
public:
// Command "getPropertyValues"
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
getPropertyValues( const ::com::sun::star::uno::Sequence<
::com::sun::star::beans::Property >& rProperties,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& xEnv );
private:
// Command "setPropertyValues"
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
setPropertyValues( const ::com::sun::star::uno::Sequence<
::com::sun::star::beans::PropertyValue >& rValues,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& xEnv );
// Command "insert"
void insert( const ::com::sun::star::uno::Reference<
::com::sun::star::io::XInputStream > & xInputStream,
sal_Bool bReplaceExisting,
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( ::com::sun::star::uno::Exception );
// Command "transfer"
void transfer( const ::com::sun::star::ucb::TransferInfo & rArgs,
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( ::com::sun::star::uno::Exception );
// Command "delete"
void destroy( sal_Bool bDeletePhysical )
throw( ::com::sun::star::uno::Exception );
// "open" helpers
void copyData( ::com::sun::star::uno::Reference<
::com::sun::star::io::XInputStream > xIn,
::com::sun::star::uno::Reference<
::com::sun::star::io::XOutputStream > xOut );
::com::sun::star::uno::Reference<
::com::sun::star::io::XInputStream >
createTempStream( const ::com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( ::com::sun::star::uno::Exception );
::com::sun::star::uno::Reference<
::com::sun::star::io::XInputStream >
createInputStream( const ::com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( ::com::sun::star::uno::Exception );
sal_Bool feedSink( ::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface> aSink,
const ::com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv );
::com::sun::star::uno::Any mapVFSException( const GnomeVFSResult result,
sal_Bool bWrite );
void cancelCommandExecution(const GnomeVFSResult result,
const ::com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment > & xEnv,
sal_Bool bWrite = sal_False )
throw( ::com::sun::star::uno::Exception );
public:
// Non-interface bits
char *getURI ();
OString getOURI ();
OUString getOUURI ();
// Externals
public:
Content( const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& rxContext,
ContentProvider *pProvider,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContentIdentifier >& Identifier)
throw ( ::com::sun::star::ucb::ContentCreationException );
Content( const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& rxContext,
ContentProvider *pProvider,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContentIdentifier >& Identifier,
sal_Bool isFolder)
throw ( ::com::sun::star::ucb::ContentCreationException );
virtual ~Content();
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual void SAL_CALL acquire()
throw() SAL_OVERRIDE;
virtual void SAL_CALL release()
throw() SAL_OVERRIDE;
// XTypeProvider
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName()
throw( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames()
throw( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
// XContent
virtual OUString SAL_CALL
getContentType()
throw( com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
// XCommandProcessor
virtual com::sun::star::uno::Any SAL_CALL
execute( const com::sun::star::ucb::Command& aCommand,
sal_Int32 CommandId,
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( com::sun::star::uno::Exception,
com::sun::star::ucb::CommandAbortedException,
com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
virtual void SAL_CALL
abort( sal_Int32 CommandId )
throw( com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
// Additional interfaces
// XContentCreator
virtual com::sun::star::uno::Sequence<
com::sun::star::ucb::ContentInfo > SAL_CALL
queryCreatableContentsInfo()
throw( com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
virtual com::sun::star::uno::Reference<
com::sun::star::ucb::XContent > SAL_CALL
createNewContent( const com::sun::star::ucb::ContentInfo& Info )
throw( com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
queryCreatableContentsInfo(
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv)
throw( com::sun::star::uno::RuntimeException );
};
}
extern "C" {
extern GPrivate *auth_queue;
extern void auth_queue_destroy( gpointer data );
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,411 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
/*
* This file pinched from webdavdatasupplier (etc.)
* cut & paste + new getData impl. & collate ResultSet code.
*/
#include <vector>
#include <osl/diagnose.h>
#include <com/sun/star/ucb/OpenMode.hpp>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/providerhelper.hxx>
#include "gvfs_directory.hxx"
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-directory.h>
#include <comphelper/processfactory.hxx>
using namespace com::sun::star;
using namespace gvfs;
// DynamicResultSet Implementation.
DynamicResultSet::DynamicResultSet(
const uno::Reference< uno::XComponentContext >& rxContext,
const rtl::Reference< Content >& rxContent,
const ucb::OpenCommandArgument2& rCommand,
const uno::Reference< ucb::XCommandEnvironment >& rxEnv )
: ResultSetImplHelper( rxContext, rCommand ),
m_xContent( rxContent ),
m_xEnv( rxEnv )
{
}
void DynamicResultSet::initStatic()
{
m_xResultSet1
= new ::ucbhelper::ResultSet( m_xContext,
m_aCommand.Properties,
new DataSupplier( m_xContent,
m_aCommand.Mode ),
m_xEnv );
}
void DynamicResultSet::initDynamic()
{
initStatic();
m_xResultSet2 = m_xResultSet1;
}
// DataSupplier Implementation.
struct ResultListEntry
{
OUString aId;
uno::Reference< ucb::XContentIdentifier > xId;
uno::Reference< ucb::XContent > xContent;
uno::Reference< sdbc::XRow > xRow;
GnomeVFSFileInfo aInfo;
explicit ResultListEntry( const GnomeVFSFileInfo *fileInfo)
{
gnome_vfs_file_info_copy (&aInfo, fileInfo);
}
~ResultListEntry()
{
gnome_vfs_file_info_clear (&aInfo);
}
};
// ResultList.
typedef std::vector< ResultListEntry* > ResultList;
// struct DataSupplier_Impl.
struct gvfs::DataSupplier_Impl
{
osl::Mutex m_aMutex;
ResultList m_aResults;
rtl::Reference< Content > m_xContent;
sal_Int32 m_nOpenMode;
sal_Bool m_bCountFinal;
DataSupplier_Impl(
const rtl::Reference< Content >& rContent,
sal_Int32 nOpenMode )
: m_xContent( rContent ),
m_nOpenMode( nOpenMode ), m_bCountFinal( sal_False ) {}
~DataSupplier_Impl()
{
ResultList::const_iterator it = m_aResults.begin();
ResultList::const_iterator end = m_aResults.end();
while ( it != end )
{
delete (*it);
++it;
}
}
};
DataSupplier::DataSupplier(
const rtl::Reference< Content >& rContent,
sal_Int32 nOpenMode )
: m_pImpl( new DataSupplier_Impl( rContent, nOpenMode ) )
{
}
// virtual
DataSupplier::~DataSupplier()
{
delete m_pImpl;
}
// virtual
OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
{
osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
if ( nIndex < m_pImpl->m_aResults.size() ) {
OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
if ( !aId.isEmpty() ) // cached
return aId;
}
if ( getResult( nIndex ) ) {
OUString aId = m_pImpl->m_xContent->getOUURI();
char *escaped_name;
escaped_name = gnome_vfs_escape_string( m_pImpl->m_aResults[ nIndex ]->aInfo.name );
if ( ( aId.lastIndexOf( '/' ) + 1 ) != aId.getLength() )
aId += "/";
aId += OUString::createFromAscii( escaped_name );
g_free( escaped_name );
m_pImpl->m_aResults[ nIndex ]->aId = aId;
return aId;
}
return OUString();
}
// virtual
uno::Reference< ucb::XContentIdentifier >
DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
{
osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
if ( nIndex < m_pImpl->m_aResults.size() ) {
uno::Reference< ucb::XContentIdentifier > xId
= m_pImpl->m_aResults[ nIndex ]->xId;
if ( xId.is() ) // Already cached.
return xId;
}
OUString aId = queryContentIdentifierString( nIndex );
if ( !aId.isEmpty() ) {
uno::Reference< ucb::XContentIdentifier > xId
= new ::ucbhelper::ContentIdentifier( aId );
m_pImpl->m_aResults[ nIndex ]->xId = xId;
return xId;
}
return uno::Reference< ucb::XContentIdentifier >();
}
// virtual
uno::Reference< ucb::XContent >
DataSupplier::queryContent( sal_uInt32 nIndex )
{
osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
if ( nIndex < m_pImpl->m_aResults.size() ) {
uno::Reference< ucb::XContent > xContent
= m_pImpl->m_aResults[ nIndex ]->xContent;
if ( xContent.is() ) // Already cached.
return xContent;
}
uno::Reference< ucb::XContentIdentifier > xId
= queryContentIdentifier( nIndex );
if ( xId.is() ) {
try
{
// FIXME:
// It would be really nice to propagate this information
// to the Content, but we can't then register it with the
// ContentProvider, and the ucbhelper hinders here.
uno::Reference< ucb::XContent > xContent
= m_pImpl->m_xContent->getProvider()->queryContent( xId );
m_pImpl->m_aResults[ nIndex ]->xContent = xContent;
return xContent;
}
catch ( ucb::IllegalIdentifierException& ) {
}
}
return uno::Reference< ucb::XContent >();
}
// virtual
bool DataSupplier::getResult( sal_uInt32 nIndex )
{
osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
if ( m_pImpl->m_aResults.size() > nIndex ) // Result already present.
return true;
if ( getData() && m_pImpl->m_aResults.size() > nIndex )
return true;
return false;
}
// virtual
sal_uInt32 DataSupplier::totalCount()
{
getData();
osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
return m_pImpl->m_aResults.size();
}
// virtual
sal_uInt32 DataSupplier::currentCount()
{
osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
return m_pImpl->m_aResults.size();
}
// virtual
bool DataSupplier::isCountFinal()
{
osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
return m_pImpl->m_bCountFinal;
}
// virtual
uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
{
osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
if ( nIndex < m_pImpl->m_aResults.size() ) {
uno::Reference< sdbc::XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow;
if ( xRow.is() ) // Already cached.
return xRow;
}
if ( getResult( nIndex ) ) {
// Inefficient - but we can't create xContent's sensibly
// nor can we do the property code sensibly cleanly staticaly.
Content *pContent = static_cast< ::gvfs::Content * >(queryContent( nIndex ).get());
uno::Reference< sdbc::XRow > xRow =
pContent->getPropertyValues( getResultSet()->getProperties(),
getResultSet()->getEnvironment() );
m_pImpl->m_aResults[ nIndex ]->xRow = xRow;
return xRow;
}
return uno::Reference< sdbc::XRow >();
}
// virtual
void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
{
osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
if ( nIndex < m_pImpl->m_aResults.size() )
m_pImpl->m_aResults[ nIndex ]->xRow = uno::Reference< sdbc::XRow >();
}
// virtual
void DataSupplier::close()
{
}
// virtual
void DataSupplier::validate()
throw( ucb::ResultSetException )
{
}
sal_Bool DataSupplier::getData()
{
osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
if ( !m_pImpl->m_bCountFinal ) {
GnomeVFSResult result;
GnomeVFSDirectoryHandle *dirHandle = NULL;
{
Authentication aAuth( getResultSet()->getEnvironment() );
char *uri = m_pImpl->m_xContent->getURI();
result = gnome_vfs_directory_open
( &dirHandle, uri, GNOME_VFS_FILE_INFO_DEFAULT );
if (result != GNOME_VFS_OK) {
#ifdef DEBUG
g_warning ("Failed open of '%s' with '%s'",
uri, gnome_vfs_result_to_string( result ));
#endif
g_free( uri );
return sal_False;
}
g_free( uri );
}
GnomeVFSFileInfo* fileInfo = gnome_vfs_file_info_new ();
while ((result = gnome_vfs_directory_read_next (dirHandle, fileInfo)) == GNOME_VFS_OK) {
if( fileInfo->name && fileInfo->name[0] == '.' &&
( fileInfo->name[1] == '\0' ||
( fileInfo->name[1] == '.' && fileInfo->name[2] == '\0' ) ) )
continue;
switch ( m_pImpl->m_nOpenMode ) {
case ucb::OpenMode::FOLDERS:
if ( !(fileInfo->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) ||
fileInfo->type != GNOME_VFS_FILE_TYPE_DIRECTORY )
continue;
break;
case ucb::OpenMode::DOCUMENTS:
if ( !(fileInfo->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) ||
fileInfo->type != GNOME_VFS_FILE_TYPE_REGULAR )
continue;
break;
case ucb::OpenMode::ALL:
default:
break;
}
m_pImpl->m_aResults.push_back( new ResultListEntry( fileInfo ) );
}
gnome_vfs_file_info_unref (fileInfo);
#if OSL_DEBUG_LEVEL > 1
g_warning ("Got %d directory entries", result);
#endif
m_pImpl->m_bCountFinal = sal_True;
// Callback possible, because listeners may be informed!
aGuard.clear();
getResultSet()->rowCountFinal();
if (result != GNOME_VFS_ERROR_EOF) {
#ifdef DEBUG
g_warning( "Failed read_next '%s'",
gnome_vfs_result_to_string( result ) );
#endif
return sal_False;
}
result = gnome_vfs_directory_close (dirHandle);
if (result != GNOME_VFS_OK) {
#ifdef DEBUG
g_warning( "Failed close '%s'",
gnome_vfs_result_to_string( result ) );
#endif
return sal_False;
}
}
return sal_True;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,87 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_DIRECTORY_HXX
#define INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_DIRECTORY_HXX
#include <rtl/ref.hxx>
#include <ucbhelper/resultset.hxx>
#include <ucbhelper/resultsethelper.hxx>
#include "gvfs_content.hxx"
namespace gvfs {
class DynamicResultSet : public ::ucbhelper::ResultSetImplHelper
{
rtl::Reference< Content > m_xContent;
com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment > m_xEnv;
private:
virtual void initStatic() SAL_OVERRIDE;
virtual void initDynamic() SAL_OVERRIDE;
public:
DynamicResultSet( const com::sun::star::uno::Reference<
com::sun::star::uno::XComponentContext >& rxContext,
const rtl::Reference< Content >& rxContent,
const com::sun::star::ucb::OpenCommandArgument2& rCommand,
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& rxEnv );
};
struct DataSupplier_Impl;
class DataSupplier : public ucbhelper::ResultSetDataSupplier
{
private:
gvfs::DataSupplier_Impl *m_pImpl;
sal_Bool getData();
public:
DataSupplier(const rtl::Reference< Content >& rContent,
sal_Int32 nOpenMode);
virtual ~DataSupplier();
virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) SAL_OVERRIDE;
virtual com::sun::star::uno::Reference<
com::sun::star::ucb::XContentIdentifier >
queryContentIdentifier( sal_uInt32 nIndex ) SAL_OVERRIDE;
virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
queryContent( sal_uInt32 nIndex ) SAL_OVERRIDE;
virtual bool getResult( sal_uInt32 nIndex ) SAL_OVERRIDE;
virtual sal_uInt32 totalCount() SAL_OVERRIDE;
virtual sal_uInt32 currentCount() SAL_OVERRIDE;
virtual bool isCountFinal() SAL_OVERRIDE;
virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
queryPropertyValues( sal_uInt32 nIndex ) SAL_OVERRIDE;
virtual void releasePropertyValues( sal_uInt32 nIndex ) SAL_OVERRIDE;
virtual void close() SAL_OVERRIDE;
virtual void validate()
throw( com::sun::star::ucb::ResultSetException ) SAL_OVERRIDE;
};
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,179 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <comphelper/processfactory.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include <libgnomevfs/gnome-vfs-init.h>
#include "gvfs_provider.hxx"
#include "gvfs_content.hxx"
using namespace com::sun::star;
using namespace gvfs;
// ContentProvider Implementation.
ContentProvider::ContentProvider(
const uno::Reference< uno::XComponentContext >& rxContext )
: ::ucbhelper::ContentProviderImplHelper( rxContext )
{
}
// sdafas
// virtual
ContentProvider::~ContentProvider()
{
}
// XInterface methods.
void SAL_CALL ContentProvider::acquire()
throw()
{
OWeakObject::acquire();
}
void SAL_CALL ContentProvider::release()
throw()
{
OWeakObject::release();
}
css::uno::Any SAL_CALL ContentProvider::queryInterface( const css::uno::Type & rType )
throw( css::uno::RuntimeException, std::exception )
{
css::uno::Any aRet = cppu::queryInterface( rType,
(static_cast< lang::XTypeProvider* >(this)),
(static_cast< lang::XServiceInfo* >(this)),
(static_cast< css::ucb::XContentProvider* >(this))
);
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
}
// XTypeProvider methods.
XTYPEPROVIDER_IMPL_3( ContentProvider,
lang::XTypeProvider,
lang::XServiceInfo,
com::sun::star::ucb::XContentProvider );
// XServiceInfo methods.
XSERVICEINFO_IMPL_1_CTX( ContentProvider,
OUString( "com.sun.star.comp.GnomeVFSContentProvider" ),
OUString( "com.sun.star.ucb.GnomeVFSContentProvider" ) );
// Service factory implementation.
ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider );
// XContentProvider methods.
uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
ContentProvider::queryContent(
const uno::Reference<
com::sun::star::ucb::XContentIdentifier >& Identifier )
throw( com::sun::star::ucb::IllegalIdentifierException,
uno::RuntimeException )
{
#if OSL_DEBUG_LEVEL > 1
g_warning ("QueryContent: '%s'",
OUStringToOString (Identifier->getContentIdentifier(),
RTL_TEXTENCODING_UTF8).getStr() );
#endif
osl::MutexGuard aGuard( m_aMutex );
// Check, if a content with given id already exists...
uno::Reference< com::sun::star::ucb::XContent > xContent
= queryExistingContent( Identifier ).get();
if ( xContent.is() )
return xContent;
try
{
xContent = new ::gvfs::Content( m_xContext, this, Identifier );
registerNewContent( xContent );
}
catch ( com::sun::star::ucb::ContentCreationException const & )
{
throw com::sun::star::ucb::IllegalIdentifierException();
}
if ( !xContent->getIdentifier().is() )
throw com::sun::star::ucb::IllegalIdentifierException();
return xContent;
}
//============================ shlib entry points =============================================
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucpgvfs1_component_getFactory(
const sal_Char *pImplName, void* pServiceManager, void* /*pRegistryKey*/)
{
void * pRet = 0;
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if (!gnome_vfs_initialized ())
gnome_vfs_init ();
SAL_WNODEPRECATED_DECLARATIONS_PUSH
if (!auth_queue)
auth_queue = g_private_new( auth_queue_destroy );
SAL_WNODEPRECATED_DECLARATIONS_POP
}
uno::Reference< lang::XMultiServiceFactory > xSMgr
(reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
uno::Reference< lang::XSingleServiceFactory > xFactory;
if ( ::gvfs::ContentProvider::getImplementationName_Static().equalsAscii( pImplName ) )
xFactory = ::gvfs::ContentProvider::createServiceFactory( xSMgr );
if ( xFactory.is() ) {
xFactory->acquire();
pRet = xFactory.get();
}
return pRet;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,78 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_PROVIDER_HXX
#define INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_PROVIDER_HXX
#include <rtl/ref.hxx>
#include <com/sun/star/beans/Property.hpp>
#include <ucbhelper/providerhelper.hxx>
namespace gvfs {
class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
{
public:
explicit ContentProvider( const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& rxContext );
virtual ~ContentProvider();
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual void SAL_CALL acquire()
throw() SAL_OVERRIDE;
virtual void SAL_CALL release()
throw() SAL_OVERRIDE;
// XTypeProvider
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName()
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
static OUString getImplementationName_Static();
static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
static css::uno::Reference< css::lang::XSingleServiceFactory >
createServiceFactory( const css::uno::Reference<
css::lang::XMultiServiceFactory >& rxServiceMgr );
// XContentProvider
virtual ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContent > SAL_CALL
queryContent( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContentIdentifier >& Identifier )
throw( ::com::sun::star::ucb::IllegalIdentifierException,
::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
};
} /* namespace gvfs */
#endif // INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_PROVIDER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,335 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "gvfs_stream.hxx"
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
#include <cppuhelper/queryinterface.hxx>
#include <libgnomevfs/gnome-vfs-ops.h>
using namespace cppu;
using namespace com::sun::star::io;
using namespace com::sun::star::uno;
using namespace com::sun::star::ucb;
using namespace gvfs;
Stream::Stream( GnomeVFSHandle *handle,
const GnomeVFSFileInfo *aInfo ) :
m_eof (sal_False),
m_bInputStreamCalled( sal_False ),
m_bOutputStreamCalled( sal_False )
{
m_handle = handle;
gnome_vfs_file_info_copy (&m_info, aInfo);
}
Stream::~Stream()
{
if (m_handle) {
gnome_vfs_close (m_handle);
m_handle = NULL;
}
}
Any Stream::queryInterface( const Type &type )
throw( RuntimeException )
{
Any aRet = ::cppu::queryInterface
( type,
static_cast< XStream * >( this ),
static_cast< XInputStream * >( this ),
static_cast< XOutputStream * >( this ),
static_cast< XSeekable * >( this ),
static_cast< XTruncate * >( this ) );
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( type );
}
// XStream
com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL
Stream::getInputStream( )
throw( com::sun::star::uno::RuntimeException )
{
{
osl::MutexGuard aGuard( m_aMutex );
m_bInputStreamCalled = true;
}
return Reference< XInputStream >( this );
}
com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > SAL_CALL
Stream::getOutputStream( )
throw( com::sun::star::uno::RuntimeException )
{
{
osl::MutexGuard aGuard( m_aMutex );
m_bOutputStreamCalled = true;
}
return Reference< XOutputStream >( this );
}
// XInputStream
sal_Int32 SAL_CALL Stream::readBytes(
Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
throw( NotConnectedException,
BufferSizeExceededException,
IOException,
RuntimeException )
{
GnomeVFSResult result;
GnomeVFSFileSize nBytesRead = 0;
if( ! m_handle )
throw IOException();
if( m_eof ) {
aData.realloc( 0 );
return 0;
}
try {
aData.realloc( nBytesToRead );
} catch ( const Exception &e ) {
throw BufferSizeExceededException();
}
do {
result = gnome_vfs_read( m_handle, aData.getArray(),
nBytesToRead, &nBytesRead );
} while( result == GNOME_VFS_ERROR_INTERRUPTED );
if (result != GNOME_VFS_OK &&
result != GNOME_VFS_ERROR_EOF)
throwOnError( result );
if (result == GNOME_VFS_ERROR_EOF)
m_eof = sal_True;
aData.realloc( sal::static_int_cast<sal_uInt32>(nBytesRead) );
return sal::static_int_cast<sal_Int32>(nBytesRead);
}
sal_Int32 SAL_CALL Stream::readSomeBytes(
Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
throw( NotConnectedException,
BufferSizeExceededException,
IOException,
RuntimeException )
{
// Again - having 2 methods here just sucks; cf. filinpstr.cxx
// This can never be an effective non-blocking API - so why bother ?
return readBytes( aData, nMaxBytesToRead );
}
void SAL_CALL Stream::skipBytes( sal_Int32 nBytesToSkip )
throw( NotConnectedException,
BufferSizeExceededException,
IOException,
RuntimeException )
{
GnomeVFSResult result;
if( ! m_handle )
throw IOException();
result = gnome_vfs_seek( m_handle, GNOME_VFS_SEEK_CURRENT, nBytesToSkip );
if ( result == GNOME_VFS_ERROR_BAD_PARAMETERS ||
result == GNOME_VFS_ERROR_NOT_SUPPORTED )
g_warning ("FIXME: just read them in ...");
throwOnError( result );
}
sal_Int32 SAL_CALL Stream::available( )
throw( NotConnectedException,
IOException,
RuntimeException )
{
return 0; // cf. filinpstr.cxx
}
void SAL_CALL Stream::closeInput()
throw( NotConnectedException,
IOException,
RuntimeException )
{
osl::MutexGuard aGuard( m_aMutex );
m_bInputStreamCalled = false;
if( ! m_bOutputStreamCalled )
closeStream();
}
// XSeekable
void SAL_CALL Stream::seek( sal_Int64 location )
throw( ::com::sun::star::lang::IllegalArgumentException,
IOException,
RuntimeException )
{
GnomeVFSResult result;
if( ! m_handle )
throw IOException();
if ( location < 0 )
throw ::com::sun::star::lang::IllegalArgumentException();
m_eof = sal_False;
result = gnome_vfs_seek( m_handle, GNOME_VFS_SEEK_START, location );
if (result == GNOME_VFS_ERROR_EOF)
throw ::com::sun::star::lang::IllegalArgumentException();
throwOnError( result );
}
sal_Int64 SAL_CALL Stream::getPosition()
throw( IOException,
RuntimeException )
{
GnomeVFSFileSize nBytesIn = 0;
if( ! m_handle )
throw IOException();
throwOnError( gnome_vfs_tell( m_handle, &nBytesIn ) );
return nBytesIn;
}
sal_Int64 SAL_CALL Stream::getLength()
throw( IOException, RuntimeException )
{
// FIXME: so this sucks; it may be stale but ...
if (m_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE)
return m_info.size;
else {
g_warning ("FIXME: No valid length");
return 0;
}
}
// XTruncate
void SAL_CALL Stream::truncate()
throw( com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException )
{
if( ! m_handle )
throw IOException();
throwOnError( gnome_vfs_truncate_handle( m_handle, 0 ) );
}
// XOutputStream
void SAL_CALL Stream::writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
throw( com::sun::star::io::NotConnectedException,
com::sun::star::io::BufferSizeExceededException,
com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException)
{
GnomeVFSResult result = GNOME_VFS_OK;
GnomeVFSFileSize toWrite = aData.getLength();
const sal_Int8 *p = aData.getConstArray();
if( ! m_handle )
throw IOException();
while( toWrite > 0) {
GnomeVFSFileSize bytesWritten = 0;
result = gnome_vfs_write( m_handle, p, toWrite, &bytesWritten );
if( result == GNOME_VFS_ERROR_INTERRUPTED )
continue;
throwOnError( result );
g_assert( bytesWritten <= toWrite );
toWrite -= bytesWritten;
p += bytesWritten;
}
}
void SAL_CALL Stream::flush()
throw( NotConnectedException, BufferSizeExceededException,
IOException, RuntimeException )
{
}
void SAL_CALL Stream::closeOutput()
throw( com::sun::star::io::NotConnectedException,
com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException )
{
osl::MutexGuard aGuard( m_aMutex );
m_bOutputStreamCalled = false;
if( ! m_bInputStreamCalled )
closeStream();
}
// Misc.
void Stream::closeStream()
throw( ::com::sun::star::io::NotConnectedException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException )
{
if (m_handle) {
gnome_vfs_close (m_handle);
m_handle = NULL;
} else
throw IOException();
}
void Stream::throwOnError( GnomeVFSResult result )
throw( NotConnectedException,
BufferSizeExceededException,
IOException,
RuntimeException )
{
if( result != GNOME_VFS_OK ) {
OUString aMsg = OUString::createFromAscii
( gnome_vfs_result_to_string( result ) );
g_warning( "Input Stream exceptional result '%s' (%d)",
gnome_vfs_result_to_string( result ), result );
throw IOException( aMsg, static_cast< cppu::OWeakObject * >( this ) );
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,159 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_STREAM_HXX
#define INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_STREAM_HXX
#include <sal/types.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/weak.hxx>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <libgnomevfs/gnome-vfs-handle.h>
namespace gvfs
{
class Stream : public ::com::sun::star::io::XStream,
public ::com::sun::star::io::XInputStream,
public ::com::sun::star::io::XOutputStream,
public ::com::sun::star::io::XTruncate,
public ::com::sun::star::io::XSeekable,
public ::cppu::OWeakObject
{
private:
GnomeVFSHandle *m_handle;
GnomeVFSFileInfo m_info;
osl::Mutex m_aMutex;
sal_Bool m_eof;
sal_Bool m_bInputStreamCalled;
sal_Bool m_bOutputStreamCalled;
void throwOnError( GnomeVFSResult result )
throw( ::com::sun::star::io::NotConnectedException,
::com::sun::star::io::BufferSizeExceededException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException );
void closeStream()
throw( ::com::sun::star::io::NotConnectedException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException );
public:
Stream ( GnomeVFSHandle *handle,
const GnomeVFSFileInfo *aInfo );
virtual ~Stream();
// XInterface
virtual com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & type )
throw( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
virtual void SAL_CALL acquire()
throw () SAL_OVERRIDE
{ OWeakObject::acquire(); }
virtual void SAL_CALL release()
throw() SAL_OVERRIDE
{ OWeakObject::release(); }
// XStream
virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL getInputStream( )
throw( com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
virtual com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( )
throw( com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
// 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 ) SAL_OVERRIDE;
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 ) SAL_OVERRIDE;
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 ) SAL_OVERRIDE;
virtual sal_Int32 SAL_CALL available()
throw( ::com::sun::star::io::NotConnectedException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
virtual void SAL_CALL closeInput()
throw( ::com::sun::star::io::NotConnectedException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
// XSeekable
virtual void SAL_CALL seek( sal_Int64 location )
throw( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
virtual sal_Int64 SAL_CALL getPosition()
throw( ::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
virtual sal_Int64 SAL_CALL getLength()
throw( ::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
// XOutputStream
virtual void SAL_CALL writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
throw( com::sun::star::io::NotConnectedException,
com::sun::star::io::BufferSizeExceededException,
com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
virtual void SAL_CALL flush()
throw( com::sun::star::io::NotConnectedException,
com::sun::star::io::BufferSizeExceededException,
com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
virtual void SAL_CALL closeOutput()
throw( com::sun::star::io::NotConnectedException,
com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
// XTruncate
virtual void SAL_CALL truncate()
throw( com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
};
} // namespace gvfs
#endif // INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_STREAM_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="ucpgvfs1" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.GnomeVFSContentProvider">
<service name="com.sun.star.ucb.GnomeVFSContentProvider"/>
</implementation>
</component>

View File

@@ -126,7 +126,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext
gtk_dialog_set_default_response( GTK_DIALOG (m_pDialog), GTK_RESPONSE_ACCEPT );
#if ENABLE_GNOME_VFS || ENABLE_GIO
#if ENABLE_GIO
gtk_file_chooser_set_local_only( GTK_FILE_CHOOSER( m_pDialog ), false );
#endif
gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER( m_pDialog ), false );

View File

@@ -57,7 +57,7 @@ SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference< uno::XComponentCon
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, nullptr );
gtk_dialog_set_default_response( GTK_DIALOG (m_pDialog), GTK_RESPONSE_ACCEPT );
#if ENABLE_GNOME_VFS || ENABLE_GIO
#if ENABLE_GIO
gtk_file_chooser_set_local_only( GTK_FILE_CHOOSER( m_pDialog ), false );
#endif
gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER( m_pDialog ), false );