Refine popup layout for linking to web page 62/72962/2
authorsangwan.kwon <sangwan.kwon@samsung.com>
Thu, 2 Jun 2016 07:30:28 +0000 (16:30 +0900)
committersangwan.kwon <sangwan.kwon@samsung.com>
Fri, 3 Jun 2016 08:46:02 +0000 (17:46 +0900)
* "More information" pressed, popup should link to detailed web page
* For this, seperate popup text to several label

Change-Id: I7832e0594a268a169dd6ec0304933b4adc442397

src/framework/ui/popup/logic.cpp
src/framework/ui/popup/popup.cpp
src/framework/ui/popup/popup.h

index 8832c5c..1b457bc 100755 (executable)
@@ -16,6 +16,7 @@
 /*
  * @file        logic.cpp
  * @author      Kyungwook Tak (k.tak@samsung.com)
+ * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
  * @version     1.0
  * @brief       Logic for popup service
  */
@@ -55,12 +56,10 @@ RawBuffer Logic::csPromptData(const std::string &message, const CsDetected &d) c
        Popup p(1);
 
        p.setMessage(message);
-       p.setTitle("Malware detected");
-       p.setHeader("Malware which is harm your phone is detected.");
-       p.setBody(FORMAT(
-                       "- Risk : " << risk << " (" << d.malwareName << ")" <<
-                       "<br><br>" << "More information"));
-       p.setFooter("Processing is prohibited to protect your phone.");
+       p.setTitle("    Malware detected");
+       p.setHeader("    Malware which is harm your phone is detected.");
+       p.setBody(FORMAT("    - Risk : " << risk << " (" << d.malwareName << ")"));
+       p.setFooter("    Processing is prohibited to protect your phone.");
 
        p.setText(p.m_buttons[0], "OK");
 
@@ -82,16 +81,16 @@ RawBuffer Logic::csPromptFile(const std::string &message, const CsDetected &d) c
        Popup p(3);
 
        p.setMessage(message);
-       p.setTitle("Malware detected");
-       p.setHeader("Malware which is harm your phone is detected.");
+       p.setTitle("    Malware detected");
+       p.setHeader("    Malware which is harm your phone is detected.");
        p.setBody(FORMAT(
-                       "- File name : " << fileName << "<br>" <<
-                       "- Path : " << extraPath << "<br>" <<
-                       "- Risk : " << risk << " (" << d.malwareName << ")" <<
-                       "<br><br>" << "More information"));
-       p.setFooter("Tap Delete to delete infected files and"
-               "protect your phone. If you really want to"
-               "process anyway, tap Ignore.");
+               "    - File name : " << fileName << "<br>" <<
+               "    - Path : " << extraPath << "<br>" <<
+               "    - Risk : " << risk << " (" << d.malwareName << ")"));
+       p.setFooter(
+               "    Tap Delete to delete infected files and<br>"
+               "    protect your phone. If you really want to<br>"
+               "    process anyway, tap Ignore.");
 
        p.setText(p.m_buttons[0], "OK");
        p.setText(p.m_buttons[1], "Ignore");
@@ -119,16 +118,16 @@ RawBuffer Logic::csPromptApp(const std::string &message, const CsDetected &d) co
        Popup p(3);
 
        p.setMessage(message);
-       p.setTitle("Malware detected");
-       p.setHeader("Malware which is harm your phone is detected.");
+       p.setTitle("    Malware detected");
+       p.setHeader("    Malware which is harm your phone is detected.");
        p.setBody(FORMAT(
-                       "App name : " << d.targetName << "<br>" <<
-                       "Version : " << "1.0" << "<br>" <<
-                       "Risk : " << risk << " (" << d.malwareName << ")" <<
-                       "<br><br>" << "More information"));
-       p.setFooter("Tap Uninstall to uninstall infected"
-               "application and protect your phone."
-               "If you really want to process anyway, tap Ignore.");
+               "    App name : " << d.targetName << "<br>" <<
+               "    Version : " << "1.0" << "<br>" <<
+               "    Risk : " << risk << " (" << d.malwareName << ")"));
+       p.setFooter(
+               "    Tap Uninstall to uninstall infected<br>"
+               "    application and protect your phone.<br>"
+               "    If you really want to process anyway, tap Ignore.");
 
        p.setText(p.m_buttons[0], "OK");
        p.setText(p.m_buttons[1], "Ignore");
@@ -154,12 +153,10 @@ RawBuffer Logic::csNotifyData(const std::string &message, const CsDetected &d) c
        Popup p(1);
 
        p.setMessage(message);
-       p.setTitle("Malware detected");
-       p.setHeader("Malware which is harm your phone is detected.");
-       p.setBody(FORMAT(
-                       "- Risk : " << "High" << " (" << d.malwareName << ")" <<
-                       "<br><br>" << "More information"));
-       p.setFooter("Processing is prohibited to protect your phone.");
+       p.setTitle("    Malware detected");
+       p.setHeader("    Malware which is harm your phone is detected.");
+       p.setBody(FORMAT("    - Risk : " << "High" << " (" << d.malwareName << ")"));
+       p.setFooter("    Processing is prohibited to protect your phone.");
 
        p.setText(p.m_buttons[0], "OK");
 
@@ -179,15 +176,15 @@ RawBuffer Logic::csNotifyFile(const std::string &message, const CsDetected &d) c
        split(d.targetName, fileName, extraPath);
 
        p.setMessage(message);
-       p.setTitle("Malware detected");
-       p.setHeader("Malware which is harm your phone is detected.");
+       p.setTitle("    Malware detected");
+       p.setHeader("    Malware which is harm your phone is detected.");
        p.setBody(FORMAT(
-                       "- File name : " << fileName << "<br>" <<
-                       "- Path : " << extraPath << "<br>" <<
-                       "- Risk : " << "High" << " (" << d.malwareName << ")" <<
-                       "<br><br>" << "More information"));
-       p.setFooter("Tap Delete to delete infected files and"
-               "protect your phone.");
+               "    - File name : " << fileName << "<br>" <<
+               "    - Path : " << extraPath << "<br>" <<
+               "    - Risk : " << "High" << " (" << d.malwareName << ")"));
+       p.setFooter(
+               "    Tap Delete to delete infected files and<br>"
+               "    protect your phone.");
 
        p.setText(p.m_buttons[0], "OK");
        p.setText(p.m_buttons[1], "Delete");
@@ -209,15 +206,15 @@ RawBuffer Logic::csNotifyApp(const std::string &message, const CsDetected &d) co
        Popup p(2);
 
        p.setMessage(message);
-       p.setTitle("Malware detected");
-       p.setHeader("Malware which is harm your phone is detected.");
+       p.setTitle("    Malware detected");
+       p.setHeader("    Malware which is harm your phone is detected.");
        p.setBody(FORMAT(
-                       "App name : " << d.targetName << "<br>" <<
-                       "Version : " << "1.0" << "<br>" <<
-                       "Risk : " << "High" << " (" << d.malwareName << ")" <<
-                       "<br><br>" << "More information"));
-       p.setFooter("Tap Uninstall to uninstall infected"
-               "application and protect your phone.");
+               "    App name : " << d.targetName << "<br>" <<
+               "    Version : " << "1.0" << "<br>" <<
+               "    Risk : " << "High" << " (" << d.malwareName << ")"));
+       p.setFooter(
+               "    Tap Uninstall to uninstall infected<br>"
+               "    application and protect your phone.");
 
        p.setText(p.m_buttons[0], "OK");
        p.setText(p.m_buttons[1], "Uninstall");
@@ -241,13 +238,14 @@ RawBuffer Logic::wpPrompt(const std::string &message, const UrlItem &item) const
        Popup p(1);
 
        p.setMessage(message);
-       p.setTitle("Block malicious URL");
-       p.setHeader("This website may harm your phone.");
+       p.setTitle("    Block malicious URL");
+       p.setHeader("    This website may harm your phone.");
        p.setBody(FORMAT(
-                       "- URL : " << item.url << "<br>" <<
-                       "- Risk : " << risk << "<br><br>" <<
-                       "More information"));
-       p.setFooter("Accessing to this URL is prohibited to protect your phone.");
+               "    - URL : " << item.url << "<br>" <<
+               "    - Risk : " << risk));
+       p.setFooter(
+               "    Accessing to this URL is prohibited to<br>"
+               "    protect your phone.");
 
        p.setText(p.m_buttons[0], "OK");
 
@@ -264,13 +262,14 @@ RawBuffer Logic::wpNotify(const std::string &message, const UrlItem &item) const
        Popup p(2);
 
        p.setMessage(message);
-       p.setTitle("Block malicious URL");
-       p.setHeader("This website may harm your phone.");
+       p.setTitle("    Block malicious URL");
+       p.setHeader("   This website may harm your phone.");
        p.setBody(FORMAT(
-                       "- URL : " << item.url << "<br>" <<
-                       "- Risk : " << "High" << "<br><br>" <<
-                       "More information"));
-       p.setFooter("If you really want to process anyway, tap View");
+               "    - URL : " << item.url << "<br>" <<
+               "    - Risk : " << "High"));
+       p.setFooter(
+               "   If you really want to process anyway,<br>"
+               "   tap View");
 
        p.setText(p.m_buttons[0], "OK");
        p.setText(p.m_buttons[1], "View");
index 51f3f1c..9bb5517 100644 (file)
@@ -35,15 +35,44 @@ Popup::Popup(int buttonN)
        m_popup = elm_popup_add(m_win);
        evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
+       m_box = elm_box_add(m_popup);
+
+       m_header = elm_label_add(m_box);
+       evas_object_size_hint_align_set(m_header, EVAS_HINT_FILL, 0);
+       elm_box_pack_end(m_box, m_header);
+       evas_object_show(m_header);
+
+       m_body = elm_label_add(m_box);
+       evas_object_size_hint_align_set(m_body, EVAS_HINT_FILL, 0);
+       elm_box_pack_end(m_box, m_body);
+       evas_object_show(m_body);
+
+       m_hypertext = elm_label_add(m_box);
+       elm_object_text_set(m_hypertext,"<color=#0000FFFF>"
+               "    More information</color>");
+       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);
+
+       m_footer = elm_label_add(m_box);
+       evas_object_size_hint_align_set(m_footer, EVAS_HINT_FILL, 0);
+       elm_box_pack_end(m_box, m_footer);
+       evas_object_show(m_footer);
+
+       elm_object_content_set(m_popup, m_box);
+
        for(int i=1 ; i <= buttonN; i++) {
                std::string id("button" + std::to_string(i));
                Evas_Object *button = elm_button_add(m_popup);
                elm_object_style_set(button, "bottom");
                elm_object_part_content_set(m_popup, id.c_str(), button);
-               elm_object_text_set(button, "default");
+               evas_object_show(button);
 
                m_buttons.emplace_back(button);
        }
+
+       evas_object_show(m_popup);
+       evas_object_show(m_win);
 }
 
 Popup::~Popup()
@@ -54,17 +83,17 @@ Popup::~Popup()
 
 void Popup::setHeader(const std::string &header) noexcept
 {
-       m_header = header;
+       setText(m_header, header);
 }
 
 void Popup::setBody(const std::string &body) noexcept
 {
-       m_body = body;
+       setText(m_body, body);
 }
 
 void Popup::setFooter(const std::string &footer) noexcept
 {
-       m_footer = footer;
+       setText(m_footer, "<br>" + footer);
 }
 
 void Popup::setMessage(const std::string &msg) noexcept
@@ -74,15 +103,18 @@ void Popup::setMessage(const std::string &msg) noexcept
 
 void Popup::run(void)
 {
-       setText(m_popup, (m_header + "<br>" +
-               m_body + "<br><br>" + m_footer).c_str());
+       m_objects.emplace_back(m_header);
+       m_objects.emplace_back(m_body);
+       m_objects.emplace_back(m_hypertext);
+       m_objects.emplace_back(m_footer);
+       m_objects.emplace_back(m_box);
+
+       for (auto &btn : m_buttons)
+               m_objects.emplace_back(btn);
 
        m_objects.emplace_back(m_popup);
        m_objects.emplace_back(m_win);
 
-       for (auto &obj : m_objects)
-               evas_object_show(obj);
-
        elm_run();
 }
 
index 02f50bc..8e86720 100644 (file)
@@ -78,11 +78,14 @@ public:
 private:
        Evas_Object *m_win;
        Evas_Object *m_popup;
-       std::string m_title;
-       std::string m_header;
-       std::string m_body;
-       std::string m_footer;
+       Evas_Object *m_box;
+       Evas_Object *m_header;
+       Evas_Object *m_body;
+       Evas_Object *m_hypertext;
+       Evas_Object *m_footer;
+
        std::string m_message;
+       std::string m_hypertextUrl;
 
        static int response;
 };