TizenRefApp-7162 MMS download button is available after request to retrieve message 26/88026/2
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Mon, 12 Sep 2016 14:07:42 +0000 (17:07 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Mon, 12 Sep 2016 14:12:11 +0000 (17:12 +0300)
Change-Id: I08311dbbf3524b605f71f801b7bbc7bf1edff508
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Conversation/ConvList/Controller/inc/BubbleDownloadButtonEntity.h
src/Conversation/ConvList/Controller/inc/ConvListItem.h
src/Conversation/ConvList/Controller/src/ConvListItem.cpp
src/Conversation/ConvList/View/inc/BubbleDownloadButtonViewItem.h
src/Conversation/ConvList/View/inc/ConvListViewItem.h
src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp
src/Conversation/ConvList/View/src/ConvListViewItem.cpp

index a796d7979d0cc6a40b90f6e75b7689065d7f6763..9d5d363c2c516009306d6526114e614948dff78d 100644 (file)
@@ -30,11 +30,16 @@ namespace Msg
             BubbleDownloadButtonEntity(Message::Direction direction);
             virtual ~BubbleDownloadButtonEntity();
 
+            void disabled(bool status);
             virtual BubbleDownloadButtonViewItem *createView(Evas_Object *parent);
+
+        private:
+            bool m_Disabled;
     };
 
     inline BubbleDownloadButtonEntity::BubbleDownloadButtonEntity(Message::Direction direction)
         : BubbleEntity(DownloadButtonItem, direction)
+        , m_Disabled(false)
     {
     }
 
@@ -45,8 +50,14 @@ namespace Msg
     inline BubbleDownloadButtonViewItem *BubbleDownloadButtonEntity::createView(Evas_Object *parent)
     {
         auto *item = new BubbleDownloadButtonViewItem(*this, parent);
+        item->disabled(m_Disabled);
         return item;
     }
+
+    inline void BubbleDownloadButtonEntity::disabled(bool status)
+    {
+        m_Disabled = status;
+    }
 }
 
 #endif /* BubbleDownloadButtonEntity_h_ */
index d296b1607ff1eaadb2d1d339ccff90e33e271a00..65d96da4aa18601886274c51f91864021c4d1687 100644 (file)
@@ -94,6 +94,8 @@ namespace Msg
             void updateEntityBgType(BubbleBgViewItem::BgType bgType);
             BubbleBgViewItem::BgType getBubbleBgType(const MsgConversationItem &item);
             void tryToDownloadMms(bool showToast = true);
+            void updateDownloadButton();
+            BubbleDownloadButtonEntity *findDownloadButton() const;
 
             // Create Popup when message is clicked
             void showMainListPopup();
index 1963b0264b7fa13a12f875182279d9a3c13fb4f7..17ed1ab24814d84385a2fe79e60d58fffb5381f9 100644 (file)
@@ -116,6 +116,10 @@ void ConvListItem::updateStatus()
         updateItemType(ConvItemType::Received);
         updateEntityBgType(BubbleBgViewItem::ReceivedStyle);
     }
+    else if(m_NetworkStatus == Message::NS_Retrieving)
+    {
+        updateDownloadButton();
+    }
 
     update();
 }
@@ -177,6 +181,22 @@ BubbleEntity *ConvListItem::createTextEntity(BubbleBgViewItem::BgType bgType, Me
     return m_BubbleEntityFactory.createTextEntity(resText, bgType, direction);
 }
 
+BubbleDownloadButtonEntity *ConvListItem::findDownloadButton() const
+{
+    for(BubbleEntity *entity : m_BubbleEntityList)
+    {
+        if(entity->getType() == BubbleEntity::DownloadButtonItem)
+            return static_cast<BubbleDownloadButtonEntity*>(entity);
+    }
+    return nullptr;
+}
+
+void ConvListItem::updateDownloadButton()
+{
+    auto *downloadButton = findDownloadButton();
+    downloadButton->disabled(m_NetworkStatus == Message::NS_Retrieving);
+}
+
 void ConvListItem::addEntity(BubbleEntity *entity)
 {
     if(entity)
@@ -210,6 +230,7 @@ void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::str
         std::string text = MessageDetailContent::getMmsNotiConvListItemContent(m_App, m_MsgId);
         addEntity(createTextEntity(bgType, direction, text, false, searchWord));
         addEntity(m_BubbleEntityFactory.createDownloadButtonEntity(direction));
+        updateDownloadButton();
     }
     else
     {
@@ -330,9 +351,17 @@ void ConvListItem::showMainListPopup()
 
 void ConvListItem::tryToDownloadMms(bool showToast)
 {
-    if (!m_App.getSysSettingsManager().isMessagingRestrictedByDpm())
+    if(!m_App.getSysSettingsManager().isMessagingRestrictedByDpm())
+    {
         m_App.getMsgEngine().getTransport().retrieveMessage(m_MsgId);
-    else if (showToast)
+        auto *button = findDownloadButton();
+        if(button)
+        {
+            button->disabled(true);
+            updateContent();
+        }
+    }
+    else if(showToast)
         notification_status_message_post(msg("IDS_MSG_TPOP_SECURITY_POLICY_RESTRICTS_DOWNLOADING_MULTIMEDIA_MESSAGES").cStr());
 }
 
index a013585f75cf42b346ccc7ecde658add3d41506a..7b4dc10c56d7f47a46e4962d7492b6e0989ec49e 100644 (file)
@@ -29,6 +29,8 @@ namespace Msg
             BubbleDownloadButtonViewItem(BubbleEntity &entity, Evas_Object *parent);
             virtual ~BubbleDownloadButtonViewItem();
 
+            void disabled(bool status);
+
         private:
             void onPressed(Evas_Object *obj, void *eventInfo);
     };
index 87df26c407ab0284cd4e4add90ff694afbc614f3..dbeeaaf518fcce693325b2bf4f5689bd6b277a9b 100644 (file)
@@ -52,7 +52,8 @@ namespace Msg
 
         protected:
             Evas_Object *createProgress();
-            void updateProgressField();
+            void updateProgress();
+            void updateContent();
             void updateItemType(ConvItemType type);
             virtual void onRealized(ListItem &item);
             virtual void onUnrealized(ListItem &item);
index 9aff8384fba0b64dbf636d927535d3c109fc6315..b880853b141b9f412362902fb526db139e966d44 100644 (file)
@@ -36,6 +36,12 @@ BubbleDownloadButtonViewItem::~BubbleDownloadButtonViewItem()
 
 }
 
+void BubbleDownloadButtonViewItem::disabled(bool status)
+{
+    elm_object_disabled_set(getEo(), status);
+    processSignal();
+}
+
 void BubbleDownloadButtonViewItem::onPressed(Evas_Object *obj, void *eventInfo)
 {
     emitActionEvent();
index e0dbe75ffaed181b2f62dc13bca2a596c5636c75..1fd729900b86047e1d534074f1062017f6c09f62 100644 (file)
@@ -168,7 +168,12 @@ void ConvListViewItem::onUnrealized(ListItem &item)
         emitSignal("hide_search", "*");
 }
 
-void ConvListViewItem::updateProgressField()
+void ConvListViewItem::updateContent()
+{
+    updateFields(bubbleContentPart, ELM_GENLIST_ITEM_FIELD_CONTENT);
+}
+
+void ConvListViewItem::updateProgress()
 {
     updateFields(infoStatus, ELM_GENLIST_ITEM_FIELD_CONTENT);
 }