summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/cmis/cmis_content.cxx
diff options
context:
space:
mode:
authorCao Cuong Ngo <cao.cuong.ngo@gmail.com>2013-07-14 23:59:51 +0200
committerCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2013-09-02 13:51:51 +0200
commit56d34815e2e0b3e3277a6a3ee850ab7e4b764b1f (patch)
treeb51db099d3c16329a47c9c182e57db19f85d1118 /ucb/source/ucp/cmis/cmis_content.cxx
parentbd97d9597cd9e3e7b077df9890d515328e3ee855 (diff)
CMIS: connect LO to Google Drive
Change-Id: I2c1b1d3e2bfd50ceb8647e62d37512ee3a0b9dae
Diffstat (limited to 'ucb/source/ucp/cmis/cmis_content.cxx')
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 299e45929177..da0dc6a5eeea 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -46,6 +46,7 @@
#include "cmis_content.hxx"
#include "cmis_provider.hxx"
#include "cmis_resultset.hxx"
+#include "cmis_oauth2_providers.hxx"
#define OUSTR_TO_STDSTR(s) string( OUStringToOString( s, RTL_TEXTENCODING_UTF8 ).getStr() )
#define STD_TO_OUSTR( str ) OUString( str.c_str(), str.length( ), RTL_TEXTENCODING_UTF8 )
@@ -313,9 +314,16 @@ namespace cmis
if ( authProvider.authenticationQuery( rUsername, rPassword ) )
{
// Initiate a CMIS session and register it as we found nothing
+ libcmis::OAuth2DataPtr oauth2Data = NULL;
+ if ( m_aURL.getBindingUrl( ) == GDRIVE_BASE_URL )
+ oauth2Data.reset( new libcmis::OAuth2Data(
+ GDRIVE_AUTH_URL, GDRIVE_TOKEN_URL,
+ GDRIVE_SCOPE, GDRIVE_REDIRECT_URI,
+ GDRIVE_CLIENT_ID, GDRIVE_CLIENT_SECRET ) );
+
m_pSession = libcmis::SessionFactory::createSession(
OUSTR_TO_STDSTR( m_aURL.getBindingUrl( ) ),
- rUsername, rPassword, OUSTR_TO_STDSTR( m_aURL.getRepositoryId( ) ) );
+ rUsername, rPassword, OUSTR_TO_STDSTR( m_aURL.getRepositoryId( ) ), oauth2Data );
if ( m_pSession == NULL )
ucbhelper::cancelCommandExecution(
ucb::IOErrorCode_INVALID_DEVICE,
@@ -1770,6 +1778,8 @@ namespace cmis
if ( sPath[sPath.getLength( ) - 1] != '/' )
sPath += "/";
sPath += STD_TO_OUSTR( ( *it )->getName( ) );
+ OUString sId = STD_TO_OUSTR( ( *it )->getId( ) );
+ aUrl.setObjectId( sId );
aUrl.setObjectPath( sPath );
uno::Reference< ucb::XContentIdentifier > xId = new ucbhelper::ContentIdentifier( aUrl.asString( ) );
uno::Reference< ucb::XContent > xContent = new Content( m_xContext, m_pProvider, xId, *it );