From 19b455d7fa747e30ebe52d3a472d6c8ae83a750f Mon Sep 17 00:00:00 2001 From: Gwangbok Kim Date: Wed, 21 Aug 2013 17:23:10 +0900 Subject: [PATCH] fix N_SE-49223 Change-Id: Ia4ebb080290ce7eac4d67ff5d2f2c127b3818791 Signed-off-by: Gwangbok Kim --- project/src/CategoryAddMemberForm.cpp | 30 ++++++++++++------ project/src/CategoryRemoveMemberForm.cpp | 54 ++++++++++++++++++++++---------- 2 files changed, 59 insertions(+), 25 deletions(-) diff --git a/project/src/CategoryAddMemberForm.cpp b/project/src/CategoryAddMemberForm.cpp index 3f06a65..05aaf24 100755 --- a/project/src/CategoryAddMemberForm.cpp +++ b/project/src/CategoryAddMemberForm.cpp @@ -131,19 +131,31 @@ CategoryAddMemberForm::OnActionPerformed(const Tizen::Ui::Control& source, int a { case ID_FOOTER_ADD: { - r = AddMember(); - TryReturnVoid(!IsFailed(r), "Failed to add member to category (%s).", GetErrorMessage(r)); + if (GetItemCount() > 0) + { + r = AddMember(); + TryReturnVoid(!IsFailed(r), "Failed to add member to category (%s).", GetErrorMessage(r)); + + ArrayList* pList = new (std::nothrow) ArrayList(); + AppAssert(pList); + + r = pList->Construct(); + TryReturnVoid(!IsFailed(r), "Failed to construct list (%s)", GetErrorMessage(r)); - ArrayList* pList = new (std::nothrow) ArrayList(); - AppAssert(pList); + r = pList->Add(*(new (std::nothrow) Category(*__pCategory))); + TryReturnVoid(!IsFailed(r), "Failed to add category (%s).", GetErrorMessage(r)); - r = pList->Construct(); - TryReturnVoid(!IsFailed(r), "Failed to construct list (%s)", GetErrorMessage(r)); + pSceneManager->GoBackward(BackwardSceneTransition(SCENE_CATEGORY_MEMBER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pList); + } + else + { + MessageBox messageBox; + messageBox.Construct(L"Info", "There is no contact to add.", MSGBOX_STYLE_OK, 0); - r = pList->Add(*(new (std::nothrow) Category(*__pCategory))); - TryReturnVoid(!IsFailed(r), "Failed to add category (%s).", GetErrorMessage(r)); + int modalResult; + messageBox.ShowAndWait(modalResult); + } - pSceneManager->GoBackward(BackwardSceneTransition(SCENE_CATEGORY_MEMBER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pList); break; } diff --git a/project/src/CategoryRemoveMemberForm.cpp b/project/src/CategoryRemoveMemberForm.cpp index 220690d..4984d95 100644 --- a/project/src/CategoryRemoveMemberForm.cpp +++ b/project/src/CategoryRemoveMemberForm.cpp @@ -124,29 +124,51 @@ CategoryRemoveMemberForm::OnActionPerformed(const Tizen::Ui::Control& source, in { case ID_FOOTER_DELETE: { - result r = E_SUCCESS; + if (GetItemCount() > 0) + { + if (__checkedIndex == -1) + { + MessageBox messageBox; + messageBox.Construct(L"Info", "Select member to remove", MSGBOX_STYLE_OK, 0); - MessageBox messageBox; - messageBox.Construct(L"Caution", "Remove selected member?", MSGBOX_STYLE_OKCANCEL, 0); + int modalResult; + messageBox.ShowAndWait(modalResult); - int modalResult; - messageBox.ShowAndWait(modalResult); + break; + } - if (modalResult == MSGBOX_RESULT_OK) - { - r = RemoveMember(); - TryReturnVoid(!IsFailed(r), "Failed to remove member (%s).", GetErrorMessage(r)); + result r = E_SUCCESS; + + MessageBox messageBox; + messageBox.Construct(L"Caution", "Remove selected member?", MSGBOX_STYLE_OKCANCEL, 0); + + int modalResult; + messageBox.ShowAndWait(modalResult); - ArrayList* pCategoryList = new (std::nothrow) ArrayList(); - AppAssert(pCategoryList); + if (modalResult == MSGBOX_RESULT_OK) + { + r = RemoveMember(); + TryReturnVoid(!IsFailed(r), "Failed to remove member (%s).", GetErrorMessage(r)); - r = pCategoryList->Construct(); - TryReturnVoid(!IsFailed(r), "Failed to construct the list (%s)", GetErrorMessage(r)); + ArrayList* pCategoryList = new (std::nothrow) ArrayList(); + AppAssert(pCategoryList); - r = pCategoryList->Add(*(new (std::nothrow) Category(*__pCategory))); - TryReturnVoid(!IsFailed(r), "Failed to add category (%s).", GetErrorMessage(r)); + r = pCategoryList->Construct(); + TryReturnVoid(!IsFailed(r), "Failed to construct the list (%s)", GetErrorMessage(r)); + + r = pCategoryList->Add(*(new (std::nothrow) Category(*__pCategory))); + TryReturnVoid(!IsFailed(r), "Failed to add category (%s).", GetErrorMessage(r)); + + pSceneManager->GoBackward(BackwardSceneTransition(SCENE_CATEGORY_MEMBER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pCategoryList); + } + } + else + { + MessageBox messageBox; + messageBox.Construct(L"Info", "There is no member to remove.", MSGBOX_STYLE_OK, 0); - pSceneManager->GoBackward(BackwardSceneTransition(SCENE_CATEGORY_MEMBER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pCategoryList); + int modalResult; + messageBox.ShowAndWait(modalResult); } break; -- 2.7.4