diff options
3 files changed, 15 insertions, 10 deletions
diff --git a/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp b/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp index f74e5f32..b733f787 100755 --- a/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp +++ b/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp @@ -114,15 +114,19 @@ Eina_Bool AutoFillFormManager::addItemToList(AutoFillFormItem *item) Eina_Bool AutoFillFormManager::deleteAutoFillFormItem(AutoFillFormItem *item) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - for (unsigned int i = 0; i < m_AutoFillFormItemList.size(); i++) { - if (m_AutoFillFormItemList[i]->getProfileId() == item->getProfileId()) { - if (ewk_context_form_autofill_profile_remove(m_ewkContext, item->getProfileId()) == EINA_FALSE) - return EINA_FALSE; - - m_AutoFillFormItemList.erase(m_AutoFillFormItemList.begin() + i); - } - } + m_AutoFillFormItemList.erase( + std::remove_if( + m_AutoFillFormItemList.begin(), + m_AutoFillFormItemList.end(), + [&](AutoFillFormItem* el) -> Eina_Bool { + return (el->getProfileId() == item->getProfileId()) ? + ewk_context_form_autofill_profile_remove(m_ewkContext, item->getProfileId()) : + EINA_FALSE; + } + ), + m_AutoFillFormItemList.end() + ); return EINA_TRUE; } diff --git a/services/SettingsUI/AutoFillForm/AutoFillFormManager.h b/services/SettingsUI/AutoFillForm/AutoFillFormManager.h index f5d5db03..329078c5 100644 --- a/services/SettingsUI/AutoFillForm/AutoFillFormManager.h +++ b/services/SettingsUI/AutoFillForm/AutoFillFormManager.h @@ -62,6 +62,7 @@ public: Eina_Bool deleteDeleteView(void); Eina_Bool deleteComposer(void); std::vector<AutoFillFormItem *> getItemList(void) { return m_AutoFillFormItemList; } + AutoFillFormItem* getItem(unsigned it){ return m_AutoFillFormItemList[it];} std::vector<AutoFillFormItem *> loadEntireItemList(void); Eina_Bool addItemToList(AutoFillFormItem *item); void rotateLandscape(); diff --git a/services/SettingsUI/AutoFillForm/AutoProfileDeleteView.cpp b/services/SettingsUI/AutoFillForm/AutoProfileDeleteView.cpp index 5c74f442..00b7b8b5 100644 --- a/services/SettingsUI/AutoFillForm/AutoProfileDeleteView.cpp +++ b/services/SettingsUI/AutoFillForm/AutoProfileDeleteView.cpp @@ -307,7 +307,7 @@ void AutoProfileDeleteView::deleteSelectedItems(void) checkbox = elm_object_item_part_content_get(it, "checkbox"); cb_data = static_cast<genlistCallbackData*>(elm_object_item_data_get(it)); if (elm_check_state_get(checkbox)) { - AutoFillFormItem *item = m_manager->getItemList()[cb_data->menu_index - del_count]; + AutoFillFormItem *item = m_manager->getItem(cb_data->menu_index - del_count); m_manager->deleteAutoFillFormItem(item); del_count++; m_checkbox_delete_state_map.erase(it); @@ -338,7 +338,7 @@ const char *AutoProfileDeleteView::getEachItemFullName(unsigned int index) BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); if (m_manager->getAutoFillFormItemCount() == 0) return NULL; - return (m_manager->getItemList())[index]->getName(); + return (m_manager->getItem(index))->getName(); } Evas_Object *AutoProfileDeleteView::__content_get_cb(void* data, Evas_Object* obj, const char *part) |