TSAM-11653 Function not run when tap to radio button with option selected 41/105141/5 submit/tizen_3.0/20161215.154716
authorSergei Kobec <s.kobec@samsung.com>
Thu, 15 Dec 2016 15:29:52 +0000 (17:29 +0200)
committerSergei Kobec <s.kobec@samsung.com>
Thu, 15 Dec 2016 15:29:52 +0000 (17:29 +0200)
Change-Id: I8abe7dfba86c4409d6320faa2020a261eda4860d
Signed-off-by: Sergei Kobec <s.kobec@samsung.com>
main-app/src/edit/CalDialogEditReminderRadioItem.cpp
main-app/src/edit/CalDialogEditReminderRadioItem.h
main-app/src/edit/CalDialogEditRepeatRadioItem.cpp
main-app/src/edit/CalDialogEditRepeatRadioItem.h
main-app/src/edit/CalEditReminderPopup.cpp
main-app/src/edit/CalEditRepeatPopup.cpp

index a05fadb..4d14413 100644 (file)
@@ -47,14 +47,10 @@ CalDialogEditReminderRadioItem::~CalDialogEditReminderRadioItem()
 {
 }
 
-void CalDialogEditReminderRadioItem::setSelectCb(std::function<void(void)> selectCb)
+void CalDialogEditReminderRadioItem::setSelectCb(std::function<void(const CalScheduleReminder &reminder)> selectCb)
 {
        __selectCb = selectCb;
 }
-void CalDialogEditReminderRadioItem::setRadioChangeCb(std::function<void(const CalScheduleReminder& reminder)> changeCb)
-{
-       __changeCb = changeCb;
-}
 
 Elm_Genlist_Item_Class *CalDialogEditReminderRadioItem::getItemClassStatic()
 {
@@ -84,7 +80,6 @@ Elm_Genlist_Item_Class *CalDialogEditReminderRadioItem::getItemClassStatic()
                        c_retv_if(NULL == radio_main, NULL);
 
                        Evas_Object *radio = elm_radio_add(obj);
-                       evas_object_propagate_events_set(radio, EINA_FALSE);
 
                        evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                        evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -96,15 +91,6 @@ Elm_Genlist_Item_Class *CalDialogEditReminderRadioItem::getItemClassStatic()
                                elm_radio_value_set(radio, item->__radioIndex);
                        }
 
-                       evas_object_smart_callback_add(radio, "changed",
-                               [](void *data, Evas_Object *obj, void *event_info) {
-                                       CalDialogEditReminderRadioItem *item = (CalDialogEditReminderRadioItem *)data;
-                                       if (item->__radioIndex == elm_radio_value_get(obj) && item->__changeCb) {
-                                               item->__changeCb(item->__reminder);
-                                       }
-                               }, item
-                       );
-
                        return radio;
                }
                return NULL;
@@ -116,6 +102,6 @@ void CalDialogEditReminderRadioItem::onSelect()
 {
        WENTER();
        if (__selectCb) {
-               __selectCb();
+               __selectCb(__reminder);
        }
 }
index 238aa48..be7eda1 100644 (file)
@@ -61,25 +61,17 @@ public:
         * @param selectCb Select callback
         *
         */
-       void setSelectCb(std::function<void(void)> selectCb);
+       void setSelectCb(std::function<void(const CalScheduleReminder &reminder)> selectCb);
 
-       /**
-        * @brief Set Radio change callback
-        *
-        * @param changeCb Radio changed callback
-        *
-        */
-       void setRadioChangeCb(std::function<void(const CalScheduleReminder& reminder)> changeCb);
 private:
        WDISABLE_COPY_AND_ASSIGN(CalDialogEditReminderRadioItem);
        virtual Elm_Genlist_Item_Class *getItemClassStatic();
        virtual void onSelect();
 private:
-       std::function<void(const CalScheduleReminder reminder)> __changeCb;
        const CalScheduleReminder __reminderOri;
        int __radioIndex;
        CalScheduleReminder __reminder;
-       std::function<void(void)> __selectCb;
+       std::function<void(const CalScheduleReminder &reminder)> __selectCb;
        bool __setRadio;
 };
 
index 86f8318..a22ad00 100644 (file)
@@ -19,8 +19,7 @@
 #include "CalScheduleRepeat.h"
 #include "CalDialogEditRepeatRadioItem.h"
 
-CalDialogEditRepeatRadioItem::CalDialogEditRepeatRadioItem(std::function<void(void)> selectCb, std::function<void(const CalScheduleRepeat::UnitType repeatType)> changeCb, int radioIndex, CalScheduleRepeat::UnitType unitType, CalScheduleRepeat::UnitType defaultUnitType) :
-       __changeCb(changeCb),
+CalDialogEditRepeatRadioItem::CalDialogEditRepeatRadioItem(std::function<void(CalScheduleRepeat::UnitType repeatType)> selectCb, int radioIndex, CalScheduleRepeat::UnitType unitType, CalScheduleRepeat::UnitType defaultUnitType) :
        __radioIndex(radioIndex),
        __repeatType(unitType),
        __selectCb(selectCb),
@@ -56,7 +55,6 @@ Elm_Genlist_Item_Class *CalDialogEditRepeatRadioItem::getItemClassStatic()
                        c_retv_if(NULL == radio_main, NULL);
 
                        Evas_Object *radio = elm_radio_add(obj);
-                       evas_object_propagate_events_set(radio, EINA_FALSE);
 
                        evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                        evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -68,15 +66,6 @@ Elm_Genlist_Item_Class *CalDialogEditRepeatRadioItem::getItemClassStatic()
                                elm_radio_value_set(radio, item->__radioIndex);
                        }
 
-                       evas_object_smart_callback_add(radio, "changed",
-                               [](void *data, Evas_Object *obj, void *event_info) {
-                                       CalDialogEditRepeatRadioItem *item = (CalDialogEditRepeatRadioItem *)data;
-                                       if (item->__radioIndex == elm_radio_value_get(obj)) {
-                                               item->__changeCb(item->__repeatType);
-                                       }
-                               }, item
-                       );
-
                        return radio;
                }
                return NULL;
@@ -88,6 +77,6 @@ void CalDialogEditRepeatRadioItem::onSelect()
 {
        WENTER();
        if (__selectCb) {
-               __selectCb();
+               __selectCb(__repeatType);
        }
 }
index d757e25..9f61c01 100644 (file)
@@ -29,13 +29,12 @@ public:
         * @brief Create item
         *
         * @param selectCb        Select callback
-        * @param changeCb        Change callback
         * @param radioIndex      Radio index
         * @param unitType        Repeat unit type
         * @param defaultUnitType Default repeat unit type
         *
         */
-       CalDialogEditRepeatRadioItem(std::function<void(void)> selectCb, std::function<void(const CalScheduleRepeat::UnitType repeatType)> changeCb, int radioIndex, CalScheduleRepeat::UnitType unitType, CalScheduleRepeat::UnitType defaultUnitType);
+       CalDialogEditRepeatRadioItem(std::function<void(CalScheduleRepeat::UnitType repeatType)> selectCb, int radioIndex, CalScheduleRepeat::UnitType unitType, CalScheduleRepeat::UnitType defaultUnitType);
 
        /**
         * @brief Destructor
@@ -46,12 +45,9 @@ private:
        virtual Elm_Genlist_Item_Class *getItemClassStatic();
        virtual void onSelect();
 private:
-       std::function<void(const CalScheduleRepeat::UnitType repeatType)> __changeCb;
-       //const CalScheduleRepeat __repeatOri;
        int __radioIndex;
-       //CalScheduleRepeat __repeat;
        CalScheduleRepeat::UnitType __repeatType;
-       std::function<void(void)> __selectCb;
+       std::function<void(CalScheduleRepeat::UnitType repeatType)> __selectCb;
        CalScheduleRepeat::UnitType __defaultRepeatType;
 };
 
index b82a743..df7e430 100644 (file)
@@ -166,14 +166,14 @@ Evas_Object *CalEditReminderPopup::onCreate(Evas_Object *parent, void *viewParam
        return WPopup::onCreate(parent, viewParam);
 }
 
-void CalEditReminderPopup::__addRadioItem(CalDialogControl *dialog, Evas_Object *radioObj, intradioIndex, CalScheduleReminder::UnitType type, int unitValue)
+void CalEditReminderPopup::__addRadioItem(CalDialogControl *dialog, Evas_Object *radioObj, int &radioIndex, CalScheduleReminder::UnitType type, int unitValue)
 {
        bool setRadio = false;
        if (__isEditReminder && __reminder.unitType == type && __reminder.unitValue == unitValue) {
                setRadio = true;
        }
        CalDialogEditReminderRadioItem *radioItem = new CalDialogEditReminderRadioItem(__reminder, radioIndex, type, unitValue, setRadio, type == CalScheduleReminder::NONE);
-       radioItem->setSelectCb([this, radioObj, radioIndex](void)->void {
+       radioItem->setSelectCb([this, radioObj, radioIndex](const CalScheduleReminder &reminder) {
                        if (__radio_index == radioIndex) {
                                if (__doneCb) {
                                        __doneCb(__reminder, __radio_index);
@@ -184,13 +184,7 @@ void CalEditReminderPopup::__addRadioItem(CalDialogControl *dialog, Evas_Object
                        }
                        elm_radio_value_set(radioObj, radioIndex);
                        __radio_index = radioIndex;
-                       Evas_Object *radio = elm_radio_selected_object_get(radioObj);
-                       evas_object_smart_callback_call(radio, "changed", NULL);
-               }
-       );
-       radioItem->setRadioChangeCb([this, radioIndex](const CalScheduleReminder& reminder)->void {
                        __reminder = reminder;
-                       __radio_index = radioIndex;
                        std::string reminderText;
                        __reminder.getString(reminderText);
                        WDEBUG("Reminder: %s", reminderText.c_str());
@@ -205,20 +199,15 @@ void CalEditReminderPopup::__addRadioItem(CalDialogControl *dialog, Evas_Object
        radioIndex++;
 }
 
-void CalEditReminderPopup::__addRadioCustomItem(CalDialogControl *dialog, Evas_Object *radioObj, intradioIndex)
+void CalEditReminderPopup::__addRadioCustomItem(CalDialogControl *dialog, Evas_Object *radioObj, int &radioIndex)
 {
        bool setRadio = false;
        __customItem = new CalDialogEditReminderRadioItem(__reminder, radioIndex, setRadio, false);
-       __customItem->setSelectCb([this, radioObj, radioIndex](void)->void {
+       __customItem->setSelectCb([this, radioObj, radioIndex](const CalScheduleReminder &reminder) {
                        elm_radio_value_set(radioObj, radioIndex);
                        __radio_index = 10;
-                       Evas_Object *radio = elm_radio_selected_object_get(radioObj);
-                       evas_object_smart_callback_call(radio, "changed", NULL);
-               }
-       );
-       __customItem->setRadioChangeCb([this](const CalScheduleReminder& reminder)->void {
+
                        if (__customSelectedCb) {
-                               __radio_index = 10;
                                __customSelectedCb(__reminder, __radio_index);
                        }
                }
index 2bf14ed..a340e41 100644 (file)
@@ -38,12 +38,8 @@ CalEditRepeatPopup::~CalEditRepeatPopup()
 CalDialogEditRepeatRadioItem *CalEditRepeatPopup::__addRadioItem(Evas_Object *radio_main, int radio_index, CalScheduleRepeat::UnitType unitType)
 {
        return new CalDialogEditRepeatRadioItem(
-               [radio_main, radio_index]() {
+               [this, radio_main, radio_index](CalScheduleRepeat::UnitType repeatType) {
                        elm_radio_value_set(radio_main, radio_index);
-                       Evas_Object *radio = elm_radio_selected_object_get(radio_main);
-                       evas_object_smart_callback_call(radio, "changed", NULL);
-               },
-               [this](const CalScheduleRepeat::UnitType repeatType) {
                        WDEBUG("repeat.unitType=%d", repeatType);
                        __repeatUnitType = repeatType;
                        __doneCb(__repeatUnitType);