From: Denis Dolzhenko Date: Mon, 12 Sep 2016 14:07:42 +0000 (+0300) Subject: TizenRefApp-7162 MMS download button is available after request to retrieve message X-Git-Tag: submit/tizen/20160916.133943^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6cd3939860bb33fd91003c3555cfc2b7532754c4;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git TizenRefApp-7162 MMS download button is available after request to retrieve message Change-Id: I08311dbbf3524b605f71f801b7bbc7bf1edff508 Signed-off-by: Denis Dolzhenko --- diff --git a/src/Conversation/ConvList/Controller/inc/BubbleDownloadButtonEntity.h b/src/Conversation/ConvList/Controller/inc/BubbleDownloadButtonEntity.h index a796d797..9d5d363c 100644 --- a/src/Conversation/ConvList/Controller/inc/BubbleDownloadButtonEntity.h +++ b/src/Conversation/ConvList/Controller/inc/BubbleDownloadButtonEntity.h @@ -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_ */ diff --git a/src/Conversation/ConvList/Controller/inc/ConvListItem.h b/src/Conversation/ConvList/Controller/inc/ConvListItem.h index d296b160..65d96da4 100644 --- a/src/Conversation/ConvList/Controller/inc/ConvListItem.h +++ b/src/Conversation/ConvList/Controller/inc/ConvListItem.h @@ -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(); diff --git a/src/Conversation/ConvList/Controller/src/ConvListItem.cpp b/src/Conversation/ConvList/Controller/src/ConvListItem.cpp index 1963b026..17ed1ab2 100644 --- a/src/Conversation/ConvList/Controller/src/ConvListItem.cpp +++ b/src/Conversation/ConvList/Controller/src/ConvListItem.cpp @@ -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(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()); } diff --git a/src/Conversation/ConvList/View/inc/BubbleDownloadButtonViewItem.h b/src/Conversation/ConvList/View/inc/BubbleDownloadButtonViewItem.h index a013585f..7b4dc10c 100644 --- a/src/Conversation/ConvList/View/inc/BubbleDownloadButtonViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleDownloadButtonViewItem.h @@ -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); }; diff --git a/src/Conversation/ConvList/View/inc/ConvListViewItem.h b/src/Conversation/ConvList/View/inc/ConvListViewItem.h index 87df26c4..dbeeaaf5 100644 --- a/src/Conversation/ConvList/View/inc/ConvListViewItem.h +++ b/src/Conversation/ConvList/View/inc/ConvListViewItem.h @@ -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); diff --git a/src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp index 9aff8384..b880853b 100644 --- a/src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp @@ -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(); diff --git a/src/Conversation/ConvList/View/src/ConvListViewItem.cpp b/src/Conversation/ConvList/View/src/ConvListViewItem.cpp index e0dbe75f..1fd72990 100644 --- a/src/Conversation/ConvList/View/src/ConvListViewItem.cpp +++ b/src/Conversation/ConvList/View/src/ConvListViewItem.cpp @@ -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); }