BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(libsystemd-daemon)
BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(pkgmgr)
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(libsmack)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(elementary)
%if "%{platform_version}" == "3.0"
BuildRequires: pkgconfig(cynara-client)
%else
<smack request="pkgmgr::db" type="rwx" />
<smack request="pkgmgr::svc" type="r" />
<smack request="system::use_internet" type="w" />
+ <smack request="aul::launch" type="x" />
+ <smack request="app-svc::db" type="rw" />
<smack request="system::media" type="rwxat" />
<smack request="system::homedir" type="rwxat" />
libsystemd-daemon
vconf
pkgmgr-info
+ capi-appfw-application
)
INCLUDE_DIRECTORIES(
p.m_types.emplace_back(
static_cast<int>(CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED));
- p.callbackRegister(p.m_buttons[0], "clicked", &p.m_types[0]);
+ p.callbackRegister(p.m_buttons[0], &p.m_types[0]);
+ p.callbackRegister(p.m_hypertext, d.detailedUrl);
p.run();
return p.getResult();
p.m_types.emplace_back(
static_cast<int>(CSR_CS_USER_RESPONSE_REMOVE));
- p.callbackRegister(p.m_buttons[0], "clicked", &p.m_types[0]);
- p.callbackRegister(p.m_buttons[1], "clicked", &p.m_types[1]);
- p.callbackRegister(p.m_buttons[2], "clicked", &p.m_types[2]);
+ p.callbackRegister(p.m_buttons[0], &p.m_types[0]);
+ p.callbackRegister(p.m_buttons[1], &p.m_types[1]);
+ p.callbackRegister(p.m_buttons[2], &p.m_types[2]);
+ p.callbackRegister(p.m_hypertext, d.detailedUrl);
p.run();
return p.getResult();
p.m_types.emplace_back(
static_cast<int>(CSR_CS_USER_RESPONSE_REMOVE));
- p.callbackRegister(p.m_buttons[0], "clicked", &p.m_types[0]);
- p.callbackRegister(p.m_buttons[1], "clicked", &p.m_types[1]);
- p.callbackRegister(p.m_buttons[2], "clicked", &p.m_types[2]);
+ p.callbackRegister(p.m_buttons[0], &p.m_types[0]);
+ p.callbackRegister(p.m_buttons[1], &p.m_types[1]);
+ p.callbackRegister(p.m_buttons[2], &p.m_types[2]);
+ p.callbackRegister(p.m_hypertext, d.detailedUrl);
p.run();
return p.getResult();
p.m_types.emplace_back(
static_cast<int>(CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED));
- p.callbackRegister(p.m_buttons[0], "clicked", &p.m_types[0]);
+ p.callbackRegister(p.m_buttons[0], &p.m_types[0]);
+ p.callbackRegister(p.m_hypertext, d.detailedUrl);
p.run();
return p.getResult();
p.m_types.emplace_back(
static_cast<int>(CSR_CS_USER_RESPONSE_REMOVE));
- p.callbackRegister(p.m_buttons[0], "clicked", &p.m_types[0]);
- p.callbackRegister(p.m_buttons[1], "clicked", &p.m_types[1]);
+ p.callbackRegister(p.m_buttons[0], &p.m_types[0]);
+ p.callbackRegister(p.m_buttons[1], &p.m_types[1]);
+ p.callbackRegister(p.m_hypertext, d.detailedUrl);
p.run();
return p.getResult();
p.m_types.emplace_back(
static_cast<int>(CSR_CS_USER_RESPONSE_PROCESSING_ALLOWED));
- p.callbackRegister(p.m_buttons[0], "clicked", &p.m_types[0]);
- p.callbackRegister(p.m_buttons[1], "clicked", &p.m_types[1]);
+ p.callbackRegister(p.m_buttons[0], &p.m_types[0]);
+ p.callbackRegister(p.m_buttons[1], &p.m_types[1]);
+ p.callbackRegister(p.m_hypertext, d.detailedUrl);
p.run();
return p.getResult();
Popup p(1);
p.setMessage(message);
- p.setTitle(" Block malicious URL");
+ p.setTitle("Block malicious URL");
p.setHeader(" This website may harm your phone.");
p.setBody(FORMAT(
" - URL : " << item.url << "<br>" <<
p.m_types.emplace_back(static_cast<int>(CSR_WP_USER_RESPONSE_PROCESSING_DISALLOWED));
- p.callbackRegister(p.m_buttons[0], "clicked", &p.m_types[0]);
+ p.callbackRegister(p.m_buttons[0], &p.m_types[0]);
+ p.callbackRegister(p.m_hypertext, item.url);
p.run();
return p.getResult();
Popup p(2);
p.setMessage(message);
- p.setTitle(" Block malicious URL");
+ p.setTitle("Block malicious URL");
p.setHeader(" This website may harm your phone.");
p.setBody(FORMAT(
" - URL : " << item.url << "<br>" <<
p.m_types.emplace_back(
static_cast<int>(CSR_WP_USER_RESPONSE_PROCESSING_ALLOWED));
- p.callbackRegister(p.m_buttons[0], "clicked", &p.m_types[0]);
- p.callbackRegister(p.m_buttons[1], "clicked", &p.m_types[1]);
+ p.callbackRegister(p.m_buttons[0], &p.m_types[0]);
+ p.callbackRegister(p.m_buttons[1], &p.m_types[1]);
+ p.callbackRegister(p.m_hypertext, item.url);
p.run();
return p.getResult();
* @brief
*/
#include "popup.h"
+
#include <package-info.h>
+#include <app_control.h>
namespace Csr {
namespace Ui {
+namespace {
+ struct AppControl {
+ AppControl() { app_control_create(&handle); }
+ ~AppControl() { app_control_destroy(handle); }
+
+ app_control_h handle;
+ };
+
+ const std::string DEFAULT_URL("https://developer.tizen.org/");
+}
+
Popup::Popup(int buttonN)
{
// Set win properties.
// If icon is not set, it doesn't appear.
m_icon = elm_icon_add(m_subBox);
- // TODO(sangwan.kwon) Fix icon size
elm_image_resizable_set(m_icon, EINA_FALSE, EINA_FALSE);
elm_box_pack_end(m_subBox, m_icon);
evas_object_show(m_icon);
evas_object_show(m_subBox);
// This label is for linking to webview.
- m_hypertext = elm_label_add(m_box);
- elm_object_text_set(m_hypertext, "<color=#0000FFFF>"
- " More information</color>");
+ m_hypertext = elm_button_add(m_box);
+ elm_object_text_set(m_hypertext, "More information");
evas_object_size_hint_align_set(m_hypertext, EVAS_HINT_FILL, 0);
elm_box_pack_end(m_box, m_hypertext);
evas_object_show(m_hypertext);
+ elm_object_style_set(m_hypertext, "anchor");
m_footer = elm_label_add(m_box);
evas_object_size_hint_align_set(m_footer, EVAS_HINT_FILL, 0);
elm_object_text_set(obj, text.c_str());
}
-void Popup::callbackRegister(Evas_Object *obj, const char *event, int *type)
+void Popup::callbackRegister(Evas_Object *obj, int *type)
{
- evas_object_smart_callback_add(obj, event, btnClickedCb, type);
+ evas_object_smart_callback_add(obj, "clicked", btnClickedCb, type);
+}
+
+void Popup::callbackRegister(Evas_Object *obj, const std::string &url)
+{
+ if (url.empty())
+ evas_object_smart_callback_add(
+ obj, "clicked", hypertextClickedCb, &DEFAULT_URL);
+ else
+ evas_object_smart_callback_add(
+ obj, "clicked", hypertextClickedCb, &url);
+}
+
+void Popup::hypertextClickedCb(void *data, Evas_Object *, void *)
+{
+ DEBUG("Launch browser for detailed url.");
+
+ std::string url = *(reinterpret_cast<std::string *>(data));
+ std::unique_ptr<AppControl> ac(new AppControl);
+
+ auto ret = app_control_set_operation(ac->handle, APP_CONTROL_OPERATION_VIEW);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ WARN("Cannot set app_control operation.");
+ return;
+ }
+
+ ret = app_control_set_uri(ac->handle, url.c_str());
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ WARN("Cannot set url to app_control handle.");
+ return;
+ }
+
+ ret = app_control_send_launch_request(ac->handle, NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ WARN("Cannot launch browser.");
+ return;
+ }
}
void Popup::btnClickedCb(void *data, Evas_Object *, void *)
void setIcon(const std::string &path) noexcept;
void setText(Evas_Object *obj, const std::string &text) noexcept;
- void callbackRegister(Evas_Object *obj, const char *event, int *type);
+ void callbackRegister(Evas_Object *obj, int *type);
+ void callbackRegister(Evas_Object *obj, const std::string &url);
static void btnClickedCb(void *data, Evas_Object *, void *);
+ static void hypertextClickedCb(void *data, Evas_Object *, void *);
std::vector<Evas_Object *> m_objects;
std::vector<Evas_Object *> m_buttons;
+ Evas_Object *m_hypertext;
std::vector<int> m_types;
private:
Evas_Object *m_subBox;
Evas_Object *m_header;
Evas_Object *m_body;
- Evas_Object *m_hypertext;
Evas_Object *m_footer;
Evas_Object *m_icon;