Add classes to separate popup creation.
Add implementation for old check popup and new launch popup.
Use libnotification to display toasts.
Change-Id: I109edbd1e0c2ea5311fe1b1d04861ed48991868b
BuildRequires: libwayland-egl
BuildRequires: gettext-tools
BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(notification)
%if %{with_systemd_daemon}
BuildRequires: pkgconfig(libsystemd)
%endif
REQUIRED
elementary
libsystemd
+ notification
vconf
pkgmgr-info
glib-2.0
scale: 1;
desc { "default";
align: 0.5 0.5;
+ fixed: 0 1;
rel1.relative: 0.00 0.00;
rel2.relative: 1.00 0.04;
}
scale: 1;
desc { "default";
align: 0.5 0.5;
+ fixed: 0 1;
rel1.relative: 0.00 0.94;
rel2.relative: 1.00 1.00;
}
scale: 1;
desc { "default";
align: 0.5 0.5;
+ fixed: 1 0;
rel1.to_y: "spacer_t";
rel2.to_y: "spacer_b";
rel1.relative: 0.91 1.00;
scale: 1;
desc { "default";
align: 0.5 0.5;
+ fixed: 1 0;
rel1.to_y: "spacer_t";
rel2.to_y: "spacer_b";
rel1.relative: 0.00 1.00;
desc { "default";
visible: 1;
align: 0.5 0.5;
+ fixed: 0 1;
rel1.to_x: "spacer_r";
rel1.to_y: "elm.swallow.content";
rel2.to_x: "spacer_l";
scale: 1;
desc { "default";
align: 0.5 0.5;
+ fixed: 1 0;
+ rel1.to_y: "spacer_t";
+ rel2.to_y: "spacer_b";
+ rel1.relative: 0.00 1.00;
+ rel2.relative: 0.05 0.00;
+ }
+ }
+ spacer { "spacer_ll";
+ scale: 1;
+ desc { "default";
+ align: 0.5 0.5;
+ fixed: 1 0;
+ rel1.to_y: "spacer_t";
+ rel2.to_y: "spacer_b";
+ rel1.relative: 0.95 1.00;
+ rel2.relative: 1.00 0.00;
+ }
+ }
+ }
+}
+
+group { "popup_layout_mobile";
+ parts {
+ spacer { "spacer_t";
+ scale: 1;
+ desc { "default";
+ align: 0.5 0.5;
+ fixed: 0 1;
+ rel1.relative: 0.00 0.00;
+ rel2.relative: 1.00 0.04;
+ }
+ }
+ spacer { "spacer_b";
+ scale: 1;
+ desc { "default";
+ align: 0.5 0.5;
+ fixed: 0 1;
+ rel1.relative: 0.00 0.94;
+ rel2.relative: 1.00 1.00;
+ }
+ }
+ spacer { "spacer_l";
+ scale: 1;
+ desc { "default";
+ align: 0.5 0.5;
+ fixed: 1 0;
+ rel1.to_y: "spacer_t";
+ rel2.to_y: "spacer_b";
+ rel1.relative: 0.91 1.00;
+ rel2.relative: 1.00 0.00;
+ }
+ }
+ spacer { "spacer_r";
+ scale: 1;
+ desc { "default";
+ align: 0.5 0.5;
+ fixed: 1 0;
+ rel1.to_y: "spacer_t";
+ rel2.to_y: "spacer_b";
+ rel1.relative: 0.00 1.00;
+ rel2.relative: 0.09 0.00;
+ }
+ }
+ swallow { "elm.swallow.content";
+ scale: 1;
+ desc { "default";
+ visible: 1;
+ align: 0.5 0.5;
+ rel1.to_x: "spacer_rr";
+ rel1.to_y: "spacer_t";
+ rel2.to_x: "spacer_ll";
+ rel2.to_y: "spacer_b";
+ rel1.relative: 1.00 1.00;
+ rel2.relative: 0.00 0.64;
+ }
+ }
+ spacer { "spacer_rr";
+ scale: 1;
+ desc { "default";
+ align: 0.5 0.5;
+ fixed: 1 0;
rel1.to_y: "spacer_t";
rel2.to_y: "spacer_b";
rel1.relative: 0.00 1.00;
scale: 1;
desc { "default";
align: 0.5 0.5;
+ fixed: 1 0;
rel1.to_y: "spacer_t";
rel2.to_y: "spacer_b";
rel1.relative: 0.95 1.00;
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co.
+ *
+ * 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
+ */
+/**
+ * @file src/agent/notification-daemon/ui/Popup.h
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Declaration of Popup class
+ */
+
+#pragma once
+
+#include <string>
+
+#include <log/alog.h>
+#include <exception/Exception.h>
+#include <Elementary.h>
+
+#include "UIElement.h"
+
+namespace AskUser {
+namespace Notification {
+
+class Popup : public UIElement {
+public:
+ Popup(Evas_Object *parent, const std::string &msg)
+ : UIElement(parent), m_msg(msg)
+ {
+ m_popup = elm_popup_add(m_parent);
+ if (m_popup == nullptr) {
+ ALOGE("Failed to add popup");
+ throw Exception("Enlightenment failed");
+ }
+ }
+
+ Popup(const Popup &other) = delete;
+ Popup& operator=(const Popup &other) = delete;
+
+ Evas_Object *getAllowButton() const { return m_allowButton; }
+ Evas_Object *getDenyButton() const { return m_denyButton; }
+
+ virtual ~Popup() {
+ evas_object_del(m_popup);
+ }
+protected:
+ Evas_Object *m_popup = nullptr;
+ Evas_Object *m_allowButton = nullptr;
+ Evas_Object *m_denyButton = nullptr;
+
+ std::string m_msg;
+};
+
+} /* namespace Notification */
+} /* namespace Askuser */
+
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co.
+ *
+ * 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
+ */
+/**
+ * @file src/agent/notification-daemon/ui/PopupCheck.h
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Declaration of PopupCheck class
+ */
+
+#pragma once
+
+#include <string>
+
+#include <Elementary.h>
+
+#include "Popup.h"
+
+namespace AskUser {
+namespace Notification {
+
+class PopupCheck : public Popup {
+public:
+ PopupCheck(Evas_Object *parent, const std::string &msg)
+ : Popup(parent, msg)
+ {}
+
+ Evas_Object *getCheckBox() const { return m_checkBox; }
+ bool getCheckboxState() const {
+ if (m_checkBox == nullptr)
+ return false;
+ return elm_check_state_get(m_checkBox);
+ }
+
+ virtual ~PopupCheck() {}
+
+protected:
+ Evas_Object *m_checkBox = nullptr;
+};
+
+} /* namespace Notification */
+} /* namespace Askuser */
+
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co.
+ *
+ * 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
+ */
+/**
+ * @file src/agent/notification-daemon/ui/PopupCheckMobile.h
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Declaration of PopupCheckMobile class
+ */
+
+#pragma once
+
+#include <Elementary.h>
+
+#include <exception/Exception.h>
+#include "Po.h"
+#include "PopupCheck.h"
+
+namespace AskUser {
+namespace Notification {
+
+class PopupCheckMobile : public PopupCheck {
+public:
+ PopupCheckMobile(Evas_Object *parent, int popupId, const std::string &msg)
+ : PopupCheck(parent, msg)
+ {
+ setId(popupId);
+ }
+ virtual void create() {
+ // popup
+ elm_popup_align_set(m_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ elm_object_part_text_set(m_popup, "title,text", Po::getPopupTitleMsg().c_str());
+ evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ // layout
+ m_layout = elm_layout_add(m_popup);
+ if (m_layout == nullptr) {
+ ALOGE("EFL : Failed to add layout");
+ throw Exception("Enlightenment failed");
+ }
+ elm_layout_file_set(m_layout, RES_DIR"/popup_custom.edj", "popup_checkview_layout_mobile");
+ evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ // content
+ m_content = elm_label_add(m_layout);
+ if (!m_content) {
+ ALOGE("EFL : Failed to add content");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_text_set(m_content, m_msg.c_str());
+ elm_object_style_set(m_content, "popup/default");
+ elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
+ evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(m_layout, "elm.swallow.content", m_content);
+
+ // checkbox
+ m_checkBox = elm_check_add(m_layout);
+ if (!m_checkBox) {
+ ALOGE("EFL : Failed to add checkbox");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_part_content_set(m_layout, "elm.swallow.end", m_checkBox);
+ elm_object_text_set(m_checkBox, Po::getCheckBoxMsg().c_str());
+ elm_check_state_set(m_checkBox, EINA_FALSE);
+ evas_object_show(m_checkBox);
+
+ // buttons
+ m_denyButton = elm_button_add(m_popup);
+ if (!m_denyButton) {
+ ALOGE("EFL : Failed to add deny button");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_part_content_set(m_popup, "button1", m_denyButton);
+ elm_object_text_set(m_denyButton, Po::getDenyButtonMsg().c_str());
+
+ m_allowButton = elm_button_add(m_popup);
+ if (!m_allowButton) {
+ ALOGE("EFL : Failed to add allow button");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_part_content_set(m_popup, "button2", m_allowButton);
+ elm_object_text_set(m_allowButton, Po::getAllowButtonMsg().c_str());
+ elm_object_content_set(m_popup, m_layout);
+ evas_object_show(m_popup);
+ }
+ virtual ~PopupCheckMobile() {
+
+ }
+private:
+ Evas_Object *m_content = nullptr;
+ Evas_Object *m_layout = nullptr;
+ Evas_Object *m_layoutInner = nullptr;
+};
+
+} /* namespace Notification */
+} /* namespace Askuser */
+
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co.
+ *
+ * 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
+ */
+/**
+ * @file src/agent/notification-daemon/ui/PopupCheckWearable.h
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Declaration of PopupCheckWearable class
+ */
+
+#pragma once
+
+#include <Elementary.h>
+
+#include <exception/Exception.h>
+#include "Po.h"
+#include "PopupCheck.h"
+
+namespace AskUser {
+namespace Notification {
+
+class PopupCheckWearable : public PopupCheck {
+public:
+ PopupCheckWearable(Evas_Object *parent, int popupId, const std::string msg)
+ : PopupCheck(parent, msg)
+ {
+ setId(popupId);
+ }
+ ~PopupCheckWearable() {}
+
+ virtual void create() {
+ elm_object_style_set(m_popup, "circle");
+
+ m_layout = elm_layout_add(m_popup);
+ if (m_layout == nullptr) {
+ ALOGE("EFL : Failed to add layout");
+ throw Exception("Enlightenment failed");
+ }
+ elm_layout_theme_set(m_layout, "layout", "popup", "content/circle/buttons2");
+ elm_object_part_text_set(m_layout, "elm.text.title", Po::getPopupTitleMsg().c_str());
+ elm_object_content_set(m_popup, m_layout);
+
+ m_layoutInner = elm_layout_add(m_layout);
+ if (m_layoutInner == nullptr) {
+ ALOGE("EFL : Failed to add layout");
+ throw Exception("Enlightenment failed");
+ }
+ elm_layout_file_set(m_layoutInner, RES_DIR"/popup_custom.edj", "popup_checkview_internal");
+ evas_object_size_hint_weight_set(m_layoutInner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(m_layout, "elm.swallow.content", m_layoutInner);
+
+ m_content = elm_label_add(m_layoutInner);
+ if (m_content == nullptr) {
+ ALOGE("EFL : Failed to add content");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_text_set(m_content, m_msg.c_str());
+ elm_object_style_set(m_content, "popup/default");
+ elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
+ evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(m_layoutInner, "label", m_content);
+
+ m_checkBox = elm_check_add(m_popup);
+ if (m_checkBox == nullptr) {
+ ALOGE("EFL : Failed to add checkbox");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_style_set(m_checkBox, "popup");
+ elm_object_text_set(m_checkBox, Po::getCheckBoxMsg().c_str());
+ elm_check_state_set(m_checkBox, EINA_FALSE);
+ evas_object_size_hint_align_set(m_checkBox, EVAS_HINT_FILL, 0.0);
+ elm_object_part_content_set(m_layoutInner, "elm.swallow.end", m_checkBox);
+ evas_object_show(m_checkBox);
+
+ m_allowButton = elm_button_add(m_popup);
+ if (m_allowButton == nullptr) {
+ ALOGE("EFL : Failed to add allow button");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_style_set(m_allowButton, "popup/circle/right");
+ elm_object_part_content_set(m_popup, "button2", m_allowButton);
+
+ Evas_Object *icon;
+ icon = elm_image_add(m_allowButton);
+ if (icon == nullptr) {
+ ALOGE("EFL : Failed to add allow button icon");
+ throw Exception("Enlightenment failed");
+ }
+ elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_check.png", NULL);
+ evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(m_allowButton, "elm.swallow.content", icon);
+ evas_object_show(icon);
+
+ m_denyButton = elm_button_add(m_popup);
+ if (m_denyButton == nullptr) {
+ ALOGE("EFL : Failed to add deny button");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_style_set(m_denyButton, "popup/circle/left");
+ elm_object_part_content_set(m_popup, "button1", m_denyButton);
+
+ icon = elm_image_add(m_denyButton);
+ if (icon == nullptr) {
+ ALOGE("EFL : Failed to add deny button icon");
+ throw Exception("Enlightenment failed");
+ }
+ elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_delete.png", NULL);
+ elm_object_part_content_set(m_denyButton, "elm.swallow.content", icon);
+ evas_object_show(icon);
+
+ evas_object_show(m_popup);
+ }
+private:
+ Evas_Object *m_content = nullptr;
+ Evas_Object *m_layout = nullptr;
+ Evas_Object *m_layoutInner = nullptr;
+};
+
+} /* namespace Notification */
+} /* namespace Askuser */
+
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co.
+ *
+ * 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
+ */
+/**
+ * @file src/agent/notification-daemon/ui/PopupLaunchMobile.h
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Declaration of PopupLaunchMobile class
+ */
+
+#pragma once
+
+#include <Elementary.h>
+
+#include <exception/Exception.h>
+#include "Po.h"
+#include "Popup.h"
+
+namespace AskUser {
+namespace Notification {
+
+class PopupLaunchMobile : public Popup {
+public:
+ PopupLaunchMobile(Evas_Object *parent, int popupId, const std::string &msg)
+ : Popup(parent, msg)
+ {
+ setId(popupId);
+ }
+ virtual ~PopupLaunchMobile() {}
+
+ virtual void create() {
+ // popup
+ elm_popup_align_set(m_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ elm_object_part_text_set(m_popup, "title,text", Po::getPopupTitleMsg().c_str());
+ evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ // layout
+ m_layout = elm_layout_add(m_popup);
+ if (m_layout == nullptr) {
+ ALOGE("EFL : Failed to add layout");
+ throw Exception("Enlightenment failed");
+ }
+ elm_layout_file_set(m_layout, RES_DIR"/popup_custom.edj", "popup_layout_mobile");
+ evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ // content
+ m_content = elm_label_add(m_layout);
+ if (!m_content) {
+ ALOGE("EFL : Failed to add content");
+ throw Exception("Enlightement failed");
+ }
+ elm_object_text_set(m_content, m_msg.c_str());
+ elm_object_style_set(m_content, "popup/default");
+ elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
+ evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(m_layout, "elm.swallow.content", m_content);
+
+ // buttons
+ m_denyButton = elm_button_add(m_popup);
+ if (!m_denyButton) {
+ ALOGE("EFL : Failed to add deny button");
+ throw Exception("Enlightement failed");
+ }
+ elm_object_part_content_set(m_popup, "button1", m_denyButton);
+ elm_object_text_set(m_denyButton, Po::getDenyButtonMsg().c_str());
+
+ m_allowButton = elm_button_add(m_popup);
+ if (!m_allowButton) {
+ ALOGE("EFL : Failed to add allow button");
+ throw Exception("Enlightement failed");
+ }
+ elm_object_part_content_set(m_popup, "button2", m_allowButton);
+ elm_object_text_set(m_allowButton, Po::getAllowButtonMsg().c_str());
+ elm_object_content_set(m_popup, m_layout);
+ evas_object_show(m_popup);
+ }
+private:
+ Evas_Object *m_content = nullptr;
+ Evas_Object *m_layout = nullptr;
+ Evas_Object *m_layoutInner = nullptr;
+};
+
+} /* namespace Notification */
+} /* namespace Askuser */
+
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co.
+ *
+ * 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
+ */
+/**
+ * @file src/agent/notification-daemon/ui/PopupLaunchWearable.h
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Declaration of PopupLaunchWearableper class
+ */
+
+#pragma once
+
+#include <Elementary.h>
+
+#include <exception/Exception.h>
+#include "Po.h"
+#include "Popup.h"
+
+namespace AskUser {
+namespace Notification {
+
+class PopupLaunchWearable : public Popup {
+public:
+ PopupLaunchWearable(Evas_Object *parent, int popupId, const std::string msg)
+ : Popup(parent, msg)
+ {
+ setId(popupId);
+ }
+ virtual ~PopupLaunchWearable() {}
+
+ virtual void create() {
+ Evas_Object *icon;
+ elm_object_style_set(m_popup, "circle");
+
+ m_layout = elm_layout_add(m_popup);
+ if (m_layout == nullptr) {
+ ALOGE("EFL : Failed to add layout");
+ throw Exception("Enlightenment failed");
+ }
+ elm_layout_theme_set(m_layout, "layout", "popup", "content/circle/buttons2");
+ elm_object_part_text_set(m_layout, "elm.text.title", Po::getPopupTitleMsg().c_str());
+ elm_object_content_set(m_popup, m_layout);
+
+ m_layoutInner = elm_layout_add(m_layout);
+ if (m_layoutInner == nullptr) {
+ ALOGE("EFL : Failed to add layout");
+ throw Exception("Enlightenment failed");
+ }
+ elm_layout_file_set(m_layoutInner, RES_DIR"/popup_custom.edj", "popup_checkview_internal");
+ evas_object_size_hint_weight_set(m_layoutInner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(m_layout, "elm.swallow.content", m_layoutInner);
+
+ m_content = elm_label_add(m_layoutInner);
+ if (m_content == nullptr) {
+ ALOGE("EFL : Failed to add content");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_text_set(m_content, m_msg.c_str());
+ elm_object_style_set(m_content, "popup/default");
+ elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
+ evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(m_layoutInner, "label", m_content);
+
+ m_allowButton = elm_button_add(m_popup);
+ if (m_allowButton == nullptr) {
+ ALOGE("EFL : Failed to add allow button");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_style_set(m_allowButton, "popup/circle/right");
+ elm_object_part_content_set(m_popup, "button2", m_allowButton);
+
+ icon = elm_image_add(m_allowButton);
+ if (icon == nullptr) {
+ ALOGE("EFL : Failed to add allow button icon");
+ throw Exception("Enlightenment failed");
+ }
+ elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_check.png", NULL);
+ evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(m_allowButton, "elm.swallow.content", icon);
+ evas_object_show(icon);
+
+ m_denyButton = elm_button_add(m_popup);
+ if (m_denyButton == nullptr) {
+ ALOGE("EFL : Failed to add deny button");
+ throw Exception("Enlightenment failed");
+ }
+ elm_object_style_set(m_denyButton, "popup/circle/left");
+ elm_object_part_content_set(m_popup, "button1", m_denyButton);
+
+ icon = elm_image_add(m_denyButton);
+ if (icon == nullptr) {
+ ALOGE("EFL : Failed to add deny button icon");
+ throw Exception("Enlightenment failed");
+ }
+ elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_delete.png", NULL);
+ elm_object_part_content_set(m_denyButton, "elm.swallow.content", icon);
+ evas_object_show(icon);
+
+ evas_object_show(m_popup);
+ }
+private:
+ std::vector<std::string> m_privs;
+ Evas_Object *m_content = nullptr;
+ Evas_Object *m_layout = nullptr;
+ Evas_Object *m_layoutInner = nullptr;
+};
+
+} /* namespace Notification */
+} /* namespace Askuser */
+
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co.
+ *
+ * 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
+ */
+/**
+ * @file src/agent/notification-daemon/ui/Toast.h
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Declaration of Toast class
+ */
+
+#pragma once
+
+#include <exception>
+#include <string>
+
+#include <notification_status.h>
+#include <notification_error.h>
+
+#include <log/alog.h>
+#include "UIElement.h"
+
+namespace AskUser {
+namespace Notification {
+
+class Toast : public UIElement {
+public:
+ Toast(Evas_Object *m_parentWindow, int toastId, const std::string msg) : UIElement(m_parentWindow), m_msg(msg)
+ {
+ setId(toastId);
+ }
+ virtual void create() {
+ int ret = notification_status_message_post(m_msg.c_str());
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ ALOGE("notification_status_message_post failed with " << ret);
+ throw std::runtime_error("notification_status_message_post failed with " + std::to_string(ret));
+ }
+ }
+private:
+ std::string m_msg;
+};
+
+} /* namespace Notification */
+} /* namespace Askuser */
+
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co.
+ *
+ * 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
+ */
+/**
+ * @file src/agent/notification-daemon/UIElement.h
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Declaration of UIElement class
+ */
+
+#pragma once
+
+#include <Elementary.h>
+
+namespace AskUser {
+namespace Notification {
+
+class UIElement {
+public:
+ explicit UIElement(Evas_Object *parent) : m_parent(parent), m_elementId(-1) {}
+ void setId(int id) { m_elementId = id;}
+ int getId() { return m_elementId; }
+ virtual void create() = 0;
+ virtual ~UIElement() {}
+protected:
+ Evas_Object *m_parent;
+ int m_elementId;
+};
+
+} /* namespace Notification */
+} /* namespace Askuser */
+