Fix APP_CONTROL_OPERATION_SEARCH 69/93469/4
authorKamil Nowac <k.nowac@samsung.com>
Mon, 24 Oct 2016 10:16:45 +0000 (12:16 +0200)
committerJarek Pytlinski <j.pytlinski@samsung.com>
Tue, 25 Oct 2016 11:14:07 +0000 (04:14 -0700)
[Issue]    http://suprem.sec.samsung.net/jira/browse/TSAM-9176
[Problem]  Open blank page
[Solution] Change behaviour for operation search
[Verify]   As in the issue

Change-Id: Ia5a62f0d05157c9523d3b79fc74d10df6d7a3bf1

core/BasicUI/AbstractMainWindow.h
core/main.cpp
services/SimpleUI/SimpleUI.cpp
services/SimpleUI/SimpleUI.h

index 29baf9f483a6cad2d4ec5669d19f9afd9f59caca..5aa0196da454352953b28b3791b1ff9a9d28dc44 100644 (file)
@@ -47,7 +47,10 @@ public:
         : m_window()
     {}
 
-    virtual int exec(const std::string& url, const std::string& caller) = 0;
+    virtual int exec(
+        const std::string& url,
+        const std::string& caller,
+        const std::string& operation) = 0;
     std::shared_ptr<T> getMainWindow(){return m_window;};
 
     /**
index a8105036ee56bb78d349941fcb5aeda0abac854d..bdaf41f535e7a39825820c864c60963d947dc955 100755 (executable)
@@ -159,14 +159,14 @@ static void app_control(app_control_h app_control, void* app_data){
 
     if ((operation && !strcmp(operation, APP_CONTROL_OPERATION_SEARCH )) &&
     ((app_control_get_extra_data(app_control, "http://tizen.org/appcontrol/data/keyword", &search_keyword) == APP_CONTROL_ERROR_NONE) ||
-    (app_control_get_extra_data(app_control, APP_CONTROL_DATA_TEXT, &search_keyword) == APP_CONTROL_ERROR_NONE))) { 
+    (app_control_get_extra_data(app_control, APP_CONTROL_DATA_TEXT, &search_keyword) == APP_CONTROL_ERROR_NONE))) {
         BROWSER_LOGD("APP_CONTROL_OPERATION_SEARCH");
         if (search_keyword) {
             uri=std::string(search_keyword);
             free(search_keyword);
         }
     }
-
+    std::string oper(operation);
     BROWSER_LOGD("[%s] uri=%s", __func__, uri.c_str());
     free(request_uri);
     free(request_mime_type);
@@ -174,7 +174,7 @@ static void app_control(app_control_h app_control, void* app_data){
     free(operation);
 
     auto bd = static_cast<BrowserDataPtr*>(app_data);
-    (*bd)->exec(uri, caller);
+    (*bd)->exec(uri, caller, oper);
     evas_object_show((*bd)->getMainWindow().get());
     elm_win_activate((*bd)->getMainWindow().get());
 
index 5912ee4853994f11650ab8368c66031a06f5248e..32743663b76e11a74daaf74b8c45892f78481fe5 100755 (executable)
@@ -214,13 +214,20 @@ std::string SimpleUI::preparePWA(const std::string& url)
 }
 #endif
 
-int SimpleUI::exec(const std::string& _url, const std::string& _caller)
-{
-    BROWSER_LOGD("[%s] _url=%s, _caller=%s, initialised=%d", __func__, _url.c_str(), _caller.c_str(), m_initialised);
+int SimpleUI::exec(const std::string& _url, const std::string& _caller, const std::string& _operation)
+{
+    BROWSER_LOGD(
+        "[%s] _url=%s, _caller=%s, _operation=%s, initialised=%d",
+        __func__,
+        _url.c_str(),
+        _caller.c_str(),
+        _operation.c_str(),
+        m_initialised);
     std::string url = _url;
+    std::string operation = _operation;
     m_caller = _caller;
     m_alreadyOpenedExecURL = false;
-    m_functionViewPrepare = [url, this]() mutable {
+    m_functionViewPrepare = [url, operation, this]() mutable {
         if (!m_initialised) {
             if (m_window.get()) {
                 prepareServices();
@@ -253,7 +260,12 @@ int SimpleUI::exec(const std::string& _url, const std::string& _caller)
 
         if (!pwaUrl.empty() || (!url.empty() && !m_alreadyOpenedExecURL)) {
             BROWSER_LOGD("[%s]: open new tab", __func__);
-            auto taburl = pwaUrl.empty() ? url : pwaUrl;
+            std::string newUrl = url;
+            if (!operation.compare(APP_CONTROL_OPERATION_SEARCH)) {
+                newUrl = m_webPageUI->getURIEntry().rewriteURI(url);
+                popStackTo(m_webPageUI);
+            }
+            auto taburl = pwaUrl.empty() ? newUrl : pwaUrl;
 #if PWA
             // Allow for only one instance of PWA
             if (m_alreadyOpenedPWA)
index a9a98eafda6028e1f7d6c8adcfc96829336be74e..d98e8860cbe231310328d8b128f17aed2353ae52 100644 (file)
@@ -85,8 +85,11 @@ class BROWSER_EXPORT SimpleUI : public AbstractMainWindow<Evas_Object>
 public:
     SimpleUI(/*Evas_Object *window*/);
     virtual ~SimpleUI();
-    int exec(const std::string& _url, const std::string& _caller) final override;
-    std::string getName() final override;
+    virtual int exec(
+        const std::string& _url,
+        const std::string& _caller,
+        const std::string& _operation) final override;
+    virtual std::string getName() final override;
     void suspend();
     void resume();
     void destroyUI();