[Libreoffice-commits] core.git: 4 commits - config_host/config_oauth2.h.in configure.ac sfx2/source sfx2/uiconfig svtools/source ucb/source

Cédric Bosdonnat cedric.bosdonnat at free.fr
Thu Nov 7 18:53:47 CET 2013


 config_host/config_oauth2.h.in                   |   28 ++++++++
 configure.ac                                     |   33 +++++++++
 sfx2/source/dialog/versdlg.cxx                   |    7 +-
 sfx2/source/inc/versdlg.hxx                      |    2 
 sfx2/uiconfig/ui/versionscmis.ui                 |   76 -----------------------
 svtools/source/dialogs/ServerDetailsControls.cxx |   12 +++
 ucb/source/ucp/cmis/cmis_content.cxx             |    4 -
 ucb/source/ucp/cmis/cmis_oauth2_providers.hxx    |   32 ---------
 ucb/source/ucp/cmis/cmis_url.cxx                 |    2 
 9 files changed, 79 insertions(+), 117 deletions(-)

New commits:
commit 39768755e8db5fb79d398373cdcde2cfd4e0f20a
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Thu Nov 7 13:15:26 2013 +0100

    OAuth2 application keys shouldn't be in the code.
    
    The GDrive OAuth2 key is now defined at configure time. If either the
    client secret or client id is missing, the Google Drive connectivity
    will be disabled at runtime.
    
    Tinderboxes can set up a GDrive key, but they need to make sure it's
    not persisting in the build log.
    
    Change-Id: I09bc748641ec14eae890f273f05bffe4ed421dbb

diff --git a/ucb/source/ucp/cmis/cmis_oauth2_providers.hxx b/config_host/config_oauth2.h.in
similarity index 79%
rename from ucb/source/ucp/cmis/cmis_oauth2_providers.hxx
rename to config_host/config_oauth2.h.in
index 63df6a4..80800f5 100644
--- a/ucb/source/ucp/cmis/cmis_oauth2_providers.hxx
+++ b/config_host/config_oauth2.h.in
@@ -10,23 +10,19 @@
  *
  */
 
-#ifndef CMIS_OAUTH2_PROVIDERS_HXX
-#define CMIS_OAUTH2_PROVIDERS_HXX
+#ifndef CONFIG_OAUTH2_H
+#define CONFIG_OAUTH2_H
 
 
-namespace cmis
-{
-
+/* Google Drive settings */
 #define GDRIVE_BASE_URL "https://www.googleapis.com/drive/v2"
-#define GDRIVE_CLIENT_ID "457862564325.apps.googleusercontent.com"
-#define GDRIVE_CLIENT_SECRET "GYWrDtzyZQZ0_g5YoBCC6F0I"
+#define GDRIVE_CLIENT_ID ""
+#define GDRIVE_CLIENT_SECRET ""
 #define GDRIVE_AUTH_URL "https://accounts.google.com/o/oauth2/auth"
 #define GDRIVE_TOKEN_URL "https://accounts.google.com/o/oauth2/token"
 #define GDRIVE_REDIRECT_URI "urn:ietf:wg:oauth:2.0:oob"
 #define GDRIVE_SCOPE "https://www.googleapis.com/auth/drive"
 
-}
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/configure.ac b/configure.ac
index d055ddc..01eb919 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2017,6 +2017,20 @@ AC_ARG_WITH(all-tarballs,
     AS_HELP_STRING([--with-all-tarballs],
         [Download all external tarballs unconditionally]))
 
+AC_ARG_WITH(gdrive-client-id,
+    AS_HELP_STRING([--with-drive-client-id],
+        [Provides the client id of the application for OAuth2 authentication
+        on Google Drive. If either this or --with-gdrive-client-secret is
+        empty, the feature will be disabled]),
+)
+
+AC_ARG_WITH(gdrive-client-secret,
+    AS_HELP_STRING([--with-drive-client-secret],
+        [Provides the client secret of the application for OAuth2
+        authentication on Google Drive. If either this or
+        --with-gdrive-client-id is empty, the feature will be disabled]),
+)
+
 dnl ===================================================================
 dnl Do we want to use pre-build binary tarball for recompile
 dnl ===================================================================
@@ -12231,6 +12245,24 @@ AC_SUBST(INSTALLDIR)
 TESTINSTALLDIR="${BUILDDIR}/test-install/${INPATH}"
 AC_SUBST(TESTINSTALLDIR)
 
+
+# ===================================================================
+# OAuth2 id and secrets
+# ===================================================================
+
+AC_MSG_CHECKING([for Google Drive client id and secret])
+GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
+GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
+if test "$with_gdrive_client_id" = "no" -o -n "$with_driver_client_id"; then
+    GDRIVE_CLIENT_ID="\"\""
+fi
+
+if test "$with_gdrive_client_secret" = "no" -o -n "$with_driver_client_secret"; then
+    GDRIVE_CLIENT_SECRET="\"\""
+fi
+AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
+AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
+
 # ===================================================================
 # De- or increase default verbosity of build process
 # ===================================================================
@@ -12606,6 +12638,7 @@ AC_CONFIG_HEADERS([config_host/config_telepathy.h])
 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
 AC_CONFIG_HEADERS([config_host/config_version.h])
+AC_CONFIG_HEADERS([config_host/config_oauth2.h])
 AC_OUTPUT
 
 if test "$CROSS_COMPILING" = YES; then
diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx
index f7a7639..6582b1c 100644
--- a/svtools/source/dialogs/ServerDetailsControls.cxx
+++ b/svtools/source/dialogs/ServerDetailsControls.cxx
@@ -22,6 +22,7 @@
 
 #include <svtools/PlaceEditDialog.hxx>
 #include <svtools/ServerDetailsControls.hxx>
+#include <config_oauth2.h>
 
 using namespace std;
 using namespace com::sun::star::lang;
@@ -278,12 +279,19 @@ CmisDetailsContainer::CmisDetailsContainer( VclBuilderContainer* pBuilder ) :
     show( false );
 
     // Load the ServerType entries
+    bool bSkipGDrive = OUString( GDRIVE_CLIENT_ID ).isEmpty() ||
+                       OUString( GDRIVE_CLIENT_SECRET ).isEmpty();
+
     Sequence< OUString > aTypesUrlsList( officecfg::Office::Common::Misc::CmisServersUrls::get( xContext ) );
     Sequence< OUString > aTypesNamesList( officecfg::Office::Common::Misc::CmisServersNames::get( xContext ) );
     for ( sal_Int32 i = 0; i < aTypesUrlsList.getLength( ) && aTypesNamesList.getLength( ); ++i )
     {
-        m_pLBServerType->InsertEntry( aTypesNamesList[i] );
-        m_aServerTypesURLs.push_back( aTypesUrlsList[i] );
+        OUString sUrl = aTypesUrlsList[i];
+        if ( !( sUrl == OUString( GDRIVE_BASE_URL ) && bSkipGDrive ) )
+        {
+            m_pLBServerType->InsertEntry( aTypesNamesList[i] );
+            m_aServerTypesURLs.push_back( sUrl );
+        }
     }
 }
 
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index f49d9ab..9809c2e 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
 
 #include <comphelper/processfactory.hxx>
+#include <config_oauth2.h>
 #include <ucbhelper/cancelcommandexecution.hxx>
 #include <ucbhelper/content.hxx>
 #include <ucbhelper/contentidentifier.hxx>
@@ -47,7 +48,6 @@
 #include "cmis_content.hxx"
 #include "cmis_provider.hxx"
 #include "cmis_resultset.hxx"
-#include "cmis_oauth2_providers.hxx"
 #include "cmis_strings.hxx"
 
 #define OUSTR_TO_STDSTR(s) string( OUStringToOString( s, RTL_TEXTENCODING_UTF8 ).getStr() )
diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx
index b6dbf6c..dd6f861 100644
--- a/ucb/source/ucp/cmis/cmis_url.cxx
+++ b/ucb/source/ucp/cmis/cmis_url.cxx
@@ -9,10 +9,10 @@
 
 #include <libcmis/libcmis.hxx>
 
+#include <config_oauth2.h>
 #include <rtl/uri.hxx>
 
 #include "cmis_url.hxx"
-#include "cmis_oauth2_providers.hxx"
 
 using namespace std;
 
commit 9c30388aa239d7c9707d31bf827a2c5322a51e27
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Wed Nov 6 23:04:11 2013 +0100

    CMIS Versions dialog is experimental-only for the while
    
    Change-Id: I39e2f3437045ae0ef7b33c65bb59f9fe201dcda7

diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index f9385df..cb75d5a 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -29,6 +29,7 @@
 #include <vcl/svapp.hxx>
 #include <tools/datetime.hxx>
 #include "svtools/treelistentry.hxx"
+#include <svtools/miscopt.hxx>
 
 #include "versdlg.hxx"
 #include "dialog.hrc"
@@ -348,6 +349,10 @@ void SfxVersionDialog::Init_Impl()
     m_pViewButton->Disable();
     m_pDeleteButton->Disable();
     m_pCompareButton->Disable();
+
+    SvtMiscOptions miscOptions;
+    if ( !miscOptions.IsExperimentalMode() )
+        m_pCmisButton->Hide( );
     m_pCmisButton->Enable();
 
     SelectHdl_Impl(m_pVersionBox);
commit 29dd94c9aac80d2712957e104ccceb016424e545
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Wed Nov 6 22:39:58 2013 +0100

    CMIS Versions: removed a few useless buttons
    
    Change-Id: I08a1593700495c2262a270cb9055e973ab0ede29

diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index ad15358..f9385df 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -536,8 +536,6 @@ SfxCmisVersionsDialog::SfxCmisVersionsDialog ( SfxViewFrame* pVwFrame, sal_Bool
     , m_pTable(NULL)
     , m_bIsSaveVersionOnClose(bIsSaveVersionOnClose)
 {
-    get(m_pSaveButton, "save");
-    get(m_pSaveCheckBox, "always");
     get(m_pOpenButton, "open");
     get(m_pViewButton, "show");
     get(m_pDeleteButton, "delete");
diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx
index 169d084..f9201f2 100644
--- a/sfx2/source/inc/versdlg.hxx
+++ b/sfx2/source/inc/versdlg.hxx
@@ -87,8 +87,6 @@ public:
 
 class SfxCmisVersionsDialog : public SfxModalDialog
 {
-    PushButton*                 m_pSaveButton;
-    CheckBox*                   m_pSaveCheckBox;
     SfxVersionsTabListBox_Impl* m_pVersionBox;
     PushButton*                 m_pOpenButton;
     PushButton*                 m_pViewButton;
diff --git a/sfx2/uiconfig/ui/versionscmis.ui b/sfx2/uiconfig/ui/versionscmis.ui
index f5b75ac..ba1be82 100644
--- a/sfx2/uiconfig/ui/versionscmis.ui
+++ b/sfx2/uiconfig/ui/versionscmis.ui
@@ -132,82 +132,6 @@
             <property name="vexpand">True</property>
             <property name="row_spacing">12</property>
             <child>
-              <object class="GtkFrame" id="frame1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
-                <child>
-                  <object class="GtkAlignment" id="alignment1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="top_padding">6</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <object class="GtkGrid" id="grid2">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="column_spacing">12</property>
-                        <child>
-                          <object class="GtkButton" id="save">
-                            <property name="label" translatable="yes">Save _New Version</property>
-                            <property name="use_action_appearance">False</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="use_action_appearance">False</property>
-                            <property name="use_underline">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkCheckButton" id="always">
-                            <property name="label" translatable="yes">_Always save a new version on closing</property>
-                            <property name="use_action_appearance">False</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_action_appearance">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="xalign">0</property>
-                            <property name="draw_indicator">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-                <child type="label">
-                  <object class="GtkLabel" id="label1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">New versions</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkFrame" id="frame2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
commit 949e6c55300a58b0b3cb4c61a5d3ad923798281a
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Wed Nov 6 22:38:44 2013 +0100

    CMIS Versions dialog: fix version date
    
    The version creation date is more likely to be the
    cmis:lastModifiedDate.
    
    Change-Id: I15e81db6a4c5f638f3f472894608a8d6728dc2d2

diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index d7987c6..f49d9ab 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -1089,7 +1089,7 @@ namespace cmis
                 libcmis::DocumentPtr pVersion = *it;
                 aVersions[i].Id = STD_TO_OUSTR( pVersion->getId( ) );
                 aVersions[i].Author = STD_TO_OUSTR( pVersion->getCreatedBy( ) );
-                aVersions[i].TimeStamp = lcl_boostToUnoTime( pVersion->getCreationDate( ) );
+                aVersions[i].TimeStamp = lcl_boostToUnoTime( pVersion->getLastModificationDate( ) );
                 aVersions[i].Comment = STD_TO_OUSTR( pVersion->getStringProperty("cmis:checkinComment") );
             }
             return aVersions;


More information about the Libreoffice-commits mailing list