diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-06-01 10:46:25 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-06-04 13:28:13 +0200 |
commit | 2c4588340ee8387513dd067ecb53dc0058b12ccc (patch) | |
tree | 1ee5f1f88918de407b7b19ed0526b96522e618d4 /fpicker | |
parent | 99465489aa24a2d9d81c0daccfcf512e4f82c841 (diff) |
CMIS UCP: Fixed folder creation and nodes renaming
Change-Id: I2c49b95279d90ebb06f38ed83061a5f1a905a555
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/office/fpsmartcontent.cxx | 40 | ||||
-rw-r--r-- | fpicker/source/office/fpsmartcontent.hxx | 9 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 9 |
3 files changed, 56 insertions, 2 deletions
diff --git a/fpicker/source/office/fpsmartcontent.cxx b/fpicker/source/office/fpsmartcontent.cxx index 0e4c9fe29d4b..69bb4034d0a0 100644 --- a/fpicker/source/office/fpsmartcontent.cxx +++ b/fpicker/source/office/fpsmartcontent.cxx @@ -310,6 +310,46 @@ namespace svt return bRet; } + rtl::OUString SmartContent::createFolder( const rtl::OUString& _rTitle ) + { + rtl::OUString aCreatedUrl; + try + { + rtl::OUString sFolderType; + + Sequence< ContentInfo > aInfo = m_pContent->queryCreatableContentsInfo(); + const ContentInfo* pInfo = aInfo.getConstArray(); + sal_Int32 nCount = aInfo.getLength(); + for ( sal_Int32 i = 0; i < nCount; ++i, ++pInfo ) + { + // Simply look for the first KIND_FOLDER... + if ( pInfo->Attributes & ContentInfoAttribute::KIND_FOLDER ) + { + sFolderType = pInfo->Type; + break; + } + } + + if ( !sFolderType.isEmpty() ) + { + ucbhelper::Content aCreated; + Sequence< rtl::OUString > aNames( 1 ); + rtl::OUString* pNames = aNames.getArray(); + pNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ); + Sequence< Any > aValues( 1 ); + Any* pValues = aValues.getArray(); + pValues[0] = makeAny( _rTitle ); + m_pContent->insertNewContent( sFolderType, aNames, aValues, aCreated ); + + aCreatedUrl = aCreated.getURL(); + } + } + catch( const Exception& ) + { + } + return aCreatedUrl; + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/fpicker/source/office/fpsmartcontent.hxx b/fpicker/source/office/fpsmartcontent.hxx index e16c288678b1..81aff5b2e020 100644 --- a/fpicker/source/office/fpsmartcontent.hxx +++ b/fpicker/source/office/fpsmartcontent.hxx @@ -61,7 +61,7 @@ namespace svt private: ::rtl::OUString m_sURL; - ::ucbhelper::Content* m_pContent; + ::ucbhelper::Content* m_pContent; State m_eState; ::com::sun::star::uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv; ::com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionHandler > m_xOwnInteraction; @@ -174,6 +174,13 @@ namespace svt */ sal_Bool canCreateFolder( ); + /** creates a new folder with the given title and return the corresponding URL. + + @return + the URL of the created folder or an empty string + */ + rtl::OUString createFolder( const rtl::OUString& _rTitle ); + /** binds to the given URL, checks whether or not it refers to a folder @postcond diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 258edd9493f9..cc57c5bc7565 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -819,7 +819,14 @@ IMPL_STATIC_LINK( SvtFileDialog, NewFolderHdl_Impl, PushButton*, EMPTYARG ) while ( !bHandled ) { if ( aDlg.Execute() == RET_OK ) - bHandled = pThis->_pFileView->CreateNewFolder( aDlg.GetName() ); + { + rtl::OUString aUrl = aContent.createFolder( aDlg.GetName( ) ); + if ( !aUrl.isEmpty( ) ) + { + pThis->_pFileView->CreatedFolder( aUrl, aDlg.GetName() ); + bHandled = sal_True; + } + } else bHandled = sal_True; } |