BubbleEntity *createEntity(const std::string &filePath, BubbleBgViewItem::BgType bgType, Message::Direction direction);
BubbleEntity *createEntity(const MsgConvMedia &msgMedia, BubbleBgViewItem::BgType bgType, Message::Direction direction);
BubbleTextEntity *createTextEntity(std::string text, BubbleBgViewItem::BgType bgType, Message::Direction direction);
+ BubbleTextEntity *createEmptyEntity(BubbleBgViewItem::BgType bgType, Message::Direction direction);
BubbleDownloadButtonEntity *createDownloadButtonEntity();
private:
return text.empty() ? nullptr : new BubbleTextEntity(bgType, direction, std::move(text));
}
+BubbleTextEntity *BubbleEntityFactory::createEmptyEntity(BubbleBgViewItem::BgType bgType, Message::Direction direction)
+{
+ return new BubbleTextEntity(bgType, direction, {});
+}
+
BubbleDownloadButtonEntity *BubbleEntityFactory::createDownloadButtonEntity()
{
return new BubbleDownloadButtonEntity;
addEntity(m_BubbleEntityFactory.createEntity(media, bgType, m_Direction));
}
}
+ if(m_BubbleEntityList.empty())
+ addEntity(m_BubbleEntityFactory.createEmptyEntity(bgType, Message::Direction::MD_Received));
+
}
void ConvListItem::shareContent()
m_IsDraft ? showDraftListPopup() : showMainListPopup();
}
+bool ConvListItem::hasAttachments() const
+{
+ for (auto &&iter: m_BubbleEntityList) {
+ if (!iter->getFilePath().empty())
+ return true;
+ }
+ return false;
+}
+
void ConvListItem::showMainListPopup()
{
auto &listPopup = m_App.getPopupManager().getPopupList(this);
listPopup.setTitle(msg("IDS_MSGF_BODY_MESSAGE_OPTIONS"));
std::string msgText = getAllMsgText();
+ bool hasAttach = hasAttachments();
if (m_NetworkStatus == Message::NS_Send_Fail)
listPopup.appendItem(msg("IDS_MSG_OPT_RESEND"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onResendItemPressed), this);
if (!msgText.empty())
listPopup.appendItem(msg("IDS_MSG_OPT_COPY_TEXT"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onCopyTextItemPressed), this);
- if (!m_IsRestrictedByDpm) {
+ if (!m_IsRestrictedByDpm && (hasAttach || !msgText.empty())) {
listPopup.appendItem(msg("IDS_MSGF_OPT_FORWARD"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onForwardItemPressed), this);
listPopup.appendItem(msg("IDS_COM_BUTTON_SHARE"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onShareItemPressed), this);
}