set(SimpleUI_SRCS
SimpleUI.cpp
SimplePopup.cpp
+ NotificationPopup.cpp
BookmarksManager.cpp
ViewManager.cpp
)
set(SimpleUI_HEADERS
SimpleUI.h
SimplePopup.h
+ NotificationPopup.h
BookmarksManager.h
ViewManager.h
)
set(edcFiles
AuthenticationPopup.edc
BookmarksManager.edc
+ NotificationPopup.edc
Tooltip.edc
ViewManager.edc
)
--- /dev/null
+/*
+ * 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.
+ */
+
+#include <Evas.h>
+#include <Elementary.h>
+#include "NotificationPopup.h"
+#include "BrowserLogger.h"
+#include "ServiceManager.h"
+#include "AbstractMainWindow.h"
+#include <BrowserAssert.h>
+
+
+static const float DEFAULT_POPUP_INTERVAL = 3.0;
+
+namespace tizen_browser {
+namespace base_ui {
+
+NotificationPopup::NotificationPopup()
+ : m_parent(nullptr)
+ , m_layout(nullptr)
+ , m_progress(nullptr)
+ , m_timer(nullptr)
+{
+ edjFilePath = EDJE_DIR;
+ edjFilePath.append("SimpleUI/NotificationPopup.edj");
+ elm_theme_extension_add(nullptr, edjFilePath.c_str());
+}
+
+NotificationPopup *NotificationPopup::createNotificationPopup(Evas_Object *parent)
+{
+ BROWSER_LOGD("[%s,%d]", __func__, __LINE__);
+ NotificationPopup *raw_popup = new NotificationPopup();
+ raw_popup->m_parent = parent;
+ return raw_popup;
+}
+
+void NotificationPopup::show(const std::string& message)
+{
+ BROWSER_LOGD("[%s,%d]", __func__, __LINE__);
+ m_message = message;
+ createLayout();
+ m_timer = ecore_timer_add(DEFAULT_POPUP_INTERVAL, _hide_cb, this);
+}
+
+void NotificationPopup::dismiss()
+{
+ BROWSER_LOGD("[%s,%d]", __func__, __LINE__);
+ float pendingTime = ecore_timer_pending_get(m_timer);
+ if(pendingTime > DEFAULT_POPUP_INTERVAL-1) {
+ ecore_timer_interval_set(m_timer, 1.0);
+ ecore_timer_reset(m_timer);
+ }
+ else {
+ evas_object_hide(m_layout);
+ ecore_timer_del(m_timer);
+ }
+}
+
+Eina_Bool NotificationPopup::_hide_cb(void *data)
+{
+ BROWSER_LOGD("[%s,%d]", __func__, __LINE__);
+ NotificationPopup * np = static_cast<NotificationPopup*>(data);
+ evas_object_hide(np->m_layout);
+ ecore_timer_del(np->m_timer);
+ delete np;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void NotificationPopup::createLayout()
+{
+ BROWSER_LOGD("[%s,%d]", __func__, __LINE__);
+ M_ASSERT(m_parent);
+
+ m_layout = elm_layout_add(m_parent);
+ elm_layout_file_set(m_layout, edjFilePath.c_str(), "notification_popup_layout");
+ evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_layout_text_set(m_layout, "popup_text", m_message.c_str());
+
+ m_progress = elm_progressbar_add(m_layout);
+ elm_object_part_content_set(m_layout, "progress_swallow", m_progress);
+ //TODO: set correct progressbar theme when it will be available.
+ elm_progressbar_horizontal_set(m_progress, EINA_TRUE);
+ elm_progressbar_pulse_set(m_progress, EINA_TRUE);
+ elm_progressbar_pulse(m_progress, EINA_TRUE);
+ evas_object_show(m_progress);
+ evas_object_show(m_layout);
+}
+
+
+} /* end of namespace base_ui */
+} /* end of namespace tizen_browser */
+
--- /dev/null
+/*
+ * 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 __NOTIFICATION_POPUP_H__
+#define __NOTIFICATION_POPUP_H__
+
+#include <Evas.h>
+#include <eina-1/Eina.h>
+#include <ecore-1/Ecore.h>
+#include <Elementary.h>
+#include <string>
+
+namespace tizen_browser {
+namespace base_ui {
+
+class NotificationPopup
+{
+public:
+ NotificationPopup();
+ static NotificationPopup *createNotificationPopup(Evas_Object *parent);
+ void show(const std::string &message);
+ void dismiss();
+ static Eina_Bool _hide_cb(void *data);
+
+private:
+ void createLayout();
+
+ std::string edjFilePath;
+ Evas_Object *m_parent;
+ Evas_Object *m_layout;
+ Evas_Object *m_progress;
+ std::string m_message;
+ Ecore_Timer *m_timer;
+};
+
+} /* end of namespace base_ui */
+} /* end of namespace tizen_browser */
+
+#endif //__NOTIFICATION_POPUP_H__
#include "boost/date_time/posix_time/posix_time.hpp"
#include "SqlStorage.h"
#include "DetailPopup.h"
+#include "NotificationPopup.h"
namespace tizen_browser{
void SimpleUI::settingsDeleteSelectedData(const std::string& str)
{
- BROWSER_LOGD("[%s]: Deleting Hisory", __func__);
- SimplePopup *popup = SimplePopup::createPopup();
- popup->setTitle("Delete selected data");
- popup->addButton(OK);
- popup->addButton(CANCEL);
- popup->setMessage("Are you sure you want to delete all selected data?");
- std::shared_ptr<EntryPopupData> popupData = std::make_shared<EntryPopupData>();
- popupData->text = str;
- popup->setData(popupData);
- popup->buttonClicked.connect(boost::bind(&SimpleUI::onDeleteSelectedDataButton, this, _1, _2));
- popup->show();
+ BROWSER_LOGD("[%s]: Deleting selected data", __func__);
+ M_ASSERT(m_viewManager);
+ NotificationPopup *popup = NotificationPopup::createNotificationPopup(m_viewManager->getContent());
+ popup->show("Delete Web Browsing Data");
+ onDeleteSelectedDataButton(str);
+ popup->dismiss();
}
-void SimpleUI::onDeleteSelectedDataButton(PopupButtons button, std::shared_ptr< PopupData > popupData)
+void SimpleUI::onDeleteSelectedDataButton(const std::string& dataText)
{
- if (button == OK) {
- BROWSER_LOGD("[%s]: OK", __func__);
- std::string dataText = std::static_pointer_cast<EntryPopupData>(popupData)->text;
BROWSER_LOGD("[%s]: TYPE : %s", __func__, dataText.c_str());
if (dataText.find("CACHE") != std::string::npos)
m_webEngine->clearPrivateData();
m_webEngine->clearPrivateData();
if (dataText.find("HISTORY") != std::string::npos)
m_historyService->clearAllHistory();
- }
}
void SimpleUI::settingsResetMostVisited()
{
- BROWSER_LOGD("[%s]: Deleting Hisory", __func__);
- SimplePopup *popup = SimplePopup::createPopup();
- popup->setTitle("Delete most visited");
- popup->addButton(OK);
- popup->addButton(CANCEL);
- popup->setMessage("Are you sure you want to delete most visited sites?");
- popup->buttonClicked.connect(boost::bind(&SimpleUI::onDeleteMostVisitedButton, this, _1, _2));
- popup->show();
+ BROWSER_LOGD("[%s]: Deleting most visited sites", __func__);
+ M_ASSERT(m_viewManager);
+ NotificationPopup *popup = NotificationPopup::createNotificationPopup(m_viewManager->getContent());
+ popup->show("Reset Most Visited Sites");
+ onDeleteMostVisitedButton(nullptr);
+ popup->dismiss();
}
-void SimpleUI::onDeleteMostVisitedButton(PopupButtons button, std::shared_ptr< PopupData > /*popupData*/)
+void SimpleUI::onDeleteMostVisitedButton(std::shared_ptr< PopupData > /*popupData*/)
{
- if (button == OK) {
- BROWSER_LOGD("[%s]: OK", __func__);
- BROWSER_LOGD("[%s]: Deleting most visited", __func__);
-
- //TODO: display notification popup
-
- m_historyService->cleanMostVisitedHistoryItems();
- }
+ BROWSER_LOGD("[%s]: Deleting most visited", __func__);
+ m_historyService->cleanMostVisitedHistoryItems();
}
void SimpleUI::settingsResetBrowser()
{
- BROWSER_LOGD("[%s]: Deleting Hisory", __func__);
+ BROWSER_LOGD("[%s]: Resetting browser", __func__);
SimplePopup *popup = SimplePopup::createPopup();
popup->setTitle("Reset browser");
popup->addButton(OK);
if (button == OK) {
BROWSER_LOGD("[%s]: OK", __func__);
BROWSER_LOGD("[%s]: Resetting browser", __func__);
+ M_ASSERT(m_viewManager);
+
+ NotificationPopup *popup = NotificationPopup::createNotificationPopup(m_viewManager->getContent());
+ popup->show("Reset Browser");
m_webEngine->clearPrivateData();
m_historyService->clearAllHistory();
m_currentSession.removeItem(id.toString());
m_webEngine->closeTab(id);
}
-
//TODO: add here any missing functionality that should be cleaned.
+
+ popup->dismiss();
}
}
void settingsDeleteSelectedData(const std::string& str);
void settingsResetMostVisited();
void settingsResetBrowser();
- void onDeleteSelectedDataButton(PopupButtons button, std::shared_ptr<PopupData> popupData);
- void onDeleteMostVisitedButton(PopupButtons button, std::shared_ptr<PopupData> popupData);
+ void onDeleteSelectedDataButton(const std::string &dataText);
+ void onDeleteMostVisitedButton(std::shared_ptr<PopupData> popupData);
void onResetBrowserButton(PopupButtons button, std::shared_ptr<PopupData> popupData);
void tabLimitPopupButtonClicked(PopupButtons button, std::shared_ptr< PopupData > /*popupData*/);
int tabsCount();
--- /dev/null
+collections {
+
+#define WIDTH 1920
+#define HEIGHT 976
+
+ styles {
+ style {
+ name: "text_style";
+ base: "font=Sans:style=Bold font_size=30 color=#000000 wrap=word align=0.5";
+ }
+ }
+
+ group {
+ name: "notification_popup_layout";
+ parts {
+
+ part { name: "bg";
+ type: RECT;
+ mouse_events: 1;
+ description { state: "default" 0.0;
+ color: 0 0 0 120;
+ visible: 1;
+ min: WIDTH HEIGHT;
+ max: WIDTH HEIGHT;
+ align: 0.0 0.0;
+ rel1 {relative: 0.0 0.0; offset: 0 104;}
+ rel2 {relative: 1.0 1.0;}
+ }
+ }
+
+ part { name: "popup_rect";
+ type: RECT;
+ mouse_events: 1;
+ description { state: "default" 0.0;
+ color: 230 230 230 255;
+ min: 600 150;
+ max: 600 150;
+ visible: 1;
+ align: 0.5 0.5;
+ rel1 {
+ to: "bg";
+ offset: 0 0;
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "bg";
+ relative: 1.0 1.0;
+ }
+ }
+ }
+
+ part { name: "progress_swallow";
+ type: SWALLOW;
+ description {
+ min: 150 150;
+ max: 150 150;
+ visible: 1;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ offset: 20 0;
+ to: "popup_rect";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to: "popup_rect";
+ }
+ }
+ }
+
+ part { name: "popup_text";
+ type: TEXTBLOCK;
+ description {
+ visible: 1;
+ min: 400 190;
+ max: 400 190;
+ align: 1.0 0.5;
+ fixed: 1 1;
+ rel1 {
+ to: "popup_rect";
+ relative: 0.0 0.0;
+ offset: 0 0;
+ }
+ rel2 {
+ to: "popup_rect";
+ relative: 1.0 1.0;
+ }
+ text {
+ style: "text_style";
+ }
+ }
+ }
+
+ }
+ }
+}