[Tizen] Add DALi Autofill implementation
[platform/core/uifw/dali-adaptor.git] / dali / internal / input / ubuntu-x11 / autofill-item-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-item-impl-x.h>
20
21 // EXTERNAL INCLUDES
22
23 #include <dali/public-api/object/type-registry.h>
24 #include <dali/integration-api/debug.h>
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::AutofillItem::New( "", "", Dali::AutofillItem::Hint::ID, false );
45 }
46
47 Dali::TypeRegistration type( typeid(Dali::AutofillItem), typeid(Dali::BaseHandle), Create );
48
49 } // unnamed namespace
50
51
52 AutofillItemX::AutofillItemX( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData )
53 : mId( id ),
54   mLabel( label ),
55   mHint( hint ),
56   mSensitiveData( sensitiveData ),
57   mValue(""),
58   mPresentationTextList(),
59   mValueList()
60 {
61 }
62
63 AutofillItemX::~AutofillItemX()
64 {
65 }
66
67
68 Dali::AutofillItem AutofillItemX::New( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData )
69 {
70   Dali::Internal::Adaptor::AutofillItem* item = new Dali::Internal::Adaptor::AutofillItemX( id, label, hint, sensitiveData );
71   Dali::AutofillItem handle = Dali::AutofillItem( item );
72
73   item->Initialize();
74
75   return handle;
76 }
77
78 void AutofillItemX::Initialize()
79 {
80 }
81
82 const std::string& AutofillItemX::GetId() const
83 {
84   DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemX::GetId \n" );
85   return mId;
86 }
87
88 const std::string& AutofillItemX::GetLabel() const
89 {
90   DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemX::GetLabel \n" );
91   return mLabel;
92 }
93
94 Dali::AutofillItem::Hint AutofillItemX::GetHint() const
95 {
96   DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemX::GetHint \n" );
97   return mHint;
98 }
99
100 bool AutofillItemX::IsSensitiveData() const
101 {
102   DALI_LOG_INFO( gLogFilter, Debug::General, "AutofillItemX::IsSensitiveData \n" );
103   return mSensitiveData;
104 }
105
106 void AutofillItemX::SetSaveValue( const std::string& value )
107 {
108   mValue = value;
109 }
110
111 const std::string& AutofillItemX::GetSaveValue() const
112 {
113   return mValue;
114 }
115
116 void AutofillItemX::AddPresentationList( const std::string& presentationText )
117 {
118   mPresentationTextList.push_back( presentationText );
119 }
120
121 void AutofillItemX::AddFillValueList( const std::string& fillValue )
122 {
123   mValueList.push_back( fillValue );
124 }
125
126 const std::string& AutofillItemX::GetPresentationText( int index ) const
127 {
128   return mPresentationTextList[index];
129 }
130
131 const std::string& AutofillItemX::GetFillValue( int index ) const
132 {
133   return mValueList[index];
134 }
135
136 void AutofillItemX::ClearPresentationTextList()
137 {
138   mPresentationTextList.clear();
139 }
140
141 void AutofillItemX::ClearFillValueList()
142 {
143   mValueList.clear();
144 }
145
146 unsigned int AutofillItemX::GetFillValueCount()
147 {
148   return mValueList.size();
149 }
150
151 } // Adaptor
152
153 } // Internal
154
155 } // Dali