From 4f9c8713e339024f2180079ba03df5c1779638f2 Mon Sep 17 00:00:00 2001 From: Albert Malewski Date: Tue, 18 Aug 2015 13:02:37 +0200 Subject: [PATCH] Fixed navigating to links from history [Issue#] https://bugs.tizen.org/jira/browse/TT-93 [Problem] Browser cannot navigate to links from history. [Cause] There is no implemented callback on click event in history. [Solution] Implemented callback _history_item_clicked_cb and switching the view. [Verify] Launch Browser > More menu > History > Click on some link > Obs Browser should load clicked webpage. Change-Id: Iaac04dd59776b302fa199dd6d631aafa03eca139 --- services/HistoryUI/HistoryUI.cpp | 9 ++++++++- services/HistoryUI/HistoryUI.h | 1 + services/SimpleUI/SimpleUI.cpp | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/services/HistoryUI/HistoryUI.cpp b/services/HistoryUI/HistoryUI.cpp index 11ab3ed..c4ec024 100644 --- a/services/HistoryUI/HistoryUI.cpp +++ b/services/HistoryUI/HistoryUI.cpp @@ -234,7 +234,7 @@ Evas_Object * HistoryUI::_history_grid_content_get(void *data, Evas_Object*, con id->historyUI->m_itemClassToday->func.del = nullptr; for(auto it = _history_item_data.begin(); it != _history_item_data.end(); it++) { - Elm_Object_Item* historyView = elm_genlist_item_append(id->historyUI->m_genListToday, id->historyUI->m_itemClassToday, *it, nullptr, ELM_GENLIST_ITEM_NONE, nullptr, id->historyUI.get()); + Elm_Object_Item* historyView = elm_genlist_item_append(id->historyUI->m_genListToday, id->historyUI->m_itemClassToday, *it, nullptr, ELM_GENLIST_ITEM_NONE, _history_item_clicked_cb, (*it)); id->historyUI->m_map_history_views.insert(std::pair((*it)->item->getUrl(), historyView)); } @@ -294,5 +294,12 @@ void HistoryUI::clearItems() setEmptyGengrid(true); } +void HistoryUI::_history_item_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + HistoryItemData * itemData = reinterpret_cast(data); + itemData->historyUI->historyItemClicked(itemData->item); +} + } } diff --git a/services/HistoryUI/HistoryUI.h b/services/HistoryUI/HistoryUI.h index 7070ff8..f6ac0b2 100644 --- a/services/HistoryUI/HistoryUI.h +++ b/services/HistoryUI/HistoryUI.h @@ -58,6 +58,7 @@ private: static void _clearHistory_clicked(void *data, Evas_Object *obj, void *event_info); static char* _listTodayTextGet(void* data, Evas_Object* obj , const char* part); static void _close_clicked_cb(void *data, Evas_Object *obj, void *event_info); + static void _history_item_clicked_cb(void *data, Evas_Object *obj, void *event_info); void setEmptyGengrid(bool setEmpty); diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 9f3c77e..05826d3 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -597,6 +597,15 @@ void SimpleUI::onHistoryAdded(std::shared_ptr historyItem) { std::string historyAddress = historyItem->getUrl(); + if(m_historyUI) { // TODO: remove this section when naviframes will be available + m_historyUI->clearItems(); + m_historyUI = nullptr; + } + + if(m_moreMenuUI) { // TODO: remove this section when naviframes will be available + m_moreMenuUI->clearItems(); + m_moreMenuUI = nullptr; + } openNewTab(historyAddress); } -- 2.7.4