Add toast popup on bookmark removal 22/88222/3
authorKamil Nowac <k.nowac@samsung.com>
Thu, 15 Sep 2016 06:24:54 +0000 (08:24 +0200)
committerHye Kyoung Hwang <cookie@samsung.com>
Mon, 19 Sep 2016 00:36:18 +0000 (17:36 -0700)
[Issue]    http://suprem.sec.samsung.net/jira/browse/TWF-1839
[Problem]  No toast popup informing about bookmark deletion
[Solution] Added popup
[Verify]   Add bookmark and remove it
           Poopup should be shown

Change-Id: I4d41b8b50a93d99254c4e46ba0ad74460e095595

core/Tools/EflTools.cpp
core/Tools/EflTools.h
services/BookmarkService/BookmarkService.cpp
services/SimpleUI/SimpleUI.cpp

index 6c4eb4bec6e824d7895bf05de3152d226fa6677e..93fb4ab2e65b0990c7b0682ef6cfd5542c9cdcee 100644 (file)
@@ -25,6 +25,7 @@
 #include "browser_config.h"
 #include "BrowserLogger.h"
 #include "EflTools.h"
+#include "Elementary.h"
 
 
 namespace tizen_browser {
@@ -107,6 +108,15 @@ bool pointInObject(Evas_Object* object, int px, int py)
     return (px >= x && px <= x + w && py >= y && py <= y + h);
 }
 
+Evas_Object* createToastPopup(Evas_Object* parent, double timeout, const char* text)
+{
+    auto toast(elm_popup_add(parent));
+    elm_object_style_set(toast, "toast");
+    elm_popup_timeout_set(toast, timeout);
+    elm_object_text_set(toast, text);
+    return toast;
+}
+
 } /* end of EflTools */
 } /* end of namespace tools */
 } /* end of namespace tizen_browser */
index 7fea71663c25fbf6c7410a250ff6d5bb97b71e95..dcc2e304fc276b022d1f70a7c0c2ac13223a99ca 100644 (file)
@@ -45,6 +45,7 @@ namespace EflTools {
      */
     bool pointInObject(Evas_Object* object, int x, int y);
 
+    Evas_Object* createToastPopup(Evas_Object* parent, double timeout, const char* text);
 } /* end of namespace EflTools */
 } /* end of namespace tools */
 } /* end of namespace tizen_browser */
index 7e27be299e152d28f81650934ae5a89a478d4702..a4589f40c60cb226aa8b04a41b114c700093e650 100644 (file)
@@ -190,11 +190,13 @@ bool BookmarkService::editBookmark(const std::string & url, const std::string &
 bool BookmarkService::deleteBookmark(const std::string & url)
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
-    int id = getBookmarkId(url);
-    if (id!=0)
-        bp_bookmark_adaptor_delete(id);
-    bookmarkDeleted(url);
-    return true;
+    int id(getBookmarkId(url));
+    int ret(0);
+
+    if (id != 0)
+        ret = bp_bookmark_adaptor_delete(id);
+
+    return static_cast<bool>(ret);
 }
 
 std::shared_ptr<BookmarkItem> BookmarkService::addFolder(const std::string &title, int parent)
index d3c7805af88077776a65c24c003a10c18c0f23f4..19012084b91fb8f23f712e408950bce4c2da7298 100755 (executable)
@@ -1994,13 +1994,22 @@ void SimpleUI::editBookmark(BookmarkUpdate bookmark_update)
     }
 }
 
-//TODO: Add toast popup informing that delete was success.
-//http://suprem.sec.samsung.net/jira/browse/TWF-1839
 void SimpleUI::deleteBookmark()
 {
-    std::string uri = m_webEngine->getURI();
+    std::string uri(m_webEngine->getURI());
+    bool ret(true);
     if (m_favoriteService->bookmarkExists(uri))
-        m_favoriteService->deleteBookmark(uri);
+        ret = m_favoriteService->deleteBookmark(uri);
+    // TODO add translations
+    auto text(
+        ret ?
+        "Bookmark deletion has failed!" :
+        "Bookmark has been deleted successfully.");
+    auto toast(tools::EflTools::createToastPopup(
+        m_viewManager.getContent(),
+        3.0,
+        text));
+    evas_object_show(toast);
 }
 }
 }