1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <ucbhelper/propertyvalueset.hxx>
22 #include <rtl/ref.hxx>
23 #include <com/sun/star/ucb/Command.hpp>
24 #include "ftpresultsetI.hxx"
25 #include "ftpcontent.hxx"
30 using namespace com::sun::star::ucb
;
31 using namespace com::sun::star::lang
;
32 using namespace com::sun::star::uno
;
33 using namespace com::sun::star::beans
;
34 using namespace com::sun::star::sdbc
;
37 ResultSetI::ResultSetI(const Reference
<XComponentContext
>& rxContext
,
38 const Reference
<XContentProvider
>& xProvider
,
39 const Sequence
<Property
>& seqProp
,
40 const std::vector
<FTPDirentry
>& dirvec
)
41 : ResultSetBase(rxContext
,xProvider
,seqProp
)
43 for(const auto & i
: dirvec
)
44 m_aPath
.push_back(i
.m_aURL
);
46 // m_aIdents holds the content identifiers
48 m_aItems
.resize( m_aPath
.size() );
49 m_aIdents
.resize( m_aPath
.size() );
51 for(size_t n
= 0; n
< m_aItems
.size(); ++n
) {
52 rtl::Reference
<ucbhelper::PropertyValueSet
> xRow
=
53 new ucbhelper::PropertyValueSet(rxContext
);
55 for( const auto& rProp
: seqProp
) {
56 const OUString
& Name
= rProp
.Name
;
57 if(Name
== "ContentType")
58 xRow
->appendString(rProp
,
59 OUString( "application/ftp" ));
60 else if(Name
== "Title")
61 xRow
->appendString(rProp
,dirvec
[n
].m_aName
);
62 else if(Name
== "IsReadOnly")
63 xRow
->appendBoolean(rProp
,
65 INETCOREFTP_FILEMODE_WRITE
) == INETCOREFTP_FILEMODE_WRITE
);
66 else if(Name
== "IsDocument")
67 xRow
->appendBoolean(rProp
,
69 INETCOREFTP_FILEMODE_ISDIR
) != INETCOREFTP_FILEMODE_ISDIR
);
70 else if(Name
== "IsFolder")
71 xRow
->appendBoolean(rProp
,
73 INETCOREFTP_FILEMODE_ISDIR
) == INETCOREFTP_FILEMODE_ISDIR
);
74 else if(Name
== "Size")
75 xRow
->appendLong(rProp
,
77 else if(Name
== "DateCreated")
78 xRow
->appendTimestamp(rProp
,
80 else if(Name
== "CreatableContentsInfo")
83 makeAny(FTPContent::queryCreatableContentsInfo_Static()));
85 xRow
->appendVoid(rProp
);
87 m_aItems
[n
].set(xRow
);
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */