[Tizen] Add DALi Autofill implementation
[platform/core/uifw/dali-adaptor.git] / dali / internal / input / ubuntu-x11 / autofill-group-impl-x.cpp
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/input/ubuntu-x11/autofill-group-impl-x.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/type-registry.h>
23 #include <dali/integration-api/debug.h>
24
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 namespace Adaptor
33 {
34
35 namespace
36 {
37 #if defined(DEBUG_ENABLED)
38 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_AUTOFILL");
39 #endif
40
41
42 BaseHandle Create()
43 {
44   return Dali::Internal::Adaptor::AutofillGroup::New( "" );
45 }
46
47 Dali::TypeRegistration type( typeid(Dali::AutofillGroup), typeid(Dali::BaseHandle), Create );
48
49 } // unnamed namespace
50
51
52 AutofillGroupX::AutofillGroupX( const std::string groupId )
53 : mAutofillItemList(),
54   mGroupId( groupId )
55 {
56 }
57
58 AutofillGroupX::~AutofillGroupX()
59 {
60 }
61
62 Dali::AutofillGroup AutofillGroupX::New( const std::string& groupId )
63 {
64   Dali::Internal::Adaptor::AutofillGroup* group = new Dali::Internal::Adaptor::AutofillGroupX( groupId );
65   Dali::AutofillGroup handle = Dali::AutofillGroup( group );
66
67   group->Initialize();
68
69   return handle;
70 }
71
72 void AutofillGroupX::Initialize()
73 {
74 }
75
76 const std::string& AutofillGroupX::GetId() const
77 {
78   DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupX::GetId \n" );
79   return mGroupId;
80 }
81
82 void AutofillGroupX::AddAutofillItem( Dali::AutofillItem item )
83 {
84   // Pushes back an AutofillItem to the ItemList of AutofillGroupX.
85   mAutofillItemList.push_back( item );
86 }
87
88 Dali::AutofillItem AutofillGroupX::GetAutofillItem( const std::string& id )
89 {
90   Dali::AutofillItem item = Dali::AutofillItem();
91   for( std::vector<Dali::AutofillItem>::iterator iter = mAutofillItemList.begin(), endIter = mAutofillItemList.end(); iter !=  endIter; ++iter )
92   {
93     const std::string& itemId = ( *iter ).GetId();
94
95     if( itemId.compare( id ) == 0 )
96     {
97       item = ( *iter );
98     }
99   }
100   return item;
101 }
102
103 void AutofillGroupX::ClearAutofillItemList()
104 {
105   for( std::vector<Dali::AutofillItem>::iterator iter = mAutofillItemList.begin(), endIter = mAutofillItemList.end(); iter !=  endIter; ++iter )
106   {
107     ( *iter ).ClearPresentationTextList();
108     ( *iter ).ClearFillValueList();
109   }
110 }
111
112 void AutofillGroupX::SaveAutofillData()
113 {
114   DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupX::SaveAutofillData\n" );
115   // Do Nothing
116 }
117
118 void AutofillGroupX::RequestAuthentication()
119 {
120   DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupX::RequestAuthentication\n" );
121   // Do Nothing
122 }
123
124 void AutofillGroupX::SendFillRequest()
125 {
126   DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillGroupX::SendFillRequest\n" );
127   // Do Nothing
128 }
129
130 } // Adaptor
131
132 } // Internal
133
134 } // Dali