From 95b4ef8935dcbf3cd6019b7dba27cb20d8fd1f2e Mon Sep 17 00:00:00 2001 From: Oleksander Kostenko Date: Wed, 9 Nov 2016 17:42:56 +0200 Subject: [PATCH] TizenRefApp-6771 Input panel is visible in selection mode Change-Id: I89216a614552f6017f9878fb62e053df1016342e Signed-off-by: Oleksander Kostenko --- .../Main/Controller/inc/Conversation.h | 4 +- .../Main/Controller/src/Conversation.cpp | 76 ++++++++++++------- 2 files changed, 52 insertions(+), 28 deletions(-) diff --git a/src/Conversation/Main/Controller/inc/Conversation.h b/src/Conversation/Main/Controller/inc/Conversation.h index 0331793e..10acbfae 100644 --- a/src/Conversation/Main/Controller/inc/Conversation.h +++ b/src/Conversation/Main/Controller/inc/Conversation.h @@ -157,7 +157,9 @@ namespace Msg void showConvList(bool show); void showRecipPanel(bool show); void showContactList(bool show); - void showMsgInputPanel(bool show); + void createMsgInputPanel(); + void destroyMsgInputPanel(); + void showMsgInputPanelIfNeeded(bool show); void updateMsgInputPanel(); void updateNavibar(); void updateSelectMsgTitle(); diff --git a/src/Conversation/Main/Controller/src/Conversation.cpp b/src/Conversation/Main/Controller/src/Conversation.cpp index 2cad6641..e28437a5 100644 --- a/src/Conversation/Main/Controller/src/Conversation.cpp +++ b/src/Conversation/Main/Controller/src/Conversation.cpp @@ -283,7 +283,7 @@ void Conversation::setThreadId(ThreadId id, const char *searchWord, bool updateC m_AddressList.reset(); setMode(m_ThreadId.isValid() ? ConversationMode : NewMessageMode); - showMsgInputPanel(!isHiddenAddress()); + isHiddenAddress() ? destroyMsgInputPanel() : showMsgInputPanelIfNeeded(true); if(m_pBody) m_pBody->setMmsRecipFlag(getMsgEngine().getStorage().hasEmail(m_ThreadId)); @@ -374,7 +374,7 @@ void Conversation::setNewMessageMode() m_Mode = NewMessageMode; m_pLayout->showRecipEditMode(true); - showMsgInputPanel(true); + showMsgInputPanelIfNeeded(true); showRecipPanel(true); showContactList(true); m_pRecipPanel->update(m_ThreadId); @@ -480,41 +480,60 @@ void Conversation::showContactList(bool show) } } -void Conversation::showMsgInputPanel(bool show) +void Conversation::createMsgInputPanel() { - if(show) + if(!m_pMsgInputPanel) { - if(!m_pMsgInputPanel) - { - m_pMsgInputPanel = new MessageInputPanel(*m_pConvList); - m_pMsgInputPanel->setListener(this); - m_pLayout->setMsgInputPanel(*m_pMsgInputPanel); - } - if(!m_pBody && m_pConvList) - { - m_pBody = new Body(*m_pMsgInputPanel, getApp(), m_WorkingDir, *m_pConvList); - m_pBody->setListener(this); + m_pMsgInputPanel = new MessageInputPanel(*m_pConvList); + m_pMsgInputPanel->setListener(this); + m_pLayout->setMsgInputPanel(*m_pMsgInputPanel); + } + if(!m_pBody && m_pConvList) + { + m_pBody = new Body(*m_pMsgInputPanel, getApp(), m_WorkingDir, *m_pConvList); + m_pBody->setListener(this); + m_pMsgInputPanel->setEntry(*m_pBody); + updateMsgInputPanel(); + } +} + +void Conversation::destroyMsgInputPanel() +{ + if(m_pBody) + { + m_pBody->setListener(this); + m_pBody->destroy(); + m_pBody = nullptr; + } + if(m_pMsgInputPanel) + { + m_pMsgInputPanel->setListener(this); + m_pMsgInputPanel->destroy(); + m_pMsgInputPanel = nullptr; + } + m_pLayout->showMsgInputPanel(false); +} + +void Conversation::showMsgInputPanelIfNeeded(bool show) +{ + if(show && !isHiddenAddress()) + { + createMsgInputPanel(); + if(m_pBody) m_pBody->show(); - m_pMsgInputPanel->setEntry(*m_pBody); - updateMsgInputPanel(); - } + if(m_pMsgInputPanel) + m_pMsgInputPanel->show(); } else { if(m_pBody) - { - m_pBody->setListener(this); - m_pBody->destroy(); - m_pBody = nullptr; - } + m_pBody->hide(); if(m_pMsgInputPanel) - { - m_pMsgInputPanel->setListener(this); - m_pMsgInputPanel->destroy(); - m_pMsgInputPanel = nullptr; - } + m_pMsgInputPanel->hide(); } m_pLayout->showMsgInputPanel(show); + if(m_pConvList) + m_pConvList->getComposeItem().show(show); } void Conversation::write(const Message &msg) @@ -1171,6 +1190,7 @@ void Conversation::onHwBackButtonClicked() { m_pConvList->setMode(ConvList::NormalMode); updateNavibar(); + showMsgInputPanelIfNeeded(true); return; } @@ -1210,6 +1230,7 @@ void Conversation::onNaviOkButtonClicked() m_pConvList->deleteSelectedItems(); m_pConvList->setMode(ConvList::NormalMode); updateNavibar(); + showMsgInputPanelIfNeeded(true); } } @@ -1368,6 +1389,7 @@ void Conversation::onDeleteItemPressed(PopupListItem &item) m_AttachPanel.show(false); m_pConvList->setMode(ConvList::SelectMode); updateNavibar(); + showMsgInputPanelIfNeeded(false); } void Conversation::onAddRecipientsItemPressed(PopupListItem &item) -- 2.34.1