Extended pop of Naviframe-item 23/82723/1
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Fri, 5 Aug 2016 08:40:59 +0000 (11:40 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Fri, 5 Aug 2016 08:40:59 +0000 (11:40 +0300)
Change-Id: I8f223b49f2acc79576568c9675a0e08489561a59
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
12 files changed:
src/Common/Controller/inc/FrameController.h
src/Common/Controller/inc/NaviFrameController.h
src/Common/Controller/src/FrameController.cpp
src/Common/Controller/src/NaviFrameController.cpp
src/Common/View/inc/NaviFrameView.h
src/Common/View/src/NaviFrameView.cpp
src/Conversation/Main/Controller/src/Conversation.cpp
src/MsgThread/Controller/src/MsgThread.cpp
src/Settings/Controller/src/MsgOnSimCard.cpp
src/Settings/Controller/src/Settings.cpp
src/Viewer/Controller/inc/Viewer.h
src/Viewer/Controller/src/Viewer.cpp

index a8da4fc..913bc78 100644 (file)
@@ -36,6 +36,7 @@ namespace Msg
             virtual ~FrameController();
 
             virtual NaviFrameController &getParent();
+            void pop();
 
         protected:
             void setNaviBarTitle(const MsgAddressList &addressList);
index 5b20532..e7e39df 100644 (file)
@@ -40,8 +40,10 @@ namespace Msg
 
             /**
              * @brief Pops last frame. Exit from app if frame count reaches zero.
+             * @param[in] frame FrameController for pop
              */
-            void pop();
+            void pop(FrameController &frame);
+            using NaviFrameView::pop;
 
             /**
              * @brief Executes app control command of default type.
index f8dd092..1455c2c 100644 (file)
@@ -44,6 +44,11 @@ void FrameController::onAttached(ViewItem &item)
     NaviFrameItem::onAttached(item);
 }
 
+void FrameController::pop()
+{
+    getParent().pop(*this);
+}
+
 void FrameController::setNaviBarTitle(const MsgAddressList &addressList)
 {
     std::string title;
index a28c94e..09bb87d 100644 (file)
@@ -44,12 +44,12 @@ void NaviFrameController::init()
     setHwButtonListener(getEo(), this);
 }
 
-void NaviFrameController::pop()
+void NaviFrameController::pop(FrameController &frame)
 {
     if(isLastFrame())
         getApp().exit();
     else
-        NaviFrameView::pop();
+        NaviFrameView::pop(frame);
 }
 
 void NaviFrameController::destroy()
index d046c23..ff5c0cc 100644 (file)
@@ -60,11 +60,17 @@ namespace Msg
             void push(NaviFrameItem &item, View &content);
 
             /**
-             * @brief Pops item from Naviframe.
+             * @brief Pops top item from Naviframe.
              */
             void pop();
 
             /**
+             * @brief Pops item from Naviframe.
+             * @param[in] item NaviFrame item for pop.
+             */
+            void pop(NaviFrameItem &item);
+
+            /**
              * @brief Inserts specified item to bottom of item's stack.
              * @param[in] item an item to be inserted.
              */
index c63bab4..1af1c7f 100644 (file)
@@ -46,8 +46,8 @@ NaviFrameView::~NaviFrameView()
 void NaviFrameView::create(Evas_Object *parent)
 {
     setEo(elm_naviframe_add(parent));
+    elm_naviframe_event_enabled_set(getEo(), true); // Remove it after fix: TSAM-6776
     addSmartCb("transition,finished", SMART_CALLBACK(NaviFrameView, onTransitionFinished), this);
-    elm_naviframe_event_enabled_set(getEo(), EINA_TRUE); //Enables event receiving during pushing/popping items
     show();
 }
 
@@ -118,6 +118,17 @@ void NaviFrameView::pop()
     elm_naviframe_item_pop(getEo());
 }
 
+void NaviFrameView::pop(NaviFrameItem &item)
+{
+    pop();
+    // Uncomment it after fix: TSAM-6776
+    /* if(getTransitionStatus())
+        item.destroy();
+    else
+        pop();
+    */
+}
+
 void NaviFrameView::insertToBottom(NaviFrameItem &item)
 {
     Elm_Object_Item *before = elm_naviframe_bottom_item_get(getEo());
index 24ca610..178e0a6 100644 (file)
@@ -132,7 +132,7 @@ void Conversation::execCmd(const AppControlDefaultRef &cmd)
 
     if(cmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1)
     {
-        getParent().pop();
+        pop();
         return;
     }
 
@@ -924,7 +924,7 @@ void Conversation::onHwBackButtonClicked()
     else
     {
         saveDraftMsg();
-        getParent().pop();
+        pop();
     }
 }
 
@@ -1037,7 +1037,7 @@ void Conversation::onNoRecipDiscardButtonClicked(Popup &popup, int buttonId)
         {   // If we came from notification menu and unread threads will be more than one, we should to go back on thread list view
             if(m_DefferedCmd.defaultCmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1)
             {
-                getParent().pop();
+                    pop();
             }
             else
             {   // Go to needed conversation
@@ -1060,7 +1060,7 @@ void Conversation::onNoRecipDiscardButtonClicked(Popup &popup, int buttonId)
     }
     else
     {   // We will get here from conversation after tap on Back Button
-        getParent().pop();
+        pop();
     }
 
     popup.destroy();
index 4bb109e..d9d0e84 100644 (file)
@@ -266,7 +266,7 @@ void MsgThread::onHwBackButtonClicked()
     if(m_Mode == SearchMode || m_Mode == DeleteMode)
         setMode(NormalMode);
     else
-        getParent().pop();
+        pop();
 }
 
 void MsgThread::onHwMoreButtonClicked()
index 2bc2b47..d8b712a 100644 (file)
@@ -112,7 +112,7 @@ void MsgOnSimCard::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
         }
     }
     else if(buttonId == NaviPrevButtonId)
-        getParent().pop();
+        pop();
     setMode(NormalMode);
 }
 
@@ -155,7 +155,7 @@ void MsgOnSimCard::onHwBackButtonClicked()
     if(m_SimMode == CopyToDeviceMode || m_SimMode == DeleteMode)
         setNormalMode();
     else
-        getParent().pop();
+        pop();
 }
 
 void MsgOnSimCard::showCopyDeletePopup()
index 35fbb27..bd779c9 100644 (file)
@@ -416,5 +416,5 @@ void Settings::onLanguageChanged()
 void Settings::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
 {
     if(buttonId == NaviPrevButtonId)
-        getParent().pop();
+        pop();
 }
index 475c097..5c883a5 100644 (file)
@@ -31,6 +31,7 @@
 #include "SmilPlayer.h"
 #include "SubjectLayout.h"
 #include "SystemSettingsManager.h"
+#include "MsgStorage.h"
 
 namespace Msg
 {
@@ -45,6 +46,7 @@ namespace Msg
         , private IConversationListener
         , private ISmilPlayerListener
         , private ISystemSettingsManager
+        , private IMsgStorageListener
     {
         public:
             Viewer(NaviFrameController &parent, MsgId id);
@@ -98,6 +100,9 @@ namespace Msg
             // SystemSettingsManager:
             virtual void onLanguageChanged();
 
+            // IMsgStorageListener:
+            virtual void onMsgStorageDelete(const MsgIdList &msgIdList);
+
         private:
             void naviExpandButtonHandler();
             void naviCenterButtonHandler();
index c47312d..d4bbbf8 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <sstream>
 #include <iomanip>
+#include <algorithm>
 
 using namespace Msg;
 
@@ -62,6 +63,7 @@ Viewer::Viewer(NaviFrameController &parent, MsgId id)
 Viewer::~Viewer()
 {
     MSG_LOG("");
+    getApp().getMsgEngine().getStorage().removeListener(*this);
     getApp().getContactManager().removeListener(*this);
     getApp().getSysSettingsManager().removeListener(*this);
 }
@@ -110,6 +112,7 @@ void Viewer::create(MsgId id)
 
     getApp().getSysSettingsManager().addListener(*this);
     getApp().getContactManager().addListener(*this);
+    getApp().getMsgEngine().getStorage().addListener(*this);
     setHwButtonListener(*m_pLayout, this);
 
     m_pSmilPlayer->start();
@@ -210,7 +213,7 @@ void Viewer::naviCenterButtonHandler()
 
 void Viewer::naviPrevButtonHandler()
 {
-    getParent().pop();
+    pop();
 }
 
 void Viewer::showRecipPopup(const std::string &title)
@@ -269,7 +272,7 @@ void Viewer::updateButtonState()
 
 void Viewer::onHwBackButtonClicked()
 {
-    getParent().pop();
+    pop();
 }
 
 void Viewer::onHwMoreButtonClicked()
@@ -392,7 +395,6 @@ void Viewer::onDeleteButtonClicked(Popup &popup, int buttonId)
 {
     popup.destroy();
     getApp().getMsgEngine().getStorage().deleteMessage(m_Msg->getId());
-    getParent().pop();
 }
 
 void Viewer::onCopyTextItemPressed(PopupListItem &item)
@@ -430,7 +432,7 @@ void Viewer::onRecipItemClicked(Evas_Object *obj, void *eventInfo)
 
 void Viewer::onConversationSentMessage()
 {
-    getParent().pop();
+    pop();
 }
 
 void Viewer::onSmilPlayerStateChanged()
@@ -458,3 +460,14 @@ void Viewer::onLanguageChanged()
     MSG_LOG("");
     updateSubject();
 }
+
+void Viewer::onMsgStorageDelete(const MsgIdList &msgIdList)
+{
+    MSG_LOG("");
+    if(m_Msg)
+    {
+        MsgId id = m_Msg->getId();
+        if(std::find(msgIdList.begin(), msgIdList.end(), id) != msgIdList.end())
+            pop();
+    }
+}