Refactoring code with creating OK button on popup.
authorPiotr Ganicz <p.ganicz@samsung.com>
Thu, 10 Dec 2015 14:44:03 +0000 (15:44 +0100)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 07:55:23 +0000 (07:55 +0000)
The issue is that we has CreateOKButton() function in Layout class,
but in the code there is not any usage. In every function with
name started with the "show" word (e.g. showDatePopup) there is
created "OK" button the same way, without using special function
for it. It creates a redundancy of code.

Reviewed by: a1.gomes, g.czajkowski

Change-Id: Ic7a98c43de3dcdc4106187b9e2624d12d9f42cd9
Signed-off-by: Piotr Ganicz <p.ganicz@samsung.com>
tizen_src/ewk/efl_integration/browser/inputpicker/InputPicker.cc

index fe5f143..5a5ed57 100755 (executable)
@@ -484,12 +484,7 @@ void InputPicker::showDatePopup(struct tm* currentTime) {
   CreatePopupLayout(dgettext("WebKit","IDS_WEBVIEW_HEADER_SET_DATE"),
       currentTime);
 
-  picker_layout_->okButton = elm_button_add(picker_layout_->popup);
-  elm_object_style_set(picker_layout_->okButton, "popup");
-  elm_object_text_set(picker_layout_->okButton, "OK");
-  elm_object_part_content_set(
-      picker_layout_->popup, "button1", picker_layout_->okButton);
-  evas_object_focus_set(picker_layout_->okButton, true);
+  picker_layout_->CreateOKButton();
 
   evas_object_smart_callback_add(
       picker_layout_->okButton, "clicked", datePopupCallback, this);
@@ -509,12 +504,7 @@ void InputPicker::showWeekPopup(struct tm* currentTime) {
   CreatePopupLayout(dgettext("WebKit","IDS_WEBVIEW_HEADER_SET_WEEK"),
       currentTime);
 
-  picker_layout_->okButton = elm_button_add(picker_layout_->popup);
-  elm_object_style_set(picker_layout_->okButton, "popup");
-  elm_object_text_set(picker_layout_->okButton, "OK");
-  elm_object_part_content_set(
-      picker_layout_->popup, "button1", picker_layout_->okButton);
-  evas_object_focus_set(picker_layout_->okButton, true);
+  picker_layout_->CreateOKButton();
 
   evas_object_smart_callback_add(
       picker_layout_->okButton, "clicked", weekPopupCallback, this);
@@ -534,12 +524,7 @@ void InputPicker::showTimePopup(struct tm* currentTime) {
   CreateTimePopupLayout(dgettext("WebKit","IDS_WEBVIEW_HEADER_SET_TIME"),
       currentTime);
 
-  picker_layout_->okButton = elm_button_add(picker_layout_->popup);
-  elm_object_style_set(picker_layout_->okButton, "popup");
-  elm_object_text_set(picker_layout_->okButton, "OK");
-  elm_object_part_content_set(
-      picker_layout_->popup, "button1", picker_layout_->okButton);
-  evas_object_focus_set(picker_layout_->okButton, true);
+  picker_layout_->CreateOKButton();
 
   evas_object_smart_callback_add(
       picker_layout_->okButton, "clicked", timePopupCallback, this);
@@ -559,12 +544,7 @@ void InputPicker::showMonthPopup(struct tm* currentTime) {
   CreatePopupLayout(dgettext("WebKit","IDS_WEBVIEW_HEADER_SET_MONTH"),
       currentTime);
 
-  picker_layout_->okButton = elm_button_add(picker_layout_->popup);
-  elm_object_style_set(picker_layout_->okButton, "popup");
-  elm_object_text_set(picker_layout_->okButton, "OK");
-  elm_object_part_content_set(
-      picker_layout_->popup, "button1", picker_layout_->okButton);
-  evas_object_focus_set(picker_layout_->okButton, true);
+  picker_layout_->CreateOKButton();
 
   evas_object_smart_callback_add(
       picker_layout_->okButton, "clicked", monthPopupCallback, this);
@@ -588,12 +568,7 @@ void InputPicker::showDatetimePopup(struct tm* currentTime, bool datetime_local)
   CreateDateTimePopupLayout(
       dgettext("WebKit","IDS_WEBVIEW_HEADER_SET_DATE_AND_TIME"), currentTime);
 
-  picker_layout_->okButton = elm_button_add(picker_layout_->popup);
-  elm_object_style_set(picker_layout_->okButton, "popup");
-  elm_object_text_set(picker_layout_->okButton, "OK");
-  elm_object_part_content_set(
-      picker_layout_->popup, "button1", picker_layout_->okButton);
-  evas_object_focus_set(picker_layout_->okButton, true);
+  picker_layout_->CreateOKButton();
 
   evas_object_smart_callback_add(
       picker_layout_->okButton, "clicked", datetimePopupCallback, this);