ucb/source/ucp/cmis/cmis_content.cxx          |    6 ++++-
 ucb/source/ucp/cmis/cmis_oauth2_providers.hxx |    2 -
 ucb/source/ucp/cmis/cmis_repo_content.cxx     |   30 +++++++++++++++++++-------
 ucb/source/ucp/cmis/cmis_url.cxx              |   23 +++++++------------
 4 files changed, 37 insertions(+), 24 deletions(-)

New commits:
commit 9020aef661d87f846b3d436d00a7118b69a45ddc
Author: Cao Cuong Ngo <cao.cuong....@gmail.com>
Date:   Tue Jul 16 20:00:56 2013 +0200

    CMIS: make GDrive work with path
    
    Change-Id: Ib85be2887219e6067a1b6c227515504020f9a4e7

diff --git a/ucb/source/ucp/cmis/cmis_content.cxx 
b/ucb/source/ucp/cmis/cmis_content.cxx
index 3d35567..9ec04f7 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -1452,7 +1452,11 @@ namespace cmis
             {
                 libcmis::Folder* folder = dynamic_cast< libcmis::Folder* >( 
pObj.get( ) );
                 if ( NULL != folder )
-                    parentPath = folder->getFolderParent( )->getPath( );
+                {
+                    libcmis::FolderPtr parentFolder = folder->getFolderParent( 
);
+                    if ( NULL != parentFolder )
+                        parentPath = parentFolder->getPath( );
+                }
             }
         }
         catch ( const libcmis::Exception & )
diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx
index bbafee5..ac26167 100644
--- a/ucb/source/ucp/cmis/cmis_url.cxx
+++ b/ucb/source/ucp/cmis/cmis_url.cxx
@@ -35,11 +35,7 @@ namespace cmis
         m_sPass = aUrl.GetPass( INetURLObject::DECODE_WITH_CHARSET );
 
         // Store the path to the object
-        // Google Drive doesn't support getObjectByPath
-        if ( m_sBindingUrl == GDRIVE_BASE_URL )
-            m_sPath = OUString( );
-        else
-            m_sPath = aUrl.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
+        m_sPath = aUrl.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
         m_sId = aUrl.GetMark( INetURLObject::DECODE_WITH_CHARSET );
 
         if ( !m_sId.isEmpty( ) )
commit b2e7610ca2ff5f7edae3312116e1a04792ac7a16
Author: Cao Cuong Ngo <cao.cuong....@gmail.com>
Date:   Tue Jul 16 19:16:44 2013 +0200

    CMIS: getRepositories should call createSession
    
    Change-Id: Ia64e15ab53155118dcfdd007a5d76e649bdeded9

diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx 
b/ucb/source/ucp/cmis/cmis_repo_content.cxx
index b2a0196..e0fd7af 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx
@@ -32,6 +32,7 @@
 #include "cmis_provider.hxx"
 #include "cmis_repo_content.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 )
@@ -142,14 +143,25 @@ namespace cmis
             string rPassword = OUSTR_TO_STDSTR( m_aURL.getPassword( ) );
             if ( authProvider.authenticationQuery( rUsername, rPassword ) )
             {
-                try
-                {
-                    m_aRepositories = libcmis::SessionFactory::getRepositories(
-                           OUSTR_TO_STDSTR( m_aURL.getBindingUrl( ) ), 
rUsername, rPassword );
-                }
-                catch (const libcmis::Exception&)
-                {
-                }
+                // Create a session to get repositories
+                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 ) );
+
+                libcmis::Session* session = 
libcmis::SessionFactory::createSession(
+                        OUSTR_TO_STDSTR( m_aURL.getBindingUrl( ) ),
+                        rUsername, rPassword, "", sal_False, oauth2Data );
+                if (session == NULL )
+                    ucbhelper::cancelCommandExecution(
+                                        ucb::IOErrorCode_INVALID_DEVICE,
+                                        uno::Sequence< uno::Any >( 0 ),
+                                        xEnv,
+                                        OUString( ) );
+                m_aRepositories = session->getRepositories( );
+                delete session;
             }
             else
             {
@@ -179,6 +191,8 @@ namespace cmis
                     repo = *it;
             }
         }
+        else
+            repo = m_aRepositories.front( );
         return repo;
     }
 
commit ae0903a8db71a695483a1801fc72739992be4fe5
Author: Cao Cuong Ngo <cao.cuong....@gmail.com>
Date:   Tue Jul 16 16:41:52 2013 +0200

    CMIS: the file picker prefer path to ID
    
    Change-Id: I3a8d52411176d29f67340d8b668b8e9cc940d648

diff --git a/ucb/source/ucp/cmis/cmis_oauth2_providers.hxx 
b/ucb/source/ucp/cmis/cmis_oauth2_providers.hxx
index bd3df5b..63df6a4 100644
--- a/ucb/source/ucp/cmis/cmis_oauth2_providers.hxx
+++ b/ucb/source/ucp/cmis/cmis_oauth2_providers.hxx
@@ -10,7 +10,7 @@
  *
  */
 
-#ifndef CMIS_OAUTH2_PROVIDER2_HXX
+#ifndef CMIS_OAUTH2_PROVIDERS_HXX
 #define CMIS_OAUTH2_PROVIDERS_HXX
 
 
diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx
index 5d82e18..bbafee5 100644
--- a/ucb/source/ucp/cmis/cmis_url.cxx
+++ b/ucb/source/ucp/cmis/cmis_url.cxx
@@ -86,15 +86,7 @@ namespace cmis
                 RTL_TEXTENCODING_UTF8 );
         sUrl = "vnd.libreoffice.cmis://" + sEncodedBinding;
 
-        // Prefer get object by ID
-        if ( !m_sId.isEmpty( ) )
-        {
-            sUrl += "#" + rtl::Uri::encode( m_sId,
-                rtl_UriCharClassRelSegment,
-                rtl_UriEncodeKeepEscapes,
-                RTL_TEXTENCODING_UTF8 );
-        }
-        else if ( !m_sPath.isEmpty( ) )
+        if ( !m_sPath.isEmpty( ) )
         {
             sal_Int32 nPos = -1;
             OUString sEncodedPath;
@@ -118,6 +110,13 @@ namespace cmis
             while ( nPos != -1 );
             sUrl += sEncodedPath;
         }
+        else if ( !m_sId.isEmpty( ) )
+        {
+            sUrl += "#" + rtl::Uri::encode( m_sId,
+                rtl_UriCharClassRelSegment,
+                rtl_UriEncodeKeepEscapes,
+                RTL_TEXTENCODING_UTF8 );
+        }
 
         return sUrl;
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to