Use Entry class instead of Evas_Object in UpdateSwitchPage 47/200947/9 submit/tizen/20190311.042353 submit/tizen/20190311.104527
authorTomasz Jeschke <t.jeschke@samsung.com>
Tue, 5 Mar 2019 14:22:23 +0000 (15:22 +0100)
committerTomasz Jeschke <t.jeschke@samsung.com>
Thu, 7 Mar 2019 16:01:16 +0000 (17:01 +0100)
Change-Id: I5a8c60eee86abfcafd3491afb049ad3f8c9887f8

src/Entry.cpp
src/Entry.hpp
src/SetValuePage.cpp
src/UpdateSwitchPage.cpp
src/UpdateSwitchPage.hpp

index c559d5f..7a2f526 100644 (file)
@@ -7,6 +7,12 @@ Entry::Entry(Widget *parent)
        show();
 }
 
+Entry::Entry(Widget *parent, const std::string &text)
+       : Entry(parent)
+{
+       setEntryText(text);
+}
+
 void Entry::setEntryText(const TranslatedString &text)
 {
        elm_entry_entry_set(uniqueObj_.get(), text.c_str());
index 7ba86bb..dbf8c4b 100644 (file)
@@ -7,6 +7,7 @@ class Entry : public Widget
 {
 public:
        Entry(Widget *parent);
+       Entry(Widget *parent, const std::string &text);
 
        void setEntryText(const TranslatedString &text);
        std::string getEntryText();
index 8356a65..3c91f9c 100644 (file)
 #define EDJ_SET_VALUE "edje/accessibility-settings-set-value.edj"
 #define GRP_SET_VALUE_NUMERIC "set-value-numeric"
 #define GRP_SET_VALUE_NUMERIC_SWITCH "set-value-numeric-switch"
-#define GRP_SET_VALUE_RADIOS "set-value-radios"
 #define GRP_SET_VALUE_SWITCHES "set-value-switches"
 #define GRP_SET_VALUE_LIST_SWITCH "set-value-list-switch"
-#define GRP_SET_VALUE_UPDATE_ACCESSORIES_SWITCH "set-value-update-accessories-switch"
 #define PRT_SET_VALUE_LIST "set-value-list"
 #define PRT_SET_VALUE_SWITCH_LABEL "set-value-switch-label"
 #define PRT_SET_VALUE_SWITCH "set-value-switch"
@@ -38,7 +36,6 @@
 #define PRT_SET_VALUE_SELECTOR "set-value-selector"
 #define PRT_SET_VALUE_RANGE "set-value-range"
 #define PRT_SET_VALUE_DESC "set-value-desc"
-#define PRT_SET_VALUE_ENTRY "set-value-entry"
 
 SetValuePage::SetValuePage(SettingAccessibility *ad, ValueEditorType type, const char *title)
        : context_(ad)
index ab8df1f..99ef5da 100644 (file)
@@ -74,12 +74,9 @@ void UpdateSwitchPage::createUpdateAccessoriesSwitchPage()
        auto naviframe = context_->md.getNaviframe();
        layout_ = Widget::make<Layout>(naviframe, "edje/accessibility-settings-set-value.edj", GRP_SET_VALUE_UPDATE_ACCESSORIES_SWITCH);
 
-       entry_ = elm_entry_add(layout_->getObject());
-       elm_entry_entry_set(entry_, config_item_to_update_.user_name.c_str());
-       elm_entry_cursor_end_set(entry_);
-       evas_object_show(entry_);
-       elm_object_part_content_set(layout_->getObject(), PRT_SET_VALUE_ENTRY, entry_);
-
+       entry_ = Widget::make<Entry>(layout_, config_item_to_update_.user_name);
+       entry_->moveCursorToEnd();
+       layout_->setPartContent(PRT_SET_VALUE_ENTRY, entry_);
        layout_->setPartText(PRT_SET_VALUE_DESC, "IDS_ACCS_UNIVERSAL_SWITCH_NAME");
 
        update_accessories_action_genlist_ = createGenlist(layout_, NULL);
@@ -101,7 +98,7 @@ void UpdateSwitchPage::closeUpdateAccessoriesSwitchPage(void *data, Evas_Object
 
        if (event_info == self->save_object_item) {
                if (self->switch_updated_cb) {
-                       self->switch_updated_cb(self->switch_updated_cb_data, self->config_item_to_update_.switch_id, self->config_item_to_update_.activity_type, elm_entry_entry_get(self->entry_));
+                       self->switch_updated_cb(self->switch_updated_cb_data, self->config_item_to_update_.switch_id, self->config_item_to_update_.activity_type, self->entry_->getEntryText());
                }
        }
 
index a117d56..09215d4 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "SettingAccessibility.hpp"
 #include "ActionPage.hpp"
+#include "Entry.hpp"
 #include "Layout.hpp"
 #include "Genlist.hpp"
 
@@ -52,7 +53,7 @@ private:
        UniversalSwitchConfigurationItem config_item_to_update_;
        std::unique_ptr<ActionPage> actionPage_;
        Elm_Object_Item *save_object_item = nullptr;
-       Evas_Object *entry_ = nullptr;
+       Entry *entry_ = nullptr;
        Genlist *update_accessories_action_genlist_ = nullptr;
        Layout *layout_ = nullptr;
 };