TizenRefApp-6571 DPM handling on incoming messages 66/84266/3
authorDmytro Dragan <dm.dragan@samsung.com>
Wed, 17 Aug 2016 16:07:28 +0000 (19:07 +0300)
committerAndrey Klimenko <and.klimenko@samsung.com>
Fri, 19 Aug 2016 11:39:12 +0000 (04:39 -0700)
Change-Id: Iad235e721c035213838afc26c75c0e93098f2398
Signed-off-by: Dmytro Dragan <dm.dragan@samsung.com>
res/edje/conv_list_bubble.edc
src/Common/MsgEngine/inc/Message.h
src/Common/MsgEngine/inc/MsgConversationItem.h
src/Common/MsgEngine/src/private/MessagePrivate.cpp
src/Common/MsgEngine/src/private/MessagePrivate.h
src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp
src/Common/MsgEngine/src/private/MsgConversationItemPrivate.h
src/Conversation/ConvList/Controller/src/ConvListItem.cpp
src/Conversation/ConvList/View/inc/BubbleBgViewItem.h
src/Conversation/ConvList/View/src/BubbleBgViewItem.cpp

index 74cbb84..196ec88 100644 (file)
@@ -13,6 +13,8 @@ collections {
     #define BUBBLE_BG_FAILED_COLOR_PRESSED 0 0 0 133
     #define BUBBLE_BG_RECEIVED_COLOR 65 197 217 255
     #define BUBBLE_BG_RECEIVED_COLOR_PRESSED 50 150 166 255
+    #define BUBBLE_BG_RESTRICTED_COLOR 184 41 62 255
+    #define BUBBLE_BG_RESTRICTED_COLOR_PRESSED 146 33 49 255
 
     images {
        image: "messages_bubble_bg.#.png" RAW;
@@ -537,4 +539,23 @@ collections {
            }
        }
    }
+
+   group {
+       name: "conv/list/bubble_restricted_bg";
+       inherit: "conv/list/bubble_draft_bg";
+       parts {
+           part {
+               name: "bg";
+               description {
+                  state: "default";
+                  color: BUBBLE_BG_RESTRICTED_COLOR;
+               }
+               description {
+                  state: "pressed";
+                  inherit: "default";
+                  color: BUBBLE_BG_RESTRICTED_COLOR_PRESSED;
+               }
+           }
+       }
+   }
 }
index 09c1590..a21a0b1 100644 (file)
@@ -190,6 +190,12 @@ namespace Msg
              * @return true in case of mms, false otherwise.
              */
             virtual bool isMms() const = 0;
+
+            /**
+             * @brief Checks whether this message is restricted by DPM policy.
+             * @return true in case of restriction, false otherwise.
+             */
+            virtual bool isRestrictedByDpm() const = 0;
     };
 }
 
index 3ae000e..91af03a 100644 (file)
@@ -116,6 +116,12 @@ namespace Msg
              * @return media-files list.
              */
             virtual const MsgConvMediaList &getMediaList() const = 0;
+
+            /**
+             * @brief Checks whether this message is restricted by DPM policy.
+             * @return true in case of restriction, false otherwise.
+             */
+            virtual bool isRestrictedByDpm() const = 0;
     };
 }
 
index 94e0320..aa68e7c 100644 (file)
@@ -180,3 +180,10 @@ bool MessagePrivate::isMms() const
     Message::Type messageType = MsgUtilsPrivate::nativeToMessageType(nativeType);
     return MsgUtils::isMms(messageType);
 }
+
+bool MessagePrivate::isRestrictedByDpm() const
+{
+    bool restricted = false;
+    msg_get_bool_value(m_MsgStruct, MSG_MESSAGE_DPM_RESTRICTED_BOOL, &restricted);
+    return restricted;
+}
index 69a8d9a..b259299 100644 (file)
@@ -51,6 +51,7 @@ namespace Msg
             virtual void setMessageStorageType(Message::MessageStorageType msgStorage);
             virtual Message::MessageStorageType getMessageStorageType() const;
             virtual bool isMms() const;
+            virtual bool isRestrictedByDpm() const;
 
             void setId(MsgId id);
             void set(msg_struct_t msgStruct);
index 51187bb..16a0cd3 100644 (file)
@@ -122,3 +122,10 @@ const MsgConvMediaListHandlePrivate &MsgConversationItemPrivate::getMediaList()
     m_MultipartList.set(multipartList);
     return m_MultipartList;
 }
+
+bool MsgConversationItemPrivate::isRestrictedByDpm() const
+{
+    bool restricted = false;
+    msg_get_bool_value(m_MsgStruct, MSG_CONV_MSG_DPM_RESTRICTED_BOOL, &restricted);
+    return restricted;
+}
index 2d29cd5..110a826 100644 (file)
@@ -48,6 +48,7 @@ namespace Msg
             virtual int getPagesCount() const;
             virtual int getAttachCount() const;
             virtual const MsgConvMediaListHandlePrivate &getMediaList() const;
+            virtual bool isRestrictedByDpm() const;
 
         protected:
             mutable MsgConvMediaListHandlePrivate m_MultipartList;
index 4137e87..bb985f2 100644 (file)
@@ -197,7 +197,12 @@ void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::str
 {
     BubbleBgViewItem::BgType bgType = getBubbleBgType(item);
     Message::Direction direction = item.getDirection();
-    if(!MsgUtils::isMms(m_Type))
+    if(item.isRestrictedByDpm())
+    {
+        //TODO: Obtain IDS for this string
+        addEntity(createTextEntity(BubbleBgViewItem::RestrictedStyle, direction, "Message not received. The security policy restricts receiving messages.", true, ""));
+    }
+    else if(!MsgUtils::isMms(m_Type))
     {
         addEntity(createTextEntity(bgType, direction, item.getText(), true, searchWord));
     }
index d558e7a..2970a1d 100644 (file)
@@ -31,7 +31,8 @@ namespace Msg
                 SentStyle,
                 ReceivedStyle,
                 DraftStyle,
-                FailedStyle
+                FailedStyle,
+                RestrictedStyle
             };
 
         public:
index b0897cc..745d565 100644 (file)
@@ -22,6 +22,7 @@
 using namespace Msg;
 const std::string whiteTextColor = "#fafafa";
 const std::string darkTextColor = "#808080";
+const std::string redTextColor = "#b8293e";
 #define WHITE_OBJ_COLOR  250, 250, 250, 255
 #define DARK_OBJ_COLOR  128, 128, 128, 255
 
@@ -44,6 +45,9 @@ BubbleBgViewItem::BubbleBgViewItem(BubbleEntity &entity, Evas_Object *parent, Bg
         case FailedStyle:
             group = "conv/list/bubble_failed_bg";
             break;
+        case RestrictedStyle:
+            group = "conv/list/bubble_restricted_bg";
+            break;
     }
 
     setEo(addLayout(parent, CONV_LIST_BUBBLE_EDJ_PATH, group));
@@ -79,7 +83,7 @@ void BubbleBgViewItem::showSearch(bool search)
 
 std::string BubbleBgViewItem::applyColor(const std::string &text, BgType bgType)
 {
-    const std::string &color = (bgType == SentStyle || bgType == ReceivedStyle) ? whiteTextColor : darkTextColor;
+    const std::string &color = (bgType == RestrictedStyle) ? redTextColor : (bgType == SentStyle || bgType == ReceivedStyle) ? whiteTextColor : darkTextColor;
     return TextDecorator::make(text, color);
 }