[TizenRefApp-7031] [Email] Add functionality to hide attach panel when from hoversel... 82/86082/7
authorAndriy Kolesnichenko <a.kolesniche@samsung.com>
Tue, 30 Aug 2016 11:37:37 +0000 (14:37 +0300)
committerAndriy Kolesnichenko <a.kolesniche@samsung.com>
Mon, 5 Sep 2016 08:29:00 +0000 (01:29 -0700)
Change-Id: I0bd922ec7e1ea927c93695375e553b64af6c974a
Signed-off-by: Andriy Kolesnichenko <a.kolesniche@samsung.com>
common/inc/email-module-launcher.h
common/src/email-module-launcher.c
modules/composer/inc/email-composer-recipient.h
modules/composer/src/email-composer-recipient.c
modules/composer/src/email-composer-util.c
modules/composer/src/email-composer.c

index d245ec2..690c927 100644 (file)
@@ -163,6 +163,17 @@ EMAIL_API int email_module_launch_attach_panel(email_module_t *module,
                email_attach_panel_mode_type_e mode);
 
 /**
+ * @brief Close launched attach panel if any
+ *
+ * @param[in]  module                  pointer to the module
+ * @param[in]  notify_close    true - notify listener on close, false - otherwise
+ *
+ * @note This method does not destroy attach panel. It only close it
+ *
+ */
+EMAIL_API void email_module_close_attach_panel(email_module_t *module, bool notify_close);
+
+/**
  * @brief Registers the attach panel listener
  *
  * @param[in]  module          pointer to the module
index 6f49da3..afcc37a 100644 (file)
@@ -275,6 +275,15 @@ int email_module_launch_attach_panel(email_module_t *module,
        return 0;
 }
 
+void email_module_close_attach_panel(email_module_t *module, bool notify_close)
+{
+       debug_enter();
+
+       _email_module_close_attach_panel(module, notify_close);
+
+       debug_leave();
+}
+
 int email_module_set_attach_panel_listener(email_module_t *module,
                email_attach_panel_listener_t *listener)
 {
index dda0480..e86c897 100644 (file)
@@ -75,6 +75,16 @@ void composer_recipient_update_bcc_detail(void *data, Evas_Object *parent);
 void composer_recipient_update_from_detail(EmailComposerView *view);
 
 /**
+ * @brief Get from hoversel expanded state
+ *
+ * @param[in]  view            User data (Email composer data)
+ *
+ * @return EINA_TRUE if from hoversel exist and is expanded, otherwise EINA_FALSE
+ *
+ */
+Eina_Bool composer_recipient_is_from_hoversel_expanded(EmailComposerView *view);
+
+/**
  * @brief Set cc field visible/hide
  *
  * @param[in]  view                                    Email composer data
index 2f4d837..d6c2311 100644 (file)
@@ -256,7 +256,7 @@ static void _resipient_from_hoversel_clear_address_list(EmailComposerView *view)
 {
        debug_enter();
 
-       if (elm_hoversel_expanded_get(view->recp_from_hoversel)) {
+       if (composer_recipient_is_from_hoversel_expanded(view)) {
                elm_hoversel_hover_end(view->recp_from_hoversel);
        }
 
@@ -304,8 +304,13 @@ static void _recipient_from_hoversel_expanded_cb(void *data, Evas_Object *obj, v
        retm_if(!data, "Invalid parameter: data is NULL!");
 
        EmailComposerView *view = (EmailComposerView *)data;
+
        eext_object_event_callback_add(view->recp_from_hoversel, EEXT_CALLBACK_BACK, _recipient_from_hoversel_back_cb, view);
 
+       if (view->base.module->is_attach_panel_launched) {
+               email_module_close_attach_panel(view->base.module, true);
+       }
+
        debug_leave();
 }
 
@@ -315,6 +320,7 @@ static void _recipient_from_hoversel_dismissed_cb(void *data, Evas_Object *obj,
        retm_if(!data, "Invalid parameter: data is NULL!");
 
        EmailComposerView *view = (EmailComposerView *)data;
+
        eext_object_event_callback_del(view->recp_from_hoversel, EEXT_CALLBACK_BACK, _recipient_from_hoversel_back_cb);
        composer_util_focus_set_focus_with_idler(view, view->selected_widget);
 
@@ -720,6 +726,17 @@ void composer_recipient_update_from_detail(EmailComposerView *view)
        email_profiling_end(composer_recipient_update_from_detail);
 }
 
+Eina_Bool composer_recipient_is_from_hoversel_expanded(EmailComposerView *view)
+{
+       debug_enter();
+       if (!view->recp_from_hoversel) {
+               return EINA_FALSE;
+       }
+
+       debug_leave();
+       return elm_hoversel_expanded_get(view->recp_from_hoversel);
+}
+
 void composer_recipient_show_hide_cc_field(EmailComposerView *view, Eina_Bool to_be_showed)
 {
        debug_enter();
index 3878d1c..d4a4950 100644 (file)
@@ -939,7 +939,7 @@ static Evas_Coord _composer_util_get_selected_widget_position(EmailComposerView
 {
        debug_enter();
 
-       if (view->recp_from_hoversel && elm_hoversel_expanded_get(view->recp_from_hoversel)) {
+       if (composer_recipient_is_from_hoversel_expanded(view)) {
                debug_log("selected_layout = from layout");
                return 0;
        }
index 709d096..8449039 100644 (file)
@@ -737,7 +737,7 @@ static void _composer_attach_panel_close_cb(void *data)
 
        elm_object_disabled_set(view->attachment_btn, EINA_FALSE);
 
-       if (!view->composer_popup) {
+       if (!composer_recipient_is_from_hoversel_expanded(view)) {
                composer_util_focus_set_focus_with_idler(view, view->selected_widget);
        }
 
@@ -1327,7 +1327,7 @@ static void _composer_orientation_change_update(EmailComposerView *view)
 
        composer_webkit_update_orientation(view);
 
-       if (view->recp_from_hoversel && elm_hoversel_expanded_get(view->recp_from_hoversel)) {
+       if (composer_recipient_is_from_hoversel_expanded(view)) {
                elm_hoversel_hover_end(view->recp_from_hoversel);
        }