TizenRefApp-7239 Can't close popup by tapping out of popup area 70/89470/3
authorDmytro Dragan <dm.dragan@samsung.com>
Fri, 23 Sep 2016 13:51:36 +0000 (16:51 +0300)
committerAndrey Klimenko <and.klimenko@samsung.com>
Mon, 26 Sep 2016 10:07:04 +0000 (03:07 -0700)
Change-Id: I66a5b579b7679f6c137b4b26d0fa4ce458047931
Signed-off-by: Dmytro Dragan <dm.dragan@samsung.com>
13 files changed:
src/Common/Controller/src/App.cpp
src/Common/View/inc/Popup.h
src/Common/View/inc/PopupList.h
src/Common/View/inc/PopupManager.h
src/Common/View/src/ContextPopup.cpp
src/Common/View/src/Popup.cpp
src/Common/View/src/PopupList.cpp
src/Common/View/src/PopupManager.cpp
src/Conversation/Body/Controller/src/Body.cpp
src/Conversation/Main/Controller/src/Conversation.cpp
src/MsgThread/Controller/src/MsgThread.cpp
src/Settings/Controller/src/MsgOnSimCard.cpp
src/Viewer/Controller/src/Viewer.cpp

index f9bfcd201765c058f682d05e773a0d5c57aad147..052024009cd27739272f94c9ab8f00da513a7b5a 100644 (file)
@@ -163,6 +163,7 @@ void App::pause()
     for(IAppListener *l : m_Listeners)
         l->onAppPause();
     updateActiveNotifPolicy();
+    getPopupManager().onPause();
 }
 
 void App::resume()
index 7f16b10c1af57803fc9c15321b2663cd977f79ac..c37013c2cc9774dd256b16f92544cf153021671d 100644 (file)
@@ -59,7 +59,11 @@ namespace Msg
             void setContent(const TText &text);
             Evas_Object *getContent() const;
             void setHeight(int height);
-            void setAutoDismissBlockClickedFlag(bool value);
+            void setDismissByOutsideTapFlag(bool value);
+            void setDismissByMoreMenuKeyFlag(bool value);
+            bool getDismissByMoreMenuKeyFlag() const;
+            void setDismissByPauseAppFlag(bool value);
+            bool getDismissByPauseAppFlag() const;
             Evas_Object *addButton(const TText &text, int buttonId, PopupButtonCb buttonCb = defaultButtonCb, void *userData = nullptr);
             void setTitle(const std::string &title);
             void setTitle(const TText &title);
@@ -76,7 +80,9 @@ namespace Msg
             Evas_Object *m_pBox;
             Evas_Object *m_pContent;
             int m_CurrentButtonIndex;
-            bool m_BlockClickedDismiss;
+            bool m_OutsideTapDismiss;
+            bool m_MoreKeyDismiss;
+            bool m_PauseAppDismiss;
             PopupManager *m_pManager;
     };
 }
index 04c847f5b1c64a96783fd4f26f54ea98d829a3a9..3ea1972cea061edfd840418e33463834805a7340 100644 (file)
@@ -32,8 +32,14 @@ namespace Msg
         , private IListViewListener
     {
         public:
-            PopupList(Evas_Object *parent);
-            PopupList(PopupManager &parent);
+            enum PopupListType
+            {
+                ListPopup,      /**< Popup with title >*/
+                MoreMenuPopup   /**< Popup without title, hides by more button and pause events >*/
+            };
+        public:
+            PopupList(Evas_Object *parent, PopupListType type = ListPopup);
+            PopupList(PopupManager &parent, PopupListType type= ListPopup);
             virtual ~PopupList();
 
             /**
@@ -69,7 +75,7 @@ namespace Msg
         private:
             virtual void onListItemSelected(ListItem &listItem);
 
-            void create();
+            void create(PopupListType type);
             Evas_Object *createList(Evas_Object *parent);
 
         private:
index e983323bfcf413f45cff6fc95221c02a22969793..9150df9d6b831238344f00efdd98ee3f9ec1adf0 100644 (file)
@@ -68,9 +68,10 @@ namespace Msg
 
             /**
              * @brief Creates popup-list.
+             * @param[in] type Type of list popup. Refer to PopupListType
              * @return created popup-list.
              */
-            PopupList &getPopupList();
+            PopupList &getPopupList(PopupList::PopupListType type = PopupList::ListPopup);
 
             /**
              * @brief Creates popup.
@@ -106,9 +107,15 @@ namespace Msg
              */
             void resetCtxPopup();
 
+            /**
+             * @brief Process pause event
+             */
+            void onPause();
+
         private:
             void onHwBackButtonPopupClicked(Evas_Object *obj, void *eventInfo);
             void onHwBackButtonCtxPopupClicked(Evas_Object *obj, void *eventInfo);
+            void onHwMoreButtonPopupListClicked(Evas_Object *obj, void *eventInfo);
 
         private:
             Popup *m_pPopup;
index a38f6dd23c7c37506670d60880241ccd6f47ac64..962ced68c8830748a857c42a161792883f893eb7 100644 (file)
@@ -89,7 +89,7 @@ void ContextPopup::createContextPopup(Evas_Object *parent)
 
     elm_object_style_set(getEo(), "more/default");
     elm_ctxpopup_horizontal_set(getEo(), EINA_FALSE);
-    elm_ctxpopup_auto_hide_disabled_set(getEo(), EINA_TRUE);
+    elm_ctxpopup_auto_hide_disabled_set(getEo(), EINA_FALSE);
     evas_object_smart_callback_add(getEo(), "dismissed", on_dismissed_cb, this);
 
     setDirectionPriority(ELM_CTXPOPUP_DIRECTION_UP,
index e4f332d273b5ae0328d9e5f35fb180b122871211..4fc8e6207b1ebbaed6634c7744e8e765fc6db348 100644 (file)
@@ -38,20 +38,18 @@ Popup::Popup(Evas_Object *parent)
     : m_pBox(nullptr)
     , m_pContent(nullptr)
     , m_CurrentButtonIndex(1)
-    , m_BlockClickedDismiss(false)
+    , m_OutsideTapDismiss(false)
+    , m_MoreKeyDismiss(false)
+    , m_PauseAppDismiss(false)
     , m_pManager(nullptr)
 {
     create(parent);
 }
 
 Popup::Popup(PopupManager &parent)
-    : m_pBox(nullptr)
-    , m_pContent(nullptr)
-    , m_CurrentButtonIndex(1)
-    , m_BlockClickedDismiss(false)
-    , m_pManager(&parent)
+    : Popup(parent.getWindow())
 {
-    create(parent.getWindow());
+    m_pManager = &parent;
 }
 
 Popup::~Popup()
@@ -114,9 +112,29 @@ void Popup::setHeight(int height)
     evas_object_size_hint_min_set(m_pBox, 0, height);
 }
 
-void Popup::setAutoDismissBlockClickedFlag(bool value)
+void Popup::setDismissByOutsideTapFlag(bool value)
+{
+    m_OutsideTapDismiss = value;
+}
+
+void Popup::setDismissByMoreMenuKeyFlag(bool value)
+{
+    m_MoreKeyDismiss = value;
+}
+
+bool Popup::getDismissByMoreMenuKeyFlag() const
+{
+    return m_MoreKeyDismiss;
+}
+
+void Popup::setDismissByPauseAppFlag(bool value)
+{
+    m_PauseAppDismiss = value;
+}
+
+bool Popup::getDismissByPauseAppFlag() const
 {
-    m_BlockClickedDismiss = value;
+    return m_PauseAppDismiss;
 }
 
 Evas_Object *Popup::addButton(const TText &text, int buttonId, PopupButtonCb buttonCb, void *userData)
@@ -183,7 +201,7 @@ void Popup::on_button_clicked(void *data, Evas_Object *obj, void *event_info)
 void Popup::on_popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
 {
     auto *popup = static_cast<Popup*>(data);
-    if(popup->m_BlockClickedDismiss)
+    if(popup->m_OutsideTapDismiss)
         popup->destroy();
 }
 
index 175c718d489e8c7f86e872f567650523bd0c5d00..53912d4b190e146a8f35d874d8bc01421ac540fe 100644 (file)
 
 using namespace Msg;
 
-PopupList::PopupList(Evas_Object *parent)
+PopupList::PopupList(Evas_Object *parent, PopupListType type)
     : Popup(parent)
     , m_pList(nullptr)
 {
-    create();
+    create(type);
 }
 
-PopupList::PopupList(PopupManager &parent)
+PopupList::PopupList(PopupManager &parent, PopupListType type)
     : Popup(parent)
     , m_pList(nullptr)
 {
-    create();
+    create(type);
 }
 
 PopupList::~PopupList()
@@ -54,11 +54,19 @@ void PopupList::appendItem(const std::string &text, const std::string &path, Pop
     m_pList->appendItem(*new PopupAttachmentListItem(*this, text, path, cb, userData));
 }
 
-void PopupList::create()
+void PopupList::create(PopupListType type)
 {
     elm_object_style_set(getEo(), "theme_bg");
     Evas_Object *list = createList(getHostEvasObject());
     Popup::setContent(list);
+
+    //set popup's behavior
+    setDismissByOutsideTapFlag(true);
+    if (type == MoreMenuPopup)
+    {
+        setDismissByMoreMenuKeyFlag(true);
+        setDismissByPauseAppFlag(true);
+    }
 }
 
 Evas_Object *PopupList::createList(Evas_Object *parent)
index 38e96ce773453fca94a261f5520be0a4ad1df52e..075e530641245b36d33538ae068cb20f7236cc75 100644 (file)
@@ -28,7 +28,6 @@ PopupManager::PopupManager(Window &window)
     , m_pCtxPopup(nullptr)
     , m_Window(window)
 {
-
 }
 
 Window &PopupManager::getWindow() const
@@ -66,11 +65,12 @@ Popup &PopupManager::getPopup()
     return *m_pPopup;
 }
 
-PopupList &PopupManager::getPopupList()
+PopupList &PopupManager::getPopupList(PopupList::PopupListType type)
 {
     reset();
-    m_pPopup = new PopupList(*this);
+    m_pPopup = new PopupList(*this, type);
     eext_object_event_callback_add(*m_pPopup, EEXT_CALLBACK_BACK, SMART_CALLBACK(PopupManager, onHwBackButtonPopupClicked), this);
+    eext_object_event_callback_add(*m_pPopup, EEXT_CALLBACK_MORE, SMART_CALLBACK(PopupManager, onHwMoreButtonPopupListClicked), this);
     return *static_cast<PopupList*>(m_pPopup);
 }
 
@@ -115,8 +115,21 @@ void PopupManager::onHwBackButtonPopupClicked(Evas_Object *obj, void *eventInfo)
     resetPopup();
 }
 
+void PopupManager::onHwMoreButtonPopupListClicked(Evas_Object *obj, void *eventInfo)
+{
+    if (m_pPopup->getDismissByMoreMenuKeyFlag())
+        resetPopup();
+}
+
 void PopupManager::onHwBackButtonCtxPopupClicked(Evas_Object *obj, void *eventInfo)
 {
     resetCtxPopup();
 }
 
+void PopupManager::onPause()
+{
+    if (m_pPopup && m_pPopup->getDismissByPauseAppFlag())
+        resetPopup();
+    resetCtxPopup();
+}
+
index 407848e078b55ad76f4b2cf28944bb6611dc0407..4f7bf9654cce5ed162a04bdb8159a2700707566e 100644 (file)
@@ -368,7 +368,6 @@ PopupList &Body::createPopupList(const std::string &title)
 {
     PopupList &popupList = m_App.getPopupManager().getPopupList();
     popupList.setTitle(title);
-    popupList.setAutoDismissBlockClickedFlag(true);
     return popupList;
 }
 
@@ -387,7 +386,6 @@ void Body::showTooLargePopup(const std::list <std::string> &tooBigFiles)
             content.append(FileUtils::getFileName(file));
         }
         popup.setContent(content);
-        popup.setAutoDismissBlockClickedFlag(true);
         popup.show();
         m_TooLargePopupShow = true;
    }
@@ -403,7 +401,6 @@ void Body::showTooMuchAttachedPopup(int willBeAttached)
         int maxCount = m_App.getMsgEngine().getSettings().getAttachmentsMaxCount();
         std::string content(msgArgs("IDS_MSGF_BODY_MAXIMUM_NUMBER_OF_ATTACHMENTS_HP1SS_EXCEEDED_ONLY_FIRST_P2SS_WILL_BE_ADDED", std::to_string(maxCount).c_str(), std::to_string(willBeAttached).c_str()));
         popup.setContent(content);
-        popup.setAutoDismissBlockClickedFlag(true);
         popup.show();
         m_TooMuchAttachedPopupShow = true;
    }
@@ -419,7 +416,6 @@ void Body::showTooMuchAttachedPopup()
         int maxCount = m_App.getMsgEngine().getSettings().getAttachmentsMaxCount();
         std::string content(msgArgs("IDS_MSGF_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_HPS_EXCEEDED", std::to_string(maxCount).c_str()));
         popup.setContent(content);
-        popup.setAutoDismissBlockClickedFlag(true);
         popup.show();
         m_TooMuchAttachedPopupShow = true;
    }
@@ -436,7 +432,6 @@ void Body::showResizingPopup()
         std::string content(msgArgs("IDS_MSG_TPOP_CANT_ADD_MORE_THAN_P1SS_P2SS_OF_ATTACHMENTS_RESIZING_ATTACHMENTS_ING",
                 std::to_string(maxSize / 1024).c_str(), msg("IDS_MSGF_BODY_MSGSIZE_KB").get()));
         popup.setContent(content);
-        popup.setAutoDismissBlockClickedFlag(true);
         popup.show();
         m_ResizingPopupShow = true;
     }
index 32b3f860e855826778f0965232bd29b9b0a08746..e7894c70349ba2cb9ba06b47424e586ffe7b3a82 100644 (file)
@@ -824,7 +824,6 @@ PopupList &Conversation::createPopupList(const std::string &title)
 {
     PopupList &popup = getApp().getPopupManager().getPopupList();
     popup.setTitle(title);
-    popup.setAutoDismissBlockClickedFlag(true);
     return popup;
 }
 
@@ -858,7 +857,6 @@ void Conversation::showSendDpmNotif(const MsgAddressList &addressList)
         std::string text = msgArgs("IDS_MSG_POP_THE_SECURITY_POLICY_PREVENTS_SENDING_MESSAGES_TO_THE_FOLLOWING_RECIPIENTS_C_NPS", addresses.c_str());
         auto &popupMngr = getApp().getPopupManager();
         Popup &popup = popupMngr.getPopup();
-        popup.setAutoDismissBlockClickedFlag(true);
         popup.addButton(msgt("IDS_MSG_BUTTON_OK_ABB"), Popup::OkButtonId);
         popup.setContent(text);
         popup.show();
@@ -902,7 +900,7 @@ void Conversation::showSendReadReportPopup()
 
 void Conversation::showMainPopup()
 {
-    PopupList &popup = getApp().getPopupManager().getPopupList();
+    PopupList &popup = getApp().getPopupManager().getPopupList(PopupList::MoreMenuPopup);
     popup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(Conversation, onDeleteItemPressed), this);
     popup.appendItem(msg("IDS_MSG_TMBODY_ADD_OR_REMOVE_RECIPIENTS"), POPUPLIST_ITEM_PRESSED_CB(Conversation, onAddRecipientsItemPressed), this);
     popup.show();
index 3921029acee21a2646f5f2173fc324e68ff8d6c8..ee55d646e5c25c58ba51c23098d3aab3538016f1 100644 (file)
@@ -106,7 +106,7 @@ void MsgThread::onAttached(ViewItem &item)
 
 void MsgThread::showMainPopup()
 {
-    PopupList &popup = getApp().getPopupManager().getPopupList();
+    PopupList &popup = getApp().getPopupManager().getPopupList(PopupList::MoreMenuPopup);
     if (!m_pThreadList->isEmpty())
     {
         popup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(MsgThread, onDeleteItemPressed), this);
index 4be1989cff788aaf4d28cbd1a623d07f95bf5d3e..f7d63d6d61c2735234d2d559ae54f39b70618a4f 100644 (file)
@@ -162,7 +162,7 @@ void MsgOnSimCard::showCopyDeletePopup()
 {
     if(!m_pList->isEmpty())
     {
-        PopupList &listPopup = getApp().getPopupManager().getPopupList();
+        PopupList &listPopup = getApp().getPopupManager().getPopupList(PopupList::MoreMenuPopup);
         listPopup.appendItem(msg("IDS_MSG_OPT_COPY_TO_DEVICE_ABB"), POPUPLIST_ITEM_PRESSED_CB(MsgOnSimCard, onCopyToDeviceItemPressed), this);
         listPopup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(MsgOnSimCard, onDeleteItemPressed), this);
         listPopup.show();
index 67418aa3e9ee355f09ea331b68043285d8d5bd59..9723bedbb2eaf6450495b46f11117aa933969da8 100644 (file)
@@ -215,7 +215,6 @@ void Viewer::showRecipPopup(const std::string &address)
 {
     PopupList &popup = getApp().getPopupManager().getPopupList();
     popup.setTitle(address);
-    popup.setAutoDismissBlockClickedFlag(true);
     if(MsgUtils::isValidNumber(address))
         popup.appendItem(msg("IDS_MSG_OPT_MAKE_VOICE_CALL"),  POPUPLIST_ITEM_PRESSED_CB(Viewer, onMakeVoiceItemPressed), this);
     popup.appendItem(msg("IDS_MSG_OPT_CREATE_CONTACT_ABB"),  POPUPLIST_ITEM_PRESSED_CB(Viewer, onCreateContactItemPressed), this);
@@ -275,8 +274,7 @@ void Viewer::onHwMoreButtonClicked()
 {
     m_pSmilPlayer->stop();
 
-    PopupList &popup = getApp().getPopupManager().getPopupList();
-    popup.setAutoDismissBlockClickedFlag(true);
+    PopupList &popup = getApp().getPopupManager().getPopupList(PopupList::MoreMenuPopup);
     popup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onDeleteItemPressed), this);
 
     if(!m_Msg->getText().empty())
@@ -374,7 +372,6 @@ void Viewer::onDeleteItemPressed(PopupListItem &item)
 {
     item.getParent().destroy();
     Popup &popup = getApp().getPopupManager().getPopup();
-    popup.setAutoDismissBlockClickedFlag(true);
     popup.addButton(msgt("IDS_MSG_BUTTON_CANCEL_ABB"), Popup::CancelButtonId, POPUP_BUTTON_CB(Viewer, onCancelButtonClicked), this);
     popup.addButton(msgt("IDS_MSG_BUTTON_DELETE_ABB4"), Popup::OkButtonId, POPUP_BUTTON_CB(Viewer, onDeleteButtonClicked), this);
     popup.setTitle(msgt("IDS_MSG_HEADER_DELETE"));