Using UrlHistoryList do display history list (on urientry edition). 76/49776/5 accepted/tizen/tv/20151021.013323 submit/tizen_tv/20151020.234143
authorAdam Skobodzinski <a.skobodzins@partner.samsung.com>
Tue, 20 Oct 2015 08:50:07 +0000 (10:50 +0200)
committerAdam Skobodzinski <a.skobodzins@partner.samsung.com>
Tue, 20 Oct 2015 13:47:04 +0000 (06:47 -0700)
[Issue]    https://bugs.tizen.org/jira/browse/TT-161
[Problem]  'Display URL from browser history that matches to given keyword.'
[Solution] UrlHistoryList is receiving list of matched entries and
creates a genlist. List is hidden, when list item is selected (with
cursor only for now) or focus changes from the uri entry. Created
genlist is not added to a focus chain yet (this will be delivered
soon).
[Verify] Typing words in uri entry should display list with matched
entries. Choosing item shoud load page in a new tab. Loading page or
focusing out from urientry should hide the list.

Signed-off-by: Adam Skobodzinski <a.skobodzins@partner.samsung.com>
Change-Id: Icb67a9b5c47556788d256613c832cdacb7620bf3

21 files changed:
services/HistoryService/HistoryService.cpp
services/HistoryService/HistoryService.h
services/PlatformInputManager/PlatformInputManager.cpp
services/PlatformInputManager/PlatformInputManager.h
services/QuickAccess/CMakeLists.txt
services/QuickAccess/QuickAccess.cpp
services/QuickAccess/QuickAccess.h
services/QuickAccess/UrlHistoryList/GenlistManager.cpp
services/QuickAccess/UrlHistoryList/GenlistManager.h
services/QuickAccess/UrlHistoryList/GenlistManagerCallbacks.cpp
services/QuickAccess/UrlHistoryList/GenlistManagerCallbacks.h
services/QuickAccess/UrlHistoryList/UrlHistoryList.cpp
services/QuickAccess/UrlHistoryList/UrlHistoryList.h
services/QuickAccess/UrlHistoryList/UrlMatchesStyler.cpp
services/QuickAccess/UrlHistoryList/UrlMatchesStyler.h
services/QuickAccess/UrlHistoryList/WidgetListManager.h [deleted file]
services/QuickAccess/edc/QuickAccess.edc
services/SimpleUI/SimpleUI.cpp
services/SimpleUI/SimpleUI.h
services/WebPageUI/URIEntry.cpp
services/WebPageUI/URIEntry.h

index a346c71..1287c1c 100644 (file)
@@ -485,7 +485,8 @@ std::shared_ptr<HistoryItemVector> HistoryService::getHistoryItemsByURL(
 }
 
 std::shared_ptr<HistoryItemVector> HistoryService::getHistoryItemsByKeywordsString(
-        const std::string& keywordsString, int maxItems)
+        const std::string& keywordsString, const int maxItems,
+        const int minKeywordLength)
 {
     if (keywordsString.empty())
         return std::make_shared<HistoryItemVector>();
@@ -500,7 +501,7 @@ std::shared_ptr<HistoryItemVector> HistoryService::getHistoryItemsByKeywordsStri
     boost::algorithm::to_lower(longestKeyword);
 
     // assumption: search starts when longest keyword is at least 3 characters long
-    if (longestKeyword.length() < 3) {
+    if (longestKeyword.length() < minKeywordLength) {
         return std::make_shared<HistoryItemVector>();
     }
 
@@ -515,9 +516,11 @@ std::shared_ptr<HistoryItemVector> HistoryService::getHistoryItemsByKeywordsStri
         m_historyMatchFinder->removeMismatches(historyItems, keywords);
     }
 
-    if (historyItems->size() > maxItems) {
-        historyItems->erase(historyItems->begin() + maxItems,
-                historyItems->end());
+    if (maxItems != -1) {
+        if (historyItems->size() > maxItems) {
+            historyItems->erase(historyItems->begin() + maxItems,
+                    historyItems->end());
+        }
     }
     return historyItems;
 }
index 3eda793..fe23f8e 100644 (file)
@@ -68,13 +68,18 @@ public:
      * Splits pattern into words by removing spaces. History item matches
      * pattern, when its url contains all words (order not considered).
      *
-     * @param keywords
-     * @param maxItems
+     * @param keywords string containing keywords separated by spaces
+     * @param maxItems searched items number will be shortened to this maxItems.
+     * if -1: no shortening.
+     * @param minKeywordLength minimum length of the longest keyword picked,
+     * from which searching will start. If longest keyword is shorter than
+     * #minKeywordLength, then search will not start.
      * @return vector of shared pointers to history items matching given
      * pattern
      */
     std::shared_ptr<HistoryItemVector> getHistoryItemsByKeywordsString(
-            const std::string& keywordsString, int maxItems);
+            const std::string& keywordsString, const int maxItems,
+            const int minKeywordLength);
 
     int getHistoryItemsCount();
     void setStorageServiceTestMode(bool testmode = true);
index fddb242..3d3d85c 100644 (file)
@@ -91,6 +91,8 @@ Eina_Bool PlatformInputManager::__filter(void *data, void */*loop_data*/, int ty
             return EINA_TRUE;
 
         BROWSER_LOGD("Released key: %s", ev->keyname);
+    } else if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN) {
+        self->mouseClicked();
     }
     return EINA_TRUE;
 }
index 0dc980e..781a418 100644 (file)
@@ -54,6 +54,7 @@ public:
     boost::signals2::signal<void ()> leftPressed;
     boost::signals2::signal<void ()> rightPressed;
     boost::signals2::signal<void ()> backPressed;
+    boost::signals2::signal<void ()> mouseClicked;
 
     /**
      * @brief Returns current service's name.
index 9d794bd..2b76470 100644 (file)
@@ -13,7 +13,6 @@ set(QuickAccess_HEADERS
     QuickAccess.h
     DetailPopup.h
     UrlHistoryList/UrlHistoryList.h
-    UrlHistoryList/WidgetListManager.h
     UrlHistoryList/GenlistManager.h
     UrlHistoryList/GenlistManagerCallbacks.h
     UrlHistoryList/UrlMatchesStyler.h
index 5db57b6..0624b26 100644 (file)
@@ -25,6 +25,7 @@
 #include "Tools/EflTools.h"
 #include "../Tools/BrowserImage.h"
 #include "Tools/GeneralTools.h"
+#include "UrlHistoryList/UrlHistoryList.h"
 
 #define efl_scale       (elm_config_scale_get() / elm_app_base_scale_get())
 
@@ -75,10 +76,14 @@ QuickAccess::QuickAccess()
     , m_after_history_thumb(false)
 {
     BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__);
-    edjFilePath = EDJE_DIR;
+    edjFilePath = edjFilePathUrlHistoryList = EDJE_DIR;
     edjFilePath.append("QuickAccess/QuickAccess.edj");
+    edjFilePathUrlHistoryList.append("QuickAccess/UrlHistoryList.edj");
     elm_theme_extension_add(nullptr, edjFilePath.c_str());
+    elm_theme_extension_add(nullptr, edjFilePathUrlHistoryList.c_str());
     QuickAccess::createItemClasses();
+
+    m_urlHistoryList = std::make_shared<UrlHistoryList>(this);
 }
 
 QuickAccess::~QuickAccess()
@@ -100,6 +105,7 @@ Evas_Object* QuickAccess::getContent()
     M_ASSERT(m_parent);
     if (!m_layout) {
         m_layout = createQuickAccessLayout(m_parent);
+        m_urlHistoryListLayout = createUrlHistoryListLayout(m_layout);
     }
     return m_layout;
 }
@@ -249,6 +255,21 @@ Evas_Object* QuickAccess::createBottomButton(Evas_Object *parent)
     return layoutBottom;
 }
 
+Evas_Object* QuickAccess::createUrlHistoryListLayout(Evas_Object* parent)
+{
+    Evas_Object* urlHistoryListLayout = elm_layout_add(parent);
+    elm_layout_file_set(urlHistoryListLayout, edjFilePath.c_str(), "url_history_list_layout");
+    evas_object_size_hint_weight_set(urlHistoryListLayout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    evas_object_size_hint_align_set (urlHistoryListLayout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+    m_urlHistoryList->createLayout(urlHistoryListLayout);
+    if(m_urlHistoryList->getLayout())
+    {
+        elm_object_part_content_set(urlHistoryListLayout, "url_history_list_swallow", m_urlHistoryList->getLayout());
+    }
+    return urlHistoryListLayout;
+}
+
 void QuickAccess::_mostVisited_clicked(void * data, Evas_Object *, void *)
 {
     BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__);
@@ -440,6 +461,7 @@ void QuickAccess::showUI()
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     evas_object_show(m_layout);
+    evas_object_show(m_urlHistoryListLayout);
     if (elm_layout_content_get(m_layout, "elm.swallow.content") == m_bookmarksView) {
         evas_object_show(m_bookmarksView);
     } else {
@@ -493,6 +515,11 @@ DetailPopup& QuickAccess::getDetailPopup()
     return m_detailPopup;
 }
 
+UrlHistoryPtr QuickAccess::getUrlHistoryList()
+{
+    return m_urlHistoryList;
+}
+
 void QuickAccess::backButtonClicked()
 {
     if (m_detailPopup.isVisible()) {
index 5418b38..9dd5155 100644 (file)
@@ -31,6 +31,9 @@
 namespace tizen_browser{
 namespace base_ui{
 
+class UrlHistoryList;
+typedef std::shared_ptr<UrlHistoryList> UrlHistoryPtr;
+
 //TODO: This class name is not revelant to what this class actually does.
 //Rename this class and file to "QuickAccessUI".
 class BROWSER_EXPORT QuickAccess
@@ -50,6 +53,7 @@ public:
     bool isDesktopMode() const;
     void setDesktopMode(bool mode);
     DetailPopup & getDetailPopup();
+    UrlHistoryPtr getUrlHistoryList();
     void backButtonClicked();
     inline bool isMostVisitedActive() const;
     void refreshFocusChain();
@@ -80,6 +84,7 @@ private:
     Evas_Object* createBookmarksView(Evas_Object *parent);
     Evas_Object* createBottomButton(Evas_Object *parent);
     Evas_Object* createTopButtons(Evas_Object *parent);
+    Evas_Object* createUrlHistoryListLayout(Evas_Object *parent);
 
     static char* _grid_bookmark_text_get(void *data, Evas_Object *obj, const char *part);
     static Evas_Object * _grid_bookmark_content_get(void *data, Evas_Object *obj, const char *part);
@@ -104,11 +109,15 @@ private:
     std::vector<Evas_Object *> m_tiles;
     Eina_List* m_parentFocusChain;
 
+    UrlHistoryPtr m_urlHistoryList;
+    Evas_Object* m_urlHistoryListLayout;
+
     Elm_Gengrid_Item_Class * m_bookmark_item_class;
     DetailPopup m_detailPopup;
     services::HistoryItemVector m_historyItems;
     bool m_gengridSetup;
     std::string edjFilePath;
+    std::string edjFilePathUrlHistoryList;
     bool m_desktopMode;
 
     static const int MAX_TILES_NUMBER;
index c29dfc5..fda4254 100644 (file)
@@ -19,7 +19,7 @@
 #include "UrlMatchesStyler.h"
 
 namespace tizen_browser {
-namespace services {
+namespace base_ui {
 
 GenlistManager::GenlistManager()
 {
@@ -38,6 +38,8 @@ GenlistManager::GenlistManager()
     m_historyItemSpaceClass->func.content_get = nullptr;
     m_historyItemSpaceClass->func.state_get = nullptr;
     m_historyItemSpaceClass->func.del = nullptr;
+
+    GenlistManagerCallbacks::setGenlistManager(this);
 }
 
 GenlistManager::~GenlistManager()
@@ -47,10 +49,8 @@ GenlistManager::~GenlistManager()
 
 void GenlistManager::clearWidget()
 {
-    elm_genlist_clear(m_genlist);
-    elm_genlist_clear(m_genlist);
-    elm_genlist_clear(m_genlist);
-    elm_genlist_clear(m_genlist);
+    if(m_genlist && elm_genlist_items_count(m_genlist))
+        elm_genlist_clear(m_genlist);
 }
 
 void GenlistManager::onMouseFocusChange(bool mouseInsideWidget)
@@ -72,28 +72,22 @@ Evas_Object* GenlistManager::createWidget(Evas_Object* parentLayout)
                     ELM_SCROLLER_POLICY_OFF);
         }
 
-        evas_object_smart_callback_add(m_genlist, "scroll,anim,stop",
-                GenlistManagerCallbacks::cb_genlistAnimStop, this);
         evas_object_smart_callback_add(m_genlist, "edge,top",
-                GenlistManagerCallbacks::cb_genlistEdgeTop, this);
+                GenlistManagerCallbacks::_genlist_edge_top, this);
         evas_object_smart_callback_add(m_genlist, "edge,bottom",
-                GenlistManagerCallbacks::cb_genlistEdgeBottom, this);
-
-        evas_object_smart_callback_add(m_genlist, "activated",
-                GenlistManagerCallbacks::cb_genlistActivated, this);
-        evas_object_smart_callback_add(m_genlist, "pressed",
-                GenlistManagerCallbacks::cb_genlistPressed, this);
-        evas_object_smart_callback_add(m_genlist, "selected",
-                GenlistManagerCallbacks::cb_genlistSelected, this);
+                GenlistManagerCallbacks::_genlist_edge_bottom, this);
 
         evas_object_event_callback_add(m_genlist, EVAS_CALLBACK_MOUSE_IN,
-                GenlistManagerCallbacks::cb_genlistMouseIn, this);
+                GenlistManagerCallbacks::_genlist_mouse_in, this);
         evas_object_event_callback_add(m_genlist, EVAS_CALLBACK_MOUSE_OUT,
-                GenlistManagerCallbacks::cb_genlistMouseOut, this);
-        evas_object_smart_callback_add(m_genlist, "unselected",
-                GenlistManagerCallbacks::cb_genlistUnselected, this);
+                GenlistManagerCallbacks::_genlist_mouse_out, this);
+
         evas_object_smart_callback_add(m_genlist, "focused",
-                GenlistManagerCallbacks::cb_genlistFocused, this);
+                GenlistManagerCallbacks::_genlist_focused, this);
+        evas_object_smart_callback_add(m_genlist, "unfocused",
+                GenlistManagerCallbacks::_genlist_unfocused, this);
+
+
     }
     return m_genlist;
 }
@@ -113,9 +107,9 @@ void GenlistManager::showWidget(const string& editedUrl,
 
     m_itemUrlFirst = m_itemUrlLast = nullptr;
     Elm_Object_Item* itemAppended;
-    for (auto it : m_readyUrls) {
+    for(auto it : m_readyUrlPairs) {
         itemAppended = elm_genlist_item_append(m_genlist, m_historyItemClass,
-                it.get(), nullptr, ELM_GENLIST_ITEM_NONE, nullptr, this);
+                it.get(), nullptr, ELM_GENLIST_ITEM_NONE, GenlistManagerCallbacks::_item_selected, it.get());
         if (!m_itemUrlFirst)
             m_itemUrlFirst = itemAppended;
     }
@@ -127,14 +121,22 @@ void GenlistManager::showWidget(const string& editedUrl,
     }
 }
 
-void GenlistManager::hideWidget()
+void GenlistManager::hideWidgetPretty()
 {
-    if (widgetPreviouslyHidden)
+    if (widgetPreviouslyHidden) {
+        hideWidgetInstant();
         return;
+    }
     startScrollOut();
     widgetPreviouslyHidden = true;
 }
 
+void GenlistManager::hideWidgetInstant()
+{
+    if(m_genlist)
+        evas_object_hide(m_genlist);
+}
+
 bool GenlistManager::isWidgetHidden()
 {
     return widgetPreviouslyHidden;
@@ -143,7 +145,7 @@ bool GenlistManager::isWidgetHidden()
 void GenlistManager::onMouseClick()
 {
     if (!mouseInsideWidget) {
-        hideWidget();
+        hideWidgetPretty();
     }
 }
 
@@ -181,7 +183,7 @@ void GenlistManager::addSpaces()
     if (m_itemUrlLast) {
         m_itemSpaceFirst = m_itemSpaceLast = nullptr;
         Elm_Object_Item* itemAppended;
-        for (auto i = 0; i < historyItemsVisibleMax; ++i) {
+        for (auto i = 0; i < HISTORY_ITEMS_VISIBLE_MAX; ++i) {
             // append spaces to the last url item, so they can be easily cleared
             itemAppended = elm_genlist_item_append(m_genlist,
                     m_historyItemSpaceClass, nullptr, m_itemUrlLast,
@@ -201,14 +203,14 @@ void GenlistManager::removeSpaces()
     m_itemSpaceFirst = m_itemSpaceLast = nullptr;
 }
 
-Evas_Object* GenlistManager::m_contentGet(void *data, Evas_Object *obj,
-        const char *part)
+Evas_Object* GenlistManager::m_contentGet(void* data, Evas_Object* obj,
+        const charpart)
 {
     Evas_Object* label = elm_label_add(obj);
     if (strcmp(part, "matched_url") == 0) {
-        const string * const item = reinterpret_cast<string*>(data);
+        const UrlPair* const item = reinterpret_cast<UrlPair*>(data);
         if (item) {
-            elm_object_text_set(label, item->c_str());
+            elm_object_text_set(label, item->urlHighlighted.c_str());
             evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND,
             EVAS_HINT_EXPAND);
             evas_object_size_hint_align_set(label, EVAS_HINT_FILL,
@@ -224,13 +226,14 @@ void GenlistManager::prepareUrlsVector(const string& editedUrl,
     // free previously used urls. IMPORTANT: it has to be assured that previous
     // genlist items are not using these pointers.
     m_readyUrls.clear();
+    m_readyUrlPairs.clear();
     for (auto it : *matchedEntries) {
-        m_readyUrls.push_back(
-                make_shared < string
-                        > (m_urlMatchesStyler->getUrlHighlightedMatches(
-                                it->getUrl(), editedUrl)));
+        UrlPair newUrlPair(it->getUrl(),
+                m_urlMatchesStyler->getUrlHighlightedMatches(it->getUrl(),
+                        editedUrl));
+        m_readyUrlPairs.push_back(make_shared < UrlPair > (newUrlPair));
     }
 }
 
-} /* namespace services */
+} /* namespace base_ui */
 } /* namespace tizen_browser */
index 05d5cd3..b1e91e1 100644 (file)
 #define GENLISTMANAGER_H_
 
 #include <Elementary.h>
-
+#include "services/HistoryService/HistoryItem.h"
+#include <boost/signals2/signal.hpp>
 #include "BrowserLogger.h"
-#include "WidgetListManager.h"
 
 using namespace std;
 
 namespace tizen_browser {
-namespace services {
+namespace base_ui {
 
 class GenlistManagerCallbacks;
 class UrlMatchesStyler;
 typedef shared_ptr<UrlMatchesStyler> UrlMatchesStylerPtr;
 
-class GenlistManager: public WidgetListManager
+typedef struct UrlPair_s {
+    UrlPair_s(string a, string b) : urlOriginal(a), urlHighlighted(b) {}
+    string urlOriginal;
+    string urlHighlighted;
+} UrlPair;
+
+class GenlistManager
 {
     friend class GenlistManagerCallbacks;
 public:
     GenlistManager();
-    virtual ~GenlistManager();
+    ~GenlistManager();
 
-    virtual Evas_Object* createWidget(Evas_Object* parentLayout);
-    virtual Evas_Object* getWidget();
+    Evas_Object* createWidget(Evas_Object* parentLayout);
+    Evas_Object* getWidget();
 
-    virtual void showWidget(const string& editedUrl,
+    void showWidget(const string& editedUrl,
             shared_ptr<services::HistoryItemVector> matchedEntries);
-    virtual void hideWidget();
-    void onMouseClick();
-
+    void hideWidgetPretty();
+    void hideWidgetInstant();
     bool isWidgetHidden();
+    void onMouseClick();
 
     /**
      * Add empty list elements to allow scroll in effect.
      */
     void addSpaces();
     void removeSpaces();
-
     void clearWidget();
 
-private:
+    boost::signals2::signal<void(string)> signalItemSelected;
+    boost::signals2::signal<void()> signalWidgetFocused;
+    boost::signals2::signal<void()> signalWidgetUnfocused;
 
+private:
     static Evas_Object* m_contentGet(void *data, Evas_Object *obj,
             const char *part);
     bool widgetExists()
@@ -66,21 +74,23 @@ private:
     }
     void prepareUrlsVector(const string& editedUrl,
             shared_ptr<services::HistoryItemVector> matchedEntries);
-    void startScrollIn();
-    void startScrollOut();
+
     void setLastEdgeTop(bool edgeTop);
     bool getLastEdgeTop();
     void onMouseFocusChange(bool mouseInsideWidget);
 
+    void startScrollIn();
+    void startScrollOut();
+
     Evas_Object* m_parentLayout = nullptr;
     Evas_Object* m_genlist = nullptr;
     const bool genlistShowScrollbar = false;
 
     // don't know how to get from edc:
-    const int historyItemH = 82;
-    const int historyItemsVisibleMax = 5;
+    const int HISTORY_ITEM_H = 82;
+    const int HISTORY_ITEMS_VISIBLE_MAX = 5;
     // don't know how to calculate:
-    const int genlistH = historyItemH * historyItemsVisibleMax;
+    const int GENLIST_H = HISTORY_ITEM_H * HISTORY_ITEMS_VISIBLE_MAX;
 
     /*
      * Set to true, whenever hide request occurs. Set to false, whenever show
@@ -96,8 +106,8 @@ private:
      */
     bool lastEdgeTop = true;
 
-    Elm_Gengrid_Item_Class * m_historyItemClass;
-    Elm_Gengrid_Item_Class * m_historyItemSpaceClass;
+    Elm_Gengrid_Item_Class* m_historyItemClass;
+    Elm_Gengrid_Item_Class* m_historyItemSpaceClass;
     Elm_Object_Item* m_itemUrlFirst = nullptr;
     Elm_Object_Item* m_itemUrlLast = nullptr;
     Elm_Object_Item* m_itemSpaceFirst = nullptr;
@@ -111,11 +121,12 @@ private:
      * manually in m_contentGet().
      */
     vector<shared_ptr<string>> m_readyUrls;
+    vector<shared_ptr<UrlPair>> m_readyUrlPairs;
     UrlMatchesStylerPtr m_urlMatchesStyler;
 
 };
 
-} /* namespace services */
+} /* namespace base_ui */
 } /* namespace tizen_browser */
 
 #endif /* GENLISTMANAGER_H_ */
index 25c3868..17d1cf3 100644 (file)
  */
 
 #include "BrowserLogger.h"
-#include "GenlistManagerCallbacks.h"
-#include "GenlistManager.h"
+#include <services/QuickAccess/UrlHistoryList/GenlistManagerCallbacks.h>
 
-namespace tizen_browser
-{
-namespace services
-{
+namespace tizen_browser {
+namespace base_ui {
+
+GenlistManager* GenlistManagerCallbacks::genlistManager = nullptr;
 
 GenlistManagerCallbacks::GenlistManagerCallbacks()
 {
@@ -31,89 +30,69 @@ GenlistManagerCallbacks::~GenlistManagerCallbacks()
 {
 }
 
-void GenlistManagerCallbacks::cb_genlistAnimStop(void *data, Evas_Object *obj,
-               void *event_info)
-{
-}
-
-void GenlistManagerCallbacks::cb_genlistEdgeTop(void *data, Evas_Object *obj,
-               void *event_info)
+void GenlistManagerCallbacks::_genlist_edge_top(void *data, Evas_Object* /*obj*/,
+        void* /*event_info*/)
 {
-       BROWSER_LOGD("@@ %s", __FUNCTION__);
-       auto manager = static_cast<GenlistManager*>(data);
-       manager->setLastEdgeTop(false);
-       // spaces added for 'slide in' effect are not longer needed
-       manager->removeSpaces();
+    auto manager = static_cast<GenlistManager*>(data);
+    manager->setLastEdgeTop(false);
+    // spaces added for 'slide in' effect are not longer needed
+    manager->removeSpaces();
 }
 
-void GenlistManagerCallbacks::cb_genlistEdgeBottom(void *data, Evas_Object *obj,
-               void *event_info)
+void GenlistManagerCallbacks::_genlist_edge_bottom(void *data, Evas_Object* /*obj*/,
+        void* /*event_info*/)
 {
-       auto manager = static_cast<GenlistManager*>(data);
-       manager->setLastEdgeTop(true);
-       if (manager->isWidgetHidden())
-       {
-               manager->clearWidget();
-               evas_object_hide(manager->getWidget());
-       }
+    auto manager = static_cast<GenlistManager*>(data);
+    manager->setLastEdgeTop(true);
+    if (manager->isWidgetHidden()) {
+        manager->clearWidget();
+        evas_object_hide(manager->getWidget());
+    }
 }
 
-void GenlistManagerCallbacks::cb_genlistActivated(void *data, Evas_Object *obj,
-               void *event_info)
-{
-}
-void GenlistManagerCallbacks::cb_genlistPressed(void *data, Evas_Object *obj,
-               void *event_info)
-{
-}
-void GenlistManagerCallbacks::cb_genlistSelected(void *data, Evas_Object *obj,
-               void *event_info)
-{
-}
-void GenlistManagerCallbacks::cb_genlistUnselected(void *data, Evas_Object *obj,
-               void *event_info)
+void GenlistManagerCallbacks::_genlist_mouse_in(void* data, Evas* /*e*/,
+        Evas_Object* /*obj*/, void* /*event_info*/)
 {
+    auto manager = static_cast<GenlistManager*>(data);
+    manager->onMouseFocusChange(true);
 }
-
-void GenlistManagerCallbacks::cb_genlistFocused(void *data, Evas_Object *obj,
-               void *event_info)
+void GenlistManagerCallbacks::_genlist_mouse_out(void* data, Evas* /*e*/,
+        Evas_Object* /*obj*/, void* /*event_info*/)
 {
+    auto manager = static_cast<GenlistManager*>(data);
+    manager->onMouseFocusChange(false);
 }
 
-void GenlistManagerCallbacks::cb_genlistUnfocused(void *data, Evas_Object *obj,
-               void *event_info)
+void GenlistManagerCallbacks::_genlist_focused(void* /*data*/, Evas_Object* /*obj*/,
+        void* /*event_info*/)
 {
+    if(genlistManager)
+    {
+        genlistManager->signalWidgetFocused();
+    }
 }
 
-void GenlistManagerCallbacks::cb_genlistMouseIn(void *data, Evas *e,
-               Evas_Object *obj, void *event_info)
-{
-       auto manager = static_cast<GenlistManager*>(data);
-       manager->onMouseFocusChange(true);
-}
-void GenlistManagerCallbacks::cb_genlistMouseOut(void *data, Evas *e,
-               Evas_Object *obj, void *event_info)
+void GenlistManagerCallbacks::_genlist_unfocused(void* /*data*/, Evas_Object* /*obj*/,
+        void* /*event_info*/)
 {
-       auto manager = static_cast<GenlistManager*>(data);
-       manager->onMouseFocusChange(false);
+    if(genlistManager)
+    {
+        genlistManager->signalWidgetUnfocused();
+    }
 }
 
-void GenlistManagerCallbacks::cb_itemFocused(void *data, Evas_Object *obj,
-               void *event_info)
-{
-}
-void GenlistManagerCallbacks::cb_itemUnfocused(void *data, Evas_Object *obj,
-               void *event_info)
-{
-}
-void GenlistManagerCallbacks::cb_itemMouseIn(void *data, Elm_Object_Item *it,
-        const char *emission, const char *source)
-{
-}
-void GenlistManagerCallbacks::cb_itemMouseOut(void *data, Evas *e,
-               Evas_Object *obj, void *event_info)
-{
+void GenlistManagerCallbacks::_item_selected(void* data, Evas_Object* /*obj*/,
+        void* /*event_info*/)
+{
+    const UrlPair* const item = reinterpret_cast<UrlPair*>(data);
+    if (item) {
+        if(genlistManager)
+        {
+            genlistManager->signalItemSelected(item->urlOriginal);
+            genlistManager->hideWidgetPretty();
+        }
+    }
 }
 
-} /* namespace services */
+} /* namespace base_ui */
 } /* namespace tizen_browser */
index 25ff418..228108d 100644 (file)
 #ifndef GENLISTMANAGERCALLBACKS_H_
 #define GENLISTMANAGERCALLBACKS_H_
 
+#include <services/QuickAccess/UrlHistoryList/GenlistManager.h>
 #include <Elementary.h>
 #include <Evas.h>
 
-class GenlistManager;
-
-namespace tizen_browser
-{
-namespace services
-{
+namespace tizen_browser {
+namespace base_ui {
 
 class GenlistManagerCallbacks
 {
 public:
-       GenlistManagerCallbacks();
-       virtual ~GenlistManagerCallbacks();
+    GenlistManagerCallbacks();
+    virtual ~GenlistManagerCallbacks();
+
+    static void _genlist_edge_top(void* data, Evas_Object* obj,
+            void* event_info);
+    static void _genlist_edge_bottom(void* data, Evas_Object* obj,
+            void* event_info);
+
+    static void _genlist_mouse_in(void* data, Evas* e, Evas_Object* obj,
+            void* event_info);
+    static void _genlist_mouse_out(void* data, Evas* e, Evas_Object* obj,
+            void* event_info);
+
+    static void _genlist_focused(void* data, Evas_Object* obj,
+            void* event_info);
+    static void _genlist_unfocused(void* data, Evas_Object* obj,
+            void* event_info);
 
-       static void cb_genlistAnimStop(void *data, Evas_Object *obj,
-                       void *event_info);
-       static void cb_genlistEdgeTop(void *data, Evas_Object *obj,
-                       void *event_info);
-       static void cb_genlistEdgeBottom(void *data, Evas_Object *obj,
-                       void *event_info);
+    static void _item_selected(void* data, Evas_Object* obj, void* event_info);
 
-       static void cb_genlistActivated(void *data, Evas_Object *obj,
-                       void *event_info);
-       static void cb_genlistPressed(void *data, Evas_Object *obj,
-                       void *event_info);
-       static void cb_genlistSelected(void *data, Evas_Object *obj,
-                       void *event_info);
-       static void cb_genlistUnselected(void *data, Evas_Object *obj,
-                       void *event_info);
+    static void setGenlistManager(GenlistManager* genlistManager)
+    {
+        GenlistManagerCallbacks::genlistManager = genlistManager;
+    }
 
-       static void cb_genlistFocused(void *data, Evas_Object *obj,
-                       void *event_info);
-       static void cb_genlistUnfocused(void *data, Evas_Object *obj,
-                       void *event_info);
-       static void cb_genlistMouseIn(void *data, Evas *e, Evas_Object *obj,
-                       void *event_info);
-       static void cb_genlistMouseOut(void *data, Evas *e, Evas_Object *obj,
-                       void *event_info);
+private:
+    static GenlistManager* genlistManager;
 
-       static void cb_itemFocused(void *data, Evas_Object *obj, void *event_info);
-       static void cb_itemUnfocused(void *data, Evas_Object *obj,
-                       void *event_info);
-       static void cb_itemMouseIn(void *data, Elm_Object_Item *it,
-            const char *emission, const char *source);
-       static void cb_itemMouseOut(void *data, Evas *e, Evas_Object *obj,
-                       void *event_info);
 };
 
-} /* namespace services */
+} /* namespace base_ui */
 } /* namespace tizen_browser */
 
 #endif /* GENLISTMANAGERCALLBACKS_H_ */
index fd76489..c6530bc 100644 (file)
 #include <Elementary.h>
 #include "UrlHistoryList.h"
 #include "GenlistManager.h"
-
 #include "BrowserLogger.h"
+#include "../QuickAccess.h"
 
-namespace tizen_browser
-{
-namespace base_ui
-{
+namespace tizen_browser {
+namespace base_ui {
 
-UrlHistoryList::UrlHistoryList() :
-               m_layout(nullptr)
+UrlHistoryList::UrlHistoryList(QuickAccess* quickAccess) :
+        m_layout(nullptr), m_quickAccess(quickAccess)
 {
-       m_edjFilePath = EDJE_DIR;
-       m_edjFilePath.append("MainUI/UrlHistoryList.edj");
-       m_widgetListManager = make_shared<services::GenlistManager>();
+    m_edjFilePath = EDJE_DIR;
+    m_edjFilePath.append("QuickAccess/UrlHistoryList.edj");
+    m_genlistListManager = make_shared<GenlistManager>();
+    m_genlistListManager->signalItemSelected.connect(
+            boost::bind(&UrlHistoryList::onListItemSelect, this, _1));
+    m_genlistListManager->signalWidgetFocused.connect(
+            boost::bind(&UrlHistoryList::onListWidgetFocused, this));
+    m_genlistListManager->signalWidgetUnfocused.connect(
+            boost::bind(&UrlHistoryList::onListWidgetUnfocused, this));
 }
 
 UrlHistoryList::~UrlHistoryList()
 {
 }
 
-void UrlHistoryList::show()
+Evas_Object* UrlHistoryList::getLayout()
 {
-       if (m_layout)
-       {
-               evas_object_show(m_layout);
-       }
+    return m_layout;
 }
 
-Evas_Object* UrlHistoryList::getLayout()
+void UrlHistoryList::createLayout(Evas_Object* parentLayout)
 {
-       return m_layout;
+    m_layout = elm_layout_add(parentLayout);
+    elm_layout_file_set(m_layout, m_edjFilePath.c_str(), "url_history_list");
+
+    Evas_Object* widgetList = m_genlistListManager->createWidget(m_layout);
 }
 
-void UrlHistoryList::createLayout(Evas_Object* parentLayout)
+void UrlHistoryList::onURLEntryEditedByUser(const string& editedUrl,
+        shared_ptr<services::HistoryItemVector> matchedEntries)
 {
-       m_layout = elm_layout_add(parentLayout);
-       elm_layout_file_set(m_layout, m_edjFilePath.c_str(), "url_history_list");
+    editedUrlStatesHelper.changeState(true);
 
-       Evas_Object* widgetList = m_widgetListManager->createWidget(m_layout);
+    if (matchedEntries->size() == 0) {
+        m_genlistListManager->hideWidgetPretty();
+    } else {
+        Evas_Object* widgetList = m_genlistListManager->getWidget();
+        elm_object_part_content_set(m_layout, "list_swallow", widgetList);
+        m_genlistListManager->showWidget(editedUrl, matchedEntries);
+        evas_object_show(widgetList);
+    }
 }
 
-void UrlHistoryList::onURLEntryEdit(const string& editedUrl,
-               shared_ptr<services::HistoryItemVector> matchedEntries)
+void UrlHistoryList::onURLEntryEdited()
 {
-       Evas_Object* widgetList = m_widgetListManager->getWidget();
-       if (matchedEntries->size() == 0)
-       {
-               m_widgetListManager->hideWidget();
-       }
-       else
-       {
-               elm_object_part_content_set(m_layout, "list_swallow", widgetList);
-               m_widgetListManager->showWidget(editedUrl, matchedEntries);
-               evas_object_show(widgetList);
-       }
+    editedUrlStatesHelper.changeState(false);
+    if (editedUrlStatesHelper.getCurrentState()
+            == EditedUrlState::EDITED_OTHER_FIRST) {
+        m_genlistListManager->hideWidgetPretty();
+    } else {
+        // in this situation scroll will not work, it has to be hidden instantly
+        m_genlistListManager->hideWidgetInstant();
+    }
 }
 
 void UrlHistoryList::onMouseClick()
 {
-       m_widgetListManager->onMouseClick();
+    m_genlistListManager->onMouseClick();
+}
+
+void UrlHistoryList::onListItemSelect(std::string content)
+{
+    openURLInNewTab(make_shared < services::HistoryItem > (content),
+            m_quickAccess->isDesktopMode());
+}
+
+void UrlHistoryList::onListWidgetFocused()
+{
+    // will be used soon: in a proper focus-chain solution
+}
+
+void UrlHistoryList::onListWidgetUnfocused()
+{
+    // will be used soon: in a proper focus-chain solution
 }
 
 }/* namespace base_ui */
index fa9934a..f42a425 100644 (file)
 #include <Evas.h>
 
 #include "services/HistoryService/HistoryItem.h"
+#include <boost/signals2/signal.hpp>
 
 using namespace std;
 
-namespace tizen_browser
-{
+namespace tizen_browser {
+namespace base_ui {
+
+class QuickAccess;
+class GenlistManager;
+typedef shared_ptr<GenlistManager> GenlistManagerPtr;
 
-namespace services
+enum class EditedUrlState
 {
-class WidgetListManager;
-typedef shared_ptr<WidgetListManager> WidgetListManagerPtr;
-}
+    // url was edited by a user (by typing)
+    EDITED_BY_USER,
+    // url was edited in other way than typing (but for the first time after previous user edition)
+    EDITED_OTHER_FIRST,
+    // url was edited in other way than typing (and previously was not edited by the user)
+    EDITED_OTHER_MANY_TIMES
+};
 
-namespace base_ui
+/**
+ * Needed to indicate who did the last url entry edition (user/other/other many times). Used
+ * to indicate when widget can be hidden in a pretty way or an instant way.
+ */
+class EditedUrlStatesHelper
 {
+public:
+    EditedUrlStatesHelper()
+    {
+    }
+    void changeState(bool editedByUser)
+    {
+        if (editedByUser) {
+            currentState = EditedUrlState::EDITED_BY_USER;
+        } else {
+            if (currentState == EditedUrlState::EDITED_BY_USER) {
+                currentState = EditedUrlState::EDITED_OTHER_FIRST;
+            } else {
+                currentState = EditedUrlState::EDITED_OTHER_MANY_TIMES;
+            }
+        }
+    }
+    EditedUrlState getCurrentState()
+    {
+        return currentState;
+    }
+private:
+    EditedUrlState currentState = EditedUrlState::EDITED_BY_USER;
+};
 
 /**
  * Manages list of url matches (URL from history). Manages top layout, creates
@@ -43,25 +79,47 @@ namespace base_ui
 class UrlHistoryList
 {
 public:
-       UrlHistoryList();
-       virtual ~UrlHistoryList();
-       void show();
-       void createLayout(Evas_Object* parentLayout);
-       Evas_Object *getLayout();
-
-       /**
-        * \brief entered url is edited (edited before acceptation)
-        */
-       void onURLEntryEdit(const string& editedUrl,
-                       shared_ptr<services::HistoryItemVector> matchedEntries);
-       void onMouseClick();
+    UrlHistoryList(QuickAccess* quickAccess);
+    virtual ~UrlHistoryList();
+    void createLayout(Evas_Object* parentLayout);
+    Evas_Object* getLayout();
+
+    // // on uri entry widget "changed,user" signal
+    void onURLEntryEditedByUser(const string& editedUrl,
+            shared_ptr<services::HistoryItemVector> matchedEntries);
+    // on uri entry widget "changed" signal
+    void onURLEntryEdited();
+
+    void onMouseClick();
+
+    boost::signals2::signal<void(shared_ptr<services::HistoryItem>, bool)> openURLInNewTab;
+
+    int getVisibleItemsMax() const
+    {
+        return VISIBLE_ITEMS_MAX;
+    }
+
+    int getMinKeywordLength() const
+    {
+        return MIN_KEYWORD_LENGTH;
+    }
 
 private:
+    void onListItemSelect(std::string content);
+    void onListWidgetFocused();
+    void onListWidgetUnfocused();
+
+    EditedUrlStatesHelper editedUrlStatesHelper;
 
-       Evas_Object* m_layout;
-       string m_edjFilePath;
+    // the maximum items number on a list
+    const int VISIBLE_ITEMS_MAX = 12;
+    // the minimum length of the keyword used to search matches
+    const int MIN_KEYWORD_LENGTH = 3;
+    Evas_Object* m_layout;
+    string m_edjFilePath;
 
-       services::WidgetListManagerPtr m_widgetListManager;
+    GenlistManagerPtr m_genlistListManager = nullptr;
+    QuickAccess* m_quickAccess;
 
 };
 
index c97758b..b03af5a 100644 (file)
@@ -17,7 +17,7 @@
 #include "UrlMatchesStyler.h"
 
 namespace tizen_browser {
-namespace services {
+namespace base_ui {
 
 UrlMatchesStyler::UrlMatchesStyler() :
                TAG_WHOLE_URL("<align=left><color=" + FONT_COLOR_NORMAL + "><font_size="+FONT_SIZE+">"),
@@ -127,5 +127,5 @@ string UrlMatchesStyler::getTaggedString(const string& strToHighlight,
        return strResult;
 }
 
-} /* namespace services */
+} /* namespace base_ui */
 } /* namespace tizen_browser */
index d100b29..75c5432 100644 (file)
@@ -26,7 +26,7 @@
 using namespace std;
 
 namespace tizen_browser {
-namespace services {
+namespace base_ui {
 
 class UrlMatchesStyler {
 public:
@@ -103,7 +103,7 @@ private:
 
 };
 
-} /* namespace services */
+} /* namespace base_ui */
 } /* namespace tizen_browser */
 
 #endif /* URLMATCHESSTYLER_H_ */
diff --git a/services/QuickAccess/UrlHistoryList/WidgetListManager.h b/services/QuickAccess/UrlHistoryList/WidgetListManager.h
deleted file mode 100644 (file)
index 18c22b5..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef WIDGETLISTMANAGER_H_
-#define WIDGETLISTMANAGER_H_
-
-#include <memory>
-#include <Evas.h>
-#include "services/HistoryService/HistoryItem.h"
-
-namespace tizen_browser
-{
-namespace services
-{
-
-/**
- * Interface for classes managing list-like widgets.
- * TODO: consider if it could be used in whole application, not only for URL
- * list.
- */
-class WidgetListManager
-{
-public:
-       virtual ~WidgetListManager()
-       {
-       }
-       virtual Evas_Object* createWidget(Evas_Object* parentLayout) = 0;
-       virtual Evas_Object* getWidget() = 0;
-       virtual void hideWidget() = 0;
-       virtual void showWidget(const std::string& editedUrl,
-                       std::shared_ptr<services::HistoryItemVector> matchedEntries) = 0;
-       virtual void onMouseClick() = 0;
-};
-
-} /* namespace services */
-} /* namespace tizen_browser */
-
-#endif /* WIDGETLISTMANAGER_H_ */
index c87299b..ef1881b 100644 (file)
@@ -20,6 +20,11 @@ collections {
 #define ITEM_WIDTH 374
 #define PARENT_ITEM_HEIGHT 36
 
+#define URI_INPUTBOX_LENGTH 1720
+#define URL_HISTORY_ITEM_H 82
+#define URL_HISTORY_ITEMS_VISIBLE_MAX 5
+#define URL_HISTORY_LIST_MAX_H HISTORY_ITEM_H*HISTORY_ITEMS_VISIBLE_MAX
+
 group{
     name: "elm/button/base/invisible_button";
     parts{
@@ -1383,6 +1388,33 @@ group { name: "top_button_item";
     }
 }
 
+group {
+    name: "url_history_list_layout";
+    parts
+    {
+        part
+        {
+            name: "url_history_list_swallow";
+            type: SWALLOW;
+            description {
+                state: "default" 0.0;
+                min: URI_INPUTBOX_LENGTH URL_HISTORY_LIST_MAX_H;
+                max: -1 -1;
+                align: 0.0 0.0;
+                fixed: 1 1;
+                visible: 1;
+                rel1 {
+                    relative: 0 0;
+                    offset: 10 106;
+                }
+                rel2 {
+                    relative: 1.0 1.0;
+                }
+            }
+        }
+    }
+}
+
 group { name: "bottom_button_item";
         min: 1920 181;
         max: 1920 181;
index 084de51..8697e7e 100644 (file)
@@ -46,6 +46,7 @@
 #include "boost/date_time/posix_time/posix_time.hpp"
 #include "SqlStorage.h"
 #include "DetailPopup.h"
+#include "UrlHistoryList/UrlHistoryList.h"
 #include "NotificationPopup.h"
 
 
@@ -236,6 +237,8 @@ void SimpleUI::connectUISignals()
 
     M_ASSERT(m_webPageUI.get());
     m_webPageUI->getURIEntry().uriChanged.connect(boost::bind(&SimpleUI::filterURL, this, _1));
+    m_webPageUI->getURIEntry().uriEntryEditingChangedByUser.connect(boost::bind(&SimpleUI::onURLEntryEditedByUser, this, _1));
+    m_webPageUI->getURIEntry().uriEntryEditingChanged.connect(boost::bind(&SimpleUI::onURLEntryEdited, this));
     m_webPageUI->backPage.connect(boost::bind(&SimpleUI::switchViewToWebPage, this));
     m_webPageUI->backPage.connect(boost::bind(&tizen_browser::basic_webengine::AbstractWebEngine<Evas_Object>::back, m_webEngine.get()));
     m_webPageUI->reloadPage.connect(boost::bind(&SimpleUI::switchViewToWebPage, this));
@@ -251,6 +254,7 @@ void SimpleUI::connectUISignals()
 
     M_ASSERT(m_quickAccess.get());
     m_quickAccess->getDetailPopup().openURLInNewTab.connect(boost::bind(&SimpleUI::onOpenURLInNewTab, this, _1, _2));
+    m_quickAccess->getUrlHistoryList()->openURLInNewTab.connect(boost::bind(&SimpleUI::onOpenURLInNewTab, this, _1, _2));
     m_quickAccess->openURLInNewTab.connect(boost::bind(&SimpleUI::onOpenURLInNewTab, this, _1, _2));
     m_quickAccess->mostVisitedTileClicked.connect(boost::bind(&SimpleUI::onMostVisitedTileClicked, this, _1, _2));
     m_quickAccess->mostVisitedClicked.connect(boost::bind(&SimpleUI::onMostVisitedClicked, this));
@@ -409,6 +413,8 @@ void SimpleUI::connectModelSignals()
 
     m_platformInputManager->returnPressed.connect(boost::bind(&elm_exit));
     m_platformInputManager->backPressed.connect(boost::bind(&SimpleUI::onBackPressed, this));
+    m_platformInputManager->mouseClicked.connect(
+            boost::bind(&SimpleUI::onMouseClick, this));
 
 }
 
@@ -688,6 +694,29 @@ void SimpleUI::filterURL(const std::string& url)
     m_webPageUI->getURIEntry().clearFocus();
 }
 
+void SimpleUI::onURLEntryEditedByUser(const std::shared_ptr<std::string> editedUrlPtr)
+{
+    string editedUrl(*editedUrlPtr);
+    int historyItemsVisibleMax =
+            m_quickAccess->getUrlHistoryList()->getVisibleItemsMax();
+    int minKeywordLength =
+            m_quickAccess->getUrlHistoryList()->getMinKeywordLength();
+    std::shared_ptr<services::HistoryItemVector> result =
+            m_historyService->getHistoryItemsByKeywordsString(editedUrl,
+                    historyItemsVisibleMax, minKeywordLength);
+    m_quickAccess->getUrlHistoryList()->onURLEntryEditedByUser(editedUrl, result);
+}
+
+void SimpleUI::onURLEntryEdited()
+{
+    m_quickAccess->getUrlHistoryList()->onURLEntryEdited();
+}
+
+void SimpleUI::onMouseClick()
+{
+    m_quickAccess->getUrlHistoryList()->onMouseClick();
+}
+
 void SimpleUI::webEngineURLChanged(const std::string url)
 {
     BROWSER_LOGD("webEngineURLChanged:%s", url.c_str());
index 5e4ecd4..f4d41b1 100644 (file)
@@ -139,6 +139,7 @@ private:
     void authPopupButtonClicked(PopupButtons button, std::shared_ptr<PopupData> popupData);
 
     void onActionTriggered(const Action& action);
+    void onMouseClick();
     void setwvIMEStatus(bool status);
 
     sharedAction m_showBookmarkManagerUI;
@@ -153,6 +154,11 @@ private:
      */
     void filterURL(const std::string& url);
 
+    // // on uri entry widget "changed,user" signal
+    void onURLEntryEditedByUser(const std::shared_ptr<std::string> editedUrlPtr);
+    // on uri entry widget "changed" signal
+    void onURLEntryEdited();
+
     /**
      * Checks if correct tab is visible to user, and if not, it update browser view
      * @param id of tab that should be visible to user
index 39bdbb2..9200abb 100644 (file)
@@ -80,11 +80,12 @@ Evas_Object* URIEntry::getContent()
         evas_object_smart_callback_add(m_entry, "activated", URIEntry::activated, this);
         evas_object_smart_callback_add(m_entry, "aborted", URIEntry::aborted, this);
         evas_object_smart_callback_add(m_entry, "preedit,changed", URIEntry::preeditChange, this);
-        evas_object_smart_callback_add(m_entry, "changed,user", URIEntry::changedUser, this);
+        evas_object_smart_callback_add(m_entry, "changed", URIEntry::_uri_entry_editing_changed, this);
+        evas_object_smart_callback_add(m_entry, "changed,user", URIEntry::_uri_entry_editing_changed_user, this);
         evas_object_smart_callback_add(m_entry, "focused", URIEntry::focused, this);
         evas_object_smart_callback_add(m_entry, "unfocused", URIEntry::unfocused, this);
-        evas_object_smart_callback_add(m_entry, "clicked", _uriEntryClicked, this);
-        evas_object_event_callback_priority_add(m_entry, EVAS_CALLBACK_KEY_DOWN, 2 * EVAS_CALLBACK_PRIORITY_BEFORE, URIEntry::fixed_entry_key_down_handler, this);
+        evas_object_smart_callback_add(m_entry, "clicked", _uri_entry_clicked, this);
+        evas_object_event_callback_priority_add(m_entry, EVAS_CALLBACK_KEY_DOWN, 2 * EVAS_CALLBACK_PRIORITY_BEFORE, URIEntry::_fixed_entry_key_down_handler, this);
 
         elm_object_part_content_set(m_entry_layout, "uri_entry_swallow", m_entry);
 
@@ -94,7 +95,7 @@ Evas_Object* URIEntry::getContent()
         evas_object_smart_callback_add(m_entryBtn, "unfocused", URIEntry::unfocusedBtn, this);
 
         elm_object_style_set(m_entryBtn, "entry_btn");
-        evas_object_smart_callback_add(m_entryBtn, "clicked", _uriEntryBtnClicked, this);
+        evas_object_smart_callback_add(m_entryBtn, "clicked", _uri_entry_btn_clicked, this);
 
         elm_object_part_content_set(m_entry_layout, "uri_entry_btn", m_entryBtn);
     }
@@ -182,14 +183,13 @@ void URIEntry::selectWholeText()
     }
 }
 
-void URIEntry::_uriEntryClicked(void* data, Evas_Object* /* obj */, void* /* event_info */)
+void URIEntry::_uri_entry_clicked(void* data, Evas_Object* /* obj */, void* /* event_info */)
 {
-    BROWSER_LOGD("%s", __func__);
     URIEntry* self = static_cast<URIEntry*>(data);
     self->selectWholeText();
 }
 
-void URIEntry::_uriEntryBtnClicked(void* data, Evas_Object* /*obj*/, void* /*event_info*/)
+void URIEntry::_uri_entry_btn_clicked(void* data, Evas_Object* /*obj*/, void* /*event_info*/)
 {
     URIEntry* self = static_cast<URIEntry*>(data);
     elm_object_focus_set(self->m_entry, EINA_TRUE);
@@ -215,7 +215,7 @@ void URIEntry::preeditChange(void* /* data */, Evas_Object* /* obj */, void* /*e
     BROWSER_LOGD("%s", __func__);
 }
 
-void URIEntry::changedUser(void* data, Evas_Object* /* obj */, void* /*event_info*/)
+void URIEntry::_uri_entry_editing_changed_user(void* data, Evas_Object* /* obj */, void* /*event_info*/)
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     URIEntry* self = reinterpret_cast<URIEntry*>(data);
@@ -227,6 +227,13 @@ void URIEntry::changedUser(void* data, Evas_Object* /* obj */, void* /*event_inf
     } else {//if(entry.find(" ") != std::string::npos){
         self->setSearchIcon();
     }
+    self->uriEntryEditingChangedByUser(std::make_shared<std::string>(entry));
+}
+
+void URIEntry::_uri_entry_editing_changed(void* data, Evas_Object* /* obj */, void* /* event_info */)
+{
+    URIEntry* self = static_cast<URIEntry*>(data);
+    self->uriEntryEditingChanged();
 }
 
 void URIEntry::setUrlGuideText(const char* txt) const
@@ -257,7 +264,7 @@ void URIEntry::focused(void* data, Evas_Object* /* obj */, void* /* event_info *
     BROWSER_LOGD("%s, URI: %s", __func__, self->m_URI.c_str());
 }
 
-void URIEntry::fixed_entry_key_down_handler(void* data, Evas* /*e*/, Evas_Object* /*obj*/, void* event_info)
+void URIEntry::_fixed_entry_key_down_handler(void* data, Evas* /*e*/, Evas_Object* /*obj*/, void* event_info)
 {
     BROWSER_LOGD("%s", __func__);
     Evas_Event_Key_Down* ev = static_cast<Evas_Event_Key_Down*>(event_info);
@@ -284,8 +291,6 @@ void URIEntry::fixed_entry_key_down_handler(void* data, Evas* /*e*/, Evas_Object
 
 void URIEntry::editingCompleted()
 {
-    BROWSER_LOGD("%s", __func__);
-
     char* text = elm_entry_markup_to_utf8(elm_entry_entry_get(m_entry));
     std::string userString(text);
     free(text);
index 20b1774..c23a0c4 100644 (file)
@@ -45,6 +45,11 @@ public:
     void changeUri(const std::string&);
     boost::signals2::signal<void (const std::string&)> uriChanged;
 
+    // uri edition change
+    boost::signals2::signal<void ()> uriEntryEditingChanged;
+    // uri edition change (by a user)
+    boost::signals2::signal<void (const std::shared_ptr<std::string>)> uriEntryEditingChangedByUser;
+
     void setFavIcon(std::shared_ptr<tizen_browser::tools::BrowserImage> favicon);
     void setCurrentFavIcon();
     void setSearchIcon();
@@ -87,11 +92,8 @@ private:
     static void activated(void* data, Evas_Object* obj, void* event_info);
     static void aborted(void* data, Evas_Object* obj, void* event_info);
     static void preeditChange(void* data, Evas_Object* obj, void* event_info);
-    static void changedUser(void* data, Evas_Object* obj, void* event_info);
     static void focused(void* data, Evas_Object* obj, void* event_info);
     static void unfocused(void* data, Evas_Object* obj, void* event_info);
-    static void fixed_entry_key_down_handler(void* data, Evas* e, Evas_Object* obj, void* event_info);
-    static void _uriEntryBtnClicked(void* data, Evas_Object* obj, void* event_info);
 
     void editingCompleted();
     void selectWholeText();
@@ -102,7 +104,11 @@ private:
      */
     std::string rewriteURI(const std::string& url);
 
-    static void _uriEntryClicked(void* data, Evas_Object* obj, void* event_info);
+    static void _fixed_entry_key_down_handler(void* data, Evas* e, Evas_Object* obj, void* event_info);
+    static void _uri_entry_btn_clicked(void* data, Evas_Object* obj, void* event_info);
+    static void _uri_entry_clicked(void* data, Evas_Object* obj, void* event_info);
+    static void _uri_entry_editing_changed(void* data, Evas_Object* obj, void* event_info);
+    static void _uri_entry_editing_changed_user(void* data, Evas_Object* obj, void* event_info);
 
     static void focusedBtn(void* data, Evas_Object* obj, void* event_info);
     static void unfocusedBtn(void* data, Evas_Object* obj, void* event_info);