From: Denis Dolzhenko Date: Mon, 14 Nov 2016 16:10:23 +0000 (+0200) Subject: TizenRefApp-7634 Delete mode in conversation not cancelled when messages app. launche... X-Git-Tag: submit/tizen_3.0/20161115.134055~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=865c94284612ed223721865613da224b7a1afcd1;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git TizenRefApp-7634 Delete mode in conversation not cancelled when messages app. launched from active notification panel. Change-Id: Ia985284cf9d2b1174bfa39892bcd00a216d69356 Signed-off-by: Denis Dolzhenko --- diff --git a/src/Common/View/inc/View.h b/src/Common/View/inc/View.h index e96730f..a704da1 100644 --- a/src/Common/View/inc/View.h +++ b/src/Common/View/inc/View.h @@ -51,19 +51,9 @@ namespace Msg /** * @brief Shows view. + * @param[in] value - true show, false - otherwise */ - void show(); - - /** - * @brief Hides view. - */ - void hide(); - - /** - * @brief Manages view's visibility. - * @param[in] show if true shows view, otherwise hides it. - */ - void setVisibility(bool show); + void show(bool value = true); /** * @brief Moves view to specified Evas-coordinates. @@ -363,22 +353,9 @@ namespace Msg return evas_object_visible_get(m_pEo); } - inline void View::show() - { - evas_object_show(m_pEo); - } - - inline void View::hide() - { - evas_object_hide(m_pEo); - } - - inline void View::setVisibility(bool show) + inline void View::show(bool value) { - if(show) - View::show(); - else - hide(); + value ? evas_object_show(m_pEo) : evas_object_hide(m_pEo); } inline void View::setSizeHintWeight(double x, double y) diff --git a/src/Conversation/Body/Controller/inc/Body.h b/src/Conversation/Body/Controller/inc/Body.h index dfdacfa..d1e75c0 100644 --- a/src/Conversation/Body/Controller/inc/Body.h +++ b/src/Conversation/Body/Controller/inc/Body.h @@ -54,6 +54,7 @@ namespace Msg void addAttachments(const std::list &fileList); void addAttachment(const std::string &filePath); void clear(); + void show(bool value); bool isEmpty() const; bool isMms(); void setMmsRecipFlag(bool value); diff --git a/src/Conversation/Body/Controller/src/Body.cpp b/src/Conversation/Body/Controller/src/Body.cpp index 21ad0cf..5f8a848 100644 --- a/src/Conversation/Body/Controller/src/Body.cpp +++ b/src/Conversation/Body/Controller/src/Body.cpp @@ -77,6 +77,13 @@ void Body::clear() getComposeItem().clear(); } +void Body::show(bool value) +{ + ComposeListItem &item = m_ConvList.getComposeItem(); + item.show(value); + BodyView::show(value); +} + void Body::setListener(IBodyListener *listener) { m_pListener = listener; diff --git a/src/Conversation/Main/Controller/inc/Conversation.h b/src/Conversation/Main/Controller/inc/Conversation.h index 10acbfa..ae7425d 100644 --- a/src/Conversation/Main/Controller/inc/Conversation.h +++ b/src/Conversation/Main/Controller/inc/Conversation.h @@ -154,6 +154,7 @@ namespace Msg void setMode(Mode mode); void setNewMessageMode(); void setConversationMode(); + void setDeleteMode(bool value); void showConvList(bool show); void showRecipPanel(bool show); void showContactList(bool show); @@ -211,6 +212,7 @@ namespace Msg private: Mode m_Mode; + bool m_DeleteMode; WorkingDirRef m_WorkingDir; ConversationLayout *m_pLayout; MessageInputPanel *m_pMsgInputPanel; diff --git a/src/Conversation/Main/Controller/src/Conversation.cpp b/src/Conversation/Main/Controller/src/Conversation.cpp index e28437a..8003923 100644 --- a/src/Conversation/Main/Controller/src/Conversation.cpp +++ b/src/Conversation/Main/Controller/src/Conversation.cpp @@ -51,6 +51,7 @@ namespace Conversation::Conversation(NaviFrameController &parent) : FrameController(parent) , m_Mode(InitMode) + , m_DeleteMode(false) , m_pLayout(nullptr) , m_pMsgInputPanel(nullptr) , m_pBody(nullptr) @@ -96,6 +97,7 @@ Conversation::~Conversation() void Conversation::execCmd(const AppControlComposeRef &cmd) { getApp().getPopupManager().reset(); + setDeleteMode(false); if(!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) // Check if we can save draft to avoid losing data { m_DefferedCmd.composeCmd = cmd; @@ -126,6 +128,8 @@ void Conversation::execCmd(const AppControlComposeRef &cmd) void Conversation::execCmd(const AppControlDefaultRef &cmd) { + getApp().getPopupManager().reset(); + setDeleteMode(false); if(!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) // Check if we can save draft to avoid losing data { m_DefferedCmd.defaultCmd = cmd; @@ -151,7 +155,6 @@ void Conversation::execCmd(const AppControlDefaultRef &cmd) return; } - getApp().getPopupManager().reset(); MsgId msgId = cmd->getMessageId(); setThreadId(getMsgEngine().getStorage().getMessage(msgId)->getThreadId()); if(msgId.isValid()) @@ -403,6 +406,27 @@ void Conversation::setConversationMode() showContactList(false); } +void Conversation::setDeleteMode(bool value) +{ + if(m_DeleteMode == value) + return; + + m_DeleteMode = value; + updateNavibar(); + showMsgInputPanelIfNeeded(!value); + + if(value) + { + if (m_AttachPanel.isFullExpanded()) + m_AttachPanel.show(false); + m_pConvList->setMode(ConvList::SelectMode); + } + else + { + m_pConvList->setMode(ConvList::NormalMode); + } +} + void Conversation::createMainLayout() { m_pLayout = new ConversationLayout(getParent()); @@ -517,23 +541,12 @@ void Conversation::destroyMsgInputPanel() void Conversation::showMsgInputPanelIfNeeded(bool show) { if(show && !isHiddenAddress()) - { createMsgInputPanel(); - if(m_pBody) - m_pBody->show(); - if(m_pMsgInputPanel) - m_pMsgInputPanel->show(); - } - else - { - if(m_pBody) - m_pBody->hide(); - if(m_pMsgInputPanel) - m_pMsgInputPanel->hide(); - } + if(m_pBody) + m_pBody->show(show); + if(m_pMsgInputPanel) + m_pMsgInputPanel->show(show); m_pLayout->showMsgInputPanel(show); - if(m_pConvList) - m_pConvList->getComposeItem().show(show); } void Conversation::write(const Message &msg) @@ -1086,7 +1099,7 @@ void Conversation::updateNavibar() } else if(m_Mode == ConversationMode) { - if(m_pConvList->getMode() == ConvList::SelectMode) + if(m_DeleteMode) { updateSelectMsgTitle(); naviBar.showButton(NaviCancelButtonId, true); @@ -1112,7 +1125,7 @@ void Conversation::updateNavibar() void Conversation::updateSelectMsgTitle() { - if(m_pConvList && m_pConvList->getMode() == ConvList::SelectMode) + if(m_pConvList && m_DeleteMode) { int checked = m_pConvList->getMessageCheckedCount(); if(checked > 0) @@ -1186,11 +1199,9 @@ void Conversation::onResume() void Conversation::onHwBackButtonClicked() { MSG_LOG(""); - if(m_pConvList && m_pConvList->getMode() == ConvList::SelectMode) + if(m_DeleteMode) { - m_pConvList->setMode(ConvList::NormalMode); - updateNavibar(); - showMsgInputPanelIfNeeded(true); + setDeleteMode(false); return; } @@ -1218,19 +1229,17 @@ void Conversation::onHwBackButtonClicked() void Conversation::onHwMoreButtonClicked() { MSG_LOG(""); - if(m_Mode == ConversationMode && m_pConvList->getMode() == ConvList::NormalMode) + if(m_Mode == ConversationMode && !m_DeleteMode) showMainPopup(); } void Conversation::onNaviOkButtonClicked() { MSG_LOG(""); - if(m_Mode == ConversationMode && m_pConvList->getMode() == ConvList::SelectMode) + if(m_Mode == ConversationMode && m_DeleteMode) { m_pConvList->deleteSelectedItems(); - m_pConvList->setMode(ConvList::NormalMode); - updateNavibar(); - showMsgInputPanelIfNeeded(true); + setDeleteMode(false); } } @@ -1385,11 +1394,7 @@ void Conversation::onDeleteItemPressed(PopupListItem &item) { MSG_LOG(""); item.getParent().destroy(); - if (m_AttachPanel.isFullExpanded()) - m_AttachPanel.show(false); - m_pConvList->setMode(ConvList::SelectMode); - updateNavibar(); - showMsgInputPanelIfNeeded(false); + setDeleteMode(true); } void Conversation::onAddRecipientsItemPressed(PopupListItem &item)