diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-10-11 14:14:48 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-10-11 17:31:18 +0200 |
commit | c767f82403635221af58998a3265e38e8d19e76d (patch) | |
tree | afaa73f1815ec9b55dfec569e12d4b62f897e0c8 /ucb/source/ucp/cmis/cmis_content.cxx | |
parent | 0c0e5c82c7d9fb790d0894c28af5cff99d71a910 (diff) |
CMIS: Implemented the CheckOut button of the InfoBar
Implementing it needed:
+ Adding XCmisDocument::checkOut method and implement it in SfxBaseModel
+ Moving the CMIS properties loading into a SfxBaseModel private method to
factorize code.
+ Adding the SfxInfoBarContainerChild registration in all modules
Change-Id: I35bcb53cd2feff354aa5d9245897d0631cc924a0
Diffstat (limited to 'ucb/source/ucp/cmis/cmis_content.cxx')
-rw-r--r-- | ucb/source/ucp/cmis/cmis_content.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index fbfa83bda138..0baee4fdea16 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1005,6 +1005,9 @@ namespace cmis ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ), -1, getCppuType( static_cast<ucb::OpenCommandArgument2 * >( 0 ) ) ), + // Mandatory CMIS-only commands + ucb::CommandInfo ( rtl::OUString( "checkout" ), -1, getCppuVoidType() ), + // Folder Only, omitted if not a folder ucb::CommandInfo ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), @@ -1187,6 +1190,49 @@ namespace cmis rtl::OUString::createFromAscii( e.what() ) ); } } + else if ( aCommand.Name == "checkout" ) + { + try + { + // Checkout the document if possible + libcmis::DocumentPtr pDoc = boost::dynamic_pointer_cast< libcmis::Document >( getObject( xEnv ) ); + if ( pDoc.get( ) == NULL ) + { + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_GENERAL, + uno::Sequence< uno::Any >( 0 ), + xEnv, + "Checkout only supported by documents" ); + } + libcmis::DocumentPtr pPwc = pDoc->checkOut( ); + + // Compute the URL of the Private Working Copy (PWC) + URL aCmisUrl( m_sURL ); + vector< string > aPaths = pPwc->getPaths( ); + if ( !aPaths.empty() ) + { + string sPath = aPaths.front( ); + aCmisUrl.setObjectPath( STD_TO_OUSTR( sPath ) ); + } + else + { + // We may have unfiled PWC depending on the server, those + // won't have any path, use their ID instead + string sId = pPwc->getId( ); + aCmisUrl.setObjectId( STD_TO_OUSTR( sId ) ); + } + aRet <<= aCmisUrl.asString( ); + } + catch ( const libcmis::Exception& e ) + { + SAL_INFO( "cmisucp", "Unexpected libcmis exception: " << e.what( ) ); + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_GENERAL, + uno::Sequence< uno::Any >( 0 ), + xEnv, + rtl::OUString::createFromAscii( e.what() ) ); + } + } else { SAL_INFO( "cmisucp", "Unknown command to execute" ); |