From 140937ccdf8e797f984e95242428402698aa54bb Mon Sep 17 00:00:00 2001 From: Mihai Varga Date: Fri, 1 Aug 2014 12:50:23 +0300 Subject: OneDrive auth fallback dialog interaction continuation Change-Id: I8dbb8dd96eef504cc7fb8d3b21ac9770ad421459 --- include/ucbhelper/interactionrequest.hxx | 34 +++++++++++++ offapi/UnoApi_offapi.mk | 1 + .../com/sun/star/ucb/XInteractionAuthFallback.idl | 42 ++++++++++++++++ ucbhelper/source/provider/interactionrequest.cxx | 56 ++++++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 offapi/com/sun/star/ucb/XInteractionAuthFallback.idl diff --git a/include/ucbhelper/interactionrequest.hxx b/include/ucbhelper/interactionrequest.hxx index a6d04477aec7..3d894c91194f 100644 --- a/include/ucbhelper/interactionrequest.hxx +++ b/include/ucbhelper/interactionrequest.hxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -660,6 +661,39 @@ public: throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; }; +class UCBHELPER_DLLPUBLIC InteractionAuthFallback: + public InteractionContinuation, + public com::sun::star::ucb::XInteractionAuthFallback +{ + OUString m_aCode; + +public: + InteractionAuthFallback( InteractionRequest * pRequest ) + : InteractionContinuation( pRequest ) {} + + // XInterface + virtual com::sun::star::uno::Any SAL_CALL + queryInterface( const com::sun::star::uno::Type & rType ) + throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + virtual void SAL_CALL acquire() + throw() SAL_OVERRIDE; + virtual void SAL_CALL release() + throw() SAL_OVERRIDE; + + // XInteractionContinuation + virtual void SAL_CALL select() + throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + + // XAuthFallback + virtual void SAL_CALL setCode( const OUString& code ) + throw (::css::uno::RuntimeException, ::std::exception); + virtual OUString SAL_CALL getCode() + throw (::css::uno::RuntimeException, ::std::exception); + + +}; + + } // namespace ucbhelper #endif /* ! INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX */ diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index e720630f6147..38779f8a3487 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -3939,6 +3939,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/ucb,\ XFetchProvider \ XFetchProviderForContentAccess \ XFileIdentifierConverter \ + XInteractionAuthFallback \ XInteractionHandlerSupplier \ XInteractionReplaceExistingData \ XInteractionSupplyAuthentication \ diff --git a/offapi/com/sun/star/ucb/XInteractionAuthFallback.idl b/offapi/com/sun/star/ucb/XInteractionAuthFallback.idl new file mode 100644 index 000000000000..0cb9038fbe54 --- /dev/null +++ b/offapi/com/sun/star/ucb/XInteractionAuthFallback.idl @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_task_XInteractionApprove_idl__ +#define __com_sun_star_task_XInteractionApprove_idl__ + +#include + + + + module com { module sun { module star { module ucb { + +/** An interaction continuation specifying authentication success. + */ +published interface XInteractionAuthFallback: com::sun::star::task::XInteractionContinuation +{ + /* Authentication code submited by the user */ + void setCode( [in] string code ); + string getCode( ); +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucbhelper/source/provider/interactionrequest.cxx b/ucbhelper/source/provider/interactionrequest.cxx index 18f15e100e3f..64bfacb580d9 100644 --- a/ucbhelper/source/provider/interactionrequest.cxx +++ b/ucbhelper/source/provider/interactionrequest.cxx @@ -937,4 +937,60 @@ void SAL_CALL InteractionReplaceExistingData::select() recordSelection(); } +// InteractionAuthFallback Implementation + +// XInterface methods. + +// virtual +void SAL_CALL InteractionAuthFallback::acquire() + throw() +{ + OWeakObject::acquire(); +} + +// virtual +void SAL_CALL InteractionAuthFallback::release() + throw() +{ + OWeakObject::release(); +} + +// virtual +uno::Any SAL_CALL +InteractionAuthFallback::queryInterface( const uno::Type & rType ) + throw ( uno::RuntimeException, std::exception ) +{ + uno::Any aRet = cppu::queryInterface( rType, + static_cast< task::XInteractionContinuation * >( this ), + static_cast< ucb::XInteractionAuthFallback * >( this )); + + return aRet.hasValue() + ? aRet : InteractionContinuation::queryInterface( rType ); +} + +// XInteractionContinuation methods. + +// virtual +void SAL_CALL InteractionAuthFallback::select() + throw( uno::RuntimeException, std::exception ) +{ + recordSelection(); +} + +// XInteractionAuthFallback methods + +// virtual +void SAL_CALL InteractionAuthFallback::setCode( const OUString& code ) + throw ( uno::RuntimeException, std::exception ) +{ + m_aCode = code; +} + +// virtual +OUString SAL_CALL InteractionAuthFallback::getCode( ) + throw ( uno::RuntimeException, std::exception ) +{ + return m_aCode; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3