From: neostom432 Date: Mon, 15 Jun 2020 16:39:01 +0000 (+0900) Subject: Revert "[Tizen] Add AutofillContainer class and autofill implementation" X-Git-Tag: accepted/tizen/unified/20200616.170924~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9c42478b6d5e538ebc089fead1c5f903b717130;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Revert "[Tizen] Add AutofillContainer class and autofill implementation" This reverts commit ed42042292ad90f180bb9d74779e2faeae4457f5. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index dbd38b4..ff17e64 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,6 @@ SET ( SOURCES ${SOURCES} ${devel_api_src_dir}/controls/popup/popup.cpp ${devel_api_src_dir}/controls/shadow-view/shadow-view.cpp ${devel_api_src_dir}/controls/super-blur-view/super-blur-view.cpp - ${devel_api_src_dir}/controls/text-controls/autofill-container.cpp ${devel_api_src_dir}/controls/text-controls/text-editor-devel.cpp ${devel_api_src_dir}/controls/text-controls/text-field-devel.cpp ${devel_api_src_dir}/controls/text-controls/text-selection-popup.cpp @@ -162,7 +161,6 @@ SET( SOURCES ${SOURCES} ${internal_src_dir}/controls/slider/slider-impl.cpp ${internal_src_dir}/controls/super-blur-view/super-blur-view-impl.cpp ${internal_src_dir}/controls/table-view/table-view-impl.cpp - ${internal_src_dir}/controls/text-controls/autofill-container-impl.cpp ${internal_src_dir}/controls/text-controls/text-editor-impl.cpp ${internal_src_dir}/controls/text-controls/text-field-impl.cpp ${internal_src_dir}/controls/text-controls/text-label-impl.cpp diff --git a/dali-toolkit/devel-api/controls/text-controls/autofill-container.cpp b/dali-toolkit/devel-api/controls/text-controls/autofill-container.cpp deleted file mode 100644 index e75ca6f..0000000 --- a/dali-toolkit/devel-api/controls/text-controls/autofill-container.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. - * - * Licensed 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Toolkit -{ - -AutofillContainer AutofillContainer::New( const std::string& name ) -{ - return Internal::AutofillContainer::New( name ); -} - -AutofillContainer::AutofillContainer() -{ -} - -AutofillContainer::AutofillContainer( const AutofillContainer& handle ) -: BaseHandle(handle) -{ -} - -AutofillContainer& AutofillContainer::operator=( const AutofillContainer& handle ) -{ - BaseHandle::operator=(handle); - return *this; -} - -AutofillContainer::~AutofillContainer() -{ -} - -AutofillContainer AutofillContainer::DownCast( BaseHandle handle ) -{ - return AutofillContainer( dynamic_cast( handle.GetObjectPtr() ) ); -} - - -void AutofillContainer::AddAutofillItem( Control control, Property::Index propertyIndex, const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ) -{ - GetImpl(*this).AddAutofillItem( control, propertyIndex, id, label, hint, isSensitive ); -} - -void AutofillContainer::RemoveAutofillItem( Control control ) -{ - GetImpl(*this).RemoveAutofillItem( control ); -} - -void AutofillContainer::SetFocusedControl( Toolkit::Control focused ) -{ - GetImpl(*this).SetFocusedControl( focused ); -} - -Toolkit::Control AutofillContainer::GetFocusedControl() -{ - return GetImpl(*this).GetFocusedControl(); -} - -void AutofillContainer::SaveAutofillData() -{ - GetImpl(*this).SaveAutofillData(); -} - -void AutofillContainer::RequestFillData() -{ - GetImpl(*this).RequestFillData(); -} - -const std::string& AutofillContainer::GetAutofillServiceName() const -{ - return GetImpl(*this).GetAutofillServiceName(); -} - -const std::string& AutofillContainer::GetAutofillServiceMessage() const -{ - return GetImpl(*this).GetAutofillServiceMessage(); -} - -const std::string& AutofillContainer::GetAutofillServiceImagePath() const -{ - return GetImpl(*this).GetAutofillServiceImagePath(); -} - -unsigned int AutofillContainer::GetListCount() -{ - return GetImpl(*this).GetListCount(); -} - -const std::string& AutofillContainer::GetListItem( unsigned int index ) const -{ - return GetImpl(*this).GetListItem( index ); -} - -void AutofillContainer::SetSelectedItem( const std::string& selected ) -{ - GetImpl(*this).SetSelectedItem( selected ); -} - -AutofillContainer::AutofillContainer( Internal::AutofillContainer* implementation ) -: BaseHandle(implementation) -{ -} - -AutofillContainer::AuthenticationSignalType& AutofillContainer::AutofillServiceShownSignal() -{ - return GetImpl(*this).AutofillServiceShownSignal(); -} - -AutofillContainer::ListShownSignalType& AutofillContainer::AutofillListShownSignal() -{ - return GetImpl(*this).AutofillListShownSignal(); -} - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/devel-api/controls/text-controls/autofill-container.h b/dali-toolkit/devel-api/controls/text-controls/autofill-container.h deleted file mode 100644 index eecad1a..0000000 --- a/dali-toolkit/devel-api/controls/text-controls/autofill-container.h +++ /dev/null @@ -1,219 +0,0 @@ -#ifndef DALI_TOOLKIT_AUTO_FILL_CONTAINER_H -#define DALI_TOOLKIT_AUTO_FILL_CONTAINER_H - -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. - * - * Licensed 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal DALI_INTERNAL -{ -class AutofillContainer; -} - -/** - * @brief AutofillContainer controls several text input boxes (Dali::Toolkit::TextField and Dali::Toolkit::TextEditor). - * - * It can make these editors a group of text boxes. - */ -class DALI_TOOLKIT_API AutofillContainer : public BaseHandle -{ -public: - - // TODO : Need to update parameter and return value according to each Signal - typedef Signal< void (AutofillContainer&) > AuthenticationSignalType; ///< Authentication Signal Type - typedef Signal< void (Control&) > ListShownSignalType; ///< List Shown Signal Type - -public: - - /** - * @brief Creates the AutofillContainer. - * - * @param[in] name The AutofillContainer name - * @return A handle to the AutofillContainer - */ - static AutofillContainer New( const std::string& name ); - - /** - * @brief Creates an empty handle. - */ - AutofillContainer(); - - /** - * @brief Copy constructor. - * - * @param[in] handle The handle to copy from - */ - AutofillContainer( const AutofillContainer& handle ); - - /** - * @brief Assignment operator. - * - * @param[in] handle The handle to copy from - * @return A reference to this - */ - AutofillContainer& operator=( const AutofillContainer& handle ); - - /** - * @brief Destructor. - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~AutofillContainer(); - - /** - * @brief Downcasts a handle to AutofillContainer. - * - * If the BaseHandle points is a AutofillContainer, the downcast returns a valid handle. - * If not, the returned handle is left empty. - * - * @param[in] handle Handle to an object - * @return Handle to a AutofillContainer or an empty handle - */ - static AutofillContainer DownCast( BaseHandle handle ); - - /** - * @brief Adds Control and AutofillItem information to Autofill Container. - * - * @param[in] control The control to be added to Autofill Container - * @param[in] propertyIndex The Property to be filled automatically of each Control - * @param[in] id A unique ID that does not always change on each launching - * @param[in] label An auxiliary means to guess heuristically what data is - * @param[in] hint The Hint - id (username), name, password, phone, credit card number, organization, and so on - * @param[in] isSensitive Whether this information is a sensitive data or not - */ - void AddAutofillItem( Control control, Property::Index propertyIndex, const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ); - - /** - * @brief Removes Control and its AutofillItem information to Autofill Container. - * - * @param[in] control The control to be removed - */ - void RemoveAutofillItem( Control control ); - - /** - * @brief Sets that a control is focused. - * - * @param focused The focused control - */ - void SetFocusedControl( Toolkit::Control focused ); - - /** - * @brief Gets the focused control. - * - * @return The focused control - */ - Toolkit::Control GetFocusedControl(); - - /** - * @brief Stores autofill data. - */ - void SaveAutofillData(); - - /** - * @brief Sends a request for filling the data. - */ - void RequestFillData(); - - /** - * @brief Gets the Autofill Service Name. - * - * @return Autofill Service Name - */ - const std::string& GetAutofillServiceName() const; - - /** - * @brief Gets the Autofill Service Message. - * - * @return Autofill Service Message - */ - const std::string& GetAutofillServiceMessage() const; - - /** - * @brief Gets the Autofill Service Image Path. - * - * @return Autofill Service Image Path - */ - const std::string& GetAutofillServiceImagePath() const; - - /** - * @brief Gets the number of list items. (The presentation text of Autofill) - * - * @return The number of list items - */ - unsigned int GetListCount(); - - /** - * @brief Gets the list item of the index. - * - * @param[in] index The index for the list - * @return The list item of the index - */ - const std::string& GetListItem( unsigned int index ) const; - - /** - * @brief Sets the selected item to fill out. - * - * @param[in] selected The selected item - */ - void SetSelectedItem( const std::string& selected ); - -public: - // Signals - - /** - * @brief AutofillServiceShownSignal - * - * @return The signal containing the received data - */ - AuthenticationSignalType& AutofillServiceShownSignal(); - - /** - * @brief AutofillListShownSignal - * - * @return The signal containing the received data - */ - ListShownSignalType& AutofillListShownSignal(); - - -public: // Not intended for application developers - - /** - * @brief Creates a handle using the Toolkit::Internal implementation. - * - * @param[in] implementation The Control implementation - */ - DALI_INTERNAL AutofillContainer( Internal::AutofillContainer* implementation ); - -}; - - -} // namespace Toolkit - -} // namespace Dali - -#endif // DALI_TOOLKIT_AUTO_FILL_CONTAINER_H diff --git a/dali-toolkit/devel-api/file.list b/dali-toolkit/devel-api/file.list index 47b565d..219fb28 100755 --- a/dali-toolkit/devel-api/file.list +++ b/dali-toolkit/devel-api/file.list @@ -25,7 +25,6 @@ SET( devel_api_src_files ${devel_api_src_dir}/controls/scene3d-view/scene3d-view.cpp ${devel_api_src_dir}/controls/shadow-view/shadow-view.cpp ${devel_api_src_dir}/controls/super-blur-view/super-blur-view.cpp - ${devel_api_src_dir}/controls/text-controls/autofill-container.cpp ${devel_api_src_dir}/controls/text-controls/text-editor-devel.cpp ${devel_api_src_dir}/controls/text-controls/text-field-devel.cpp ${devel_api_src_dir}/controls/text-controls/text-selection-popup.cpp @@ -173,7 +172,6 @@ SET( devel_api_super_blur_view_header_files ) SET( devel_api_text_controls_header_files - ${devel_api_src_dir}/controls/text-controls/autofill-container.h ${devel_api_src_dir}/controls/text-controls/text-editor-devel.h ${devel_api_src_dir}/controls/text-controls/text-field-devel.h ${devel_api_src_dir}/controls/text-controls/text-label-devel.h diff --git a/dali-toolkit/internal/controls/control/control-data-impl.cpp b/dali-toolkit/internal/controls/control/control-data-impl.cpp index b49a8c5..eb6285a 100755 --- a/dali-toolkit/internal/controls/control/control-data-impl.cpp +++ b/dali-toolkit/internal/controls/control/control-data-impl.cpp @@ -313,6 +313,7 @@ const PropertyRegistration Control::Impl::PROPERTY_13( typeRegistration, "upFocu const PropertyRegistration Control::Impl::PROPERTY_14( typeRegistration, "downFocusableActorId", Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); const PropertyRegistration Control::Impl::PROPERTY_15( typeRegistration, "shadow", Toolkit::DevelControl::Property::SHADOW, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty ); + Control::Impl::Impl( Control& controlImpl ) : mControlImpl( controlImpl ), mState( Toolkit::DevelControl::NORMAL ), @@ -337,12 +338,9 @@ Control::Impl::Impl( Control& controlImpl ) mLongPressGestureDetector(), mTooltip( NULL ), mInputMethodContext(), - mAutofillItem(), - mAutofillContainer(), mFlags( Control::ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mIsKeyboardNavigationSupported( false ), - mIsKeyboardFocusGroup( false ), - mIsAutofillEnabled( false ) + mIsKeyboardFocusGroup( false ) { } @@ -1452,36 +1450,6 @@ void Control::Impl::ClearShadow() mControlImpl.RelayoutRequest(); } -void Control::Impl::SetAutofillEnabled( bool autofillEnabled ) -{ - mIsAutofillEnabled = autofillEnabled; -} - -bool Control::Impl::IsAutofillEnabled() -{ - return mIsAutofillEnabled; -} - -void Control::Impl::SetAutofillItemHandle( Dali::AutofillItem item ) -{ - mAutofillItem = item; -} - -Dali::AutofillItem Control::Impl::GetAutofillItemHandle() -{ - return mAutofillItem; -} - -void Control::Impl::SetAutofillContainer( Toolkit::AutofillContainer container ) -{ - mAutofillContainer = container; -} - -Toolkit::AutofillContainer Control::Impl::GetAutofillContainer() -{ - return mAutofillContainer; -} - } // namespace Internal } // namespace Toolkit diff --git a/dali-toolkit/internal/controls/control/control-data-impl.h b/dali-toolkit/internal/controls/control/control-data-impl.h index 9648cd6..210f6e2 100755 --- a/dali-toolkit/internal/controls/control/control-data-impl.h +++ b/dali-toolkit/internal/controls/control/control-data-impl.h @@ -21,14 +21,11 @@ // EXTERNAL INCLUDES #include #include -#include -#include #include // INTERNAL INCLUDES #include #include -#include #include #include #include @@ -349,42 +346,6 @@ public: * @brief Clear the shadow. */ void ClearShadow(); - - /** - * @brief Sets whether the Autofill functionality is enabled. - * @param[in] autofillEnabled Set true when Autofill should be enabled. - */ - void SetAutofillEnabled( bool autofillEnabled ); - - /** - * @brief Check if the Autofill framework is enabled. - * @return True if Autofill is enabled - */ - bool IsAutofillEnabled(); - - /** - * @brief Sets AutofillItemHandle - * @param item AutofillItem handle - */ - void SetAutofillItemHandle( Dali::AutofillItem item ); - - /** - * @brief Gets AutofillItemHandle - * @return AutofillItem handle - */ - Dali::AutofillItem GetAutofillItemHandle(); - - /** - * @brief Sets AutofillContainer which this control belongs to. - * @param[in] container - */ - void SetAutofillContainer( Toolkit::AutofillContainer container ); - - /** - * @brief Gets AutofillContainer that the control belongs to. - * @return AutofillContainer handle - */ - Toolkit::AutofillContainer GetAutofillContainer(); private: @@ -458,13 +419,10 @@ public: TooltipPtr mTooltip; InputMethodContext mInputMethodContext; - AutofillItem mAutofillItem; - Toolkit::AutofillContainer mAutofillContainer; ControlBehaviour mFlags : CONTROL_BEHAVIOUR_FLAG_COUNT; ///< Flags passed in from constructor. bool mIsKeyboardNavigationSupported :1; ///< Stores whether keyboard navigation is supported by the control. bool mIsKeyboardFocusGroup :1; ///< Stores whether the control is a focus group. - bool mIsAutofillEnabled : 1; ///< Stroes whether the Autofill functionality is enabled. RegisteredVisualContainer mRemoveVisuals; ///< List of visuals that are being replaced by another visual once ready diff --git a/dali-toolkit/internal/controls/text-controls/autofill-container-impl.cpp b/dali-toolkit/internal/controls/text-controls/autofill-container-impl.cpp deleted file mode 100755 index 6c9628b..0000000 --- a/dali-toolkit/internal/controls/text-controls/autofill-container-impl.cpp +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. - * - * Licensed 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL INCLUDES -#include // for strcmp -#include -#include - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -namespace -{ - -#if defined ( DEBUG_ENABLED ) - Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_AUTOFILL_CONTAINER"); -#endif - -// Type registration -BaseHandle Create() -{ - return Toolkit::AutofillContainer::New( "" ); -} - -// Setup properties, signals and actions using the type-registry. -DALI_TYPE_REGISTRATION_BEGIN( Toolkit::AutofillContainer, Dali::BaseHandle, Create ); - -DALI_SIGNAL_REGISTRATION( Toolkit, AutofillContainer, "serviceShown", SIGNAL_SERVICE_SHOWN ) -DALI_SIGNAL_REGISTRATION( Toolkit, AutofillContainer, "listShown", SIGNAL_LIST_SHOWN ) - -DALI_TYPE_REGISTRATION_END() - -} // namespace - -Toolkit::AutofillContainer AutofillContainer::New( const std::string& name ) -{ - // Create the implementation, temporarily owned by this handle on stack - Internal::AutofillContainer* impl = new AutofillContainer(); - - // Pass ownership to CustomActor handle - Toolkit::AutofillContainer handle( impl ); - impl->Initialize( name ); - - return handle; -} - -void AutofillContainer::Initialize( const std::string& name ) -{ - mAutofillManager = Dali::AutofillManager::Get(); - mAutofillGroup = mAutofillManager.CreateAutofillGroup( name ); - - // If the authentication is needed, AuthenticationReceivedSignal would be emitted. - mAutofillManager.AuthenticationReceivedSignal().Connect( mSlotDelegate, &AutofillContainer::OnAutofillAuthReceived ); - - // If the data to be filled is present, FillResponseReceivedSignal would be emitted. - mAutofillManager.FillResponseReceivedSignal().Connect( mSlotDelegate, &AutofillContainer::OnDataFillReceived ); - - // If the values to be filled are multiple, ListEventSignal would be emitted. - mAutofillManager.ListEventSignal().Connect( mSlotDelegate, &AutofillContainer::OnListReceived ); -} - -void AutofillContainer::AddAutofillItem( Dali::Toolkit::Control control, Dali::Property::Index propertyIndex, const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ) -{ - if( control ) - { - Dali::AutofillItem item = mAutofillManager.CreateAutofillItem( id, label, static_cast(hint), isSensitive ); - - Internal::Control& controlImpl = GetImplementation( control ); - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); - controlDataImpl.SetAutofillContainer( this ); - controlDataImpl.SetAutofillEnabled( true ); - controlDataImpl.SetAutofillItemHandle( item ); // TODO : This instance would be here as... std::map or pair - - mAutofillGroup.AddAutofillItem( item ); - - mPropertyIndex = propertyIndex; - - // TODO : Remove the mControlItemList below and replace it. - mControlList.push_back( std::pair< Dali::Toolkit::Control, Dali::AutofillItem >( control, item ) ); - - // Push back a Control to the list - mControlItemList.push_back( control ); - } -} - -void AutofillContainer::RemoveAutofillItem( Dali::Toolkit::Control control ) -{ - if( control ) - { - Internal::Control& controlImpl = GetImplementation( control ); - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); - controlDataImpl.SetAutofillEnabled( false ); - // TODO : Put the control out the list - } -} - -Dali::AutofillGroup AutofillContainer::GetAutofillGroup() -{ - return mAutofillGroup; -} - -void AutofillContainer::SetFocusedControl( Toolkit::Control focused ) -{ - mCurrentFocused = focused; -} - -Toolkit::Control AutofillContainer::GetFocusedControl() -{ - return mCurrentFocused; -} - -void AutofillContainer::SaveAutofillData() -{ - for( std::vector::iterator iter = mControlItemList.begin(), endIter = mControlItemList.end(); iter != endIter; ++iter ) - { - std::string controlValue = (*iter).GetProperty( mPropertyIndex ); - Internal::Control& controlImpl = GetImplementation( *iter ); - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); - controlDataImpl.GetAutofillItemHandle().SetSaveValue( controlValue ); - } - - // Sends request to save the current autofill data - mAutofillGroup.SaveAutofillData(); - mAutofillManager.SaveAutofillData( mAutofillGroup ); -} - -void AutofillContainer::RequestFillData() -{ - // Sends fill request to fill out the data. - mAutofillGroup.SendFillRequest(); -} - -void AutofillContainer::SetAutofillServiceName( const std::string& serviceName ) -{ - mAutofillServiceName = serviceName; -} - -const std::string& AutofillContainer::GetAutofillServiceName() const -{ - return mAutofillServiceName; -} - -void AutofillContainer::SetAutofillServiceMessage( const std::string& serviceMessage ) -{ - mAutofillServiceMessage = serviceMessage; -} - -const std::string& AutofillContainer::GetAutofillServiceMessage() const -{ - return mAutofillServiceMessage; -} - -void AutofillContainer::SetAutofillServiceImagePath( const std::string& serviceImagePath ) -{ - mAutofillServiceImagePath = serviceImagePath; -} - -const std::string& AutofillContainer::GetAutofillServiceImagePath() const -{ - return mAutofillServiceImagePath; -} - -unsigned int AutofillContainer::GetListCount() -{ - Toolkit::Control control = mCurrentFocused; - Internal::Control& controlImpl = GetImplementation( control ); - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); - return controlDataImpl.GetAutofillItemHandle().GetFillValueCount(); -} - -const std::string& AutofillContainer::GetListItem( unsigned int index ) const -{ - Toolkit::Control control = mCurrentFocused; - Internal::Control& controlImpl = GetImplementation( control ); - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); - return controlDataImpl.GetAutofillItemHandle().GetPresentationText( index ); -} - -void AutofillContainer::SetSelectedItem( const std::string& selected ) -{ - Toolkit::Control control = mCurrentFocused; - Internal::Control& controlImpl = GetImplementation( control ); - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); - unsigned int count = controlDataImpl.GetAutofillItemHandle().GetFillValueCount(); - unsigned int index = 0; - for( index = 0; index < count; index++ ) - { - std::string presentationText = controlDataImpl.GetAutofillItemHandle().GetPresentationText( index ); - if( 0 == strcmp( presentationText.c_str(), selected.c_str() ) ) - { - break; - } - } - - for( std::vector::iterator iter = mControlItemList.begin(), endIter = mControlItemList.end(); iter != endIter; ++iter ) - { - Internal::Control& controlImpl = GetImplementation( *iter ); - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); - std::string fillValue = controlDataImpl.GetAutofillItemHandle().GetFillValue( index ); - (*iter).SetProperty( Toolkit::TextField::Property::TEXT, fillValue ); - } -} - -// -void AutofillContainer::OnAutofillAuthReceived() -{ - SetAutofillServiceName( mAutofillManager.GetAuthenticationServiceName() ); - SetAutofillServiceMessage( mAutofillManager.GetAuthenticationServiceMessage() ); - SetAutofillServiceImagePath( mAutofillManager.GetAuthenticationServiceImagePath() ); - - Dali::Toolkit::AutofillContainer handle( this ); - mAuthenticationEventSignal.Emit( handle ); - - DALI_LOG_ERROR(" [ Emit DALi signal to receive the auth information ] \n"); - -} - -void AutofillContainer::OnDataFillReceived( Dali::AutofillItem item ) -{ - for( std::vector::iterator iter = mControlItemList.begin(), endIter = mControlItemList.end(); iter != endIter; ++iter ) - { - Internal::Control& controlImpl = GetImplementation( *iter ); - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); - - if( 0 == strcmp( controlDataImpl.GetAutofillItemHandle().GetId().c_str(), item.GetId().c_str() ) ) - { - // TODO : Is the index for fill data always 0 in this case? - std::string itemText = controlDataImpl.GetAutofillItemHandle().GetFillValue( 0 ); - (*iter).SetProperty( Toolkit::TextField::Property::TEXT, itemText ); - } - } - -} - -void AutofillContainer::OnListReceived() -{ - mListEventSignal.Emit( mCurrentFocused ); - -} - - -AutofillContainer::AutofillContainer() -: mAutofillManager(), - mAutofillGroup(), - mControlItemList(), - mControlList(), - mSlotDelegate( this ), - mPropertyIndex( Property::INVALID_INDEX ), - mAutofillServiceName( "" ), - mAutofillServiceMessage( "" ), - mAutofillServiceImagePath( "" ), - mCurrentFocused() -{ -} - -AutofillContainer::~AutofillContainer() -{ - mAutofillManager.AuthenticationReceivedSignal().Disconnect( mSlotDelegate, &AutofillContainer::OnAutofillAuthReceived ); - mAutofillManager.FillResponseReceivedSignal().Disconnect( mSlotDelegate, &AutofillContainer::OnDataFillReceived ); - mAutofillManager.ListEventSignal().Disconnect( mSlotDelegate, &AutofillContainer::OnListReceived ); -} - -// Signals -Toolkit::AutofillContainer::AuthenticationSignalType& AutofillContainer::AutofillServiceShownSignal() -{ - return mAuthenticationEventSignal; -} - -Toolkit::AutofillContainer::ListShownSignalType& AutofillContainer::AutofillListShownSignal() -{ - return mListEventSignal; -} - -bool AutofillContainer::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) -{ - Dali::BaseHandle handle( object ); - - bool connected( true ); - Toolkit::AutofillContainer container = Toolkit::AutofillContainer::DownCast( handle ); - - if( container ) - { - if( 0 == signalName.compare( SIGNAL_SERVICE_SHOWN ) ) - { - container.AutofillServiceShownSignal().Connect( tracker, functor ); - } - else if( 0 == signalName.compare( SIGNAL_LIST_SHOWN ) ) - { - container.AutofillListShownSignal().Connect( tracker, functor ); - } - else - { - // signalName does not match any signal - connected = false; - } - } - - return connected; -} - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/internal/controls/text-controls/autofill-container-impl.h b/dali-toolkit/internal/controls/text-controls/autofill-container-impl.h deleted file mode 100644 index 1ef8262..0000000 --- a/dali-toolkit/internal/controls/text-controls/autofill-container-impl.h +++ /dev/null @@ -1,249 +0,0 @@ -#ifndef DALI_TOOLKIT_INTERNAL_AUTOFILL_CONTAINER_H -#define DALI_TOOLKIT_INTERNAL_AUTOFILL_CONTAINER_H - -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. - * - * Licensed 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include - - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -/** - * @copydoc Toolkit::AutofillContainer - */ -class AutofillContainer : public Dali::BaseObject -{ -public: - - /** - * @copydoc Dali::Toollkit::AutofillContainer::New() - */ - static Toolkit::AutofillContainer New( const std::string& name ); - - /** - * @brief Initialize AutofillContainer - */ - void Initialize( const std::string& name ); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::AddAutofillItem() - */ - void AddAutofillItem( Dali::Toolkit::Control control, Dali::Property::Index propertyIndex, const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::RemoveAutofillItem() - */ - void RemoveAutofillItem( Dali::Toolkit::Control control ); - - /** - * @brief Gets AutofillGroup setting to AutofillContainer. - * - * @return The AutofillGroup instance - */ - Dali::AutofillGroup GetAutofillGroup(); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::SetFocusedControl() - */ - void SetFocusedControl( Toolkit::Control focused ); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::GetFocusedControl() - */ - Toolkit::Control GetFocusedControl(); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::SaveAutofillData() - */ - void SaveAutofillData(); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::RequestFillData() - */ - void RequestFillData(); - - /** - * @brief Sets the Autofill Service Name - * - * @param serviceName Autofill Service Name - */ - void SetAutofillServiceName( const std::string& serviceName ); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::GetAutofillServiceName() - */ - const std::string& GetAutofillServiceName() const; - - /** - * @brief Sets the Autofill Service Message - * - * @param serviceMessage Autofill Service Message - */ - void SetAutofillServiceMessage( const std::string& serviceMessage ); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::GetAutofillServiceMessage() - */ - const std::string& GetAutofillServiceMessage() const; - - /** - * @brief Sets the Autofill Service Image Path - * - * @param serviceImagePath Autofill Service Image Path - */ - void SetAutofillServiceImagePath( const std::string& serviceImagePath ); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::GetAutofillServiceImagePath() - */ - const std::string& GetAutofillServiceImagePath() const; - - /** - * @copydoc Dali::Toollkit::AutofillContainer::GetListCount() - */ - unsigned int GetListCount(); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::GetListItem() - */ - const std::string& GetListItem( unsigned int index ) const; - - /** - * @copydoc Dali::Toollkit::AutofillContainer::SetSelectedItem() - */ - void SetSelectedItem( const std::string& selected ); - - /** - * @brief Callback when Autofill Authentication information is recieved. - */ - void OnAutofillAuthReceived(); - - /** - * @brief Callback when Autofill Fill Response is recieved. - * @param[in] item The callback parameter - */ - void OnDataFillReceived( Dali::AutofillItem item ); - - /** - * @brief Callback when the values to be filled are multiple. - */ - void OnListReceived(); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::AutofillServiceShownSignal() - */ - Toolkit::AutofillContainer::AuthenticationSignalType& AutofillServiceShownSignal(); - - /** - * @copydoc Dali::Toollkit::AutofillContainer::AutofillListShownSignal() - */ - Toolkit::AutofillContainer::ListShownSignalType& AutofillListShownSignal(); - - /** - * Connects a callback function with the object's signals. - * @param[in] object The object providing the signal. - * @param[in] tracker Used to disconnect the signal. - * @param[in] signalName The signal to connect to. - * @param[in] functor A newly allocated FunctorDelegate. - * @return True if the signal was connected. - * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. - */ - static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); - - -private: // Implementation - - /** - * Construct a new AutofillContainer. - */ - AutofillContainer(); - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~AutofillContainer(); - -private: - - // Undefined copy constructor and assignment operators - AutofillContainer(const AutofillContainer&); - AutofillContainer& operator=(const AutofillContainer& rhs); - -private: // Data - - Dali::AutofillManager mAutofillManager; - Dali::AutofillGroup mAutofillGroup; - std::vector mControlItemList; ///< The List of Control adding to AutofillContainer - //std::map mControlList; - std::vector< std::pair< Dali::Toolkit::Control, Dali::AutofillItem > > mControlList; - - SlotDelegate< AutofillContainer > mSlotDelegate; - - Property::Index mPropertyIndex; ///< The index of property registered by each control - - Toolkit::AutofillContainer::AuthenticationSignalType mAuthenticationEventSignal; - Toolkit::AutofillContainer::ListShownSignalType mListEventSignal; - - std::string mAutofillServiceName; - std::string mAutofillServiceMessage; - std::string mAutofillServiceImagePath; - - Toolkit::Control mCurrentFocused; -}; - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Toolkit::Internal::AutofillContainer& GetImpl( Toolkit::AutofillContainer& autofillContainer ) -{ - DALI_ASSERT_ALWAYS(autofillContainer); - - Dali::BaseObject& handle = autofillContainer.GetBaseObject(); - - return static_cast(handle); -} - -inline const Toolkit::Internal::AutofillContainer& GetImpl( const Toolkit::AutofillContainer& autofillContainer ) -{ - DALI_ASSERT_ALWAYS(autofillContainer); - - const Dali::BaseObject& handle = autofillContainer.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Toolkit - -} // namespace Dali - -#endif // DALI_TOOLKIT_INTERNAL_AUTOFILL_CONTAINER_H diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 35534e5..7e2d143 100755 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -37,8 +37,6 @@ #include #include #include -#include -#include #include #include #include @@ -1587,7 +1585,7 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType ) void TextField::OnKeyInputFocusGained() { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyInputFocusGained %p\n", mController.Get() ); - if( mInputMethodContext ) + if ( mInputMethodContext ) { mInputMethodContext.ApplyOptions( mInputMethodOptions ); @@ -1601,30 +1599,13 @@ void TextField::OnKeyInputFocusGained() // When window gain lost focus, the inputMethodContext is deactivated. Thus when window gain focus again, the inputMethodContext must be activated. mInputMethodContext.SetRestoreAfterFocusLost( true ); } - ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() ); - if( notifier ) + + if ( notifier ) { notifier.ContentSelectedSignal().Connect( this, &TextField::OnClipboardTextSelected ); } - Toolkit::Control control = Toolkit::Control::DownCast( Self() ); - Internal::Control& controlImpl = GetImplementation( control ); - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl ); - bool enableAutofill = controlDataImpl.IsAutofillEnabled(); - if( enableAutofill ) - { - Toolkit::AutofillContainer container = controlDataImpl.GetAutofillContainer(); - container.SetFocusedControl( control ); - - Internal::AutofillContainer& containerImpl = GetImpl( container ); - Dali::AutofillGroup containerGroup = containerImpl.GetAutofillGroup(); - if( containerGroup != nullptr ) - { - containerGroup.RequestAuthentication(); - } - - } mController->KeyboardFocusGainEvent(); // Called in the case of no virtual keyboard to trigger this event EmitKeyInputFocusSignal( true ); // Calls back into the Control hence done last. diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.h b/dali-toolkit/internal/controls/text-controls/text-field-impl.h index 59bedf8..2991931 100755 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.h @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #include #include -#include // INTERNAL INCLUDES #include @@ -292,7 +291,6 @@ private: // Data Toolkit::Control mStencil; ///< For EXCEED_POLICY_CLIP std::vector mClippingDecorationActors; ///< Decoration actors which need clipping. Dali::InputMethodOptions mInputMethodOptions; - Dali::AutofillItem mAutofillItem; Actor mRenderableActor; Actor mActiveLayer; diff --git a/dali-toolkit/internal/file.list b/dali-toolkit/internal/file.list index 8f79e84..8f3b2f2 100644 --- a/dali-toolkit/internal/file.list +++ b/dali-toolkit/internal/file.list @@ -95,7 +95,6 @@ SET( toolkit_src_files ${toolkit_src_dir}/controls/slider/slider-impl.cpp ${toolkit_src_dir}/controls/super-blur-view/super-blur-view-impl.cpp ${toolkit_src_dir}/controls/table-view/table-view-impl.cpp - ${toolkit_src_dir}/controls/text-controls/autofill-container-impl.cpp ${toolkit_src_dir}/controls/text-controls/text-editor-impl.cpp ${toolkit_src_dir}/controls/text-controls/text-field-impl.cpp ${toolkit_src_dir}/controls/text-controls/text-label-impl.cpp