Fixed navigating to links from history 49/46249/3
authorAlbert Malewski <a.malewski@samsung.com>
Tue, 18 Aug 2015 11:02:37 +0000 (13:02 +0200)
committerAlbert Malewski <a.malewski@samsung.com>
Wed, 19 Aug 2015 12:20:15 +0000 (05:20 -0700)
[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
services/HistoryUI/HistoryUI.h
services/SimpleUI/SimpleUI.cpp

index 11ab3ed..c4ec024 100644 (file)
@@ -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<std::string,Elm_Object_Item*>((*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<HistoryItemData *>(data);
+    itemData->historyUI->historyItemClicked(itemData->item);
+}
+
 }
 }
index 7070ff8..f6ac0b2 100644 (file)
@@ -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);
 
index 9f3c77e..05826d3 100644 (file)
@@ -597,6 +597,15 @@ void SimpleUI::onHistoryAdded(std::shared_ptr<tizen_browser::services::HistoryIt
 void SimpleUI::onHistoryClicked(std::shared_ptr<tizen_browser::services::HistoryItem> 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);
 }