From aaf7cfb1ea5091edf822b12614daa35c5cb2863a Mon Sep 17 00:00:00 2001 From: neostom432 Date: Mon, 23 Mar 2020 18:41:22 +0900 Subject: [PATCH] [Tizen] Add DALi Autofill implementation This reverts commit 47b6d469243121941cf88c9e1e4737fc92fad267. --- build/tizen/CMakeLists.txt | 2 +- build/tizen/deps-check.cmake | 12 + .../devel-api/adaptor-framework/autofill-group.cpp | 89 ++++ dali/devel-api/adaptor-framework/autofill-group.h | 151 ++++++ dali/devel-api/adaptor-framework/autofill-item.cpp | 115 ++++ dali/devel-api/adaptor-framework/autofill-item.h | 210 ++++++++ .../adaptor-framework/autofill-manager.cpp | 126 +++++ .../devel-api/adaptor-framework/autofill-manager.h | 213 ++++++++ dali/devel-api/file.list | 200 +++---- dali/internal/input/common/autofill-factory.h | 54 ++ dali/internal/input/common/autofill-group-impl.cpp | 44 ++ dali/internal/input/common/autofill-group-impl.h | 137 +++++ dali/internal/input/common/autofill-item-impl.cpp | 43 ++ dali/internal/input/common/autofill-item-impl.h | 174 ++++++ .../input/common/autofill-manager-impl.cpp | 44 ++ dali/internal/input/common/autofill-manager-impl.h | 190 +++++++ dali/internal/input/file.list | 40 +- .../tizen-wayland/autofill-factory-ecore-wl.cpp | 53 ++ .../tizen-wayland/autofill-group-impl-ecore-wl.cpp | 230 ++++++++ .../tizen-wayland/autofill-group-impl-ecore-wl.h | 150 ++++++ .../tizen-wayland/autofill-item-impl-ecore-wl.cpp | 207 +++++++ .../tizen-wayland/autofill-item-impl-ecore-wl.h | 195 +++++++ .../autofill-manager-impl-ecore-wl.cpp | 592 +++++++++++++++++++++ .../tizen-wayland/autofill-manager-impl-ecore-wl.h | 258 +++++++++ .../input/ubuntu-x11/autofill-factory-x.cpp | 54 ++ .../input/ubuntu-x11/autofill-group-impl-x.cpp | 134 +++++ .../input/ubuntu-x11/autofill-group-impl-x.h | 127 +++++ .../input/ubuntu-x11/autofill-item-impl-x.cpp | 155 ++++++ .../input/ubuntu-x11/autofill-item-impl-x.h | 171 ++++++ .../input/ubuntu-x11/autofill-manager-impl-x.cpp | 252 +++++++++ .../input/ubuntu-x11/autofill-manager-impl-x.h | 217 ++++++++ packaging/dali-adaptor.spec | 6 + 32 files changed, 4532 insertions(+), 113 deletions(-) create mode 100755 dali/devel-api/adaptor-framework/autofill-group.cpp create mode 100755 dali/devel-api/adaptor-framework/autofill-group.h create mode 100755 dali/devel-api/adaptor-framework/autofill-item.cpp create mode 100755 dali/devel-api/adaptor-framework/autofill-item.h create mode 100755 dali/devel-api/adaptor-framework/autofill-manager.cpp create mode 100755 dali/devel-api/adaptor-framework/autofill-manager.h create mode 100644 dali/internal/input/common/autofill-factory.h create mode 100755 dali/internal/input/common/autofill-group-impl.cpp create mode 100644 dali/internal/input/common/autofill-group-impl.h create mode 100755 dali/internal/input/common/autofill-item-impl.cpp create mode 100644 dali/internal/input/common/autofill-item-impl.h create mode 100755 dali/internal/input/common/autofill-manager-impl.cpp create mode 100644 dali/internal/input/common/autofill-manager-impl.h create mode 100755 dali/internal/input/tizen-wayland/autofill-factory-ecore-wl.cpp create mode 100755 dali/internal/input/tizen-wayland/autofill-group-impl-ecore-wl.cpp create mode 100644 dali/internal/input/tizen-wayland/autofill-group-impl-ecore-wl.h create mode 100755 dali/internal/input/tizen-wayland/autofill-item-impl-ecore-wl.cpp create mode 100644 dali/internal/input/tizen-wayland/autofill-item-impl-ecore-wl.h create mode 100755 dali/internal/input/tizen-wayland/autofill-manager-impl-ecore-wl.cpp create mode 100644 dali/internal/input/tizen-wayland/autofill-manager-impl-ecore-wl.h create mode 100755 dali/internal/input/ubuntu-x11/autofill-factory-x.cpp create mode 100755 dali/internal/input/ubuntu-x11/autofill-group-impl-x.cpp create mode 100644 dali/internal/input/ubuntu-x11/autofill-group-impl-x.h create mode 100755 dali/internal/input/ubuntu-x11/autofill-item-impl-x.cpp create mode 100644 dali/internal/input/ubuntu-x11/autofill-item-impl-x.h create mode 100755 dali/internal/input/ubuntu-x11/autofill-manager-impl-x.cpp create mode 100644 dali/internal/input/ubuntu-x11/autofill-manager-impl-x.h diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index fd6681a..b9dd463 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -360,7 +360,7 @@ IF( ENABLE_LINK_TEST ) ADD_EXECUTABLE( ${LINKER_TEST_NAME} ${LINKER_TEST_SOURCES} ) MESSAGE(STATUS "libs: ${DALICORE_LDFLAGS}") TARGET_COMPILE_OPTIONS( ${LINKER_TEST_NAME} PRIVATE -I${ROOT_SRC_DIR} ${DALICORE_CFLAGS} ) - TARGET_LINK_LIBRARIES(${LINKER_TEST_NAME} ${name} ${DALICORE_LDFLAGS} ${VCONF_LDFLAGS} ${HARFBUZZ_LDFLAGS} ) + TARGET_LINK_LIBRARIES(${LINKER_TEST_NAME} ${name} ${DALICORE_LDFLAGS} ${VCONF_LDFLAGS} ${HARFBUZZ_LDFLAGS} ${AUTOFILL_LDFLAGS} ) TARGET_INCLUDE_DIRECTORIES( ${LINKER_TEST_NAME} PRIVATE ${DALI_TEST_SUITE_DIR} ) ENDIF() diff --git a/build/tizen/deps-check.cmake b/build/tizen/deps-check.cmake index b496dd9..b60bd0c 100644 --- a/build/tizen/deps-check.cmake +++ b/build/tizen/deps-check.cmake @@ -18,6 +18,9 @@ ARG_ENABLE( ENABLE_PROFILE enable_profile "${ENABLE_VAL};UBUNTU" "Select the var # Tizen Major version ARG_ENABLE( ENABLE_TIZEN_MAJOR_VERSION enable_tizen_major_version "${ENABLE_VAL};0" "Specify the Tizen Major version for backwards compatibility" ) +# Tizen Minor version +ARG_ENABLE( ENABLE_TIZEN_MINOR_VERSION enable_tizen_minor_version "${ENABLE_VAL};0" "Specify the Tizen Minor version for backwards compatibility" ) + ARG_ENABLE( ENABLE_FEEDBACK enable_feedback 1 "Enable feedback plugin" ) ARG_ENABLE( ENABLE_WAYLAND enable_wayland "${ENABLE_VAL}" "Build on Wayland" ) @@ -126,6 +129,13 @@ ENDIF() CHECK_MODULE_AND_SET( WAYLAND_EXTENSION xdg-shell-client text-client input-method-client [] ) +IF( enable_tizen_major_version GREATER 5 ) + IF( enable_tizen_minor_version GREATER 5 ) + CHECK_MODULE_AND_SET( AUTOFILL capi-ui-autofill [] ) + ADD_DEFINITIONS( -DCAPI_AUTOFILL_SUPPORT ) + ENDIF() +ENDIF() + # BUILD CONDITIONS IF( watch_available AND WEARABLE_PROFILE ) ADD_DEFINITIONS( -DAPPCORE_WATCH_AVAILABLE ) @@ -265,6 +275,8 @@ SET( DALI_LDFLAGS ${LIBCURL_LDFLAGS} ${LIBCRYPTO_LDFLAGS} ${HARFBUZZ_LDFLAGS} + ${AUTOFILL_LDFLAGS} + ${TPKP_CURL_LDFLAGS} ${UTILX_LDFLAGS} -lgif -lturbojpeg diff --git a/dali/devel-api/adaptor-framework/autofill-group.cpp b/dali/devel-api/adaptor-framework/autofill-group.cpp new file mode 100755 index 0000000..cca5b06 --- /dev/null +++ b/dali/devel-api/adaptor-framework/autofill-group.cpp @@ -0,0 +1,89 @@ +/* + * 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 +{ + +AutofillGroup::AutofillGroup() +{ +} + +AutofillGroup::AutofillGroup( Internal::Adaptor::AutofillGroup* internal ) +: BaseHandle( internal ) +{ +} + +AutofillGroup::~AutofillGroup() +{ +} + +AutofillGroup::AutofillGroup( const AutofillGroup& group ) +: BaseHandle( group ) +{ +} + +AutofillGroup& AutofillGroup::operator=( const AutofillGroup& group ) +{ + if( *this != group ) + { + BaseHandle::operator=( group ); + } + return *this; +} + +AutofillGroup AutofillGroup::DownCast( BaseHandle handle ) +{ + return AutofillGroup( dynamic_cast< Internal::Adaptor::AutofillGroup* >( handle.GetObjectPtr() ) ); +} + +const std::string& AutofillGroup::GetId() const +{ + return Internal::Adaptor::GetImplementation(*this).GetId(); +} + +void AutofillGroup::AddAutofillItem( Dali::AutofillItem item ) +{ + Internal::Adaptor::GetImplementation(*this).AddAutofillItem( item ); +} + +Dali::AutofillItem AutofillGroup::GetAutofillItem( const std::string& id ) +{ + return Internal::Adaptor::GetImplementation(*this).GetAutofillItem( id ); +} + +void AutofillGroup::SaveAutofillData() +{ + Internal::Adaptor::GetImplementation(*this).SaveAutofillData(); +} + +void AutofillGroup::RequestAuthentication() +{ + Internal::Adaptor::GetImplementation(*this).RequestAuthentication(); +} + +void AutofillGroup::SendFillRequest() +{ + Internal::Adaptor::GetImplementation(*this).SendFillRequest(); +} + +} // namespace Dali diff --git a/dali/devel-api/adaptor-framework/autofill-group.h b/dali/devel-api/adaptor-framework/autofill-group.h new file mode 100755 index 0000000..26bfe8d --- /dev/null +++ b/dali/devel-api/adaptor-framework/autofill-group.h @@ -0,0 +1,151 @@ +#ifndef DALI_AUTOFILL_GROUP_H +#define DALI_AUTOFILL_GROUP_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 +#include + +namespace Dali +{ + +namespace Internal DALI_INTERNAL +{ +namespace Adaptor +{ +class AutofillGroup; +} +} + + +/** + * @brief The AutofillGroup class + * + * is used to group AutofillItems together. + */ +class DALI_ADAPTOR_API AutofillGroup : public BaseHandle +{ +public: + + /** + * @brief Creates an uninitialized AutofillGroup. + * + * To create AutofillGroup instance, please refer to Dali::AutofillManager::CreateAutofillGroup(). + */ + AutofillGroup(); + + /** + * @brief AutofillGroup Destructor. + */ + ~AutofillGroup(); + + /** + * @brief Copy constructor. + * + * @param[in] group AutofillGroup to copy. The copied player will point at the same implementation + */ + AutofillGroup( const AutofillGroup& group ); + + /** + * @brief Assignment operator. + * + * @param[in] group The AutofillGroup to assign from. + * @return The updated AutofillGroup. + */ + AutofillGroup& operator=( const AutofillGroup& group ); + + /** + * @brief Downcast a handle to AutofillGroup handle. + * + * If handle points to a AutofillGroup the downcast produces valid + * handle. If not the returned handle is left uninitialized. + * + * @param[in] handle Handle to an object + * @return Handle to a AutofillGroup or an uninitialized handle + */ + static AutofillGroup DownCast( BaseHandle handle ); + + /** + * @brief Equality operator. + * + * @param[in] rhs The AutofillGroup structure to test against + * @return True if AutofillGroups are equal + */ + bool operator==( const AutofillGroup& rhs ) const + { + if( &rhs == this ) + { + return true; + } + return false; + } + + /** + * @brief Gets AutofillGroup unique Id. + * + * @return AutofillGroup ID + */ + const std::string& GetId() const; + + /** + * @brief Adds AutofillItem to AutofillGroup itself in order to group. + * + * @param[in] item AutofillItem instance to be included in AutofillGroup + */ + void AddAutofillItem( Dali::AutofillItem item ); + + /** + * @brief Gets AutofillItem instance according to the id. + * + * @param[in] id AutofillItem Id to get from AutofillGroup List + * @return AutofillItem instance to match for Id + */ + Dali::AutofillItem GetAutofillItem( const std::string& id ); + + /** + * @brief Stores Autofill data in autofill group. + */ + void SaveAutofillData(); + + /** + * @brief Requests and receives autofill authentication information. + */ + void RequestAuthentication(); + + /** + * @brief Sends fill request to fill out the data. + */ + void SendFillRequest(); + +public: // Not intended for application developers + + /** + * @brief Internal constructor + */ + explicit DALI_INTERNAL AutofillGroup( Internal::Adaptor::AutofillGroup* internal ); + +}; + + +} // namespace Dali + +#endif // DALI_AUTOFILL_GROUP_H diff --git a/dali/devel-api/adaptor-framework/autofill-item.cpp b/dali/devel-api/adaptor-framework/autofill-item.cpp new file mode 100755 index 0000000..2b68534 --- /dev/null +++ b/dali/devel-api/adaptor-framework/autofill-item.cpp @@ -0,0 +1,115 @@ +/* + * 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 +{ + +AutofillItem::AutofillItem() +{ +} + +AutofillItem::AutofillItem( Internal::Adaptor::AutofillItem* internal ) +: BaseHandle( internal ) +{ +} + +AutofillItem::~AutofillItem() +{ +} + +AutofillItem::AutofillItem( const AutofillItem& item ) +: BaseHandle( item ) +{ +} + +AutofillItem& AutofillItem::operator=( const AutofillItem& item ) +{ + if( *this != item ) + { + BaseHandle::operator=( item ); + } + return *this; +} + +AutofillItem AutofillItem::DownCast( BaseHandle handle ) +{ + return AutofillItem( dynamic_cast< Internal::Adaptor::AutofillItem* >( handle.GetObjectPtr() ) ); +} + + +const std::string& AutofillItem::GetId() const +{ + return Internal::Adaptor::GetImplementation(*this).GetId(); +} + +const std::string& AutofillItem::GetLabel() const +{ + return Internal::Adaptor::GetImplementation(*this).GetLabel(); +} + +Dali::AutofillItem::Hint AutofillItem::GetHint() const +{ + return Internal::Adaptor::GetImplementation(*this).GetHint(); +} + +bool AutofillItem::IsSensitiveData() const +{ + return Internal::Adaptor::GetImplementation(*this).IsSensitiveData(); +} + +void AutofillItem::SetSaveValue( const std::string& value ) +{ + Internal::Adaptor::GetImplementation(*this).SetSaveValue( value ); +} + +const std::string& AutofillItem::GetSaveValue() const +{ + return Internal::Adaptor::GetImplementation(*this).GetSaveValue(); +} + +const std::string& AutofillItem::GetPresentationText( int index ) const +{ + return Internal::Adaptor::GetImplementation(*this).GetPresentationText( index ); +} + +const std::string& AutofillItem::GetFillValue( int index ) const +{ + return Internal::Adaptor::GetImplementation(*this).GetFillValue( index ); +} + +void AutofillItem::ClearPresentationTextList() +{ + Internal::Adaptor::GetImplementation(*this).ClearPresentationTextList(); +} + +void AutofillItem::ClearFillValueList() +{ + Internal::Adaptor::GetImplementation(*this).ClearFillValueList(); +} + +unsigned int AutofillItem::GetFillValueCount() +{ + return Internal::Adaptor::GetImplementation(*this).GetFillValueCount(); +} + +} // namespace Dali diff --git a/dali/devel-api/adaptor-framework/autofill-item.h b/dali/devel-api/adaptor-framework/autofill-item.h new file mode 100755 index 0000000..e47cb12 --- /dev/null +++ b/dali/devel-api/adaptor-framework/autofill-item.h @@ -0,0 +1,210 @@ +#ifndef DALI_AUTOFILL_ITEM_H +#define DALI_AUTOFILL_ITEM_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 Internal DALI_INTERNAL +{ +namespace Adaptor +{ +class AutofillItem; +} +} + + +/** + * @brief The AutofillItem class + * + * is used to pass on data from the AutofillItem. + * AutofillItem includes Id, Label, Autofill Hint, and whether it is sensitive or not. + */ +class DALI_ADAPTOR_API AutofillItem : public BaseHandle +{ +public: + + /** + * @brief Enumeration for hint of the autofill item. + */ + enum class Hint + { + CREDIT_CARD_EXPIRATION_DATE, ///< Autofill hint for a credit card expiration date + CREDIT_CARD_EXPIRATION_DAY, ///< Autofill hint for a credit card expiration day + CREDIT_CARD_EXPIRATION_MONTH, ///< Autofill hint for a credit card expiration month + CREDIT_CARD_EXPIRATION_YEAR, ///< Autofill hint for a credit card expiration year + CREDIT_CARD_NUMBER, ///< Autofill hint for a credit card number + EMAIL_ADDRESS, ///< Autofill hint for an email address + NAME, ///< Autofill hint for a user's real name + PHONE, ///< Autofill hint for a phone number + POSTAL_ADDRESS, ///< Autofill hint for a postal address + POSTAL_CODE, ///< Autofill hint for a postal code + ID, ///< Autofill hint for a user's ID + PASSWORD, ///< Autofill hint for password + CREDIT_CARD_SECURITY_CODE ///< Autofill hint for a credit card security code + }; + +public: + + /** + * @brief Creates an uninitialized AutofillItem. + * + * To create AutofillItem instance, please refer to Dali::AutofillManager::CreateAutofillItem(). + */ + AutofillItem(); + + /** + * @brief AutofillItem Destructor. + */ + ~AutofillItem(); + + /** + * @brief Copy constructor. + * + * @param[in] item AutofillItem to copy. The copied player will point at the same implementation + */ + AutofillItem( const AutofillItem& item ); + + /** + * @brief Assignment operator. + * + * @param[in] item The AutofillItem to assign from. + * @return The updated AutofillItem. + */ + AutofillItem& operator=( const AutofillItem& item ); + + /** + * @brief Downcast a handle to AutofillItem handle. + * + * If handle points to a AutofillItem the downcast produces valid + * handle. If not the returned handle is left uninitialized. + * + * @param[in] handle Handle to an object + * @return Handle to a AutofillItem or an uninitialized handle + */ + static AutofillItem DownCast( BaseHandle handle ); + + /** + * @brief Equality operator. + * + * @param[in] rhs The AutofillItem structure to test against + * @return True if AutofillItems are equal + */ + bool operator==( const AutofillItem& rhs ) const + { + if( &rhs == this ) + { + return true; + } + return false; + } + + /** + * @brief Gets AutofillItem Id. + * + * @return AutofillItem Id + */ + const std::string& GetId() const; + + /** + * @brief Gets AutofillItem Label. + * + * @return AutofillItem Label + */ + const std::string& GetLabel() const; + + /** + * @brief Gets AutofillItem Hint. + * + * @return AutofillItem Hint + */ + Dali::AutofillItem::Hint GetHint() const; + + /** + * @brief Gets whether AutofillItem is sensitive data or not. + * + * @return True if the AutofillItem is sensitive. + */ + bool IsSensitiveData() const; + + /** + * @brief Sets AutofillItem value for saving. + * + * @param[in] value The value for saving + */ + void SetSaveValue( const std::string& value ); + + /** + * @brief Gets the saved value of AutofillItem. + * + * @return The saved value + */ + const std::string& GetSaveValue() const; + + /** + * @brief Gets the presentation text with a index of the list. + * + * @param index The index for the presentation text list + * @return The presentation text to show up for the fill value + */ + const std::string& GetPresentationText( int index ) const; + + /** + * @brief Gets the value to be filled with a index of the list. + * + * @param index The index for the value list + * @return The value to be filled + */ + const std::string& GetFillValue( int index ) const; + + /** + * @brief Clears the presentation text list. + */ + void ClearPresentationTextList(); + + /** + * @brief Clears the value list. + */ + void ClearFillValueList(); + + /** + * @brief Gets the number of fill value in the list. + * + * @return The number of fill value in the list + */ + unsigned int GetFillValueCount(); + +public: // Not intended for application developers + + /** + * @brief Internal constructor + */ + explicit DALI_INTERNAL AutofillItem( Internal::Adaptor::AutofillItem* internal ); + +}; + +} // namespace Dali + +#endif // DALI_AUTOFILL_ITEM_H diff --git a/dali/devel-api/adaptor-framework/autofill-manager.cpp b/dali/devel-api/adaptor-framework/autofill-manager.cpp new file mode 100755 index 0000000..4507004 --- /dev/null +++ b/dali/devel-api/adaptor-framework/autofill-manager.cpp @@ -0,0 +1,126 @@ +/* + * 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 +{ + +AutofillManager::AutofillManager() +{ +} + +AutofillManager::~AutofillManager() +{ +} + +AutofillManager AutofillManager::Get() +{ + return Internal::Adaptor::AutofillManager::Get(); +} + +AutofillManager::AutofillManager(Internal::Adaptor::AutofillManager *impl) +: BaseHandle(impl) +{ +} + +/////////////////////////////////////////////// Autofill Item and Group /////////////////////////////////////////////// + +Dali::AutofillItem AutofillManager::CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ) +{ + return Internal::Adaptor::GetImplementation(*this).CreateAutofillItem( id, label, hint, isSensitive ); +} + +Dali::AutofillGroup AutofillManager::CreateAutofillGroup( const std::string& groupId ) +{ + return Internal::Adaptor::GetImplementation(*this).CreateAutofillGroup( groupId ); +} + + +/////////////////////////////////////////////// Autofill Authentication Information /////////////////////////////////////////////// + +bool AutofillManager::IsAutofillDataPresent() const +{ + return Internal::Adaptor::GetImplementation(*this).IsAutofillDataPresent(); +} + +bool AutofillManager::IsAuthenticationNeeded() const +{ + return Internal::Adaptor::GetImplementation(*this).IsAuthenticationNeeded(); +} + +const std::string& AutofillManager::GetAuthenticationServiceName() const +{ + return Internal::Adaptor::GetImplementation(*this).GetAuthenticationServiceName(); +} + +const std::string& AutofillManager::GetAuthenticationServiceMessage() const +{ + return Internal::Adaptor::GetImplementation(*this).GetAuthenticationServiceMessage(); +} + +const std::string& AutofillManager::GetAuthenticationServiceImagePath() const +{ + return Internal::Adaptor::GetImplementation(*this).GetAuthenticationServiceImagePath(); +} + +/////////////////////////////////////////////// Autofill Fill Response /////////////////////////////////////////////// + +const std::string& AutofillManager::GetFillItemId() const +{ + return Internal::Adaptor::GetImplementation(*this).GetFillItemId(); +} + +const std::string& AutofillManager::GetFillItemPresentationText() const +{ + return Internal::Adaptor::GetImplementation(*this).GetFillItemPresentationText(); +} + +const std::string& AutofillManager::GetFillItemValue() const +{ + return Internal::Adaptor::GetImplementation(*this).GetFillItemValue(); +} + +void AutofillManager::SaveAutofillData( Dali::AutofillGroup group ) +{ + Internal::Adaptor::GetImplementation(*this).SaveAutofillData( group ); +} + + +// Signals + +AutofillManager::AuthSignalType& AutofillManager::AuthenticationReceivedSignal() +{ + return Internal::Adaptor::GetImplementation(*this).AuthenticationReceivedSignal(); +} + +AutofillManager::FillSignalType& AutofillManager::FillResponseReceivedSignal() +{ + return Internal::Adaptor::GetImplementation(*this).FillResponseReceivedSignal(); +} + +AutofillManager::ListSignalType& AutofillManager::ListEventSignal() +{ + return Internal::Adaptor::GetImplementation(*this).ListEventSignal(); +} + + +} // namespace Dali diff --git a/dali/devel-api/adaptor-framework/autofill-manager.h b/dali/devel-api/adaptor-framework/autofill-manager.h new file mode 100755 index 0000000..fce0af9 --- /dev/null +++ b/dali/devel-api/adaptor-framework/autofill-manager.h @@ -0,0 +1,213 @@ +#ifndef DALI_AUTOFILL_MANAGER_H +#define DALI_AUTOFILL_MANAGER_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 + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +namespace Internal DALI_INTERNAL +{ +namespace Adaptor +{ +class AutofillManager; +} +} + + +/** + * @brief The AutofillManager class + * + * allows the application to fill out the user data, such as email, account and address previously saved. + * Currently, Autofill is limited to text input box. Later it can be ScrollView, etc. + * + * Signals + * | %Signal Name | Method | + * |------------------------|-------------------------------------| + * | authenticationReceived | @ref AuthenticationReceivedSignal() | + * | fillResponseReceived | @ref FillResponseReceivedSignal() | + */ +class DALI_ADAPTOR_API AutofillManager : public BaseHandle +{ +public: + + + // TODO : Need to update parameter and return value according to each Signal + typedef Signal< void () > AuthSignalType; ///< Authentication Received Signal + typedef Signal< void ( AutofillItem ) > FillSignalType; ///< Fill Response Received Signal + typedef Signal< void () > ListSignalType; ///< List Event Signal for multi-group + +public: + + /** + * @brief Retrieves a handle to the instance of AutofillManager. + * + * @return A handle to the AutofillManager. + */ + static AutofillManager Get(); + + + /////////////////////////////////////////////// Autofill Item and Group /////////////////////////////////////////////// + + /** + * @brief Creates AutofillItem instance. + * + * @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 AutofillItem is a sensitive data or not + * @return A public handle to the newly allocated AutofillItem + */ + Dali::AutofillItem CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ); + + /** + * @brief Creates AutofillGroup instance. + * + * @param[in] groupId A unique ID value of each AutofillGroup + * @return A public handle to the newly allocated AutofillGroup + */ + Dali::AutofillGroup CreateAutofillGroup( const std::string& groupId ); + + + /////////////////////////////////////////////// Autofill Authentication Information /////////////////////////////////////////////// + + /** + * @brief Gets the 'autofill data present' attribute in autofill authentication information. + * + * @return True if Autofill data is present + */ + bool IsAutofillDataPresent() const; + + /** + * @brief Gets the 'authentication needed' attribute in autofill authentication information. + * + * @return True if the authentication is needed in the current Autofill process. + */ + bool IsAuthenticationNeeded() const; + + /** + * @brief Gets the service name in autofill authentication information. + * + * @return The autofill authentication service name + */ + const std::string& GetAuthenticationServiceName() const; + + /** + * @brief Gets the service message in autofill authentication information. + * + * @return The autofill authentication service message + */ + const std::string& GetAuthenticationServiceMessage() const; + + /** + * @brief Gets the service logo image path in autofill authentication information. + * + * @return The autofill authentication service logo image path + */ + const std::string& GetAuthenticationServiceImagePath() const; + + + /////////////////////////////////////////////// Autofill Fill Response /////////////////////////////////////////////// + + /** + * @brief Gets the autofill ID in an autofill fill response item. + * + * @return The autofill fill response item ID + */ + const std::string& GetFillItemId() const; + + /** + * @brief Gets the presentation text in an autofill fill response item. + * + * @return The presentation text + */ + const std::string& GetFillItemPresentationText() const; + + /** + * @brief Gets the autofill value in an autofill fill response item. + * + * @return The autofill fill response item value + */ + const std::string& GetFillItemValue() const; + + /** + * @brief Stores the current Autofill data. + * + * @param[in] group The AutofillGroup to store the data + */ + void SaveAutofillData( Dali::AutofillGroup group ); + +public: + // Signals + /** + * @brief This is emitted when the authentication is needed and AutofillManager gets the information. + * + * @return The signal containing the received data + */ + AuthSignalType& AuthenticationReceivedSignal(); + + /** + * @brief This is emitted when AutofillManager receives the fill response. + * + * @return The signal containing the received data + */ + FillSignalType& FillResponseReceivedSignal(); + + /** + * @brief This is emitted when the list for multi fill response group is needed. + * + * @return The signal containing the received data + */ + ListSignalType& ListEventSignal(); + + // Construction & Destruction + /** + * @brief Constructor. + * + * Create an uninitialized handle. + * This can be initialized by calling AutofillManager::Get(). + */ + AutofillManager(); + + /** + * @brief Destructor + * + * This is non-virtual since derived Handle types must not contain data or virtual methods. + */ + ~AutofillManager(); + + /** + * @brief This constructor is used by AutofillManager::Get(). + * + * @param[in] autofillManager A pointer to the AutofillManager. + */ + explicit DALI_INTERNAL AutofillManager( Internal::Adaptor::AutofillManager* autofillManager ); + +}; + +} // namespace Dali + +#endif // DALI_AUTOFILL_MANAGER_H diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index e85cb13..69a4c25 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -1,118 +1,124 @@ SET( devel_api_src_files - ${adaptor_devel_api_dir}/adaptor-framework/accessibility-adaptor.cpp - ${adaptor_devel_api_dir}/adaptor-framework/application-devel.cpp - ${adaptor_devel_api_dir}/adaptor-framework/bitmap-saver.cpp - ${adaptor_devel_api_dir}/adaptor-framework/clipboard.cpp - ${adaptor_devel_api_dir}/adaptor-framework/clipboard-event-notifier.cpp - ${adaptor_devel_api_dir}/adaptor-framework/color-controller.cpp - ${adaptor_devel_api_dir}/adaptor-framework/environment-variable.cpp - ${adaptor_devel_api_dir}/adaptor-framework/event-feeder.cpp - ${adaptor_devel_api_dir}/adaptor-framework/event-thread-callback.cpp - ${adaptor_devel_api_dir}/adaptor-framework/feedback-player.cpp - ${adaptor_devel_api_dir}/adaptor-framework/file-loader.cpp - ${adaptor_devel_api_dir}/adaptor-framework/file-stream.cpp - ${adaptor_devel_api_dir}/adaptor-framework/image-loading.cpp - ${adaptor_devel_api_dir}/adaptor-framework/gif-loading.cpp - ${adaptor_devel_api_dir}/adaptor-framework/input-method-context.cpp - ${adaptor_devel_api_dir}/adaptor-framework/input-method-options.cpp - ${adaptor_devel_api_dir}/adaptor-framework/native-image-source-queue.cpp - ${adaptor_devel_api_dir}/adaptor-framework/orientation.cpp - ${adaptor_devel_api_dir}/adaptor-framework/performance-logger.cpp - ${adaptor_devel_api_dir}/adaptor-framework/physical-keyboard.cpp - ${adaptor_devel_api_dir}/adaptor-framework/key-devel.cpp - ${adaptor_devel_api_dir}/adaptor-framework/pixel-buffer.cpp - ${adaptor_devel_api_dir}/adaptor-framework/sound-player.cpp - ${adaptor_devel_api_dir}/adaptor-framework/style-monitor.cpp - ${adaptor_devel_api_dir}/adaptor-framework/tilt-sensor.cpp - ${adaptor_devel_api_dir}/adaptor-framework/lifecycle-controller.cpp - ${adaptor_devel_api_dir}/adaptor-framework/vector-animation-renderer.cpp - ${adaptor_devel_api_dir}/adaptor-framework/video-player.cpp - ${adaptor_devel_api_dir}/adaptor-framework/virtual-keyboard.cpp - ${adaptor_devel_api_dir}/adaptor-framework/thread-settings.cpp - ${adaptor_devel_api_dir}/adaptor-framework/web-engine.cpp + ${adaptor_devel_api_dir}/adaptor-framework/accessibility-adaptor.cpp + ${adaptor_devel_api_dir}/adaptor-framework/application-devel.cpp + ${adaptor_devel_api_dir}/adaptor-framework/autofill-group.cpp + ${adaptor_devel_api_dir}/adaptor-framework/autofill-item.cpp + ${adaptor_devel_api_dir}/adaptor-framework/autofill-manager.cpp + ${adaptor_devel_api_dir}/adaptor-framework/bitmap-saver.cpp + ${adaptor_devel_api_dir}/adaptor-framework/clipboard.cpp + ${adaptor_devel_api_dir}/adaptor-framework/clipboard-event-notifier.cpp + ${adaptor_devel_api_dir}/adaptor-framework/color-controller.cpp + ${adaptor_devel_api_dir}/adaptor-framework/environment-variable.cpp + ${adaptor_devel_api_dir}/adaptor-framework/event-feeder.cpp + ${adaptor_devel_api_dir}/adaptor-framework/event-thread-callback.cpp + ${adaptor_devel_api_dir}/adaptor-framework/feedback-player.cpp + ${adaptor_devel_api_dir}/adaptor-framework/file-loader.cpp + ${adaptor_devel_api_dir}/adaptor-framework/file-stream.cpp + ${adaptor_devel_api_dir}/adaptor-framework/image-loading.cpp + ${adaptor_devel_api_dir}/adaptor-framework/gif-loading.cpp + ${adaptor_devel_api_dir}/adaptor-framework/input-method-context.cpp + ${adaptor_devel_api_dir}/adaptor-framework/input-method-options.cpp + ${adaptor_devel_api_dir}/adaptor-framework/native-image-source-queue.cpp + ${adaptor_devel_api_dir}/adaptor-framework/orientation.cpp + ${adaptor_devel_api_dir}/adaptor-framework/performance-logger.cpp + ${adaptor_devel_api_dir}/adaptor-framework/physical-keyboard.cpp + ${adaptor_devel_api_dir}/adaptor-framework/key-devel.cpp + ${adaptor_devel_api_dir}/adaptor-framework/pixel-buffer.cpp + ${adaptor_devel_api_dir}/adaptor-framework/sound-player.cpp + ${adaptor_devel_api_dir}/adaptor-framework/style-monitor.cpp + ${adaptor_devel_api_dir}/adaptor-framework/tilt-sensor.cpp + ${adaptor_devel_api_dir}/adaptor-framework/lifecycle-controller.cpp + ${adaptor_devel_api_dir}/adaptor-framework/vector-animation-renderer.cpp + ${adaptor_devel_api_dir}/adaptor-framework/video-player.cpp + ${adaptor_devel_api_dir}/adaptor-framework/virtual-keyboard.cpp + ${adaptor_devel_api_dir}/adaptor-framework/thread-settings.cpp + ${adaptor_devel_api_dir}/adaptor-framework/web-engine.cpp ${adaptor_devel_api_dir}/adaptor-framework/window-devel.cpp ) SET( devel_api_adaptor_framework_header_files - ${adaptor_devel_api_dir}/adaptor-framework/accessibility-adaptor.h - ${adaptor_devel_api_dir}/adaptor-framework/accessibility-action-handler.h - ${adaptor_devel_api_dir}/adaptor-framework/accessibility-gesture-handler.h - ${adaptor_devel_api_dir}/adaptor-framework/accessibility-gesture-event.h - ${adaptor_devel_api_dir}/adaptor-framework/application-devel.h - ${adaptor_devel_api_dir}/adaptor-framework/atspi-accessibility.h - ${adaptor_devel_api_dir}/adaptor-framework/bitmap-saver.h - ${adaptor_devel_api_dir}/adaptor-framework/clipboard-event-notifier.h - ${adaptor_devel_api_dir}/adaptor-framework/clipboard.h - ${adaptor_devel_api_dir}/adaptor-framework/color-controller-plugin.h - ${adaptor_devel_api_dir}/adaptor-framework/color-controller.h - ${adaptor_devel_api_dir}/adaptor-framework/environment-variable.h - ${adaptor_devel_api_dir}/adaptor-framework/event-feeder.h - ${adaptor_devel_api_dir}/adaptor-framework/event-thread-callback.h - ${adaptor_devel_api_dir}/adaptor-framework/feedback-plugin.h - ${adaptor_devel_api_dir}/adaptor-framework/feedback-player.h - ${adaptor_devel_api_dir}/adaptor-framework/file-loader.h - ${adaptor_devel_api_dir}/adaptor-framework/file-stream.h - ${adaptor_devel_api_dir}/adaptor-framework/image-loader-input.h - ${adaptor_devel_api_dir}/adaptor-framework/image-loader-plugin.h - ${adaptor_devel_api_dir}/adaptor-framework/image-loading.h - ${adaptor_devel_api_dir}/adaptor-framework/gif-loading.h - ${adaptor_devel_api_dir}/adaptor-framework/input-method-context.h - ${adaptor_devel_api_dir}/adaptor-framework/input-method-options.h - ${adaptor_devel_api_dir}/adaptor-framework/keyboard.h - ${adaptor_devel_api_dir}/adaptor-framework/lifecycle-controller.h - ${adaptor_devel_api_dir}/adaptor-framework/native-image-source-queue.h - ${adaptor_devel_api_dir}/adaptor-framework/orientation.h - ${adaptor_devel_api_dir}/adaptor-framework/performance-logger.h - ${adaptor_devel_api_dir}/adaptor-framework/pixel-buffer.h - ${adaptor_devel_api_dir}/adaptor-framework/sound-player.h - ${adaptor_devel_api_dir}/adaptor-framework/style-monitor.h - ${adaptor_devel_api_dir}/adaptor-framework/tilt-sensor.h - ${adaptor_devel_api_dir}/adaptor-framework/vector-animation-renderer.h - ${adaptor_devel_api_dir}/adaptor-framework/vector-animation-renderer-plugin.h - ${adaptor_devel_api_dir}/adaptor-framework/video-player.h - ${adaptor_devel_api_dir}/adaptor-framework/video-player-plugin.h - ${adaptor_devel_api_dir}/adaptor-framework/web-engine.h - ${adaptor_devel_api_dir}/adaptor-framework/web-engine-plugin.h - ${adaptor_devel_api_dir}/adaptor-framework/key-extension-plugin.h - ${adaptor_devel_api_dir}/adaptor-framework/virtual-keyboard.h - ${adaptor_devel_api_dir}/adaptor-framework/physical-keyboard.h - ${adaptor_devel_api_dir}/adaptor-framework/key-devel.h - ${adaptor_devel_api_dir}/adaptor-framework/thread-settings.h + ${adaptor_devel_api_dir}/adaptor-framework/accessibility-adaptor.h + ${adaptor_devel_api_dir}/adaptor-framework/accessibility-action-handler.h + ${adaptor_devel_api_dir}/adaptor-framework/accessibility-gesture-handler.h + ${adaptor_devel_api_dir}/adaptor-framework/accessibility-gesture-event.h + ${adaptor_devel_api_dir}/adaptor-framework/application-devel.h + ${adaptor_devel_api_dir}/adaptor-framework/atspi-accessibility.h + ${adaptor_devel_api_dir}/adaptor-framework/autofill-group.h + ${adaptor_devel_api_dir}/adaptor-framework/autofill-item.h + ${adaptor_devel_api_dir}/adaptor-framework/autofill-manager.h + ${adaptor_devel_api_dir}/adaptor-framework/bitmap-saver.h + ${adaptor_devel_api_dir}/adaptor-framework/clipboard-event-notifier.h + ${adaptor_devel_api_dir}/adaptor-framework/clipboard.h + ${adaptor_devel_api_dir}/adaptor-framework/color-controller-plugin.h + ${adaptor_devel_api_dir}/adaptor-framework/color-controller.h + ${adaptor_devel_api_dir}/adaptor-framework/environment-variable.h + ${adaptor_devel_api_dir}/adaptor-framework/event-feeder.h + ${adaptor_devel_api_dir}/adaptor-framework/event-thread-callback.h + ${adaptor_devel_api_dir}/adaptor-framework/feedback-plugin.h + ${adaptor_devel_api_dir}/adaptor-framework/feedback-player.h + ${adaptor_devel_api_dir}/adaptor-framework/file-loader.h + ${adaptor_devel_api_dir}/adaptor-framework/file-stream.h + ${adaptor_devel_api_dir}/adaptor-framework/image-loader-input.h + ${adaptor_devel_api_dir}/adaptor-framework/image-loader-plugin.h + ${adaptor_devel_api_dir}/adaptor-framework/image-loading.h + ${adaptor_devel_api_dir}/adaptor-framework/gif-loading.h + ${adaptor_devel_api_dir}/adaptor-framework/input-method-context.h + ${adaptor_devel_api_dir}/adaptor-framework/input-method-options.h + ${adaptor_devel_api_dir}/adaptor-framework/keyboard.h + ${adaptor_devel_api_dir}/adaptor-framework/lifecycle-controller.h + ${adaptor_devel_api_dir}/adaptor-framework/native-image-source-queue.h + ${adaptor_devel_api_dir}/adaptor-framework/orientation.h + ${adaptor_devel_api_dir}/adaptor-framework/performance-logger.h + ${adaptor_devel_api_dir}/adaptor-framework/pixel-buffer.h + ${adaptor_devel_api_dir}/adaptor-framework/sound-player.h + ${adaptor_devel_api_dir}/adaptor-framework/style-monitor.h + ${adaptor_devel_api_dir}/adaptor-framework/tilt-sensor.h + ${adaptor_devel_api_dir}/adaptor-framework/vector-animation-renderer.h + ${adaptor_devel_api_dir}/adaptor-framework/vector-animation-renderer-plugin.h + ${adaptor_devel_api_dir}/adaptor-framework/video-player.h + ${adaptor_devel_api_dir}/adaptor-framework/video-player-plugin.h + ${adaptor_devel_api_dir}/adaptor-framework/web-engine.h + ${adaptor_devel_api_dir}/adaptor-framework/web-engine-plugin.h + ${adaptor_devel_api_dir}/adaptor-framework/key-extension-plugin.h + ${adaptor_devel_api_dir}/adaptor-framework/virtual-keyboard.h + ${adaptor_devel_api_dir}/adaptor-framework/physical-keyboard.h + ${adaptor_devel_api_dir}/adaptor-framework/key-devel.h + ${adaptor_devel_api_dir}/adaptor-framework/thread-settings.h ${adaptor_devel_api_dir}/adaptor-framework/window-devel.h ) SET( devel_api_text_abstraction_src_files - ${adaptor_devel_api_dir}/text-abstraction/bidirectional-support.cpp - ${adaptor_devel_api_dir}/text-abstraction/bitmap-font.cpp - ${adaptor_devel_api_dir}/text-abstraction/font-client.cpp - ${adaptor_devel_api_dir}/text-abstraction/font-list.cpp - ${adaptor_devel_api_dir}/text-abstraction/font-metrics.cpp - ${adaptor_devel_api_dir}/text-abstraction/glyph-info.cpp - ${adaptor_devel_api_dir}/text-abstraction/script.cpp - ${adaptor_devel_api_dir}/text-abstraction/segmentation.cpp - ${adaptor_devel_api_dir}/text-abstraction/shaping.cpp - ${adaptor_devel_api_dir}/text-abstraction/text-renderer.cpp + ${adaptor_devel_api_dir}/text-abstraction/bidirectional-support.cpp + ${adaptor_devel_api_dir}/text-abstraction/bitmap-font.cpp + ${adaptor_devel_api_dir}/text-abstraction/font-client.cpp + ${adaptor_devel_api_dir}/text-abstraction/font-list.cpp + ${adaptor_devel_api_dir}/text-abstraction/font-metrics.cpp + ${adaptor_devel_api_dir}/text-abstraction/glyph-info.cpp + ${adaptor_devel_api_dir}/text-abstraction/script.cpp + ${adaptor_devel_api_dir}/text-abstraction/segmentation.cpp + ${adaptor_devel_api_dir}/text-abstraction/shaping.cpp + ${adaptor_devel_api_dir}/text-abstraction/text-renderer.cpp ${adaptor_devel_api_dir}/text-abstraction/text-renderer-layout-helper.cpp ) SET( text_abstraction_header_files - ${adaptor_devel_api_dir}/text-abstraction/bidirectional-support.h - ${adaptor_devel_api_dir}/text-abstraction/bitmap-font.h - ${adaptor_devel_api_dir}/text-abstraction/font-client.h - ${adaptor_devel_api_dir}/text-abstraction/font-list.h - ${adaptor_devel_api_dir}/text-abstraction/font-metrics.h - ${adaptor_devel_api_dir}/text-abstraction/glyph-info.h - ${adaptor_devel_api_dir}/text-abstraction/script.h - ${adaptor_devel_api_dir}/text-abstraction/segmentation.h - ${adaptor_devel_api_dir}/text-abstraction/shaping.h - ${adaptor_devel_api_dir}/text-abstraction/text-abstraction.h - ${adaptor_devel_api_dir}/text-abstraction/text-abstraction-definitions.h - ${adaptor_devel_api_dir}/text-abstraction/text-renderer.h + ${adaptor_devel_api_dir}/text-abstraction/bidirectional-support.h + ${adaptor_devel_api_dir}/text-abstraction/bitmap-font.h + ${adaptor_devel_api_dir}/text-abstraction/font-client.h + ${adaptor_devel_api_dir}/text-abstraction/font-list.h + ${adaptor_devel_api_dir}/text-abstraction/font-metrics.h + ${adaptor_devel_api_dir}/text-abstraction/glyph-info.h + ${adaptor_devel_api_dir}/text-abstraction/script.h + ${adaptor_devel_api_dir}/text-abstraction/segmentation.h + ${adaptor_devel_api_dir}/text-abstraction/shaping.h + ${adaptor_devel_api_dir}/text-abstraction/text-abstraction.h + ${adaptor_devel_api_dir}/text-abstraction/text-abstraction-definitions.h + ${adaptor_devel_api_dir}/text-abstraction/text-renderer.h ${adaptor_devel_api_dir}/text-abstraction/text-renderer-layout-helper.h ) diff --git a/dali/internal/input/common/autofill-factory.h b/dali/internal/input/common/autofill-factory.h new file mode 100644 index 0000000..cc86821 --- /dev/null +++ b/dali/internal/input/common/autofill-factory.h @@ -0,0 +1,54 @@ +#ifndef DALI_INTERNAL_INPUT_COMMON_AUTOFILL_FACTORY_H +#define DALI_INTERNAL_INPUT_COMMON_AUTOFILL_FACTORY_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. + * + */ + +// INTERNAL INCLUDES +#include +#include +#include + +namespace Dali +{ +namespace Internal +{ +namespace Adaptor +{ + +class AutofillGroup; +class AutofillItem; +class AutofillManager; + +namespace AutofillFactory +{ +// Factory function creating new AutofillGroup, AutofillItem, and AutofillManager +// Symbol exists but may be overriden during linking + + Dali::AutofillGroup CreateAutofillGroup( const std::string& groupId ); + + Dali::AutofillItem CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ); + + Dali::AutofillManager CreateAutofillManager(); + +} + +} // namespace Adaptor +} // namespace Internal +} // namespace Dali + +#endif // DALI_INTERNAL_INPUT_COMMON_AUTOFILL_FACTORY_H diff --git a/dali/internal/input/common/autofill-group-impl.cpp b/dali/internal/input/common/autofill-group-impl.cpp new file mode 100755 index 0000000..f2807e9 --- /dev/null +++ b/dali/internal/input/common/autofill-group-impl.cpp @@ -0,0 +1,44 @@ +/* + * 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 Internal +{ + +namespace Adaptor +{ + +Dali::AutofillGroup AutofillGroup::New( const std::string& groupId ) +{ + return Dali::Internal::Adaptor::AutofillFactory::CreateAutofillGroup( groupId ); +} + + +} // Adaptor + +} // Internal + +} // Dali diff --git a/dali/internal/input/common/autofill-group-impl.h b/dali/internal/input/common/autofill-group-impl.h new file mode 100644 index 0000000..f335c10 --- /dev/null +++ b/dali/internal/input/common/autofill-group-impl.h @@ -0,0 +1,137 @@ +#ifndef DALI_INTERNAL_AUTOFILL_GROUP_IMPL_H +#define DALI_INTERNAL_AUTOFILL_GROUP_IMPL_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 Internal +{ + +namespace Adaptor +{ + +/** + * @brief This class is used to group AutofillItems. + */ +class AutofillGroup : public Dali::BaseObject +{ + +public: + + /** + * @brief Constructor. + * + * @param[in] groupId A unique ID value of each AutofillGroup + * @return A public handle to the newly allocated AutofillGroup. + */ + static Dali::AutofillGroup New( const std::string& groupId ); + + /** + * @brief Initialize AutofillGroup constructor. + */ + virtual void Initialize() = 0; + + /** + * @copydoc Dali::AutofillGroup::GetId() + */ + virtual const std::string& GetId() const = 0; + + /** + * @copydoc Dali::AutofillGroup::AddAutofillItem() + */ + virtual void AddAutofillItem( Dali::AutofillItem item ) = 0; + + /** + * @copydoc Dali::AutofillGroup::GetAutofillItem() + */ + virtual Dali::AutofillItem GetAutofillItem( const std::string& id ) = 0; + + /** + * @brief Clears all lists of AutofillItem added in AutofillGroup. + */ + virtual void ClearAutofillItemList() = 0; + + /** + * @copydoc Dali::AutofillGroup::SaveAutofillData() + */ + virtual void SaveAutofillData() = 0; + + /** + * @copydoc Dali::AutofillGroup::RequestAuthentication() + */ + virtual void RequestAuthentication() = 0; + + /** + * @copydoc Dali::AutofillGroup::SendFillRequest() + */ + virtual void SendFillRequest() = 0; + +public: + /** + * Constructor. + */ + AutofillGroup() = default; + +protected: + /** + * Destructor. + */ + ~AutofillGroup() = default; + +private: + // Undefined copy constructor + AutofillGroup( const AutofillGroup& autofillGroup ) = delete; + + // Undefined assignment operator + AutofillGroup& operator=( AutofillGroup& autofillGroup ) = delete; + +}; + +inline static Internal::Adaptor::AutofillGroup& GetImplementation(Dali::AutofillGroup& autofillGroup) +{ + DALI_ASSERT_ALWAYS( autofillGroup && "AutofillGroup handle is empty" ); + + BaseObject& handle = autofillGroup.GetBaseObject(); + + return static_cast(handle); +} + +inline static const Internal::Adaptor::AutofillGroup& GetImplementation(const Dali::AutofillGroup& autofillGroup) +{ + DALI_ASSERT_ALWAYS( autofillGroup && "AutofillGroup handle is empty" ); + + const BaseObject& handle = autofillGroup.GetBaseObject(); + + return static_cast(handle); +} + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // DALI_INTERNAL_AUTOFILL_GROUP_IMPL_H diff --git a/dali/internal/input/common/autofill-item-impl.cpp b/dali/internal/input/common/autofill-item-impl.cpp new file mode 100755 index 0000000..eacf07e --- /dev/null +++ b/dali/internal/input/common/autofill-item-impl.cpp @@ -0,0 +1,43 @@ +/* + * 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 Internal +{ + +namespace Adaptor +{ + +Dali::AutofillItem AutofillItem::New( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ) +{ + return Dali::Internal::Adaptor::AutofillFactory::CreateAutofillItem( id, label, hint, sensitiveData ); +} + + +} // Adaptor + +} // Internal + +} // Dali diff --git a/dali/internal/input/common/autofill-item-impl.h b/dali/internal/input/common/autofill-item-impl.h new file mode 100644 index 0000000..92c5db8 --- /dev/null +++ b/dali/internal/input/common/autofill-item-impl.h @@ -0,0 +1,174 @@ +#ifndef DALI_INTERNAL_AUTOFILL_ITEM_IMPL_H +#define DALI_INTERNAL_AUTOFILL_ITEM_IMPL_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 Internal +{ + +namespace Adaptor +{ + +/** + * @brief This class is used to pass on data from the AutofillItem of control. + */ +class AutofillItem : public Dali::BaseObject +{ + +public: + + /** + * @brief Constructor. + * + * @param[in] id A unique ID for this AutofillItem + * @param[in] label An auxiliary means to guess what data is + * @param[in] hint The hint - id (username), name, password, phone, credit card number, organization, and so on + * @param[in] sensitiveData Whether this AutofillItem is a sensitive data or not. (The default is false) + * @return A public handle to the newly allocated AutofillItem + */ + static Dali::AutofillItem New( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ); + + /** + * @brief Initialize AutofillItem constructor. + */ + virtual void Initialize() = 0; + + /** + * @copydoc Dali::AutofillItem::GetId() + */ + virtual const std::string& GetId() const = 0; + + /** + * @copydoc Dali::AutofillItem::GetLabel() + */ + virtual const std::string& GetLabel() const = 0; + + /** + * @copydoc Dali::AutofillItem::GetHint() + */ + virtual Dali::AutofillItem::Hint GetHint() const = 0; + + /** + * @copydoc Dali::AutofillItem::IsSensitiveData() + */ + virtual bool IsSensitiveData() const = 0; + + /** + * @copydoc Dali::AutofillItem::SetSaveValue() + */ + virtual void SetSaveValue( const std::string& value ) = 0; + + /** + * @copydoc Dali::AutofillItem::GetSaveValue() + */ + virtual const std::string& GetSaveValue() const = 0; + + /** + * @brief Adds the presentation text to fill out in the list. + * + * @param[in] presentationText The presentation text to fill out + */ + virtual void AddPresentationList( const std::string& presentationText ) = 0; + + /** + * @brief Adds the value to fill out in the list. + * + * @param[in] fillValue The value to fill out + */ + virtual void AddFillValueList( const std::string& fillValue ) = 0; + + /** + * @copydoc Dali::AutofillItem::GetPresentationText() + */ + virtual const std::string& GetPresentationText( int index ) const = 0; + + /** + * @copydoc Dali::AutofillItem::GetFillValue() + */ + virtual const std::string& GetFillValue( int index ) const = 0; + + /** + * @copydoc Dali::AutofillItem::ClearPresentationTextList() + */ + virtual void ClearPresentationTextList() = 0; + + /** + * @copydoc Dali::AutofillItem::ClearFillValueList() + */ + virtual void ClearFillValueList() = 0; + + /** + * @copydoc Dali::AutofillItem::GetFillValueCount() + */ + virtual unsigned int GetFillValueCount() = 0; + +public: + /** + * Constructor. + */ + AutofillItem() = default; + +protected: + /** + * Destructor. + */ + ~AutofillItem() = default; + +private: + // Undefined copy constructor + AutofillItem( const AutofillItem& autofillItem ) = delete; + + // Undefined assignment operator + AutofillItem& operator=( AutofillItem& autofillItem ) = delete; + +}; + +inline static Internal::Adaptor::AutofillItem& GetImplementation(Dali::AutofillItem& autofillItem) +{ + DALI_ASSERT_ALWAYS( autofillItem && "AutofillItem handle is empty" ); + + BaseObject& handle = autofillItem.GetBaseObject(); + + return static_cast(handle); +} + +inline static const Internal::Adaptor::AutofillItem& GetImplementation(const Dali::AutofillItem& autofillItem) +{ + DALI_ASSERT_ALWAYS( autofillItem && "AutofillItem handle is empty" ); + + const BaseObject& handle = autofillItem.GetBaseObject(); + + return static_cast(handle); +} + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // DALI_INTERNAL_AUTOFILL_ITEM_IMPL_H diff --git a/dali/internal/input/common/autofill-manager-impl.cpp b/dali/internal/input/common/autofill-manager-impl.cpp new file mode 100755 index 0000000..5dd466e --- /dev/null +++ b/dali/internal/input/common/autofill-manager-impl.cpp @@ -0,0 +1,44 @@ +/* + * 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 Internal +{ + +namespace Adaptor +{ + +Dali::AutofillManager AutofillManager::Get() +{ + return Dali::Internal::Adaptor::AutofillFactory::CreateAutofillManager(); +} + + +} // Adaptor + +} // Internal + +} // Dali diff --git a/dali/internal/input/common/autofill-manager-impl.h b/dali/internal/input/common/autofill-manager-impl.h new file mode 100644 index 0000000..48819ab --- /dev/null +++ b/dali/internal/input/common/autofill-manager-impl.h @@ -0,0 +1,190 @@ +#ifndef DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_H +#define DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_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 Internal +{ + +namespace Adaptor +{ + +class AutofillManager : public Dali::BaseObject +{ + +public: + + /** + * @brief Gets the AutofillManager instance + * + * It creates the instance if it has not already been created. + * Internally, a check should be made using IsAvailable() before this is called as we do not want + * to create an instance if not needed by applications. + * @see IsAvailable() + */ + static Dali::AutofillManager Get(); + + /** + * @brief Connects Callbacks required for Autofill daemon. + */ + virtual void ConnectCallbacks() = 0; + + /** + * @copydoc Dali::AutofillManager::CreateAutofillItem() + */ + virtual Dali::AutofillItem CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ) = 0; + + /** + * @copydoc Dali::AutofillManager::CreateAutofillGroup() + */ + virtual Dali::AutofillGroup CreateAutofillGroup( const std::string& groupId ) = 0; + + /** + * @copydoc Dali::AutofillManager::IsAutofillDataPresent() + */ + virtual bool IsAutofillDataPresent() const = 0; + + /** + * @copydoc Dali::AutofillManager::IsAuthenticationNeeded() + */ + virtual bool IsAuthenticationNeeded() const = 0; + + /** + * @copydoc Dali::AutofillManager::GetAuthenticationServiceName() + */ + virtual const std::string& GetAuthenticationServiceName() const = 0; + + /** + * @copydoc Dali::AutofillManager::GetAuthenticationServiceMessage() + */ + virtual const std::string& GetAuthenticationServiceMessage() const = 0; + + /** + * @copydoc Dali::AutofillManager::GetAuthenticationServiceImagePath() + */ + virtual const std::string& GetAuthenticationServiceImagePath() const = 0; + + /** + * @copydoc Dali::AutofillManager::GetFillItemId() + */ + virtual const std::string& GetFillItemId() const = 0; + + /** + * @copydoc Dali::AutofillManager::GetFillItemPresentationText() + */ + virtual const std::string& GetFillItemPresentationText() const = 0; + + /** + * @copydoc Dali::AutofillManager::GetFillItemValue() + */ + virtual const std::string& GetFillItemValue() const = 0; + + /** + * @copydoc Dali::AutofillManager::SaveAutofillData() + */ + virtual void SaveAutofillData( Dali::AutofillGroup group ) = 0; + +public: // Signals + + /** + * @copydoc Dali::AutofillManager::AuthenticationReceivedSignal() + */ + virtual Dali::AutofillManager::AuthSignalType& AuthenticationReceivedSignal() { return mAuthReceivedSignal; } + + /** + * @copydoc Dali::AutofillManager::FillResponseReceivedSignal() + */ + virtual Dali::AutofillManager::FillSignalType& FillResponseReceivedSignal() { return mFillReceivedSignal; } + + /** + * @copydoc Dali::AutofillManager::ListEventSignal() + */ + virtual Dali::AutofillManager::ListSignalType& ListEventSignal() { return mListReceivedSignal; } + +private: + /** + * Context created the first time and kept until deleted. + */ + virtual void CreateContext() = 0; + + /** + * Delete Autofill context. + */ + virtual void DeleteContext() = 0; + +public: + /** + * Constructor. + */ + AutofillManager() = default; + +protected: + /** + * Destructor. + */ + ~AutofillManager() = default; + +private: + // Undefined copy constructor + AutofillManager( const AutofillManager& autofillManager ) = delete; + + // Undefined assignment operator + AutofillManager& operator=( AutofillManager& autofillManager ) = delete; + +private: + Dali::AutofillManager::AuthSignalType mAuthReceivedSignal; ///< Authentication Received Signal + Dali::AutofillManager::FillSignalType mFillReceivedSignal; ///< Fill Response Received Signal + Dali::AutofillManager::ListSignalType mListReceivedSignal; ///< List Received Signal + + +}; + +inline static Internal::Adaptor::AutofillManager& GetImplementation(Dali::AutofillManager& autofillManager) +{ + DALI_ASSERT_ALWAYS( autofillManager && "AutofillManager handle is empty" ); + + BaseObject& handle = autofillManager.GetBaseObject(); + + return static_cast(handle); +} + +inline static const Internal::Adaptor::AutofillManager& GetImplementation(const Dali::AutofillManager& autofillManager) +{ + DALI_ASSERT_ALWAYS( autofillManager && "AutofillManager handle is empty" ); + + const BaseObject& handle = autofillManager.GetBaseObject(); + + return static_cast(handle); +} + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_H diff --git a/dali/internal/input/file.list b/dali/internal/input/file.list index 3e447ce..4725d55 100644 --- a/dali/internal/input/file.list +++ b/dali/internal/input/file.list @@ -1,29 +1,39 @@ # module: input, backend: common -SET( adaptor_input_common_src_files - ${adaptor_input_dir}/common/input-method-context-impl.cpp - ${adaptor_input_dir}/common/key-grab.cpp - ${adaptor_input_dir}/common/key-impl.cpp - ${adaptor_input_dir}/common/keyboard.cpp - ${adaptor_input_dir}/common/physical-keyboard-impl.cpp +SET( adaptor_input_common_src_files + ${adaptor_input_dir}/common/autofill-group-impl.cpp + ${adaptor_input_dir}/common/autofill-item-impl.cpp + ${adaptor_input_dir}/common/autofill-manager-impl.cpp + ${adaptor_input_dir}/common/input-method-context-impl.cpp + ${adaptor_input_dir}/common/key-grab.cpp + ${adaptor_input_dir}/common/key-impl.cpp + ${adaptor_input_dir}/common/keyboard.cpp + ${adaptor_input_dir}/common/physical-keyboard-impl.cpp ) # module: input, backend: tizen-wayland -SET( adaptor_input_tizen_wayland_src_files +SET( adaptor_input_tizen_wayland_src_files + ${adaptor_input_dir}/tizen-wayland/autofill-factory-ecore-wl.cpp + ${adaptor_input_dir}/tizen-wayland/autofill-group-impl-ecore-wl.cpp + ${adaptor_input_dir}/tizen-wayland/autofill-item-impl-ecore-wl.cpp + ${adaptor_input_dir}/tizen-wayland/autofill-manager-impl-ecore-wl.cpp ${adaptor_input_dir}/tizen-wayland/ecore-virtual-keyboard.cpp - ${adaptor_input_dir}/tizen-wayland/input-method-context-factory-ecore-wl.cpp - ${adaptor_input_dir}/tizen-wayland/input-method-context-impl-ecore-wl.cpp - ${adaptor_input_dir}/tizen-wayland/key-mapping-ecore-wl.cpp + ${adaptor_input_dir}/tizen-wayland/input-method-context-factory-ecore-wl.cpp + ${adaptor_input_dir}/tizen-wayland/input-method-context-impl-ecore-wl.cpp + ${adaptor_input_dir}/tizen-wayland/key-mapping-ecore-wl.cpp ${adaptor_input_dir}/tizen-wayland/virtual-keyboard-impl-ecore-wl.cpp ) # module: input, backend: ubuntu-x11 -SET( adaptor_input_ubuntu_x11_src_files +SET( adaptor_input_ubuntu_x11_src_files + ${adaptor_input_dir}/ubuntu-x11/autofill-factory-x.cpp + ${adaptor_input_dir}/ubuntu-x11/autofill-group-impl-x.cpp + ${adaptor_input_dir}/ubuntu-x11/autofill-item-impl-x.cpp + ${adaptor_input_dir}/ubuntu-x11/autofill-manager-impl-x.cpp ${adaptor_input_dir}/tizen-wayland/ecore-virtual-keyboard.cpp - ${adaptor_input_dir}/ubuntu-x11/input-method-context-factory-x.cpp - ${adaptor_input_dir}/ubuntu-x11/input-method-context-impl-x.cpp - ${adaptor_input_dir}/ubuntu-x11/key-mapping-x.cpp - ${adaptor_input_dir}/ubuntu-x11/virtual-keyboard-impl-x.cpp + ${adaptor_input_dir}/ubuntu-x11/input-method-context-factory-x.cpp + ${adaptor_input_dir}/ubuntu-x11/input-method-context-impl-x.cpp + ${adaptor_input_dir}/ubuntu-x11/key-mapping-x.cpp ) # module: input, backend: generic diff --git a/dali/internal/input/tizen-wayland/autofill-factory-ecore-wl.cpp b/dali/internal/input/tizen-wayland/autofill-factory-ecore-wl.cpp new file mode 100755 index 0000000..4d7d912 --- /dev/null +++ b/dali/internal/input/tizen-wayland/autofill-factory-ecore-wl.cpp @@ -0,0 +1,53 @@ +/* + * 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. + * + */ + +#include +#include +#include +#include + +namespace Dali +{ +namespace Internal +{ +namespace Adaptor +{ + +namespace AutofillFactory +{ + +// Autofill Factory to be implemented by the platform +Dali::AutofillGroup CreateAutofillGroup( const std::string& groupId ) +{ + return Dali::Internal::Adaptor::AutofillGroupEcoreWl::New( groupId ); +} + +Dali::AutofillItem CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ) +{ + return Dali::Internal::Adaptor::AutofillItemEcorewWl::New( id, label, hint, sensitiveData ); +} + +Dali::AutofillManager CreateAutofillManager() +{ + return Dali::Internal::Adaptor::AutofillManagerEcoreWl::Get(); +} + +} + +} // namespace Adaptor +} // namespace Internal +} // namespace Dali diff --git a/dali/internal/input/tizen-wayland/autofill-group-impl-ecore-wl.cpp b/dali/internal/input/tizen-wayland/autofill-group-impl-ecore-wl.cpp new file mode 100755 index 0000000..73cbeff --- /dev/null +++ b/dali/internal/input/tizen-wayland/autofill-group-impl-ecore-wl.cpp @@ -0,0 +1,230 @@ +/* + * 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 + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +namespace +{ +#if defined(DEBUG_ENABLED) +Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_AUTOFILL"); +#endif + +BaseHandle Create() +{ + return Dali::Internal::Adaptor::AutofillGroup::New( "" ); +} + +Dali::TypeRegistration type( typeid(Dali::AutofillGroup), typeid(Dali::BaseHandle), Create ); + +} // unnamed namespace + + +AutofillGroupEcoreWl::AutofillGroupEcoreWl( const std::string groupId ) +: mAutofillItemList(), + mGroupId( groupId ) +{ +#ifdef CAPI_AUTOFILL_SUPPORT + mAutofillGroupHandle = NULL; + mAutofillSaveGroupHandle = NULL; +#endif // CAPI_AUTOFILL_SUPPORT +} + +AutofillGroupEcoreWl::~AutofillGroupEcoreWl() +{ +#ifdef CAPI_AUTOFILL_SUPPORT + if( mAutofillGroupHandle ) + { + autofill_view_info_destroy( mAutofillGroupHandle ); + mAutofillGroupHandle = NULL; + } + if( mAutofillSaveGroupHandle ) + { + autofill_save_view_info_destroy( mAutofillSaveGroupHandle ); + mAutofillSaveGroupHandle = NULL; + } +#endif // CAPI_AUTOFILL_SUPPORT +} + + +Dali::AutofillGroup AutofillGroupEcoreWl::New( const std::string& groupId ) +{ + Dali::Internal::Adaptor::AutofillGroup* group = new Dali::Internal::Adaptor::AutofillGroupEcoreWl( groupId ); + Dali::AutofillGroup handle = Dali::AutofillGroup( group ); + group->Initialize(); + + return handle; +} + +void AutofillGroupEcoreWl::Initialize() +{ +#ifdef CAPI_AUTOFILL_SUPPORT + int ret = autofill_view_info_create( &mAutofillGroupHandle ); + if( ret != AUTOFILL_ERROR_NONE ) + { + DALI_LOG_ERROR( "Failed to create autofill group info handle : %d \n", ret ); + return; + } + + autofill_view_info_set_view_id( mAutofillGroupHandle, mGroupId.c_str() ); + +#endif // CAPI_AUTOFILL_SUPPORT +} + +const std::string& AutofillGroupEcoreWl::GetId() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupEcoreWl::GetId \n" ); + return mGroupId; +} + +#ifdef CAPI_AUTOFILL_SUPPORT +autofill_view_info_h AutofillGroupEcoreWl::GetAutofillGroupHandle() +{ + return mAutofillGroupHandle; +} + +autofill_save_view_info_h AutofillGroupEcoreWl::GetAutofillSaveGroupHandle() +{ + return mAutofillSaveGroupHandle; +} +#endif // CAPI_AUTOFILL_SUPPORT + +void AutofillGroupEcoreWl::AddAutofillItem( Dali::AutofillItem item ) +{ +#ifdef CAPI_AUTOFILL_SUPPORT + Internal::Adaptor::AutofillItem& itemImpl = Internal::Adaptor::GetImplementation( item ); + Internal::Adaptor::AutofillItemEcorewWl& itemImplWl = static_cast( itemImpl ); + + if( mAutofillGroupHandle && itemImplWl.GetAutofillItemHandle() ) + { + autofill_view_info_add_item( mAutofillGroupHandle, itemImplWl.GetAutofillItemHandle() ); + } +#endif // CAPI_AUTOFILL_SUPPORT + + // Pushes back an AutofillItem to the ItemList of AutofillGroup. + mAutofillItemList.push_back( item ); +} + +Dali::AutofillItem AutofillGroupEcoreWl::GetAutofillItem( const std::string& id ) +{ + Dali::AutofillItem item = Dali::AutofillItem(); + for( std::vector::iterator iter = mAutofillItemList.begin(), endIter = mAutofillItemList.end(); iter != endIter; ++iter ) + { + const std::string& itemId = ( *iter ).GetId(); + + if( itemId.compare( id ) == 0 ) + { + item = ( *iter ); + } + } + return item; +} + +void AutofillGroupEcoreWl::ClearAutofillItemList() +{ + for( std::vector::iterator iter = mAutofillItemList.begin(), endIter = mAutofillItemList.end(); iter != endIter; ++iter ) + { + ( *iter ).ClearPresentationTextList(); + ( *iter ).ClearFillValueList(); + } +} + +void AutofillGroupEcoreWl::SaveAutofillData() +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupEcoreWl::SaveAutofillData\n" ); +#ifdef CAPI_AUTOFILL_SUPPORT + // Creates autofill save view info handle. + autofill_save_view_info_create( &mAutofillSaveGroupHandle ); + autofill_save_view_info_set_view_id( mAutofillSaveGroupHandle, mGroupId.c_str() ); + + for( std::vector::iterator iter = mAutofillItemList.begin(), endIter = mAutofillItemList.end(); iter != endIter; ++iter ) + { + Internal::Adaptor::AutofillItem& itemImpl = Internal::Adaptor::GetImplementation( *iter ); + Internal::Adaptor::AutofillItemEcorewWl& itemImplWl = static_cast( itemImpl ); + + // Appends autofill save item in autofill save view. + autofill_save_view_info_add_item( mAutofillSaveGroupHandle, itemImplWl.GetAutofillSaveItemHandle() ); + } +#endif // CAPI_AUTOFILL_SUPPORT +} + +// If Autofill service sends authentication signal, AutofillManagerEcoreWl::ReceiveAuthInfo() would be called. +void AutofillGroupEcoreWl::RequestAuthentication() +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupEcoreWl::RequestAuthentication\n" ); + +#ifdef CAPI_AUTOFILL_SUPPORT + Dali::AutofillManager manager = Dali::AutofillManager::Get(); + Internal::Adaptor::AutofillManager& managerImpl = Internal::Adaptor::GetImplementation( manager ); + Internal::Adaptor::AutofillManagerEcoreWl& managerImplWl = static_cast( managerImpl ); + + // Requests to invoke the authentication information. + // After requests of authentication, AutofillManagerEcoreWl::AuthInfoCallback would be called. + int ret = autofill_auth_info_request( managerImplWl.GetAutofillHandle(), mAutofillGroupHandle ); + if( ret != AUTOFILL_ERROR_NONE ) + { + DALI_LOG_ERROR( "Failed to request auth info. error : %d \n", ret ); + } +#endif // CAPI_AUTOFILL_SUPPORT +} + +// If Autofill service sends fill response signal, AutofillManagerEcoreWl::FillGroupItem() or +// AutofillManagerEcoreWl::FillMultipleGroupItem() would be called according to the number of group count. +void AutofillGroupEcoreWl::SendFillRequest() +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupEcoreWl::SendFillRequest\n" ); + +#ifdef CAPI_AUTOFILL_SUPPORT + Dali::AutofillManager manager = Dali::AutofillManager::Get(); + Internal::Adaptor::AutofillManager& managerImpl = Internal::Adaptor::GetImplementation( manager ); + Internal::Adaptor::AutofillManagerEcoreWl& managerImplWl = static_cast( managerImpl ); + + // Removes all elements of each AutofillItem in AutofillGroup + ClearAutofillItemList(); + + // Sends fill request to fill out each input form. + // After request of fill data, AutofillManagerEcoreWl::FillResponseCallback would be called. + int ret = autofill_fill_request( managerImplWl.GetAutofillHandle(), mAutofillGroupHandle ); + if( ret != AUTOFILL_ERROR_NONE ) + { + DALI_LOG_ERROR( "Failed to request fill : %d \n", ret ); + } +#endif // CAPI_AUTOFILL_SUPPORT +} + +} // Adaptor + +} // Internal + +} // Dali diff --git a/dali/internal/input/tizen-wayland/autofill-group-impl-ecore-wl.h b/dali/internal/input/tizen-wayland/autofill-group-impl-ecore-wl.h new file mode 100644 index 0000000..0abdca3 --- /dev/null +++ b/dali/internal/input/tizen-wayland/autofill-group-impl-ecore-wl.h @@ -0,0 +1,150 @@ +#ifndef DALI_INTERNAL_AUTOFILL_GROUP_IMPL_ECORE_WL_H +#define DALI_INTERNAL_AUTOFILL_GROUP_IMPL_ECORE_WL_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 +#ifdef CAPI_AUTOFILL_SUPPORT +#include +#endif // CAPI_AUTOFILL_SUPPORT +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + + +/** + * @brief This class is used to group AutofillItems. + */ +class AutofillGroupEcoreWl : public Dali::Internal::Adaptor::AutofillGroup +{ + +public: + + /** + * @brief Constructor. + * + * @param[in] groupId A unique ID value of each AutofillGroup + * @return A public handle to the newly allocated AutofillGroup. + */ + static Dali::AutofillGroup New( const std::string& groupId ); + + /** + * @brief Initialize AutofillGroup constructor. + */ + void Initialize() override; + + /** + * @copydoc Dali::AutofillGroup::GetId() + */ + const std::string& GetId() const override; + +#ifdef CAPI_AUTOFILL_SUPPORT + /** + * @brief Gets Autofill framework group handle + * @return Autofill framework group handle, which type is 'autofill_view_info_h' + */ + autofill_view_info_h GetAutofillGroupHandle(); + + /** + * @brief Gets Autofill framework save group handle + * @return Autofill framework save group handle, which type is 'autofill_save_view_info_h' + */ + autofill_save_view_info_h GetAutofillSaveGroupHandle(); +#endif // CAPI_AUTOFILL_SUPPORT + + /** + * @copydoc Dali::AutofillGroup::AddAutofillItem() + */ + void AddAutofillItem( Dali::AutofillItem item ) override; + + /** + * @copydoc Dali::AutofillGroup::GetAutofillItem() + */ + Dali::AutofillItem GetAutofillItem( const std::string& id ) override; + + /** + * @brief Clears all lists of AutofillItem added in AutofillGroup. + */ + void ClearAutofillItemList() override; + + /** + * @copydoc Dali::AutofillGroup::SaveAutofillData() + */ + void SaveAutofillData() override; + + /** + * @copydoc Dali::AutofillGroup::RequestAuthentication() + */ + void RequestAuthentication() override; + + /** + * @copydoc Dali::AutofillGroup::SendFillRequest() + */ + void SendFillRequest() override; + +private: + /** + * Constructor. + */ + explicit AutofillGroupEcoreWl( const std::string groupId ); + +protected: + /** + * Destructor. + */ + ~AutofillGroupEcoreWl(); + +private: + // Undefined copy constructor + explicit AutofillGroupEcoreWl( const AutofillGroupEcoreWl& autofillGroup ) = delete; + + // Undefined assignment operator + AutofillGroupEcoreWl& operator=( AutofillGroupEcoreWl& autofillGroup ) = delete; + + +private: +#ifdef CAPI_AUTOFILL_SUPPORT + autofill_view_info_h mAutofillGroupHandle; ///< The Autofill Framework group handle + autofill_save_view_info_h mAutofillSaveGroupHandle; +#endif // CAPI_AUTOFILL_SUPPORT + + std::vector mAutofillItemList; ///< The List to add AutofillItem + std::string mGroupId; ///< The AutofillGroup ID + +}; + + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // DALI_INTERNAL_AUTOFILL_GROUP_IMPL_ECORE_WL_H diff --git a/dali/internal/input/tizen-wayland/autofill-item-impl-ecore-wl.cpp b/dali/internal/input/tizen-wayland/autofill-item-impl-ecore-wl.cpp new file mode 100755 index 0000000..146f9cc --- /dev/null +++ b/dali/internal/input/tizen-wayland/autofill-item-impl-ecore-wl.cpp @@ -0,0 +1,207 @@ +/* + * 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 +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +namespace +{ +#if defined(DEBUG_ENABLED) +Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_AUTOFILL"); +#endif + +BaseHandle Create() +{ + return Dali::Internal::Adaptor::AutofillItem::New( "", "", Dali::AutofillItem::Hint::ID, false ); +} + +Dali::TypeRegistration type( typeid(Dali::AutofillItem), typeid(Dali::BaseHandle), Create ); + +} // unnamed namespace + + +AutofillItemEcorewWl::AutofillItemEcorewWl( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ) +: mId( id ), + mLabel( label ), + mHint( hint ), + mSensitiveData( sensitiveData ), + mValue(""), + mPresentationTextList(), + mValueList() +{ +#ifdef CAPI_AUTOFILL_SUPPORT + mAutofillItemHandle = NULL; + mAutofillSaveItemHandle = NULL; +#endif // CAPI_AUTOFILL_SUPPORT +} + +AutofillItemEcorewWl::~AutofillItemEcorewWl() +{ +#ifdef CAPI_AUTOFILL_SUPPORT + if( mAutofillItemHandle ) + { + autofill_item_destroy( mAutofillItemHandle ); + mAutofillItemHandle = NULL; + } + + if( mAutofillSaveItemHandle ) + { + autofill_save_item_destroy( mAutofillSaveItemHandle ); + mAutofillSaveItemHandle = NULL; + } +#endif // CAPI_AUTOFILL_SUPPORT +} + + +Dali::AutofillItem AutofillItemEcorewWl::New( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ) +{ + Dali::Internal::Adaptor::AutofillItem* item = new Dali::Internal::Adaptor::AutofillItemEcorewWl( id, label, hint, sensitiveData ); + Dali::AutofillItem handle = Dali::AutofillItem( item ); + item->Initialize(); + + return handle; +} + +void AutofillItemEcorewWl::Initialize() +{ +#ifdef CAPI_AUTOFILL_SUPPORT + int ret = autofill_item_create( &mAutofillItemHandle ); + if( ret != AUTOFILL_ERROR_NONE ) + { + DALI_LOG_ERROR( "Failed to create autofill item handle : %d \n", ret ); + return; + } + + autofill_item_set_id( mAutofillItemHandle, mId.c_str() ); + autofill_item_set_label( mAutofillItemHandle, mLabel.c_str() ); + autofill_item_set_sensitive_data( mAutofillItemHandle, mSensitiveData ); + + // Create autofill save item handle for save. + autofill_save_item_create( &mAutofillSaveItemHandle ); + autofill_save_item_set_id( mAutofillSaveItemHandle, mId.c_str() ); + autofill_save_item_set_label( mAutofillSaveItemHandle, mLabel.c_str() ); + autofill_save_item_set_sensitive_data( mAutofillSaveItemHandle, mSensitiveData ); + + autofill_hint_e value = static_cast(mHint); + autofill_item_set_autofill_hint( mAutofillItemHandle, value ); + autofill_save_item_set_autofill_hint( mAutofillSaveItemHandle, value); +#endif // CAPI_AUTOFILL_SUPPORT +} + +const std::string& AutofillItemEcorewWl::GetId() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemEcorewWl::GetId \n" ); + return mId; +} + +const std::string& AutofillItemEcorewWl::GetLabel() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemEcorewWl::GetLabel \n" ); + return mLabel; +} + + +Dali::AutofillItem::Hint AutofillItemEcorewWl::GetHint() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemEcorewWl::GetHint \n" ); + return mHint; +} + +bool AutofillItemEcorewWl::IsSensitiveData() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemEcorewWl::IsSensitiveData \n" ); + return mSensitiveData; +} + +void AutofillItemEcorewWl::SetSaveValue( const std::string& value ) +{ + mValue = value; +#ifdef CAPI_AUTOFILL_SUPPORT + autofill_save_item_set_value( mAutofillSaveItemHandle, mValue.c_str() ); +#endif // CAPI_AUTOFILL_SUPPORT +} + +const std::string& AutofillItemEcorewWl::GetSaveValue() const +{ + return mValue; +} + +#ifdef CAPI_AUTOFILL_SUPPORT +autofill_item_h AutofillItemEcorewWl::GetAutofillItemHandle() +{ + return mAutofillItemHandle; +} + +autofill_save_item_h AutofillItemEcorewWl::GetAutofillSaveItemHandle() +{ + return mAutofillSaveItemHandle; +} +#endif // CAPI_AUTOFILL_SUPPORT + +void AutofillItemEcorewWl::AddPresentationList( const std::string& presentationText ) +{ + mPresentationTextList.push_back( presentationText ); +} + +void AutofillItemEcorewWl::AddFillValueList( const std::string& fillValue ) +{ + mValueList.push_back( fillValue ); +} + +const std::string& AutofillItemEcorewWl::GetPresentationText( int index ) const +{ + return mPresentationTextList[index]; +} + +const std::string& AutofillItemEcorewWl::GetFillValue( int index ) const +{ + return mValueList[index]; +} + +void AutofillItemEcorewWl::ClearPresentationTextList() +{ + mPresentationTextList.clear(); +} + +void AutofillItemEcorewWl::ClearFillValueList() +{ + mValueList.clear(); +} + +unsigned int AutofillItemEcorewWl::GetFillValueCount() +{ + return mValueList.size(); +} + +} // Adaptor + +} // Internal + +} // Dali diff --git a/dali/internal/input/tizen-wayland/autofill-item-impl-ecore-wl.h b/dali/internal/input/tizen-wayland/autofill-item-impl-ecore-wl.h new file mode 100644 index 0000000..2fbbd6b --- /dev/null +++ b/dali/internal/input/tizen-wayland/autofill-item-impl-ecore-wl.h @@ -0,0 +1,195 @@ +#ifndef DALI_INTERNAL_AUTOFILL_ITEM_IMPL_ECORE_WL_H +#define DALI_INTERNAL_AUTOFILL_ITEM_IMPL_ECORE_WL_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 +#ifdef CAPI_AUTOFILL_SUPPORT +#include +#endif // CAPI_AUTOFILL_SUPPORT +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + + +/** + * @brief This class is used to pass on data from the AutofillItem of control. + */ +class AutofillItemEcorewWl : public Dali::Internal::Adaptor::AutofillItem +{ + +public: + + /** + * @brief Constructor. + * + * @param[in] id A unique ID for this AutofillItem + * @param[in] label An auxiliary means to guess what data is + * @param[in] hint The hint - id (username), name, password, phone, credit card number, organization, and so on + * @param[in] sensitiveData Whether this AutofillItem is a sensitive data or not. (The default is false) + * @return A public handle to the newly allocated AutofillItem + */ + static Dali::AutofillItem New( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ); + + /** + * @brief Initialize AutofillItem constructor. + */ + void Initialize() override; + + /** + * @copydoc Dali::AutofillItem::GetId() + */ + const std::string& GetId() const override; + + /** + * @copydoc Dali::AutofillItem::GetLabel() + */ + const std::string& GetLabel() const override; + + /** + * @copydoc Dali::AutofillItem::GetHint() + */ + Dali::AutofillItem::Hint GetHint() const override; + + /** + * @copydoc Dali::AutofillItem::IsSensitiveData() + */ + bool IsSensitiveData() const override; + + /** + * @copydoc Dali::AutofillItem::SetSaveValue() + */ + void SetSaveValue( const std::string& value ) override; + + /** + * @copydoc Dali::AutofillItem::GetSaveValue() + */ + const std::string& GetSaveValue() const override; + +#ifdef CAPI_AUTOFILL_SUPPORT + /** + * @brief Gets Autofill framework item handle + * @return Autofill framework item handle, which type is 'autofill_item_h' + */ + autofill_item_h GetAutofillItemHandle(); + + /** + * @brief Gets Autofill framework save item handle + * @return Autofill framework save item handle, which type is 'autofill_save_item_h' + */ + autofill_save_item_h GetAutofillSaveItemHandle(); +#endif // CAPI_AUTOFILL_SUPPORT + + /** + * @brief Adds the presentation text to fill out in the list. + * + * @param[in] presentationText The presentation text to fill out + */ + void AddPresentationList( const std::string& presentationText ) override; + + /** + * @brief Adds the value to fill out in the list. + * + * @param[in] fillValue The value to fill out + */ + void AddFillValueList( const std::string& fillValue ) override; + + /** + * @copydoc Dali::AutofillItem::GetPresentationText() + */ + const std::string& GetPresentationText( int index ) const override; + + /** + * @copydoc Dali::AutofillItem::GetFillValue() + */ + const std::string& GetFillValue( int index ) const override; + + /** + * @copydoc Dali::AutofillItem::ClearPresentationTextList() + */ + void ClearPresentationTextList() override; + + /** + * @copydoc Dali::AutofillItem::ClearFillValueList() + */ + void ClearFillValueList() override; + + /** + * @copydoc Dali::AutofillItem::GetFillValueCount() + */ + unsigned int GetFillValueCount() override; + +private: + /** + * Constructor. + */ + explicit AutofillItemEcorewWl( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ); + +protected: + /** + * Destructor. + */ + ~AutofillItemEcorewWl(); + +private: + // Undefined copy constructor + explicit AutofillItemEcorewWl( const AutofillItemEcorewWl& autofillItem ) = delete; + + // Undefined assignment operator + AutofillItemEcorewWl& operator=( AutofillItemEcorewWl& autofillItem ) = delete; + +private: +#ifdef CAPI_AUTOFILL_SUPPORT + autofill_item_h mAutofillItemHandle; ///< The Autofill Framework item handle + autofill_save_item_h mAutofillSaveItemHandle; ///< The Autofill Framework save item handle for save +#endif // CAPI_AUTOFILL_SUPPORT + +// Data +private: + std::string mId; ///< The AutofillItem ID + std::string mLabel; ///< The AutofillItem Label + Dali::AutofillItem::Hint mHint; ///< The AutofillItem Hint (id (username), name, password, phone, credit card number, organization, so on) + bool mSensitiveData; ///< Whether the data is sensitive or not + + std::string mValue; + + std::vector mPresentationTextList; ///< The list for the presentation text to fill out + std::vector mValueList; ///< The list for the value to fill out + +}; + + + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // DALI_INTERNAL_AUTOFILL_ITEM_IMPL_ECORE_WL_H diff --git a/dali/internal/input/tizen-wayland/autofill-manager-impl-ecore-wl.cpp b/dali/internal/input/tizen-wayland/autofill-manager-impl-ecore-wl.cpp new file mode 100755 index 0000000..79e0613 --- /dev/null +++ b/dali/internal/input/tizen-wayland/autofill-manager-impl-ecore-wl.cpp @@ -0,0 +1,592 @@ +/* + * 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 +#include +#include + +// INTERNAL INCLUDES +#include + + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +namespace +{ +#if defined(DEBUG_ENABLED) +Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_AUTOFILL"); +#endif + +// Signals +const char* const SIGNAL_AUTHENTICATION_RECEIVED = "authenticationReceived"; +const char* const SIGNAL_FILL_RESPONSE_RECEIVED = "fillResponseReceived"; +const char* const SIGNAL_LIST_RECEIVED = "listReceived"; + + +#ifdef CAPI_AUTOFILL_SUPPORT + +// All methods in this range are Static function calls used by ecore 'c' style callback registration +static void ConnectionStatusChangedCallback( autofill_h autofillHandle, autofill_connection_status_e status, void *user_data ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::ConnectionStatusChangedCallback mAutofillHandle : %p \n", autofillHandle ); + + switch( status ) + { + case AUTOFILL_CONNECTION_STATUS_CONNECTED: + { + DALI_LOG_INFO( gLogFilter, Debug::General, "Autofill Connected.\n" ); + break; + } + case AUTOFILL_CONNECTION_STATUS_DISCONNECTED: + { + DALI_LOG_INFO( gLogFilter, Debug::General, "Autofill Disconnected.\n" ); + break; + } + case AUTOFILL_CONNECTION_STATUS_REJECTED: + { + DALI_LOG_INFO( gLogFilter, Debug::General, "Autofill Rejected.\n" ); + break; + } + default: + { + // Do nothing + break; + } + } +} + +// Callback to receive the authentication information. +static void AuthInfoCallback( autofill_h ah, autofill_auth_info_h authInfoHandle, void *data ) +{ + Dali::AutofillManager autofill = AutofillManager::Get(); + Internal::Adaptor::AutofillManager& autofillImpl = Internal::Adaptor::GetImplementation( autofill ); + Internal::Adaptor::AutofillManagerEcoreWl& autofillImplWl = static_cast( autofillImpl ); + autofillImplWl.ReceiveAuthInfo( authInfoHandle, data ); +} + +// If there's an only one fill response group, then this callback is called. +static bool FillResponseItemCallback( autofill_fill_response_item_h itemHandle, void *userData ) +{ + Dali::AutofillManager autofill = AutofillManager::Get(); + Internal::Adaptor::AutofillManager& autofillImpl = Internal::Adaptor::GetImplementation( autofill ); + Internal::Adaptor::AutofillManagerEcoreWl& autofillImplWl = static_cast( autofillImpl ); + autofillImplWl.FillGroupItem( itemHandle, userData ); // Implementation here + return true; +} + +// If the fill response groups are multiple, then this callback is called. +static bool FillResponseMultipleItemCallback( autofill_fill_response_item_h itemHandle, void *userData ) +{ + Dali::AutofillManager autofill = AutofillManager::Get(); + Internal::Adaptor::AutofillManager& autofillImpl = Internal::Adaptor::GetImplementation( autofill ); + Internal::Adaptor::AutofillManagerEcoreWl& autofillImplWl = static_cast( autofillImpl ); + autofillImplWl.FillMultipleGroupItem( itemHandle, userData ); // Implementation here + return true; +} + +// This callback is called according to the number of pairs to fill out. +static bool FillResponseGroupCallback( autofill_fill_response_group_h groupHandle, void *userData ) +{ + int* count = static_cast(userData); + + // According to the number of group count, Retrieves all fill response items of each fill response group. + if( *count == 1 ) + { + autofill_fill_response_group_foreach_item( groupHandle, FillResponseItemCallback, NULL ); + } + else if( *count > 1 ) + { + autofill_fill_response_group_foreach_item( groupHandle, FillResponseMultipleItemCallback, groupHandle ); + } + + return true; +} + +// Callback to receive autofill fill response. +static void FillResponseCallback( autofill_h autofillHandle, autofill_fill_response_h fillResponseHandle, void *data ) +{ + if( !fillResponseHandle ) + { + DALI_LOG_ERROR("Fill response handle is empty. \n"); + return; + } + + // Get fill response group count + int count = 0; + autofill_fill_response_get_group_count( fillResponseHandle, &count ); + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::FillResponseCallback group count : %d \n", count ); + + // Retrieves all groups of each fill response. + autofill_fill_response_foreach_group( fillResponseHandle, FillResponseGroupCallback, &count ); + + if( count > 1 ) + { + // Emits the signal to make a list of multiple data. + Dali::AutofillManager autofill = AutofillManager::Get(); + autofill.ListEventSignal().Emit(); + } +} +#endif // CAPI_AUTOFILL_SUPPORT + +BaseHandle Create() +{ + return Dali::AutofillManager::Get(); +} + +Dali::TypeRegistration typeRegistration( typeid(Dali::AutofillManager), typeid(Dali::BaseHandle), Create ); + +Dali::SignalConnectorType signalConnector1( typeRegistration, SIGNAL_AUTHENTICATION_RECEIVED, Dali::Internal::Adaptor::AutofillManagerEcoreWl::DoConnectSignal ); +Dali::SignalConnectorType signalConnector2( typeRegistration, SIGNAL_FILL_RESPONSE_RECEIVED, Dali::Internal::Adaptor::AutofillManagerEcoreWl::DoConnectSignal ); +Dali::SignalConnectorType signalConnector3( typeRegistration, SIGNAL_LIST_RECEIVED, Dali::Internal::Adaptor::AutofillManagerEcoreWl::DoConnectSignal ); + +} // unnamed namespace + + + +Dali::AutofillManager AutofillManagerEcoreWl::Get() +{ + Dali::AutofillManager autofill; + AutofillManagerEcoreWl *autofillPtr = NULL; + + Dali::SingletonService service( SingletonService::Get() ); + if( service ) + { + // Check whether the singleton is already created + Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::AutofillManager ) ); + if( handle ) + { + // If so, downcast the handle + autofillPtr = dynamic_cast< AutofillManagerEcoreWl* >( handle.GetObjectPtr() ); + autofill = Dali::AutofillManager( autofillPtr ); + } + else if( Adaptor::IsAvailable() ) + { + // Create instance and register singleton only if the adaptor is available + autofillPtr = new AutofillManagerEcoreWl(); + autofill = Dali::AutofillManager( autofillPtr ); + service.Register( typeid( autofill ), autofill ); + + // Connect Autofill daemon at the first time + autofillPtr->CreateContext(); + autofillPtr->ConnectCallbacks(); + } + } + + return autofill; +} + +AutofillManagerEcoreWl::AutofillManagerEcoreWl() +: mAutofillGroup(), + mAuthenticationServiceName(""), + mAuthenticationServiceMessage(""), + mAuthenticationServiceImagePath(""), + mFillItemId(""), + mFillItemPresentationText(""), + mFillItemValue(""), + mIsDataPresent( false ), + mIsAuthNeeded( false ) +{ +#ifdef CAPI_AUTOFILL_SUPPORT + mAutofillHandle = NULL; +#endif // CAPI_AUTOFILL_SUPPORT +} + +AutofillManagerEcoreWl::~AutofillManagerEcoreWl() +{ + DeleteContext(); +} + +void AutofillManagerEcoreWl::CreateContext() +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::CreateContext\n" ); + +#ifdef CAPI_AUTOFILL_SUPPORT + int ret = autofill_create( &mAutofillHandle ); + if( ret != AUTOFILL_ERROR_NONE ) + { + DALI_LOG_ERROR( "Failed to create autofill handle : %d \n", ret ); + } +#endif // CAPI_AUTOFILL_SUPPORT +} + +void AutofillManagerEcoreWl::DeleteContext() +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::DeleteContext\n" ); +#ifdef CAPI_AUTOFILL_SUPPORT + if( mAutofillHandle ) + { + // Unsets the callback to receive the authentication information. + autofill_auth_info_unset_received_cb( mAutofillHandle ); + + autofill_destroy( mAutofillHandle ); + mAutofillHandle = NULL; + } +#endif // CAPI_AUTOFILL_SUPPORT +} + +// Callbacks for connecting to autofill daemon. +void AutofillManagerEcoreWl::ConnectCallbacks() +{ +#ifdef CAPI_AUTOFILL_SUPPORT + if( mAutofillHandle ) + { + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::ConnectCallbacks\n" ); + + int ret = autofill_connect( mAutofillHandle, ConnectionStatusChangedCallback, NULL ); + if( ret != AUTOFILL_ERROR_NONE ) + { + DALI_LOG_ERROR( "Failed to connect : %d \n", ret ); + } + + // Sets the callback to receive the authentication information. + autofill_auth_info_set_received_cb( mAutofillHandle, AuthInfoCallback, NULL ); + + // Sets the callback to receive autofill fill response. + autofill_fill_response_set_received_cb( mAutofillHandle, FillResponseCallback, NULL ); + } +#endif // CAPI_AUTOFILL_SUPPORT +} + + +/////////////////////////////////////////////// Autofill Callback implementation /////////////////////////////////////////////// + +#ifdef CAPI_AUTOFILL_SUPPORT + +autofill_h AutofillManagerEcoreWl::GetAutofillHandle() +{ + return mAutofillHandle; +} + +// Implementation to receive the authentication information. +void AutofillManagerEcoreWl::ReceiveAuthInfo( autofill_auth_info_h authInfoHandle, void *data ) +{ + bool autofillDataPresent = false; + bool authenticationNeeded = false; + char* serviceName = NULL; + char* serviceMessage = NULL; + char* serviceLogoImagePath = NULL; + char* groupId = NULL; + + // Gets the authentication information which is set by Autofill Service framework. + autofill_auth_info_get_view_id( authInfoHandle, &groupId ); + autofill_auth_info_get_autofill_data_present( authInfoHandle, &autofillDataPresent ); + autofill_auth_info_get_authentication_needed( authInfoHandle, &authenticationNeeded ); + + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::ReceiveAuthInfo group id : %s, Is autofill data present ? : %s, Is authentication needed ? : %s \n", + groupId, autofillDataPresent ? "true" : "false", authenticationNeeded ? "true" : "false" ); + + for( std::vector::iterator iter = mAutofillGroupList.begin(), endIter = mAutofillGroupList.end(); iter != endIter; ++iter ) + { + const std::string id = ( *iter ).GetId(); + if( id.compare( groupId ) == 0 ) + { + mAutofillGroup = ( *iter ); + break; + } + } + // Sets the 'autofill data present' and 'authentication needed' attributes in autofill authentication information. + mIsDataPresent = autofillDataPresent; + mIsAuthNeeded = authenticationNeeded; + + if( groupId ) + { + free( groupId ); + } + + if( !autofillDataPresent ) + { + DALI_LOG_ERROR( " -> The autofill data is not present now. \n" ); + return; + } + + // If autofill authentication is needed, get authentication service information and set to DALi member variables. + if( authenticationNeeded ) + { + // Gets the authentication service information which is set by Autofill Service framework. + autofill_auth_info_get_service_name( authInfoHandle, &serviceName ); + autofill_auth_info_get_service_message( authInfoHandle, &serviceMessage ); + autofill_auth_info_get_service_logo_image_path( authInfoHandle, &serviceLogoImagePath ); + + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::ReceiveAuthInfo service name : %s, logo path : %s, message : '%s' \n", + serviceName, serviceLogoImagePath, serviceMessage ); + + // Sets the authentication service information in order to use in other components. + mAuthenticationServiceName = serviceName; + mAuthenticationServiceMessage = serviceMessage; + mAuthenticationServiceImagePath = serviceLogoImagePath; + + // Emits the signal to receive the authentication information. + mAuthReceivedSignal.Emit(); + + if( serviceMessage ) + { + free( serviceMessage ); + } + + if( serviceName ) + { + free( serviceName ); + } + + if( serviceLogoImagePath ) + { + free( serviceLogoImagePath ); + } + } + else + { + // If Authentication is not needed, sends fill request directly to fill the data. + mAutofillGroup.SendFillRequest(); + } +} + +// Implementation to fill out the data +void AutofillManagerEcoreWl::FillGroupItem( autofill_fill_response_item_h itemHandle, void *userData ) +{ + char* id = NULL; + char* value = NULL; + char* presentationText = NULL; + + // Gets the fill response information which is set by Autofill Service framework. + autofill_fill_response_item_get_id( itemHandle, &id ); + autofill_fill_response_item_get_presentation_text( itemHandle, &presentationText ); + autofill_fill_response_item_get_value( itemHandle, &value ); + + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::FillResponseItemCallback item id : %s, value : %s, presentation text : %s\n", + id, value, presentationText ); + + // Sets the fill response information in order to use in other components. + mFillItemId = id; + mFillItemPresentationText = presentationText; + mFillItemValue = value; + + Dali::AutofillItem item = mAutofillGroup.GetAutofillItem( id ); + Internal::Adaptor::AutofillItem& itemImpl = Internal::Adaptor::GetImplementation( item ); + itemImpl.AddPresentationList( presentationText ); + itemImpl.AddFillValueList( value ); + + // Emits the signal to fill the data in text input field. + mFillReceivedSignal.Emit( item ); + + if( id ) + { + free( id ); + } + + if( value ) + { + free( value ); + } + + if( presentationText ) + { + free( presentationText ); + } + +} + +// Implementation to fill out the data when the group count is more than one. +void AutofillManagerEcoreWl::FillMultipleGroupItem( autofill_fill_response_item_h itemHandle, void *userData ) +{ + char* id = NULL; + char* value = NULL; + char* presentationText = NULL; + + // Gets the fill response information which is set by Autofill Service framework. + autofill_fill_response_item_get_id( itemHandle, &id ); + autofill_fill_response_item_get_presentation_text( itemHandle, &presentationText ); + autofill_fill_response_item_get_value( itemHandle, &value ); + + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::FillResponseMultipleItemCallback item id : %s, value : %s, presentation text : %s\n", + id, value, presentationText ); + + // Sets the fill response information in order to use in other components. + mFillItemId = id; + mFillItemPresentationText = presentationText; + mFillItemValue = value; + + Dali::AutofillItem item = mAutofillGroup.GetAutofillItem( id ); + Internal::Adaptor::AutofillItem& itemImpl = Internal::Adaptor::GetImplementation( item ); + itemImpl.AddPresentationList( presentationText ); + itemImpl.AddFillValueList( value ); + + if( id ) + { + free( id ); + } + + if( value ) + { + free( value ); + } + + if( presentationText ) + { + free( presentationText ); + } +} +#endif // CAPI_AUTOFILL_SUPPORT + + +/////////////////////////////////////////////// Autofill Item and Group /////////////////////////////////////////////// + +Dali::AutofillItem AutofillManagerEcoreWl::CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::CreateAutofillItem \n" ); + + Dali::AutofillItem item = AutofillItem::New( id, label, hint, isSensitive ); + mAutofillItemList.push_back( item ); + + return mAutofillItemList.back(); +} + +Dali::AutofillGroup AutofillManagerEcoreWl::CreateAutofillGroup( const std::string& groupId ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::CreateAutofillGroup \n" ); + + Dali::AutofillGroup group = AutofillGroup::New( groupId ); + mAutofillGroupList.push_back( group ); + + return mAutofillGroupList.back(); +} + + +/////////////////////////////////////////////// Autofill Authentication Information /////////////////////////////////////////////// + +bool AutofillManagerEcoreWl::IsAutofillDataPresent() const +{ + return mIsDataPresent; +} + +bool AutofillManagerEcoreWl::IsAuthenticationNeeded() const +{ + return mIsAuthNeeded; +} + +const std::string& AutofillManagerEcoreWl::GetAuthenticationServiceName() const +{ + return mAuthenticationServiceName; +} + +const std::string& AutofillManagerEcoreWl::GetAuthenticationServiceMessage() const +{ + return mAuthenticationServiceMessage; +} + +const std::string& AutofillManagerEcoreWl::GetAuthenticationServiceImagePath() const +{ + return mAuthenticationServiceImagePath; +} + + +/////////////////////////////////////////////// Autofill Fill Response /////////////////////////////////////////////// + +const std::string& AutofillManagerEcoreWl::GetFillItemId() const +{ + return mFillItemId; +} + +const std::string& AutofillManagerEcoreWl::GetFillItemPresentationText() const +{ + return mFillItemPresentationText; +} + +const std::string& AutofillManagerEcoreWl::GetFillItemValue() const +{ + return mFillItemValue; +} + +void AutofillManagerEcoreWl::SaveAutofillData( Dali::AutofillGroup group ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerEcoreWl::SaveAutofillData -> Sends request to store data. \n" ); + +#ifdef CAPI_AUTOFILL_SUPPORT + Internal::Adaptor::AutofillGroup& groupImpl = Internal::Adaptor::GetImplementation( group ); + Internal::Adaptor::AutofillGroupEcoreWl& groupImplWl = static_cast( groupImpl ); + + // Sends request to save autofill data. + int ret = autofill_commit( mAutofillHandle, groupImplWl.GetAutofillSaveGroupHandle() ); + if( ret != AUTOFILL_ERROR_NONE ) + { + DALI_LOG_ERROR( "Failed to request auth info. error : %d \n", ret ); + } +#endif // CAPI_AUTOFILL_SUPPORT +} + +// Signals +AutofillManagerEcoreWl::AuthSignalType& AutofillManagerEcoreWl::AuthenticationReceivedSignal() +{ + return mAuthReceivedSignal; +} + +AutofillManagerEcoreWl::FillSignalType& AutofillManagerEcoreWl::FillResponseReceivedSignal() +{ + return mFillReceivedSignal; +} + +AutofillManagerEcoreWl::ListSignalType& AutofillManagerEcoreWl::ListEventSignal() +{ + return mListReceivedSignal; +} + +bool AutofillManagerEcoreWl::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +{ + Dali::BaseHandle handle( object ); + + bool connected( true ); + AutofillManagerEcoreWl* manager = dynamic_cast< AutofillManagerEcoreWl* >( object ); + + if( manager ) + { + if( 0 == signalName.compare( SIGNAL_AUTHENTICATION_RECEIVED ) ) + { + manager->AuthenticationReceivedSignal().Connect( tracker, functor ); + } + else if( 0 == signalName.compare( SIGNAL_FILL_RESPONSE_RECEIVED ) ) + { + manager->FillResponseReceivedSignal().Connect( tracker, functor ); + } + else if( 0 == signalName.compare( SIGNAL_LIST_RECEIVED ) ) + { + manager->ListEventSignal().Connect( tracker, functor ); + } + else + { + // signalName does not match any signal + connected = false; + } + } + + return connected; +} + +} // Adaptor + +} // Internal + +} // Dali diff --git a/dali/internal/input/tizen-wayland/autofill-manager-impl-ecore-wl.h b/dali/internal/input/tizen-wayland/autofill-manager-impl-ecore-wl.h new file mode 100644 index 0000000..4f84ff3 --- /dev/null +++ b/dali/internal/input/tizen-wayland/autofill-manager-impl-ecore-wl.h @@ -0,0 +1,258 @@ +#ifndef DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_ECORE_WL_H +#define DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_ECORE_WL_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 +#ifdef CAPI_AUTOFILL_SUPPORT +#include +#endif // CAPI_AUTOFILL_SUPPORT +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +class AutofillManagerEcoreWl : public Dali::Internal::Adaptor::AutofillManager +{ + +public: + + using AuthSignalType = Dali::AutofillManager::AuthSignalType; + using FillSignalType = Dali::AutofillManager::FillSignalType; + using ListSignalType = Dali::AutofillManager::ListSignalType; + +public: + + /** + * @brief Gets the AutofillManager instance + * + * It creates the instance if it has not already been created. + * Internally, a check should be made using IsAvailable() before this is called as we do not want + * to create an instance if not needed by applications. + * @see IsAvailable() + */ + static Dali::AutofillManager Get(); + + /** + * @brief Connects Callbacks required for Autofill daemon. + */ + void ConnectCallbacks() override; + +#ifdef CAPI_AUTOFILL_SUPPORT + + /** + * @brief Gets Autofill framework handle + * @return Autofill framework handle, which type is 'autofill_h" + */ + autofill_h GetAutofillHandle(); + + /** + * @brief Implement to receives Autofill Authentication Information callback. + * + * In this method, gets authentication information and emits the signal to check the authentication. + * @param authInfoHandle The autofill authentication information handle + * @param data The data from authentication information callback + */ + void ReceiveAuthInfo( autofill_auth_info_h authInfoHandle, void *data ); + + /** + * @brief Implement to fill out the data. + * + * This method would emit the signal to fill out the data. + * @param itemHandle The autofill fill response item handle + * @param userData The data from fill response callback + */ + void FillGroupItem( autofill_fill_response_item_h itemHandle, void *userData ); + + /** + * @brief Implement to set multiple group information. + * + * This method would emit the signals to make lists and fill out the data. + * @param itemHandle The autofill fill response item handle + * @param userData The data from fill response callback + */ + void FillMultipleGroupItem( autofill_fill_response_item_h itemHandle, void *userData ); +#endif // CAPI_AUTOFILL_SUPPORT + + + /////////////////////////////////////////////// Autofill Item and Group /////////////////////////////////////////////// + + /** + * @copydoc Dali::AutofillManager::CreateAutofillItem() + */ + Dali::AutofillItem CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ) override; + + /** + * @copydoc Dali::AutofillManager::CreateAutofillGroup() + */ + Dali::AutofillGroup CreateAutofillGroup( const std::string& groupId ) override; + + + /////////////////////////////////////////////// Autofill Authentication Information /////////////////////////////////////////////// + + /** + * @copydoc Dali::AutofillManager::IsAutofillDataPresent() + */ + bool IsAutofillDataPresent() const override; + + /** + * @copydoc Dali::AutofillManager::IsAuthenticationNeeded() + */ + bool IsAuthenticationNeeded() const override; + + /** + * @copydoc Dali::AutofillManager::GetAuthenticationServiceName() + */ + const std::string& GetAuthenticationServiceName() const override; + + /** + * @copydoc Dali::AutofillManager::GetAuthenticationServiceMessage() + */ + const std::string& GetAuthenticationServiceMessage() const override; + + /** + * @copydoc Dali::AutofillManager::GetAuthenticationServiceImagePath() + */ + const std::string& GetAuthenticationServiceImagePath() const override; + + + /////////////////////////////////////////////// Autofill Fill Response /////////////////////////////////////////////// + + /** + * @copydoc Dali::AutofillManager::GetFillItemId() + */ + const std::string& GetFillItemId() const override; + + /** + * @copydoc Dali::AutofillManager::GetFillItemPresentationText() + */ + const std::string& GetFillItemPresentationText() const override; + + /** + * @copydoc Dali::AutofillManager::GetFillItemValue() + */ + const std::string& GetFillItemValue() const override; + + /** + * @copydoc Dali::AutofillManager::SaveAutofillData() + */ + void SaveAutofillData( Dali::AutofillGroup group ) override; + +public: // Signals + + /** + * @copydoc Dali::AutofillManager::AuthenticationReceivedSignal() + */ + AuthSignalType& AuthenticationReceivedSignal() override; + + /** + * @copydoc Dali::AutofillManager::FillResponseReceivedSignal() + */ + FillSignalType& FillResponseReceivedSignal() override; + + /** + * @copydoc Dali::AutofillManager::ListEventSignal() + */ + ListSignalType& ListEventSignal() override; + + /** + * 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: + /** + * Context created the first time and kept until deleted. + */ + void CreateContext() override; + + /** + * Delete Autofill context. + */ + void DeleteContext() override; + +private: + /** + * Constructor. + */ + explicit AutofillManagerEcoreWl(); + +protected: + /** + * Destructor. + */ + ~AutofillManagerEcoreWl(); + +private: + // Undefined copy constructor + explicit AutofillManagerEcoreWl( const AutofillManagerEcoreWl& autofillManager ) = delete; + + // Undefined assignment operator + AutofillManagerEcoreWl& operator=( AutofillManagerEcoreWl& autofillManager ) = delete; + +private: +#ifdef CAPI_AUTOFILL_SUPPORT + autofill_h mAutofillHandle; ///< The Autofill framework handle +#endif // CAPI_AUTOFILL_SUPPORT + Dali::AutofillGroup mAutofillGroup; + + std::vector mAutofillGroupList; ///< The list to manage AutofillGroup + std::vector mAutofillItemList; ///< The list to manage AutofillItem + +private: + AuthSignalType mAuthReceivedSignal; ///< Authentication Received Signal + FillSignalType mFillReceivedSignal; ///< Fill Response Received Signal + ListSignalType mListReceivedSignal; ///< List Received Signal + +private: + std::string mAuthenticationServiceName; ///< The autofill authentication service name + std::string mAuthenticationServiceMessage; ///< The autofill authentication service message + std::string mAuthenticationServiceImagePath; ///< The autofill authentication service logo image path + std::string mFillItemId; ///< The autofill fill response item ID + std::string mFillItemPresentationText; ///< The autofill fill response item presentation text + std::string mFillItemValue; ///< The autofill fill response item value (input data) + + bool mIsDataPresent; ///< The autofill data presence + bool mIsAuthNeeded; ///< The authentication need + +}; + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_ECORE_WL_H diff --git a/dali/internal/input/ubuntu-x11/autofill-factory-x.cpp b/dali/internal/input/ubuntu-x11/autofill-factory-x.cpp new file mode 100755 index 0000000..06848ac --- /dev/null +++ b/dali/internal/input/ubuntu-x11/autofill-factory-x.cpp @@ -0,0 +1,54 @@ +/* + * 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. + * + */ + +#include +#include +#include +#include + +namespace Dali +{ +namespace Internal +{ +namespace Adaptor +{ + +namespace AutofillFactory +{ + +// Autofill Factory to be implemented by the platform + +Dali::AutofillGroup CreateAutofillGroup( const std::string& groupId ) +{ + return Dali::Internal::Adaptor::AutofillGroupX::New( groupId ); +} + +Dali::AutofillItem CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ) +{ + return Dali::Internal::Adaptor::AutofillItemX::New( id, label, hint, sensitiveData ); +} + +Dali::AutofillManager CreateAutofillManager() +{ + return Dali::Internal::Adaptor::AutofillManagerX::Get(); +} + +} + +} // namespace Adaptor +} // namespace Internal +} // namespace Dali diff --git a/dali/internal/input/ubuntu-x11/autofill-group-impl-x.cpp b/dali/internal/input/ubuntu-x11/autofill-group-impl-x.cpp new file mode 100755 index 0000000..4f6b775 --- /dev/null +++ b/dali/internal/input/ubuntu-x11/autofill-group-impl-x.cpp @@ -0,0 +1,134 @@ +/* + * 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 +#include + + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +namespace +{ +#if defined(DEBUG_ENABLED) +Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_AUTOFILL"); +#endif + + +BaseHandle Create() +{ + return Dali::Internal::Adaptor::AutofillGroup::New( "" ); +} + +Dali::TypeRegistration type( typeid(Dali::AutofillGroup), typeid(Dali::BaseHandle), Create ); + +} // unnamed namespace + + +AutofillGroupX::AutofillGroupX( const std::string groupId ) +: mAutofillItemList(), + mGroupId( groupId ) +{ +} + +AutofillGroupX::~AutofillGroupX() +{ +} + +Dali::AutofillGroup AutofillGroupX::New( const std::string& groupId ) +{ + Dali::Internal::Adaptor::AutofillGroup* group = new Dali::Internal::Adaptor::AutofillGroupX( groupId ); + Dali::AutofillGroup handle = Dali::AutofillGroup( group ); + + group->Initialize(); + + return handle; +} + +void AutofillGroupX::Initialize() +{ +} + +const std::string& AutofillGroupX::GetId() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupX::GetId \n" ); + return mGroupId; +} + +void AutofillGroupX::AddAutofillItem( Dali::AutofillItem item ) +{ + // Pushes back an AutofillItem to the ItemList of AutofillGroupX. + mAutofillItemList.push_back( item ); +} + +Dali::AutofillItem AutofillGroupX::GetAutofillItem( const std::string& id ) +{ + Dali::AutofillItem item = Dali::AutofillItem(); + for( std::vector::iterator iter = mAutofillItemList.begin(), endIter = mAutofillItemList.end(); iter != endIter; ++iter ) + { + const std::string& itemId = ( *iter ).GetId(); + + if( itemId.compare( id ) == 0 ) + { + item = ( *iter ); + } + } + return item; +} + +void AutofillGroupX::ClearAutofillItemList() +{ + for( std::vector::iterator iter = mAutofillItemList.begin(), endIter = mAutofillItemList.end(); iter != endIter; ++iter ) + { + ( *iter ).ClearPresentationTextList(); + ( *iter ).ClearFillValueList(); + } +} + +void AutofillGroupX::SaveAutofillData() +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupX::SaveAutofillData\n" ); + // Do Nothing +} + +void AutofillGroupX::RequestAuthentication() +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupX::RequestAuthentication\n" ); + // Do Nothing +} + +void AutofillGroupX::SendFillRequest() +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupX::SendFillRequest\n" ); + // Do Nothing +} + +} // Adaptor + +} // Internal + +} // Dali diff --git a/dali/internal/input/ubuntu-x11/autofill-group-impl-x.h b/dali/internal/input/ubuntu-x11/autofill-group-impl-x.h new file mode 100644 index 0000000..4003215 --- /dev/null +++ b/dali/internal/input/ubuntu-x11/autofill-group-impl-x.h @@ -0,0 +1,127 @@ +#ifndef DALI_INTERNAL_AUTOFILL_GROUP_IMPL_X_H +#define DALI_INTERNAL_AUTOFILL_GROUP_IMPL_X_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 + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + + +/** + * @brief This class is used to group AutofillItems. + */ +class AutofillGroupX : public Dali::Internal::Adaptor::AutofillGroup +{ + +public: + + /** + * @brief Constructor. + * + * @param[in] groupId A unique ID value of each AutofillGroup + * @return A public handle to the newly allocated AutofillGroup. + */ + static Dali::AutofillGroup New( const std::string& groupId ); + + /** + * @brief Initialize AutofillGroup constructor. + */ + void Initialize() override; + + /** + * @copydoc Dali::AutofillGroup::GetId() + */ + const std::string& GetId() const override; + + /** + * @copydoc Dali::AutofillGroup::AddAutofillItem() + */ + void AddAutofillItem( Dali::AutofillItem item ) override; + + /** + * @copydoc Dali::AutofillGroup::GetAutofillItem() + */ + Dali::AutofillItem GetAutofillItem( const std::string& id ) override; + + /** + * @brief Clears all lists of AutofillItem added in AutofillGroup. + */ + void ClearAutofillItemList() override; + + /** + * @copydoc Dali::AutofillGroup::SaveAutofillData() + */ + void SaveAutofillData() override; + + /** + * @copydoc Dali::AutofillGroup::RequestAuthentication() + */ + void RequestAuthentication() override; + + /** + * @copydoc Dali::AutofillGroup::SendFillRequest() + */ + void SendFillRequest() override; + +private: + /** + * Constructor. + */ + explicit AutofillGroupX( const std::string groupId ); + +protected: + /** + * Destructor. + */ + ~AutofillGroupX(); + +private: + // Undefined copy constructor + explicit AutofillGroupX( const AutofillGroupX& autofillGroup ) = delete; + + // Undefined assignment operator + AutofillGroupX& operator=( AutofillGroupX& autofillGroup ) = delete; + +private: + std::vector mAutofillItemList; ///< The List to add AutofillItem + std::string mGroupId; ///< The AutofillGroup ID + +}; + + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // DALI_INTERNAL_AUTOFILL_GROUP_IMPL_X_H diff --git a/dali/internal/input/ubuntu-x11/autofill-item-impl-x.cpp b/dali/internal/input/ubuntu-x11/autofill-item-impl-x.cpp new file mode 100755 index 0000000..9801552 --- /dev/null +++ b/dali/internal/input/ubuntu-x11/autofill-item-impl-x.cpp @@ -0,0 +1,155 @@ +/* + * 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 +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +namespace +{ +#if defined(DEBUG_ENABLED) +Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_AUTOFILL"); +#endif + + +BaseHandle Create() +{ + return Dali::Internal::Adaptor::AutofillItem::New( "", "", Dali::AutofillItem::Hint::ID, false ); +} + +Dali::TypeRegistration type( typeid(Dali::AutofillItem), typeid(Dali::BaseHandle), Create ); + +} // unnamed namespace + + +AutofillItemX::AutofillItemX( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ) +: mId( id ), + mLabel( label ), + mHint( hint ), + mSensitiveData( sensitiveData ), + mValue(""), + mPresentationTextList(), + mValueList() +{ +} + +AutofillItemX::~AutofillItemX() +{ +} + + +Dali::AutofillItem AutofillItemX::New( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ) +{ + Dali::Internal::Adaptor::AutofillItem* item = new Dali::Internal::Adaptor::AutofillItemX( id, label, hint, sensitiveData ); + Dali::AutofillItem handle = Dali::AutofillItem( item ); + + item->Initialize(); + + return handle; +} + +void AutofillItemX::Initialize() +{ +} + +const std::string& AutofillItemX::GetId() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemX::GetId \n" ); + return mId; +} + +const std::string& AutofillItemX::GetLabel() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemX::GetLabel \n" ); + return mLabel; +} + +Dali::AutofillItem::Hint AutofillItemX::GetHint() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemX::GetHint \n" ); + return mHint; +} + +bool AutofillItemX::IsSensitiveData() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemX::IsSensitiveData \n" ); + return mSensitiveData; +} + +void AutofillItemX::SetSaveValue( const std::string& value ) +{ + mValue = value; +} + +const std::string& AutofillItemX::GetSaveValue() const +{ + return mValue; +} + +void AutofillItemX::AddPresentationList( const std::string& presentationText ) +{ + mPresentationTextList.push_back( presentationText ); +} + +void AutofillItemX::AddFillValueList( const std::string& fillValue ) +{ + mValueList.push_back( fillValue ); +} + +const std::string& AutofillItemX::GetPresentationText( int index ) const +{ + return mPresentationTextList[index]; +} + +const std::string& AutofillItemX::GetFillValue( int index ) const +{ + return mValueList[index]; +} + +void AutofillItemX::ClearPresentationTextList() +{ + mPresentationTextList.clear(); +} + +void AutofillItemX::ClearFillValueList() +{ + mValueList.clear(); +} + +unsigned int AutofillItemX::GetFillValueCount() +{ + return mValueList.size(); +} + +} // Adaptor + +} // Internal + +} // Dali diff --git a/dali/internal/input/ubuntu-x11/autofill-item-impl-x.h b/dali/internal/input/ubuntu-x11/autofill-item-impl-x.h new file mode 100644 index 0000000..c7b8985 --- /dev/null +++ b/dali/internal/input/ubuntu-x11/autofill-item-impl-x.h @@ -0,0 +1,171 @@ +#ifndef DALI_INTERNAL_AUTOFILL_ITEM_IMPL_X_H +#define DALI_INTERNAL_AUTOFILL_ITEM_IMPL_X_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 + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * @brief This class is used to pass on data from the AutofillItem of control. + */ +class AutofillItemX : public Dali::Internal::Adaptor::AutofillItem +{ + +public: + + /** + * @brief Constructor. + * + * @param[in] id A unique ID for this AutofillItem + * @param[in] label An auxiliary means to guess what data is + * @param[in] hint The hint - id (username), name, password, phone, credit card number, organization, and so on + * @param[in] sensitiveData Whether this AutofillItem is a sensitive data or not. (The default is false) + * @return A public handle to the newly allocated AutofillItem + */ + static Dali::AutofillItem New( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ); + + /** + * @brief Initialize AutofillItem constructor. + */ + void Initialize() override; + + /** + * @copydoc Dali::AutofillItem::GetId() + */ + const std::string& GetId() const override; + + /** + * @copydoc Dali::AutofillItem::GetLabel() + */ + const std::string& GetLabel() const override; + + /** + * @copydoc Dali::AutofillItem::GetHint() + */ + Dali::AutofillItem::Hint GetHint() const override; + + /** + * @copydoc Dali::AutofillItem::IsSensitiveData() + */ + bool IsSensitiveData() const override; + + /** + * @copydoc Dali::AutofillItem::SetSaveValue() + */ + void SetSaveValue( const std::string& value ) override; + + /** + * @copydoc Dali::AutofillItem::GetSaveValue() + */ + const std::string& GetSaveValue() const override; + + /** + * @brief Adds the presentation text to fill out in the list. + * + * @param[in] presentationText The presentation text to fill out + */ + void AddPresentationList( const std::string& presentationText ) override; + + /** + * @brief Adds the value to fill out in the list. + * + * @param[in] fillValue The value to fill out + */ + void AddFillValueList( const std::string& fillValue ) override; + + /** + * @copydoc Dali::AutofillItem::GetPresentationText() + */ + const std::string& GetPresentationText( int index ) const override; + + /** + * @copydoc Dali::AutofillItem::GetFillValue() + */ + const std::string& GetFillValue( int index ) const override; + + /** + * @copydoc Dali::AutofillItem::ClearPresentationTextList() + */ + void ClearPresentationTextList() override; + + /** + * @copydoc Dali::AutofillItem::ClearFillValueList() + */ + void ClearFillValueList() override; + + /** + * @copydoc Dali::AutofillItem::GetFillValueCount() + */ + unsigned int GetFillValueCount() override; + +private: + /** + * Constructor. + */ + explicit AutofillItemX( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData ); + +protected: + /** + * Destructor. + */ + ~AutofillItemX(); + +private: + // Undefined copy constructor + explicit AutofillItemX( const AutofillItemX& autofillItem ) = delete; + + // Undefined assignment operator + AutofillItemX& operator=( AutofillItemX& autofillItem ) = delete; + + +// Data +private: + std::string mId; ///< The AutofillItem ID + std::string mLabel; ///< The AutofillItem Label + Dali::AutofillItem::Hint mHint; ///< The AutofillItem Hint (id (username), name, password, phone, credit card number, organization, so on) + bool mSensitiveData; ///< Whether the data is sensitive or not + + std::string mValue; + + std::vector mPresentationTextList; ///< The list for the presentation text to fill out + std::vector mValueList; ///< The list for the value to fill out + +}; + + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // DALI_INTERNAL_AUTOFILL_ITEM_IMPL_X_H diff --git a/dali/internal/input/ubuntu-x11/autofill-manager-impl-x.cpp b/dali/internal/input/ubuntu-x11/autofill-manager-impl-x.cpp new file mode 100755 index 0000000..25c289f --- /dev/null +++ b/dali/internal/input/ubuntu-x11/autofill-manager-impl-x.cpp @@ -0,0 +1,252 @@ +/* + * 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 +#include +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +namespace +{ +#if defined(DEBUG_ENABLED) +Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_AUTOFILL"); +#endif + +// Signals +const char* const SIGNAL_AUTHENTICATION_RECEIVED = "authenticationReceived"; +const char* const SIGNAL_FILL_RESPONSE_RECEIVED = "fillResponseReceived"; +const char* const SIGNAL_LIST_RECEIVED = "listReceived"; + +BaseHandle Create() +{ + return Dali::AutofillManager::Get(); +} + +Dali::TypeRegistration typeRegistration( typeid(Dali::AutofillManager), typeid(Dali::BaseHandle), Create ); + +Dali::SignalConnectorType signalConnector1( typeRegistration, SIGNAL_AUTHENTICATION_RECEIVED, Dali::Internal::Adaptor::AutofillManagerX::DoConnectSignal ); +Dali::SignalConnectorType signalConnector2( typeRegistration, SIGNAL_FILL_RESPONSE_RECEIVED, Dali::Internal::Adaptor::AutofillManagerX::DoConnectSignal ); +Dali::SignalConnectorType signalConnector3( typeRegistration, SIGNAL_LIST_RECEIVED, Dali::Internal::Adaptor::AutofillManagerX::DoConnectSignal ); + +} // unnamed namespace + + + +Dali::AutofillManager AutofillManagerX::Get() +{ + Dali::AutofillManager autofill; + AutofillManagerX *autofillPtr = NULL; + + Dali::SingletonService service( SingletonService::Get() ); + if( service ) + { + // Check whether the singleton is already created + Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::AutofillManager ) ); + if( handle ) + { + // If so, downcast the handle + autofillPtr = dynamic_cast< AutofillManagerX* >( handle.GetObjectPtr() ); + autofill = Dali::AutofillManager( autofillPtr ); + } + else if( Adaptor::IsAvailable() ) + { + // Create instance and register singleton only if the adaptor is available + autofillPtr = new AutofillManagerX(); + autofill = Dali::AutofillManager( autofillPtr ); + service.Register( typeid( autofill ), autofill ); + } + } + + return autofill; +} + +AutofillManagerX::AutofillManagerX() +: mAutofillGroup(), + mAuthenticationServiceName(""), + mAuthenticationServiceMessage(""), + mAuthenticationServiceImagePath(""), + mFillItemId(""), + mFillItemPresentationText(""), + mFillItemValue(""), + mIsDataPresent( false ), + mIsAuthNeeded( false ) +{ +} + +AutofillManagerX::~AutofillManagerX() +{ + DeleteContext(); +} + +void AutofillManagerX::ConnectCallbacks() +{ +} + +void AutofillManagerX::CreateContext() +{ +} + +void AutofillManagerX::DeleteContext() +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerX::DeleteContext\n" ); + // Do Nothing +} + + +/////////////////////////////////////////////// Autofill Item and Group /////////////////////////////////////////////// + +Dali::AutofillItem AutofillManagerX::CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerX::CreateAutofillItem \n" ); + + Dali::AutofillItem item = AutofillItem::New( id, label, hint, isSensitive ); + mAutofillItemList.push_back( item ); + + return mAutofillItemList.back(); +} + +Dali::AutofillGroup AutofillManagerX::CreateAutofillGroup( const std::string& groupId ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerX::CreateAutofillGroup \n" ); + + Dali::AutofillGroup group = AutofillGroup::New( groupId ); + mAutofillGroupList.push_back( group ); + + return mAutofillGroupList.back(); +} + + +/////////////////////////////////////////////// Autofill Authentication Information /////////////////////////////////////////////// + +bool AutofillManagerX::IsAutofillDataPresent() const +{ + return mIsDataPresent; +} + +bool AutofillManagerX::IsAuthenticationNeeded() const +{ + return mIsAuthNeeded; +} + +const std::string& AutofillManagerX::GetAuthenticationServiceName() const +{ + return mAuthenticationServiceName; +} + +const std::string& AutofillManagerX::GetAuthenticationServiceMessage() const +{ + return mAuthenticationServiceMessage; +} + +const std::string& AutofillManagerX::GetAuthenticationServiceImagePath() const +{ + return mAuthenticationServiceImagePath; +} + + +/////////////////////////////////////////////// Autofill Fill Response /////////////////////////////////////////////// + +const std::string& AutofillManagerX::GetFillItemId() const +{ + return mFillItemId; +} + +const std::string& AutofillManagerX::GetFillItemPresentationText() const +{ + return mFillItemPresentationText; +} + +const std::string& AutofillManagerX::GetFillItemValue() const +{ + return mFillItemValue; +} + +void AutofillManagerX::SaveAutofillData( Dali::AutofillGroup group ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillManagerX::SaveAutofillData\n" ); + // Do Nothing +} + +// Signals +AutofillManagerX::AuthSignalType& AutofillManagerX::AuthenticationReceivedSignal() +{ + return mAuthReceivedSignal; +} + +AutofillManagerX::FillSignalType& AutofillManagerX::FillResponseReceivedSignal() +{ + return mFillReceivedSignal; +} + +AutofillManagerX::ListSignalType& AutofillManagerX::ListEventSignal() +{ + return mListReceivedSignal; +} + +bool AutofillManagerX::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +{ + Dali::BaseHandle handle( object ); + + bool connected( true ); + AutofillManagerX* manager = dynamic_cast< AutofillManagerX* >( object ); + + if( manager ) + { + if( 0 == signalName.compare( SIGNAL_AUTHENTICATION_RECEIVED ) ) + { + manager->AuthenticationReceivedSignal().Connect( tracker, functor ); + } + else if( 0 == signalName.compare( SIGNAL_FILL_RESPONSE_RECEIVED ) ) + { + manager->FillResponseReceivedSignal().Connect( tracker, functor ); + } + else if( 0 == signalName.compare( SIGNAL_LIST_RECEIVED ) ) + { + manager->ListEventSignal().Connect( tracker, functor ); + } + else + { + // signalName does not match any signal + connected = false; + } + } + + return connected; +} + + + +} // Adaptor + +} // Internal + +} // Dali diff --git a/dali/internal/input/ubuntu-x11/autofill-manager-impl-x.h b/dali/internal/input/ubuntu-x11/autofill-manager-impl-x.h new file mode 100644 index 0000000..1b0b3e9 --- /dev/null +++ b/dali/internal/input/ubuntu-x11/autofill-manager-impl-x.h @@ -0,0 +1,217 @@ +#ifndef DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_X_H +#define DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_X_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 + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +class AutofillManagerX : public Dali::Internal::Adaptor::AutofillManager +{ + +public: + + using AuthSignalType = Dali::AutofillManager::AuthSignalType; + using FillSignalType = Dali::AutofillManager::FillSignalType; + using ListSignalType = Dali::AutofillManager::ListSignalType; + +public: + + /** + * @brief Gets the AutofillManager instance + * + * It creates the instance if it has not already been created. + * Internally, a check should be made using IsAvailable() before this is called as we do not want + * to create an instance if not needed by applications. + * @see IsAvailable() + */ + static Dali::AutofillManager Get(); + + /** + * @brief Connects Callbacks required for Autofill daemon. + */ + void ConnectCallbacks() override; + + + /////////////////////////////////////////////// Autofill Item and Group /////////////////////////////////////////////// + + /** + * @copydoc Dali::AutofillManager::CreateAutofillItem() + */ + Dali::AutofillItem CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ) override; + + /** + * @copydoc Dali::AutofillManager::CreateAutofillGroup() + */ + Dali::AutofillGroup CreateAutofillGroup( const std::string& groupId ) override; + + + /////////////////////////////////////////////// Autofill Authentication Information /////////////////////////////////////////////// + + /** + * @copydoc Dali::AutofillManager::IsAutofillDataPresent() + */ + bool IsAutofillDataPresent() const override; + + /** + * @copydoc Dali::AutofillManager::IsAuthenticationNeeded() + */ + bool IsAuthenticationNeeded() const override; + + /** + * @copydoc Dali::AutofillManager::GetAuthenticationServiceName() + */ + const std::string& GetAuthenticationServiceName() const override; + + /** + * @copydoc Dali::AutofillManager::GetAuthenticationServiceMessage() + */ + const std::string& GetAuthenticationServiceMessage() const override; + + /** + * @copydoc Dali::AutofillManager::GetAuthenticationServiceImagePath() + */ + const std::string& GetAuthenticationServiceImagePath() const override; + + + /////////////////////////////////////////////// Autofill Fill Response /////////////////////////////////////////////// + + /** + * @copydoc Dali::AutofillManager::GetFillItemId() + */ + const std::string& GetFillItemId() const override; + + /** + * @copydoc Dali::AutofillManager::GetFillItemPresentationText() + */ + const std::string& GetFillItemPresentationText() const override; + + /** + * @copydoc Dali::AutofillManager::GetFillItemValue() + */ + const std::string& GetFillItemValue() const override; + + /** + * @copydoc Dali::AutofillManager::SaveAutofillData() + */ + void SaveAutofillData( Dali::AutofillGroup group ) override; + +public: // Signals + + /** + * @copydoc Dali::AutofillManager::AuthenticationReceivedSignal() + */ + AuthSignalType& AuthenticationReceivedSignal() override; + + /** + * @copydoc Dali::AutofillManager::FillResponseReceivedSignal() + */ + FillSignalType& FillResponseReceivedSignal() override; + + /** + * @copydoc Dali::AutofillManager::ListEventSignal() + */ + ListSignalType& ListEventSignal() override; + + /** + * 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: + /** + * Context created the first time and kept until deleted. + */ + void CreateContext() override; + + /** + * Delete Autofill context. + */ + void DeleteContext() override; + +private: + /** + * Constructor. + */ + explicit AutofillManagerX(); + +protected: + /** + * Destructor. + */ + ~AutofillManagerX(); + +private: + // Undefined copy constructor + explicit AutofillManagerX( const AutofillManagerX& autofillManager ) = delete; + + // Undefined assignment operator + AutofillManagerX& operator=( AutofillManagerX& autofillManager ) = delete; + +private: + Dali::AutofillGroup mAutofillGroup; + + std::vector mAutofillGroupList; ///< The list to manage AutofillGroup + std::vector mAutofillItemList; ///< The list to manage AutofillItem + +private: + AuthSignalType mAuthReceivedSignal; ///< Authentication Received Signal + FillSignalType mFillReceivedSignal; ///< Fill Response Received Signal + ListSignalType mListReceivedSignal; ///< List Received Signal + +private: + std::string mAuthenticationServiceName; ///< The autofill authentication service name + std::string mAuthenticationServiceMessage; ///< The autofill authentication service message + std::string mAuthenticationServiceImagePath; ///< The autofill authentication service logo image path + std::string mFillItemId; ///< The autofill fill response item ID + std::string mFillItemPresentationText; ///< The autofill fill response item presentation text + std::string mFillItemValue; ///< The autofill fill response item value (input data) + + bool mIsDataPresent; ///< The autofill data presence + bool mIsAuthNeeded; ///< The authentication need + +}; + + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_X_H diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index 724afa5..f69143a 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -100,6 +100,11 @@ BuildRequires: pkgconfig(ecore-imf) BuildRequires: pkgconfig(capi-system-system-settings) +# for autofill +%if 0%{?tizen_version_major} >= 5 && 0%{?tizen_version_minor} >= 5 +BuildRequires: pkgconfig(capi-ui-autofill) +%endif + # for feedback plugin BuildRequires: pkgconfig(mm-sound) BuildRequires: pkgconfig(feedback) @@ -298,6 +303,7 @@ cmake_flags+=" -DCMAKE_INSTALL_PREFIX=$PREFIX" cmake_flags+=" -DCMAKE_INSTALL_LIBDIR=%{_libdir}" cmake_flags+=" -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir}" cmake_flags+=" -DENABLE_TIZEN_MAJOR_VERSION=%{tizen_version_major}" +cmake_flags+=" -DENABLE_TIZEN_MINOR_VERSION=%{tizen_version_minor}" cmake_flags+=" -DENABLE_FEEDBACK=YES" cmake_flags+=" -DENABLE_APPFW=YES" -- 2.7.4