1*2f86921cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*2f86921cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*2f86921cSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*2f86921cSAndrew Rist * distributed with this work for additional information
6*2f86921cSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*2f86921cSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*2f86921cSAndrew Rist * "License"); you may not use this file except in compliance
9*2f86921cSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*2f86921cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*2f86921cSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*2f86921cSAndrew Rist * software distributed under the License is distributed on an
15*2f86921cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2f86921cSAndrew Rist * KIND, either express or implied. See the License for the
17*2f86921cSAndrew Rist * specific language governing permissions and limitations
18*2f86921cSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*2f86921cSAndrew Rist *************************************************************/
21*2f86921cSAndrew Rist
22*2f86921cSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_ucb.hxx"
26cdf0e10cSrcweir /*
27cdf0e10cSrcweir * This file pinched from webdavdatasupplier (etc.)
28cdf0e10cSrcweir * cut & paste + new getData impl. & collate ResultSet code.
29cdf0e10cSrcweir */
30cdf0e10cSrcweir #include <vector>
31cdf0e10cSrcweir #include <osl/diagnose.h>
32cdf0e10cSrcweir #include <com/sun/star/ucb/OpenMode.hpp>
33cdf0e10cSrcweir #include <ucbhelper/contentidentifier.hxx>
34cdf0e10cSrcweir #include <ucbhelper/providerhelper.hxx>
35cdf0e10cSrcweir
36cdf0e10cSrcweir #include "gvfs_directory.hxx"
37cdf0e10cSrcweir
38cdf0e10cSrcweir #include <libgnomevfs/gnome-vfs-utils.h>
39cdf0e10cSrcweir #include <libgnomevfs/gnome-vfs-directory.h>
40cdf0e10cSrcweir
41cdf0e10cSrcweir using namespace com::sun::star;
42cdf0e10cSrcweir using namespace gvfs;
43cdf0e10cSrcweir
44cdf0e10cSrcweir // DynamicResultSet Implementation.
45cdf0e10cSrcweir
DynamicResultSet(const uno::Reference<lang::XMultiServiceFactory> & rxSMgr,const rtl::Reference<Content> & rxContent,const ucb::OpenCommandArgument2 & rCommand,const uno::Reference<ucb::XCommandEnvironment> & rxEnv)46cdf0e10cSrcweir DynamicResultSet::DynamicResultSet(
47cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
48cdf0e10cSrcweir const rtl::Reference< Content >& rxContent,
49cdf0e10cSrcweir const ucb::OpenCommandArgument2& rCommand,
50cdf0e10cSrcweir const uno::Reference< ucb::XCommandEnvironment >& rxEnv )
51cdf0e10cSrcweir : ResultSetImplHelper( rxSMgr, rCommand ),
52cdf0e10cSrcweir m_xContent( rxContent ),
53cdf0e10cSrcweir m_xEnv( rxEnv )
54cdf0e10cSrcweir {
55cdf0e10cSrcweir }
initStatic()56cdf0e10cSrcweir void DynamicResultSet::initStatic()
57cdf0e10cSrcweir {
58cdf0e10cSrcweir m_xResultSet1
59cdf0e10cSrcweir = new ::ucbhelper::ResultSet( m_xSMgr,
60cdf0e10cSrcweir m_aCommand.Properties,
61cdf0e10cSrcweir new DataSupplier( m_xSMgr,
62cdf0e10cSrcweir m_xContent,
63cdf0e10cSrcweir m_aCommand.Mode ),
64cdf0e10cSrcweir m_xEnv );
65cdf0e10cSrcweir }
initDynamic()66cdf0e10cSrcweir void DynamicResultSet::initDynamic()
67cdf0e10cSrcweir {
68cdf0e10cSrcweir initStatic();
69cdf0e10cSrcweir m_xResultSet2 = m_xResultSet1;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir
72cdf0e10cSrcweir //=========================================================================
73cdf0e10cSrcweir
74cdf0e10cSrcweir
75cdf0e10cSrcweir // DataSupplier Implementation.
76cdf0e10cSrcweir
77cdf0e10cSrcweir
78cdf0e10cSrcweir
79cdf0e10cSrcweir struct ResultListEntry
80cdf0e10cSrcweir {
81cdf0e10cSrcweir rtl::OUString aId;
82cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId;
83cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent;
84cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow;
85cdf0e10cSrcweir GnomeVFSFileInfo aInfo;
86cdf0e10cSrcweir
ResultListEntryResultListEntry87cdf0e10cSrcweir ResultListEntry( const GnomeVFSFileInfo *fileInfo)
88cdf0e10cSrcweir {
89cdf0e10cSrcweir gnome_vfs_file_info_copy (&aInfo, fileInfo);
90cdf0e10cSrcweir }
91cdf0e10cSrcweir
~ResultListEntryResultListEntry92cdf0e10cSrcweir ~ResultListEntry()
93cdf0e10cSrcweir {
94cdf0e10cSrcweir gnome_vfs_file_info_clear (&aInfo);
95cdf0e10cSrcweir }
96cdf0e10cSrcweir };
97cdf0e10cSrcweir
98cdf0e10cSrcweir //=========================================================================
99cdf0e10cSrcweir //
100cdf0e10cSrcweir // ResultList.
101cdf0e10cSrcweir //
102cdf0e10cSrcweir //=========================================================================
103cdf0e10cSrcweir
104cdf0e10cSrcweir typedef std::vector< ResultListEntry* > ResultList;
105cdf0e10cSrcweir
106cdf0e10cSrcweir //=========================================================================
107cdf0e10cSrcweir //
108cdf0e10cSrcweir // struct DataSupplier_Impl.
109cdf0e10cSrcweir //
110cdf0e10cSrcweir //=========================================================================
111cdf0e10cSrcweir
112cdf0e10cSrcweir struct gvfs::DataSupplier_Impl
113cdf0e10cSrcweir {
114cdf0e10cSrcweir osl::Mutex m_aMutex;
115cdf0e10cSrcweir ResultList m_aResults;
116cdf0e10cSrcweir rtl::Reference< Content > m_xContent;
117cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > m_xSMgr;
118cdf0e10cSrcweir sal_Int32 m_nOpenMode;
119cdf0e10cSrcweir sal_Bool m_bCountFinal;
120cdf0e10cSrcweir
DataSupplier_Implgvfs::DataSupplier_Impl121cdf0e10cSrcweir DataSupplier_Impl(
122cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
123cdf0e10cSrcweir const rtl::Reference< Content >& rContent,
124cdf0e10cSrcweir sal_Int32 nOpenMode )
125cdf0e10cSrcweir : m_xContent( rContent ), m_xSMgr( rxSMgr ),
126cdf0e10cSrcweir m_nOpenMode( nOpenMode ), m_bCountFinal( sal_False ) {}
~DataSupplier_Implgvfs::DataSupplier_Impl127cdf0e10cSrcweir ~DataSupplier_Impl()
128cdf0e10cSrcweir {
129cdf0e10cSrcweir ResultList::const_iterator it = m_aResults.begin();
130cdf0e10cSrcweir ResultList::const_iterator end = m_aResults.end();
131cdf0e10cSrcweir
132cdf0e10cSrcweir while ( it != end )
133cdf0e10cSrcweir {
134cdf0e10cSrcweir delete (*it);
135cdf0e10cSrcweir it++;
136cdf0e10cSrcweir }
137cdf0e10cSrcweir }
138cdf0e10cSrcweir };
139cdf0e10cSrcweir
DataSupplier(const uno::Reference<lang::XMultiServiceFactory> & rxSMgr,const rtl::Reference<Content> & rContent,sal_Int32 nOpenMode)140cdf0e10cSrcweir DataSupplier::DataSupplier(
141cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
142cdf0e10cSrcweir const rtl::Reference< Content >& rContent,
143cdf0e10cSrcweir sal_Int32 nOpenMode )
144cdf0e10cSrcweir : m_pImpl( new DataSupplier_Impl( rxSMgr, rContent, nOpenMode ) )
145cdf0e10cSrcweir {
146cdf0e10cSrcweir }
147cdf0e10cSrcweir
148cdf0e10cSrcweir //=========================================================================
149cdf0e10cSrcweir // virtual
~DataSupplier()150cdf0e10cSrcweir DataSupplier::~DataSupplier()
151cdf0e10cSrcweir {
152cdf0e10cSrcweir delete m_pImpl;
153cdf0e10cSrcweir }
154cdf0e10cSrcweir
155cdf0e10cSrcweir // virtual
queryContentIdentifierString(sal_uInt32 nIndex)156cdf0e10cSrcweir rtl::OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
157cdf0e10cSrcweir {
158cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
159cdf0e10cSrcweir
160cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) {
161cdf0e10cSrcweir rtl::OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
162cdf0e10cSrcweir if ( aId.getLength() ) // cached
163cdf0e10cSrcweir return aId;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
166cdf0e10cSrcweir if ( getResult( nIndex ) ) {
167cdf0e10cSrcweir rtl::OUString aId = m_pImpl->m_xContent->getOUURI();
168cdf0e10cSrcweir
169cdf0e10cSrcweir char *escaped_name;
170cdf0e10cSrcweir escaped_name = gnome_vfs_escape_string( m_pImpl->m_aResults[ nIndex ]->aInfo.name );
171cdf0e10cSrcweir
172cdf0e10cSrcweir if ( ( aId.lastIndexOf( '/' ) + 1 ) != aId.getLength() )
173cdf0e10cSrcweir aId += rtl::OUString::createFromAscii( "/" );
174cdf0e10cSrcweir
175cdf0e10cSrcweir aId += rtl::OUString::createFromAscii( escaped_name );
176cdf0e10cSrcweir
177cdf0e10cSrcweir g_free( escaped_name );
178cdf0e10cSrcweir
179cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->aId = aId;
180cdf0e10cSrcweir return aId;
181cdf0e10cSrcweir }
182cdf0e10cSrcweir
183cdf0e10cSrcweir return rtl::OUString();
184cdf0e10cSrcweir }
185cdf0e10cSrcweir
186cdf0e10cSrcweir // virtual
187cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier >
queryContentIdentifier(sal_uInt32 nIndex)188cdf0e10cSrcweir DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
189cdf0e10cSrcweir {
190cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
191cdf0e10cSrcweir
192cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) {
193cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId
194cdf0e10cSrcweir = m_pImpl->m_aResults[ nIndex ]->xId;
195cdf0e10cSrcweir if ( xId.is() ) // Already cached.
196cdf0e10cSrcweir return xId;
197cdf0e10cSrcweir }
198cdf0e10cSrcweir
199cdf0e10cSrcweir rtl::OUString aId = queryContentIdentifierString( nIndex );
200cdf0e10cSrcweir if ( aId.getLength() ) {
201cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId
202cdf0e10cSrcweir = new ::ucbhelper::ContentIdentifier( aId );
203cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xId = xId;
204cdf0e10cSrcweir return xId;
205cdf0e10cSrcweir }
206cdf0e10cSrcweir
207cdf0e10cSrcweir return uno::Reference< ucb::XContentIdentifier >();
208cdf0e10cSrcweir }
209cdf0e10cSrcweir
210cdf0e10cSrcweir // virtual
211cdf0e10cSrcweir uno::Reference< ucb::XContent >
queryContent(sal_uInt32 nIndex)212cdf0e10cSrcweir DataSupplier::queryContent( sal_uInt32 nIndex )
213cdf0e10cSrcweir {
214cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
215cdf0e10cSrcweir
216cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) {
217cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent
218cdf0e10cSrcweir = m_pImpl->m_aResults[ nIndex ]->xContent;
219cdf0e10cSrcweir if ( xContent.is() ) // Already cached.
220cdf0e10cSrcweir return xContent;
221cdf0e10cSrcweir }
222cdf0e10cSrcweir
223cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > xId
224cdf0e10cSrcweir = queryContentIdentifier( nIndex );
225cdf0e10cSrcweir if ( xId.is() ) {
226cdf0e10cSrcweir try
227cdf0e10cSrcweir {
228cdf0e10cSrcweir // FIXME:
229cdf0e10cSrcweir // It would be really nice to propagate this information
230cdf0e10cSrcweir // to the Content, but we can't then register it with the
231cdf0e10cSrcweir // ContentProvider, and the ucbhelper hinders here.
232cdf0e10cSrcweir uno::Reference< ucb::XContent > xContent
233cdf0e10cSrcweir = m_pImpl->m_xContent->getProvider()->queryContent( xId );
234cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xContent = xContent;
235cdf0e10cSrcweir return xContent;
236cdf0e10cSrcweir
237cdf0e10cSrcweir }
238cdf0e10cSrcweir catch ( ucb::IllegalIdentifierException& ) {
239cdf0e10cSrcweir }
240cdf0e10cSrcweir }
241cdf0e10cSrcweir return uno::Reference< ucb::XContent >();
242cdf0e10cSrcweir }
243cdf0e10cSrcweir
244cdf0e10cSrcweir // virtual
getResult(sal_uInt32 nIndex)245cdf0e10cSrcweir sal_Bool DataSupplier::getResult( sal_uInt32 nIndex )
246cdf0e10cSrcweir {
247cdf0e10cSrcweir osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
248cdf0e10cSrcweir
249cdf0e10cSrcweir if ( m_pImpl->m_aResults.size() > nIndex ) // Result already present.
250cdf0e10cSrcweir return sal_True;
251cdf0e10cSrcweir
252cdf0e10cSrcweir if ( getData() && m_pImpl->m_aResults.size() > nIndex )
253cdf0e10cSrcweir return sal_True;
254cdf0e10cSrcweir
255cdf0e10cSrcweir return sal_False;
256cdf0e10cSrcweir }
257cdf0e10cSrcweir
258cdf0e10cSrcweir // virtual
totalCount()259cdf0e10cSrcweir sal_uInt32 DataSupplier::totalCount()
260cdf0e10cSrcweir {
261cdf0e10cSrcweir getData();
262cdf0e10cSrcweir
263cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
264cdf0e10cSrcweir
265cdf0e10cSrcweir return m_pImpl->m_aResults.size();
266cdf0e10cSrcweir }
267cdf0e10cSrcweir
268cdf0e10cSrcweir // virtual
currentCount()269cdf0e10cSrcweir sal_uInt32 DataSupplier::currentCount()
270cdf0e10cSrcweir {
271cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
272cdf0e10cSrcweir return m_pImpl->m_aResults.size();
273cdf0e10cSrcweir }
274cdf0e10cSrcweir
275cdf0e10cSrcweir // virtual
isCountFinal()276cdf0e10cSrcweir sal_Bool DataSupplier::isCountFinal()
277cdf0e10cSrcweir {
278cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
279cdf0e10cSrcweir return m_pImpl->m_bCountFinal;
280cdf0e10cSrcweir }
281cdf0e10cSrcweir
282cdf0e10cSrcweir // virtual
queryPropertyValues(sal_uInt32 nIndex)283cdf0e10cSrcweir uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
284cdf0e10cSrcweir {
285cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
286cdf0e10cSrcweir
287cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() ) {
288cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow;
289cdf0e10cSrcweir if ( xRow.is() ) // Already cached.
290cdf0e10cSrcweir return xRow;
291cdf0e10cSrcweir }
292cdf0e10cSrcweir
293cdf0e10cSrcweir if ( getResult( nIndex ) ) {
294cdf0e10cSrcweir // Inefficient - but we can't create xContent's sensibly
295cdf0e10cSrcweir // nor can we do the property code sensibly cleanly staticaly.
296cdf0e10cSrcweir Content *pContent = static_cast< ::gvfs::Content * >(queryContent( nIndex ).get());
297cdf0e10cSrcweir
298cdf0e10cSrcweir uno::Reference< sdbc::XRow > xRow =
299cdf0e10cSrcweir pContent->getPropertyValues( getResultSet()->getProperties(),
300cdf0e10cSrcweir getResultSet()->getEnvironment() );
301cdf0e10cSrcweir
302cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xRow = xRow;
303cdf0e10cSrcweir
304cdf0e10cSrcweir return xRow;
305cdf0e10cSrcweir }
306cdf0e10cSrcweir
307cdf0e10cSrcweir return uno::Reference< sdbc::XRow >();
308cdf0e10cSrcweir }
309cdf0e10cSrcweir
310cdf0e10cSrcweir // virtual
releasePropertyValues(sal_uInt32 nIndex)311cdf0e10cSrcweir void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
312cdf0e10cSrcweir {
313cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
314cdf0e10cSrcweir
315cdf0e10cSrcweir if ( nIndex < m_pImpl->m_aResults.size() )
316cdf0e10cSrcweir m_pImpl->m_aResults[ nIndex ]->xRow = uno::Reference< sdbc::XRow >();
317cdf0e10cSrcweir }
318cdf0e10cSrcweir
319cdf0e10cSrcweir // virtual
close()320cdf0e10cSrcweir void DataSupplier::close()
321cdf0e10cSrcweir {
322cdf0e10cSrcweir }
323cdf0e10cSrcweir
324cdf0e10cSrcweir // virtual
validate()325cdf0e10cSrcweir void DataSupplier::validate()
326cdf0e10cSrcweir throw( ucb::ResultSetException )
327cdf0e10cSrcweir {
328cdf0e10cSrcweir }
329cdf0e10cSrcweir
getData()330cdf0e10cSrcweir sal_Bool DataSupplier::getData()
331cdf0e10cSrcweir {
332cdf0e10cSrcweir osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
333cdf0e10cSrcweir
334cdf0e10cSrcweir if ( !m_pImpl->m_bCountFinal ) {
335cdf0e10cSrcweir GnomeVFSResult result;
336cdf0e10cSrcweir GnomeVFSDirectoryHandle *dirHandle = NULL;
337cdf0e10cSrcweir
338cdf0e10cSrcweir {
339cdf0e10cSrcweir Authentication aAuth( getResultSet()->getEnvironment() );
340cdf0e10cSrcweir char *uri = m_pImpl->m_xContent->getURI();
341cdf0e10cSrcweir result = gnome_vfs_directory_open
342cdf0e10cSrcweir ( &dirHandle, uri, GNOME_VFS_FILE_INFO_DEFAULT );
343cdf0e10cSrcweir
344cdf0e10cSrcweir if (result != GNOME_VFS_OK) {
345cdf0e10cSrcweir #ifdef DEBUG
346cdf0e10cSrcweir g_warning ("Failed open of '%s' with '%s'",
347cdf0e10cSrcweir uri, gnome_vfs_result_to_string( result ));
348cdf0e10cSrcweir #endif
349cdf0e10cSrcweir g_free( uri );
350cdf0e10cSrcweir return sal_False;
351cdf0e10cSrcweir }
352cdf0e10cSrcweir
353cdf0e10cSrcweir g_free( uri );
354cdf0e10cSrcweir }
355cdf0e10cSrcweir
356cdf0e10cSrcweir GnomeVFSFileInfo* fileInfo = gnome_vfs_file_info_new ();
357cdf0e10cSrcweir
358cdf0e10cSrcweir while ((result = gnome_vfs_directory_read_next (dirHandle, fileInfo)) == GNOME_VFS_OK) {
359cdf0e10cSrcweir if( fileInfo->name && fileInfo->name[0] == '.' &&
360cdf0e10cSrcweir ( fileInfo->name[1] == '\0' ||
361cdf0e10cSrcweir ( fileInfo->name[1] == '.' && fileInfo->name[2] == '\0' ) ) )
362cdf0e10cSrcweir continue;
363cdf0e10cSrcweir
364cdf0e10cSrcweir switch ( m_pImpl->m_nOpenMode ) {
365cdf0e10cSrcweir case ucb::OpenMode::FOLDERS:
366cdf0e10cSrcweir if ( !(fileInfo->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) ||
367cdf0e10cSrcweir fileInfo->type != GNOME_VFS_FILE_TYPE_DIRECTORY )
368cdf0e10cSrcweir continue;
369cdf0e10cSrcweir break;
370cdf0e10cSrcweir
371cdf0e10cSrcweir case ucb::OpenMode::DOCUMENTS:
372cdf0e10cSrcweir if ( !(fileInfo->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) ||
373cdf0e10cSrcweir fileInfo->type != GNOME_VFS_FILE_TYPE_REGULAR )
374cdf0e10cSrcweir continue;
375cdf0e10cSrcweir break;
376cdf0e10cSrcweir
377cdf0e10cSrcweir case ucb::OpenMode::ALL:
378cdf0e10cSrcweir default:
379cdf0e10cSrcweir break;
380cdf0e10cSrcweir }
381cdf0e10cSrcweir
382cdf0e10cSrcweir m_pImpl->m_aResults.push_back( new ResultListEntry( fileInfo ) );
383cdf0e10cSrcweir }
384cdf0e10cSrcweir
385cdf0e10cSrcweir gnome_vfs_file_info_unref (fileInfo);
386cdf0e10cSrcweir
387cdf0e10cSrcweir #ifdef DEBUG
388cdf0e10cSrcweir g_warning ("Got %d directory entries", result);
389cdf0e10cSrcweir #endif
390cdf0e10cSrcweir
391cdf0e10cSrcweir m_pImpl->m_bCountFinal = sal_True;
392cdf0e10cSrcweir
393cdf0e10cSrcweir // Callback possible, because listeners may be informed!
394cdf0e10cSrcweir aGuard.clear();
395cdf0e10cSrcweir getResultSet()->rowCountFinal();
396cdf0e10cSrcweir
397cdf0e10cSrcweir if (result != GNOME_VFS_ERROR_EOF) {
398cdf0e10cSrcweir #ifdef DEBUG
399cdf0e10cSrcweir g_warning( "Failed read_next '%s'",
400cdf0e10cSrcweir gnome_vfs_result_to_string( result ) );
401cdf0e10cSrcweir #endif
402cdf0e10cSrcweir return sal_False;
403cdf0e10cSrcweir }
404cdf0e10cSrcweir
405cdf0e10cSrcweir result = gnome_vfs_directory_close (dirHandle);
406cdf0e10cSrcweir if (result != GNOME_VFS_OK) {
407cdf0e10cSrcweir #ifdef DEBUG
408cdf0e10cSrcweir g_warning( "Failed close '%s'",
409cdf0e10cSrcweir gnome_vfs_result_to_string( result ) );
410cdf0e10cSrcweir #endif
411cdf0e10cSrcweir return sal_False;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir }
414cdf0e10cSrcweir
415cdf0e10cSrcweir return sal_True;
416cdf0e10cSrcweir }
417cdf0e10cSrcweir
418cdf0e10cSrcweir
419cdf0e10cSrcweir
420