diff options
author | jihye3.song <jihye3.song@samsung.com> | 2012-08-24 16:02:28 +0900 |
---|---|---|
committer | jihye3.song <jihye3.song@samsung.com> | 2012-08-24 19:02:27 +0900 |
commit | 2190375684e767245067effc53ed12fda55bad36 (patch) | |
tree | 375cb3892d71f1a9a193f0ecb8c286040670ee2e /src | |
parent | 81e606e50366e58c4980952fc8e77c56755a7b72 (diff) | |
download | browser-2190375684e767245067effc53ed12fda55bad36.tar.gz browser-2190375684e767245067effc53ed12fda55bad36.tar.bz2 browser-2190375684e767245067effc53ed12fda55bad36.zip |
[Title] Find-word change.
[Issue#] p120809-6372
[Problem] Some condition, button are not dimmed.
[Cause] no exception.
[Solution] Implementation exception.
[Team] Browser UI
[Developer] jihye3.song
[Request] N/A
Change-Id: I50d04bf73a515bd3629db4d0b7213c02751b9faf
Diffstat (limited to 'src')
-rwxr-xr-x | src/browser-extension/browser-find-word.cpp | 12 | ||||
-rwxr-xr-x | src/browser-view/browser-view.cpp | 97 | ||||
-rwxr-xr-x | src/browser-view/browser-view.h | 2 |
3 files changed, 47 insertions, 64 deletions
diff --git a/src/browser-extension/browser-find-word.cpp b/src/browser-extension/browser-find-word.cpp index 04360f72..99e248b1 100755 --- a/src/browser-extension/browser-find-word.cpp +++ b/src/browser-extension/browser-find-word.cpp @@ -46,7 +46,15 @@ void Browser_Find_Word::__did_find_string_cb(Evas_Object* o, const char* string, find_word->m_find_word_index = 0; find_word->m_find_word_max_count = 0; - find_word->m_browser_view->_update_find_word_index_text("0/0"); + find_word->m_browser_view->_update_find_word_index_text("0/0", find_word->m_find_word_index, find_word->m_find_word_max_count); + return; + } + + if (match_count == 1) { + find_word->m_find_word_index = 1; + find_word->m_find_word_max_count = 1; + + find_word->m_browser_view->_update_find_word_index_text("1/1", find_word->m_find_word_index, find_word->m_find_word_max_count); return; } @@ -61,7 +69,7 @@ void Browser_Find_Word::__did_find_string_cb(Evas_Object* o, const char* string, return; } g_string_printf(index_string, "%d/%d", find_word->m_find_word_index, find_word->m_find_word_max_count); - find_word->m_browser_view->_update_find_word_index_text(index_string->str); + find_word->m_browser_view->_update_find_word_index_text(index_string->str, find_word->m_find_word_index, find_word->m_find_word_max_count); g_string_free(index_string, true); } diff --git a/src/browser-view/browser-view.cpp b/src/browser-view/browser-view.cpp index 790f7c5b..4dab52d1 100755 --- a/src/browser-view/browser-view.cpp +++ b/src/browser-view/browser-view.cpp @@ -2324,13 +2324,31 @@ void Browser_View::__internet_settings_cb(void *data, Evas_Object *obj, void *ev BROWSER_LOGE("_call_internet_settings failed"); } -void Browser_View::_update_find_word_index_text(const char *index_text) +void Browser_View::_update_find_word_index_text(const char *index_text, int index, int max_match_cnt) { BROWSER_LOGD("[%s]", __func__); edje_object_part_text_set(elm_layout_edje_get(m_option_header_find_word_layout), "elm.index_text", index_text); -} + if (max_match_cnt == 0 || max_match_cnt == 1) { + elm_object_disabled_set(m_find_word_prev_button, EINA_TRUE); + elm_object_disabled_set(m_find_word_next_button, EINA_TRUE); + } else if (index == 0 || index == 1) { + elm_object_disabled_set(m_find_word_prev_button, EINA_TRUE); + elm_object_disabled_set(m_find_word_next_button, EINA_FALSE); + if (index == 0 || (index == 1 && elm_object_focus_get(m_find_word_cancel_button))) + elm_object_focus_set(m_find_word_cancel_button, EINA_TRUE); + } else if (index == max_match_cnt) { + elm_object_disabled_set(m_find_word_prev_button, EINA_FALSE); + elm_object_disabled_set(m_find_word_next_button, EINA_TRUE); + elm_object_focus_set(m_find_word_cancel_button, EINA_TRUE); + } else { + if (elm_object_disabled_get(m_find_word_prev_button)) + elm_object_disabled_set(m_find_word_prev_button, EINA_FALSE); + if (elm_object_disabled_get(m_find_word_next_button)) + elm_object_disabled_set(m_find_word_next_button, EINA_FALSE); + } +} void Browser_View::__find_word_cb(void *data, Evas_Object *obj, void *event_info) { BROWSER_LOGD("[%s]", __func__); @@ -3424,11 +3442,6 @@ void Browser_View::__find_word_erase_button_clicked_cb(void *data, Evas_Object * BROWSER_LOGD("[%s]", __func__); Browser_View *browser_view = (Browser_View *)data; edje_object_part_text_set(elm_layout_edje_get(browser_view->m_option_header_find_word_layout), "elm.index_text", "0/0"); - - if (elm_object_disabled_get(browser_view->m_find_word_prev_button)) - elm_object_disabled_set(browser_view->m_find_word_prev_button, EINA_FALSE); - if (elm_object_disabled_get(browser_view->m_find_word_next_button)) - elm_object_disabled_set(browser_view->m_find_word_next_button, EINA_FALSE); } void Browser_View::__find_word_cancel_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) @@ -3440,12 +3453,8 @@ void Browser_View::__find_word_cancel_button_clicked_cb(void *data, Evas_Object Browser_View *browser_view = (Browser_View *)data; browser_view->_set_edit_mode(BR_NO_EDIT_MODE); browser_view->m_find_word->find_word("", Browser_Find_Word::BROWSER_FIND_WORD_FORWARD); - - if (elm_object_disabled_get(browser_view->m_find_word_prev_button)) - elm_object_disabled_set(browser_view->m_find_word_prev_button, EINA_FALSE); - if (elm_object_disabled_get(browser_view->m_find_word_next_button)) - elm_object_disabled_set(browser_view->m_find_word_next_button, EINA_FALSE); } + void Browser_View::__find_word_prev_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) { BROWSER_LOGD("[%s]", __func__); @@ -3453,24 +3462,16 @@ void Browser_View::__find_word_prev_button_clicked_cb(void *data, Evas_Object *o return; Browser_View *browser_view = (Browser_View *)data; + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,control_bar,no_animation,signal", ""); Evas_Object *edit_field_entry = br_elm_editfield_entry_get(browser_view->m_find_word_edit_field); const char *find_word = elm_entry_entry_get(edit_field_entry); if (!find_word || !strlen(find_word)) return; - int index_cnt = browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_BACKWARD); - int match_max_cnt = browser_view->m_find_word->get_match_max_value(); - - if (index_cnt == 1) { - elm_object_disabled_set(browser_view->m_find_word_prev_button, EINA_TRUE); - if (index_cnt != match_max_cnt) - elm_object_disabled_set(browser_view->m_find_word_next_button, EINA_FALSE); - } else { - elm_object_disabled_set(browser_view->m_find_word_next_button, EINA_FALSE); - elm_object_disabled_set(browser_view->m_find_word_prev_button, EINA_FALSE); - } + int index = browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_BACKWARD); + if (index == 1) + elm_object_focus_set(browser_view->m_find_word_cancel_button, EINA_TRUE); } - void Browser_View::__find_word_next_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) { BROWSER_LOGD("[%s]", __func__); @@ -3478,22 +3479,15 @@ void Browser_View::__find_word_next_button_clicked_cb(void *data, Evas_Object *o return; Browser_View *browser_view = (Browser_View *)data; + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,control_bar,no_animation,signal", ""); Evas_Object *edit_field_entry = br_elm_editfield_entry_get(browser_view->m_find_word_edit_field); const char *find_word = elm_entry_entry_get(edit_field_entry); if (!find_word || !strlen(find_word)) return; - int index_cnt = browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_FORWARD); - int match_max_cnt = browser_view->m_find_word->get_match_max_value(); - - if (index_cnt == match_max_cnt) { - elm_object_disabled_set(browser_view->m_find_word_next_button, EINA_TRUE); - if (match_max_cnt != 1) - elm_object_disabled_set(browser_view->m_find_word_prev_button, EINA_FALSE); - } else { - elm_object_disabled_set(browser_view->m_find_word_next_button, EINA_FALSE); - elm_object_disabled_set(browser_view->m_find_word_prev_button, EINA_FALSE); - } + int index = browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_FORWARD); + if (index == browser_view->m_find_word->get_match_max_value()) + elm_object_focus_set(browser_view->m_find_word_cancel_button, EINA_TRUE); } void Browser_View::__find_word_entry_imf_event_cb(void *data, Ecore_IMF_Context *ctx, int value) @@ -3504,16 +3498,10 @@ void Browser_View::__find_word_entry_imf_event_cb(void *data, Ecore_IMF_Context Browser_View *browser_view = (Browser_View *)data; Evas_Object *find_word_editfield_entry = br_elm_editfield_entry_get(browser_view->m_find_word_edit_field); - elm_object_focus_set(find_word_editfield_entry, EINA_FALSE); - const char *find_word = elm_entry_entry_get(find_word_editfield_entry); - if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) { - int match_max_cnt = browser_view->m_find_word->get_match_max_value(); - if (match_max_cnt == 0 || match_max_cnt == 1) { - elm_object_disabled_set(browser_view->m_find_word_next_button, EINA_TRUE); - elm_object_disabled_set(browser_view->m_find_word_prev_button, EINA_TRUE); - } - } else + if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) + elm_object_focus_set(find_word_editfield_entry, EINA_FALSE); + else elm_object_focus_set(find_word_editfield_entry, EINA_TRUE); } @@ -3548,16 +3536,12 @@ void Browser_View::__find_word_entry_enter_key_cb(void *data, Evas_Object *obj, return; Browser_View *browser_view = (Browser_View *)data; + edje_object_signal_emit(elm_layout_edje_get(browser_view->m_main_layout), "hide,control_bar,no_animation,signal", ""); Evas_Object *edit_field_entry = br_elm_editfield_entry_get(browser_view->m_find_word_edit_field); const char *find_word = elm_entry_entry_get(edit_field_entry); if (!find_word || !strlen(find_word)) return; - if (elm_object_disabled_get(browser_view->m_find_word_prev_button)) - elm_object_disabled_set(browser_view->m_find_word_prev_button, EINA_FALSE); - if (elm_object_disabled_get(browser_view->m_find_word_next_button)) - elm_object_disabled_set(browser_view->m_find_word_next_button, EINA_FALSE); - browser_view->m_find_word->init_index(); browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_FORWARD); @@ -3573,22 +3557,13 @@ void Browser_View::__find_word_entry_changed_cb(void *data, Evas_Object *obj, vo Browser_View *browser_view = (Browser_View *)data; Evas_Object *edit_field_entry = br_elm_editfield_entry_get(browser_view->m_find_word_edit_field); - const char *find_word = elm_entry_entry_get(edit_field_entry); - if (elm_object_disabled_get(browser_view->m_find_word_prev_button)) - elm_object_disabled_set(browser_view->m_find_word_prev_button, EINA_FALSE); - if (elm_object_disabled_get(browser_view->m_find_word_next_button)) - elm_object_disabled_set(browser_view->m_find_word_next_button, EINA_FALSE); - - if (!find_word || !strlen(find_word)) { - browser_view->m_find_word->find_word("", Browser_Find_Word::BROWSER_FIND_WORD_FORWARD); - } else { - browser_view->m_find_word->init_index(); - browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_FORWARD); - } + browser_view->m_find_word->init_index(); + browser_view->m_find_word->find_word(find_word, Browser_Find_Word::BROWSER_FIND_WORD_FORWARD); } + void Browser_View::_navigationbar_title_clicked(void) { BROWSER_LOGD("[%s]", __func__); diff --git a/src/browser-view/browser-view.h b/src/browser-view/browser-view.h index bc4718b3..9627f41a 100755 --- a/src/browser-view/browser-view.h +++ b/src/browser-view/browser-view.h @@ -264,7 +264,7 @@ private: void _navigationbar_visible_set(Eina_Bool visible); Eina_Bool _navigationbar_visible_get(void); Evas_Object *_create_find_word_layout(void); - void _update_find_word_index_text(const char *index_text); + void _update_find_word_index_text(const char *index_text, int index, int max_match_cnt); void _jump_to_top(void); void _hide_scroller_url_layout(void); Eina_Bool _show_scissorbox_view(void); |