TSAM-10985 temporary disabling "Contacts" button when contacts-app was started to... 01/102401/1 submit/tizen_3.0/20161205.153030
authorAndrey Klimenko <and.klimenko@samsung.com>
Mon, 5 Dec 2016 13:52:59 +0000 (15:52 +0200)
committerAndrey Klimenko <and.klimenko@samsung.com>
Mon, 5 Dec 2016 13:54:10 +0000 (15:54 +0200)
Change-Id: Iaa4d3d1e01d258bce844b8dbc73419c78130056d
Signed-off-by: Andrey Klimenko <and.klimenko@samsung.com>
src/Conversation/AppControl/inc/ContactPicker.h
src/Conversation/AppControl/src/ContactPicker.cpp
src/Conversation/Recipients/Controller/inc/ConvRecipientsPanel.h
src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp
src/Conversation/Recipients/View/inc/ConvRecipientsPanelView.h
src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp

index c4dfe0d63adae4e0ae16250b5558053f37921e16..0ea346d41e44b2f9b13b2976d67221b3d8332c5b 100644 (file)
@@ -69,6 +69,7 @@ namespace Msg
         public:
             virtual ~IContactPickerListener() {}
             virtual void onContactsPicked(const std::list<ResultData> &numberIdList) {};
+            virtual void onFinish() {};
     };
 }
 
index b2cf628cdda4721a542cd4073c027b7e7a4438ea..f5cf201dcaf1ca8a4686c34f4964d6f76d1876c3 100644 (file)
@@ -59,6 +59,7 @@ bool ContactPicker::launch(size_t howManyToPick)
         size_t len = sizeof(addressesTypes) / sizeof(addressesTypes[0]);
         app_control_add_extra_data_array(svc_handle, APP_CONTROL_DATA_TYPE, addressesTypes, len);
         app_control_set_launch_mode(svc_handle, APP_CONTROL_LAUNCH_MODE_GROUP);
+        app_control_enable_app_started_result_event(svc_handle);
         int ret = app_control_send_launch_request(svc_handle, APP_CONTROL_RES_CALLBACK(ContactPicker, onAppControlRes), this);
         MSG_LOG("launching contacts, result-code: ", ret);
         res = (ret == APP_CONTROL_ERROR_NONE);
@@ -70,6 +71,9 @@ bool ContactPicker::launch(size_t howManyToPick)
 
 void ContactPicker::onAppControlRes(app_control_h request, app_control_h reply, app_control_result_e result)
 {
+    if (m_pListener)
+        m_pListener->onFinish();
+
     if (result == APP_CONTROL_RESULT_SUCCEEDED)
     {
         std::list<int> addressIds;
index 24b33ed4e88e42f18e06eed6497d5973aea80ce8..e5140aee8fcbd8520b9f1c9434aadc375c392d73 100644 (file)
@@ -80,6 +80,7 @@ namespace Msg
 
             // IContactPickerListener
             virtual void onContactsPicked(const std::list<ResultData> &addressIdList);
+            virtual void onFinish();
 
             // IContactManagerListener:
             virtual void onContactChanged();
index ac62108e8e624d3874a983d665ea6804027732d9..346a2879bef807b5abd29682e0c127a7472b1ba3 100644 (file)
@@ -257,7 +257,10 @@ void ConvRecipientsPanel::onContactButtonClicked()
     MSG_LOG("");
     int currentRecipientsCount = getItemsCount();
     if (currentRecipientsCount < getMaxRecipientCount())
+    {
+        setButtonEnabled(ContactButton, false);
         m_Picker.launch(getMaxRecipientCount() - currentRecipientsCount);
+    }
     else
         showTooManyRecipientsNotif();
 }
@@ -298,6 +301,12 @@ void ConvRecipientsPanel::onContactsPicked(const std::list<ResultData> &addressI
     setEntryFocus(true);
 }
 
+void ConvRecipientsPanel::onFinish()
+{
+    MSG_LOG("");
+    setButtonEnabled(ContactButton, true);
+}
+
 void ConvRecipientsPanel::onPopupBtnClicked(Popup &popup, int buttonId)
 {
     popup.destroy();
index 39579a6ae0d73f3218368b4e3806f7442a161704..e9af39827663a03b8dfd1fc40239e9980fb3d676 100644 (file)
@@ -71,7 +71,7 @@ namespace Msg
             void setEditMode(bool isEdit);
             void showInvalidIcon(bool show);
             void showClearButton(bool show);
-
+            void setButtonEnabled(ButtonType buttonType, bool enabled);
         private:
             // Out signals:
             virtual void onKeyDown(Evas_Event_Key_Down *ev) {};
index 10b6aacaff9a8187bcd62891c6f0b58f2311d451..0b368a68d792115658891fcd44ea3c3da8f48a38 100644 (file)
@@ -84,6 +84,33 @@ void ConvRecipientsPanelView::showButton(ButtonType buttonType)
     }
 }
 
+void ConvRecipientsPanelView::setButtonEnabled(ButtonType buttonType, bool enabled)
+{
+    Evas_Object *pBtn = nullptr;
+    switch (buttonType)
+    {
+        case NoneButton:
+            break;
+
+        case ContactButton:
+            pBtn = getContactBtn();
+            break;
+
+        case PlusButton:
+            pBtn = getPlusBtn();
+            break;
+
+        default:
+            assert(false);
+            break;
+    }
+
+    if(pBtn)
+    {
+        elm_object_disabled_set(pBtn, !enabled);
+    }
+}
+
 void ConvRecipientsPanelView::addGeometryChangedCb(Evas_Object *obj)
 {
     evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, EVAS_EVENT_CALLBACK(ConvRecipientsPanelView, onGeometryChanged), this);