#include <exception/Exception.h>
#include <translator/Translator.h>
#include <libintl.h>
+#include "Policy.h"
namespace AskUser {
void GuiRunner::initialize()
{
+ char *popupTitle = dgettext(PROJECT_NAME, "SID_PRIVILEGE_REQUEST_DIALOG_TITLE");
+ char *checkBoxText = dgettext(PROJECT_NAME, "SID_PRIVILEGE_REQUEST_DIALOG_CHECKBOX_ALWAYS");
elm_init(0, NULL);
//placeholder
- m_win = elm_win_add(NULL, dgettext(PROJECT_NAME, "SID_PRIVILEGE_REQUEST_DIALOG_TITLE"),
- ELM_WIN_DOCK);
+ m_win = elm_win_add(NULL, popupTitle, ELM_WIN_DOCK);
if (!m_win) {
ALOGE("EFL : Failed to add window");
throw Exception("Elementary failed");
elm_win_override_set(m_win, EINA_TRUE);
elm_win_alpha_set(m_win, EINA_TRUE);
+#ifdef MOBILE_UI
// popup
m_popup = elm_popup_add(m_win);
if (!m_popup) {
ALOGE("EFL : Failed to add popup");
throw Exception("Elementary failed");
}
- elm_object_part_text_set(m_popup, "title,text", dgettext(PROJECT_NAME,
- "SID_PRIVILEGE_REQUEST_DIALOG_TITLE"));
+ elm_object_part_text_set(m_popup, "title,text", popupTitle);
// box
m_box = elm_box_add(m_popup);
ALOGE("EFL : Failed to add checkbox");
throw Exception("Enlightement failed");
}
- elm_object_part_content_set(m_popup, "checkbox1", m_checkbox);
- elm_object_text_set(m_checkbox, dgettext(PROJECT_NAME,
- "SID_PRIVILEGE_REQUEST_DIALOG_CHECKBOX_ALWAYS"));
+ elm_object_content_set(m_popup, m_checkbox);
+ elm_object_text_set(m_checkbox, checkBoxText);
elm_check_state_set(m_checkbox, EINA_FALSE);
evas_object_size_hint_align_set(m_checkbox, EVAS_HINT_FILL, 0.0);
evas_object_show(m_checkbox);
ALOGE("EFL : Failed to add allow button");
throw Exception("Enlightement failed");
}
- elm_object_part_content_set(m_popup, "button3", m_allowButton);
+ elm_object_part_content_set(m_popup, "button2", m_allowButton);
elm_object_text_set(m_allowButton, dgettext(PROJECT_NAME,
"SID_PRIVILEGE_REQUEST_DIALOG_BUTTON_ALLOW"));
+#elif defined(CIRCLE_UI)
+ Evas_Object *icon;
+ m_popup = elm_popup_add(m_win);
+ elm_object_style_set(m_popup, "circle");
+
+ m_layout = elm_layout_add(m_popup);
+ elm_layout_theme_set(m_layout, "layout", "popup", "content/circle/buttons2");
+ elm_object_part_text_set(m_layout, "elm.text.title", popupTitle);
+ elm_object_content_set(m_popup, m_layout);
+
+ m_layoutInner = elm_layout_add(m_layout);
+ 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);
+ 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);
+ elm_object_style_set(m_checkbox, "popup");
+ elm_object_text_set(m_checkbox, checkBoxText);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+#endif
// callbacks
evas_object_smart_callback_add(m_win, "unfocused", &GuiRunner::unfocused, this);
evas_object_smart_callback_add(m_allowButton, "clicked", &GuiRunner::allowAnswerCb, this);
initialize();
}
m_running = true;
-
+ std::string appId;
+ identifyApp(app, appId);
// create message
char *messageFormat = dgettext(PROJECT_NAME, "SID_PRIVILEGE_REQUEST_DIALOG_MESSAGE");
char buf[BUFSIZ];
int ret = std::snprintf(buf, sizeof(buf), messageFormat,
- app.c_str(),
+ appId.c_str(),
perm.c_str());
if (ret < 0)
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+collections {
+ base_scale: 1.3;
+//Height = 480 - (2 + 83 + 68)
+group { name: "popup_checkview_internal";
+ parts {
+ part { name: "label";
+ scale: 1;
+ type: SWALLOW;
+ description { state: "default" 0.0;
+ fixed: 1 0;
+ rel2 {
+ relative: 1.0 0.0;
+ to_y: "end_field";
+ }
+ }
+ }
+ part { name: "bottom_pad";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ align: 0.0 1.0;
+ min: 0 4;
+ fixed: 0 1;
+ rel1.relative: 0.0 1.0;
+ }
+ }
+ part { name: "pad_b";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ align: 0.0 1.0;
+ min: 0 90;
+ fixed: 0 1;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "bottom_pad";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to: "bottom_pad";
+ }
+ }
+ }
+ part { name: "left_pad";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 0;
+ min: 16 0;
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ }
+ }
+ }
+ part { name: "right_pad";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 0;
+ min: 16 0;
+ rel1 {
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ }
+ part { name: "end_field";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ align: 0.0 1.0;
+ min: 0 90;
+ max: 244 -1;
+ fixed: 0 1;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "left_pad";
+ to_y: "pad_b";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "right_pad";
+ to_y: "pad_b";
+ }
+ }
+ }
+ part { name: "elm.swallow.end";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1.to: "end_field";
+ rel2.to: "end_field";
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ }
+ }
+}
+}