2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file PhnLogsDetailForm.cpp
19 * @brief Call log details form
22 #include <FGraphics.h>
25 #include "PhnPhoneApp.h"
26 #include "PhnAppUtility.h"
27 #include "PhnLogsDetailForm.h"
28 #include "PhnSceneRegister.h"
29 #include "PhnCalllogManager.h"
30 #include "PhnCallLogPresentationModel.h"
31 #include "PhnCallRejectInfo.h"
32 #include "PhnDialPresentationModel.h"
33 #include "PhnSettingsPresentationModel.h"
36 using namespace Tizen::App;
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Collection;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Media;
41 using namespace Tizen::Social;
42 using namespace Tizen::Ui;
43 using namespace Tizen::Ui::Controls;
44 using namespace Tizen::Ui::Scenes;
46 const wchar_t* IDL_CALL_LOG_DETAIL_FORM = L"IDL_CALL_LOG_DETAIL_FORM";
47 const wchar_t* IDC_BUTTON_CONTACT_IMAGE = L"IDC_BUTTON_CONTACT_IMAGE";
48 const wchar_t* IDC_LABEL_NAME = L"IDC_LABEL_NAME";
49 const wchar_t* IDC_LABEL_NUMBER_COUNT = L"IDC_LABEL_NUMBER_COUNT";
50 const wchar_t* IDC_LABEL_UNSAVED_NUMBER = L"IDC_LABEL_UNSAVED_NUMBER";
51 const wchar_t* IDC_LABEL_COUNT = L"IDC_LABEL_COUNT";
52 const wchar_t* IDC_LABEL_NUMBER = L"IDC_LABEL_NUMBER";
53 const wchar_t* IDC_LABEL_NUMBER_UNSAVED = L"IDC_LABEL_NUMBER_UNSAVED";
54 const wchar_t* IDC_LABEL_BLOCKED = L"IDC_LABEL_BLOCKED";
55 const wchar_t* IDC_BUTTON_MESSAGE = L"IDC_BUTTON_MESSAGE";
56 const wchar_t* IDC_SELECTALL = L"IDC_SELECTALL";
57 const wchar_t* IDC_LABEL_DETAIL_SELECTED = L"IDC_LABEL_DETAIL_SELECTED";
58 const wchar_t* IDC_PANEL_NAME = L"IDC_PANEL_NAME";
59 const wchar_t* IDC_PANEL_NUMBER_UNSAVED = L"IDC_PANEL_NUMBER_UNSAVED";
60 const wchar_t* IDS_ALREADY_USED_MSG = L"IDS_ALREADY_USED_MSG";
62 const int IDA_CALL_LOG_CALL = 201;
63 const int IDA_CALL_LOG_MESSAGE = 202;
64 const int IDA_FOOTER_BUTTON_LEFT = 203;
65 const int IDA_FOOTER_BUTTON_RIGHT = 204;
66 const int IDA_SELECT_ALL_CHECKED = 205;
67 const int IDA_SELECT_ALL_UNCHECKED = 206;
68 const int IDA_POPUP_DELETE_CANCEL = 207;
69 const int IDA_FOOTER_LOG_MORE = 208;
70 const int IDA_CONTEXTMENU_DETAILS = 209;
71 const int IDA_CONTEXTMENU_ADDTOCONTACT = 210;
72 const int IDA_CONTEXTMENU_BLOCK = 211;
74 const int W_BUTTON = 48;
75 const int H_BUTTON = 48;
76 const int W_BLOCKED_ICON = 56;
77 const int H_BLOCKED_ICON = 56;
78 //static const int X_MORE = 55;
80 const wchar_t* FORMAT_STR = L"%ls (%d)";
82 static const int W_DELETE_POPUP = 720;
83 static const int H_DELETE_POPUP = 308;
84 static const int Y_DELETE_POPUP_TITLE = 20;
85 static const int H_DELETE_POPUP_ELEMENT = 60;
86 static const int H_DELETE_POPUP_PROGRESS = 34;
87 static const int Y_DELETE_POPUP_CANCEL_BUTTON = 214;
88 static const int H_DELETE_POPUP_CANCEL_BUTTON = 74;
89 static const int W_DELETE_POPUP_CANCEL_BUTTON = 394;
91 static const int FONT_SIZE_DELETE_POPUP_TEXT = 36;
93 static const unsigned int COLOR_DELETE_POPUP_TEXT = Color32<128, 128, 128>::Value;
94 static const unsigned int COLOR_DELAIL_LABEL_SELECTED = Color32<215, 225, 232, 255>::Value;
97 DlLogsDetailForm::DlLogsDetailForm(void)
99 __pDataProvider = new LogsDetailItemProvider();
102 __pButtonCall = null;
103 __pButtonMessage = null;
104 __pButtonContactImage = null;
105 __pPanelNumberUnsaved = null;
107 __pLabelNumber = null;
108 __pFormFooter = null;
110 __isEditMode = false;
111 __isSelectAll = false;
112 __isPresentInContacts = false;
114 __selectedItemCount = 0;
115 __calllogListByNum = null;
116 __pLogPresentor = null;
118 __isMsgAppControlLaunched = false;
119 __deleteLogsTimer.Construct(*this);
120 __deleteGroupIndex = 0;
121 __deleteItemIndex = 0;
122 __pDeletePopup = null;
123 __isDeleteInProgress = false;
125 __isSceneVisible = false;
126 __pLogsBlockPopup = null;
\r
127 __isContactAppControlLaunched = false;
128 __isCallBeRejected = false;
129 __isCallAppControlLaunched = false;
130 __isMsgBeRejected = false;
131 __pOptionMenu = null;
134 DlLogsDetailForm::~DlLogsDetailForm(void)
136 if (__pDataProvider != null)
138 delete __pDataProvider;
139 __pDataProvider = null;
141 if (__pLogPresentor != null)
143 __pLogPresentor->RemoveCalllogChangeListner(*this);
144 __pLogPresentor = null;
146 if (__pCallLogId != null)
148 __pCallLogId->RemoveAll();
152 if(__pLogsBlockPopup != null)
\r
154 delete __pLogsBlockPopup;
\r
155 __pLogsBlockPopup = null;
\r
160 DlLogsDetailForm::Initialize()
162 result r = Construct(IDL_CALL_LOG_DETAIL_FORM);
163 __pCallLogId = new(std::nothrow) ArrayList();
164 r = __pCallLogId->Construct();
166 TryCatch(r == E_SUCCESS, , "DlLogsDetailForm::Initialize Fail to initialize Call log detail form");
174 DlLogsDetailForm::OnInitializing(void)
176 result r = E_SUCCESS;
178 AddOrientationEventListener(*this);
179 SetFormMenuEventListener(this);
180 SetFormBackEventListener(this);
181 AppResource* pAppResource = App::GetInstance()->GetAppResource();
183 __pFormFooter = GetFooter();
184 if (__pFormFooter != null)
186 __pFormFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
187 __pFormFooter->AddActionEventListener(*this);
189 __pFooterItemDelete.Construct(IDA_FOOTER_BUTTON_LEFT);
190 __pFooterItemDelete.SetText(AppUtility::GetResourceString(IDS_CALLLOG_DELETE_FOOTER));
191 __pFormFooter->AddItem(__pFooterItemDelete);
193 __pFooterItemCancel.Construct(IDA_FOOTER_BUTTON_RIGHT);
194 __pFooterItemCancel.SetText(AppUtility::GetResourceString(IDS_CALLLOG_CANCEL_FOOTER));
197 __pButtonContactImage = static_cast<Button*>(GetControl(IDC_BUTTON_CONTACT_IMAGE));
198 if (__pButtonContactImage != null)
200 //todo: set image & show if present in contacts
201 __pButtonContactImage->SetShowState(false);
204 __pPanelName = static_cast<Panel*>(GetControl(IDC_PANEL_NAME));
205 __pPanelNumberUnsaved = static_cast<Panel*>(GetControl(IDC_PANEL_NUMBER_UNSAVED));
207 __pLabelNumber = static_cast<Label*>(GetControl(IDC_LABEL_NUMBER));
208 if (__pLabelNumber != null)
210 __pLabelNumber->SetTextColor(Color::GetColor(COLOR_ID_BLACK));
211 __pLabelNumber->SetTextConfig(32, LABEL_TEXT_STYLE_BOLD);
214 __pLabelBlocked = static_cast<Label*>(GetControl(IDC_LABEL_BLOCKED));
215 if (__pLabelBlocked != null)
217 __pLabelBlocked->SetShowState(false);
220 Bitmap* pBgNormal = pAppResource->GetBitmapN(IDB_CIRCLE_BUTTON_NORMAL ,BITMAP_PIXEL_FORMAT_ARGB8888);
221 Bitmap* pBgPressed = pAppResource->GetBitmapN(IDB_CIRCLE_BUTTON_PRESSED ,BITMAP_PIXEL_FORMAT_ARGB8888);
222 Bitmap* pCallNormal = pAppResource->GetBitmapN(IDB_LOG_DETAIL_CALL_ICON ,BITMAP_PIXEL_FORMAT_ARGB8888);
223 Bitmap* pCallPressed = pAppResource->GetBitmapN(IDB_LOG_DETAIL_CALL_PRESSED_ICON ,BITMAP_PIXEL_FORMAT_ARGB8888);
225 __pButtonCall = static_cast<Button*>(GetControl(IDC_BUTTON_CALL));
226 if (__pButtonCall != null)
228 __pButtonCall->SetActionId(IDA_CALL_LOG_CALL);
229 __pButtonCall->AddActionEventListener(*this);
231 if (pBgNormal != null)
233 __pButtonCall->SetNormalBackgroundBitmap(*pBgNormal);
237 if (pBgPressed != null)
239 __pButtonCall->SetPressedBackgroundBitmap(*pBgPressed);
243 if (pCallNormal != null)
245 __pButtonCall->SetNormalBitmap(Point(0, 0), *pCallNormal);
249 if (pCallPressed != null)
251 __pButtonCall->SetPressedBitmap(Point(0, 0), *pCallPressed);
256 pBgNormal = pAppResource->GetBitmapN(IDB_CIRCLE_BUTTON_NORMAL ,BITMAP_PIXEL_FORMAT_ARGB8888);
257 pBgPressed = pAppResource->GetBitmapN(IDB_CIRCLE_BUTTON_PRESSED ,BITMAP_PIXEL_FORMAT_ARGB8888);
258 Bitmap* pMsgNormal = pAppResource->GetBitmapN(IDB_LOG_DETAIL_MSG_ICON ,BITMAP_PIXEL_FORMAT_ARGB8888);
259 Bitmap* pMsgPressed = pAppResource->GetBitmapN(IDB_LOG_DETAIL_MSG_PRESSED_ICON ,BITMAP_PIXEL_FORMAT_ARGB8888);
261 __pButtonMessage = static_cast<Button*>(GetControl(IDC_BUTTON_MESSAGE));
262 if (__pButtonMessage != null)
264 __pButtonMessage->SetActionId(IDA_CALL_LOG_MESSAGE);
265 __pButtonMessage->AddActionEventListener(*this);
267 if (pBgNormal != null)
269 __pButtonMessage->SetNormalBackgroundBitmap(*pBgNormal);
273 if (pBgPressed != null)
275 __pButtonMessage->SetPressedBackgroundBitmap(*pBgPressed);
279 if (pMsgNormal != null)
281 __pButtonMessage->SetNormalBitmap(Point(0, 0), *pMsgNormal);
285 if (pMsgPressed != null)
287 __pButtonMessage->SetPressedBitmap(Point(0, 0), *pMsgPressed);
292 __pSelectAll = static_cast<CheckButton*>(GetControl(IDC_SELECTALL));
293 if(__pSelectAll != null)
295 __pSelectAll->SetActionId(IDA_SELECT_ALL_CHECKED, IDA_SELECT_ALL_UNCHECKED);
296 __pSelectAll->SetSize(GetClientAreaBounds().width, 112);
297 __pSelectAll->SetShowState(false);
298 __pSelectAll->AddActionEventListener(*this);
300 __pList = new (std::nothrow) GroupedListView();
303 __listHeight = GetClientAreaBounds().height - __pButtonContactImage->GetBounds().height - __pButtonMessage->GetBounds().height - 40;
304 int listY = __pButtonContactImage->GetBounds().height + __pButtonMessage->GetBounds().height + 40;
305 __pList->Construct(Rectangle(0, listY, GetClientAreaBounds().width, __listHeight), GROUPED_LIST_VIEW_STYLE_INDEXED, true, SCROLL_STYLE_FADE_OUT);
307 __pList->AddGroupedListViewItemEventListener(*this);
308 r = AddControl(__pList);
309 TryCatch(r == E_SUCCESS, , "call log detail list control not added");
312 __pSelectedLabel = static_cast<Label*>(GetControl(IDC_LABEL_DETAIL_SELECTED));
313 if(__pSelectedLabel != null)
315 SetControlAlwaysOnTop(*__pSelectedLabel,true);
316 __pSelectedLabel->SetBackgroundColor(COLOR_DELAIL_LABEL_SELECTED);
317 __pSelectedLabel->SetShowState(false);
325 DlLogsDetailForm::OnTerminating(void)
327 result r = E_SUCCESS;
333 DlLogsDetailForm::DeleteSelectedCalllog(void)
341 DlLogsDetailForm::OnActionPerformed(const Control& source, int actionId)
346 case IDA_CALL_LOG_CALL:
348 if(__isCallAppControlLaunched == true)
350 AppLogDebug("Call AppControl is already launched");
353 if (__number.IsEmpty() == false)
355 PhoneApp* pPhoneApp = static_cast<PhoneApp*>(UiApp::GetInstance());
356 if (pPhoneApp->IsOpenAsAppControl() == false)
358 CalLogPresentationModel* pLogPresentor = CalLogPresentationModel::GetInstance();
359 pLogPresentor->DialCall(__number);
360 __isCallAppControlLaunched = true;
364 //launched as AppControl
366 resultData.Construct();
367 resultData.Add(new (std::nothrow) String(PARAM_PHONE_NUMBER), new (std::nothrow) String(__number));
368 //send "APP_CTRL_RESULT_SUCCEEDED" and 'contactNumber' as result.
369 pPhoneApp->SendAppControlResponseMessage(APP_CTRL_RESULT_SUCCEEDED, &resultData);
370 resultData.RemoveAll(true);
371 pPhoneApp->Terminate();
377 case IDA_CALL_LOG_MESSAGE:
379 if(__isMsgAppControlLaunched == true)
381 //Message AppControl is already launched
386 __isMsgAppControlLaunched = true;
387 result r = E_SUCCESS;
389 extraData.Construct();
391 extraData.Add(new (std::nothrow) String(MESSAGE_TYPE), new (std::nothrow) String(MESSAGE_SMS_TYPE));
392 extraData.Add(new (std::nothrow) String(MESSAGE_TO), new (std::nothrow) String(__number));
394 AppControl* pAc = AppManager::FindAppControlN(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE);
397 r = pAc->Start(null, null, &extraData, this);
401 __isMsgAppControlLaunched = false;
405 extraData.RemoveAll(true);
409 case IDA_FOOTER_BUTTON_LEFT:
411 if(__isContactAppControlLaunched == true || __isMsgAppControlLaunched == true || __isCallAppControlLaunched == true)
413 AppLog("AppControl lunching. Can not do delete operation");
416 const wchar_t* pContact = __number.GetPointer();
417 int len = __number.GetLength() + 1;
418 char* pNumber = new (std::nothrow) char[len];
419 wcstombs(pNumber, pContact, len);
420 if (__isEditMode == false)
424 __calllogListByNum = __pLogPresentor->GetCallogListByNumberFromDatabaseN(pNumber);
425 __pList->UpdateList();
426 __pList->Invalidate(false);
437 case IDA_FOOTER_BUTTON_RIGHT:
439 __pCallLogId->RemoveAll();
442 __pList->UpdateList();
446 case IDA_SELECT_ALL_UNCHECKED:
448 SetListItemSelectStatus(false);
449 __pCallLogId->RemoveAll();
450 __selectedItemCount = 0;
451 String selStr = AppUtility::GetResourceString(IDS_SELECT_CALL_LOG);
452 __pSelectedLabel->SetText(selStr);
453 __pSelectedLabel->Invalidate(false);
456 case IDA_SELECT_ALL_CHECKED:
458 __pCallLogId->RemoveAll();
459 SetAllListItems(true);
460 __selectedItemCount = __listItemCount;
462 String selItemStr = L"";
463 if(__selectedItemCount > 1)
465 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEMS_STRING);
469 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEM_STRING);
471 text.Format(100, selItemStr.GetPointer(), __listItemCount);
472 __pSelectedLabel->SetText(text);
473 __pSelectedLabel->Invalidate(false);
476 case IDA_POPUP_DELETE_CANCEL:
478 __deleteLogsTimer.Cancel();
483 case IDA_CONTEXTMENU_DETAILS:
489 case IDA_CONTEXTMENU_ADDTOCONTACT:
491 result r = __pLogPresentor->LaunchAddContactsAppControl(__number);
494 __isContactAppControlLaunched = true;
499 case IDA_CONTEXTMENU_BLOCK:
511 DlLogsDetailForm::GetUpdatedListFromDatabase(char* number)
513 AppLogDebug("Enter");
514 if(__calllogListByNum != null)
516 AppLog(" list already present, UPDATE");
517 __calllogListByNum->RemoveAll();
518 delete __calllogListByNum;
521 __calllogListByNum = __pLogPresentor->GetCallogListByNumberFromDatabaseN(number);
522 __calllogCount = __pLogPresentor->GetCalllogCountByNumber();
526 DlLogsDetailForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
528 AppLogDebug("Enter");
529 PhoneApp* pPhoneApp = static_cast<PhoneApp*>(PhoneApp::GetInstance());
530 pPhoneApp->AddAppStateChangeListener(*this);
531 Tizen::System::SettingInfo::AddSettingEventListener(*this);
532 __pLogPresentor = CalLogPresentationModel::GetInstance();
533 __pLogPresentor->AddCalllogChangeListener(*this);
534 __isPresentInContacts = false;
535 __selectedItemCount =0;
536 __isMsgAppControlLaunched = false;
537 __isCallAppControlLaunched = false;
541 String* pNumberStr = static_cast<String*> (pArgs->GetAt(0));
542 __number.Append(*pNumberStr);
548 __pList->SetItemProvider(*__pDataProvider);
551 SetSceneVisible(true);
555 DlLogsDetailForm::UpdateForm(void)
557 AppLogDebug("Enter");
558 SettingsPresentationModel* pSettingsPresentationModel = SettingsPresentationModel::GetInstance();
559 bool isCallToBeRejected = pSettingsPresentationModel->IsCallToBeRejected(__number);
560 __isCallBeRejected = isCallToBeRejected;
561 __isPresentInContacts = false;
563 const wchar_t* pContact = __number.GetPointer();
564 int len = __number.GetLength() + 1;
565 char* pNumber = new (std::nothrow) char[len];
566 wcstombs(pNumber, pContact, len);
568 GetUpdatedListFromDatabase(pNumber);
570 AppLog("__calllogCount = %d", __calllogCount);
571 if(__calllogCount == 0)
576 Bitmap* pBitmap = null;
577 Addressbook* pAddressBook = AddressbookManager::GetInstance()->GetAddressbookN();
578 if (pAddressBook != null)
580 IList* pNumberContactsList = null;
581 if(__number.Contains(L"@"))
583 pNumberContactsList = pAddressBook->SearchContactsByEmailN(__number);
587 pNumberContactsList = pAddressBook->SearchContactsByPhoneNumberN(__number);
589 if(pNumberContactsList != null)
591 IEnumerator* pContactListEnum = pNumberContactsList->GetEnumeratorN();
592 while (pContactListEnum->MoveNext() == E_SUCCESS)
594 Contact* pContact = static_cast<Contact*>(pContactListEnum->GetCurrent());
597 IList* pPhoneNumberList = null;
598 if(__number.Contains(L"@"))
600 pPhoneNumberList = pContact->GetValuesN(CONTACT_MPROPERTY_ID_EMAILS);
601 if (pPhoneNumberList != null)
603 IEnumerator* pEnum = pPhoneNumberList->GetEnumeratorN();
604 while (E_SUCCESS == pEnum->MoveNext())
606 Email* pPhoneNumber = (Email*) pEnum->GetCurrent();
607 if(pPhoneNumber->GetEmail().Equals(__number) == true)
609 __isPresentInContacts = true;
614 pPhoneNumberList->RemoveAll(true);
615 delete pPhoneNumberList;
620 pPhoneNumberList = pContact->GetValuesN(CONTACT_MPROPERTY_ID_PHONE_NUMBERS);
621 if (pPhoneNumberList != null)
623 IEnumerator* pEnum = pPhoneNumberList->GetEnumeratorN();
624 while (E_SUCCESS == pEnum->MoveNext())
626 PhoneNumber* pPhoneNumber = (PhoneNumber*) pEnum->GetCurrent();
627 if(pPhoneNumber->GetPhoneNumber().Equals(__number) == true)
629 __isPresentInContacts = true;
634 pPhoneNumberList->RemoveAll(true);
635 delete pPhoneNumberList;
640 if(__isPresentInContacts == true)
643 __contactName.Clear();
644 pContact->GetValue(CONTACT_PROPERTY_ID_DISPLAY_NAME, __contactName);
645 //fetch person's photo
646 pBitmap = pContact->GetThumbnailN(); //In case of big image, it will return null.
649 AppLog("Fetch big image");
650 String thumbnailPath;
651 pContact->GetValue(CONTACT_PROPERTY_ID_THUMBNAIL, thumbnailPath);
652 if(thumbnailPath.IsEmpty() == true)
654 IList* pCategoryList = pAddressBook->GetCategoriesByContactN(pContact->GetRecordId());
655 if(pCategoryList != null && pCategoryList->GetCount() > 0)
657 AppLogDebug("Changes to get thumbnail group photo");
658 Category* pCategory = static_cast<Category*>(pCategoryList->GetAt(0));
659 thumbnailPath = pCategory->GetThumbnailPath();
662 ImageBuffer thumbnailImageBuffer;
663 if (thumbnailImageBuffer.Construct(thumbnailPath) == E_SUCCESS)
665 pBitmap = thumbnailImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, BUFFER_SCALING_NONE);
669 //todo: set the contact button image
670 Canvas* pCanvas = null;
671 pCanvas = new (std::nothrow) Canvas();
672 pCanvas->Construct(Rectangle(0,0,__pButtonContactImage->GetBounds().width,__pButtonContactImage->GetBounds().height));
673 //set bitmap to button
676 pBitmap = AppUtility::GetBitmapFromResourcesN(L"C01-1_icon_contacts.png", W_CONTACT_BITMAP_ITEM, H_CONTACT_BITMAP_ITEM);
680 //scale bitmap to predefined size
681 pBitmap->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
682 pBitmap->Scale(Dimension(W_CONTACT_BITMAP_ITEM, H_CONTACT_BITMAP_ITEM));
685 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pBitmap->GetWidth(), pBitmap->GetHeight())), *pBitmap);
688 //TODO: chk whether the number is blocked and add icon in top right
689 bool isMsgBeRejected = SettingsPresentationModel::GetInstance()->GetMsgFilterListIndex(__number);
690 if (isCallToBeRejected == true || isMsgBeRejected == true)
692 pBitmap = AppUtility::GetBitmapFromResourcesN(L"C01-4_icon_Blocked.png", W_BLOCKED_ICON, H_BLOCKED_ICON);
693 pCanvas->DrawBitmap(Rectangle(Point(86, 0), Dimension(pBitmap->GetWidth(), pBitmap->GetHeight())), *pBitmap);
697 if(__isEditMode == false)
699 Bitmap* pActualBgBmp = new Bitmap();
700 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
701 __pButtonContactImage->SetNormalBackgroundBitmap(*pActualBgBmp);
702 __pButtonContactImage->SetPressedBackgroundBitmap(*pActualBgBmp);
703 __pButtonContactImage->SetHighlightedBackgroundBitmap(*pActualBgBmp);
704 __pButtonContactImage->SetShowState(true);
705 __pButtonContactImage->Invalidate(false);
713 delete pContactListEnum;
714 pNumberContactsList->RemoveAll(true);
715 delete pNumberContactsList;
721 if (__isPresentInContacts == false)
723 __isPresentInContacts = false;
724 //not in contacts rearrage the icons
726 //if(__isEditMode == false)
729 bool isMsgBeRejected = SettingsPresentationModel::GetInstance()->GetMsgFilterListIndex(__number);
730 if (isCallToBeRejected == true || isMsgBeRejected == true)
732 pBitmap = AppUtility::GetBitmapFromResourcesN(L"C01-4_icon_Blocked.png", W_BLOCKED_ICON, H_BLOCKED_ICON);
733 __pLabelBlocked->SetBackgroundBitmap(*pBitmap);
739 Canvas* pCanvas = null;
740 pCanvas = new (std::nothrow) Canvas();
741 pCanvas->Construct(Rectangle(0,0,__pLabelBlocked->GetBounds().width,__pButtonContactImage->GetBounds().height));
742 Bitmap* pActualBgBmp = new Bitmap();
743 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
744 __pLabelBlocked->SetBackgroundBitmap(*pActualBgBmp);
748 __pLabelBlocked->SetShowState(true);
749 __pLabelBlocked->Invalidate(false);
752 if (__pDataProvider != null)
754 __pDataProvider->ResetDetailsList();
756 __pList->UpdateList();
757 __pList->Invalidate(true);
758 if(__number.Contains(L"@"))
760 __pButtonCall->SetEnabled(false);
764 __pButtonCall->SetEnabled(true);
769 DlLogsDetailForm::ManageUserDetail()
771 if(__isEditMode == false)
773 AppLogDebug("Enter");
776 AppUtility::GetGlobalFontAndItemHeight(&fontSize, &itemHeight);
777 if(fontSize == 44.0f)
779 fontSize = 50.0f; //normal fort size
781 if(__isPresentInContacts == true)
783 String contactNameStr;
784 contactNameStr.Format(100, L"%ls",__contactName.GetPointer(), __calllogCount);
785 TextElement* pTextElement = new (std::nothrow) TextElement();
786 pTextElement->Construct(contactNameStr);
787 Font* ContactNameTextfont = new (std::nothrow) Font();
788 ContactNameTextfont->Construct(FONT_STYLE_BOLD, fontSize);
789 FloatDimension textDimension;
790 ContactNameTextfont->GetTextExtent(contactNameStr, contactNameStr.GetLength(), textDimension);
792 String countString = L"(" + Integer::ToString(__calllogCount) + L")";
793 float countStringWidth = 0.0;
794 float stringHeight = 0.0;
795 GetTextWidthHeight(countString, fontSize, &countStringWidth, &stringHeight);
796 __pPanelName->SetSize(__pPanelName->GetWidthF(), stringHeight);
797 width = __pPanelName->GetWidthF() - countStringWidth;
798 Label* pLabelName = static_cast<Label*>(GetControl(IDC_LABEL_NAME, true));
799 Label* pLabelCount = static_cast<Label*>(GetControl(IDC_LABEL_NUMBER_COUNT, true));
800 if(pLabelName != null && pLabelCount != null)
802 pLabelName->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
803 pLabelCount->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
805 pLabelName->SetTextConfig(fontSize, LABEL_TEXT_STYLE_BOLD);
806 pLabelCount->SetTextConfig(fontSize, LABEL_TEXT_STYLE_BOLD);
807 if(textDimension.width > width)
809 pLabelName->SetBounds(FloatRectangle(0, 0, width, __pPanelName->GetHeightF()));
810 pLabelName->SetText(contactNameStr);
811 pLabelName->SetShowState(true);
812 pLabelName->Invalidate(false);
814 pLabelCount->SetBounds(FloatRectangle(width, 0, __pPanelName->GetWidthF() - countStringWidth, __pPanelName->GetHeightF()));
815 pLabelCount->SetText(countString);
816 pLabelCount->SetShowState(true);
817 pLabelCount->Invalidate(false);
821 contactNameStr.Format(100, L"%ls (%d)",__contactName.GetPointer(), __calllogCount);
822 pLabelName->SetBounds(FloatRectangle(0, 0, __pPanelName->GetWidthF(), __pPanelName->GetHeightF()));
823 pLabelName->SetText(contactNameStr);
824 pLabelName->SetShowState(true);
825 pLabelName->Invalidate(false);
826 pLabelCount->SetShowState(false);
830 __pPanelName->SetShowState(true);
831 __pPanelName->Invalidate(true);
832 __pLabelNumber->SetText(__number);
833 __pLabelNumber->SetShowState(true);
834 __pLabelNumber->Invalidate(false);
835 __pPanelNumberUnsaved->SetShowState(false);
836 __pPanelNumberUnsaved->Invalidate(true);
837 __pLabelBlocked->SetShowState(false);
838 __pLabelBlocked->Invalidate(false);
842 String contactNameStr;
843 contactNameStr.Format(100, L"%ls",__number.GetPointer(), __calllogCount);
844 TextElement* pTextElement = new (std::nothrow) TextElement();
845 pTextElement->Construct(contactNameStr);
846 Font* ContactNameTextfont = new (std::nothrow) Font();
847 ContactNameTextfont->Construct(FONT_STYLE_BOLD, fontSize);
848 FloatDimension textDimension;
849 ContactNameTextfont->GetTextExtent(contactNameStr, contactNameStr.GetLength(), textDimension);
851 String countString = L"(" + Integer::ToString(__calllogCount) + L")";
852 float countStringWidth = 0.0;
853 float stringHeight = 0.0;
854 GetTextWidthHeight(countString, fontSize, &countStringWidth, &stringHeight);
855 __pPanelNumberUnsaved->SetSize(__pPanelNumberUnsaved->GetWidthF(), stringHeight);
856 width = __pPanelNumberUnsaved->GetWidthF() - countStringWidth;
857 Label* pLabelNumber = static_cast<Label*>(GetControl(IDC_LABEL_UNSAVED_NUMBER, true));
858 Label* pLabelCount = static_cast<Label*>(GetControl(IDC_LABEL_COUNT, true));
860 if(pLabelNumber != null && pLabelCount != null)
862 pLabelNumber->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
863 pLabelCount->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
865 pLabelNumber->SetTextConfig(fontSize, LABEL_TEXT_STYLE_BOLD);
866 pLabelCount->SetTextConfig(fontSize, LABEL_TEXT_STYLE_BOLD);
867 if(textDimension.width > width)
869 pLabelNumber->SetBounds(FloatRectangle(0, 0, width, __pPanelNumberUnsaved->GetHeightF()));
870 pLabelNumber->SetText(contactNameStr);
871 pLabelNumber->SetShowState(true);
872 pLabelNumber->Invalidate(false);
874 pLabelCount->SetBounds(FloatRectangle(width, 0, __pPanelNumberUnsaved->GetWidthF() - countStringWidth, __pPanelNumberUnsaved->GetHeightF()));
875 pLabelCount->SetText(countString);
876 pLabelCount->SetShowState(true);
877 pLabelCount->Invalidate(false);
881 pLabelNumber->SetBounds(FloatRectangle(0, 0, __pPanelNumberUnsaved->GetWidthF(), __pPanelNumberUnsaved->GetHeightF()));
882 contactNameStr.Format(100, L"%ls (%d)",__number.GetPointer(), __calllogCount);
883 pLabelNumber->SetText(contactNameStr);
884 pLabelNumber->SetShowState(true);
885 pLabelNumber->Invalidate(false);
886 pLabelCount->SetShowState(false);
890 __pPanelNumberUnsaved->SetShowState(true);
891 __pPanelNumberUnsaved->Invalidate(true);
892 __pPanelName->SetShowState(false);
893 __pPanelName->Invalidate(true);
894 __pLabelNumber->SetShowState(false);
895 __pLabelNumber->Invalidate(false);
896 __pButtonContactImage->SetShowState(false);
897 __pButtonContactImage->Invalidate(true);
903 DlLogsDetailForm::GetTextWidthHeight(String str, float fontSize, float *width, float *height)
905 TextElement* pTextElement = new (std::nothrow) TextElement();
906 pTextElement->Construct(str);
907 Font* ContactNameTextfont = new (std::nothrow) Font();
908 ContactNameTextfont->Construct(FONT_STYLE_BOLD, fontSize);
909 FloatDimension textDimension;
910 ContactNameTextfont->GetTextExtent(str, str.GetLength(), textDimension);
911 *width = textDimension.width;
912 *height = textDimension.height;
916 DlLogsDetailForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
918 PhoneApp* pPhoneApp = static_cast<PhoneApp*>(PhoneApp::GetInstance());
919 pPhoneApp->RemoveAppStateChangeListener(*this);
920 Tizen::System::SettingInfo::RemoveSettingEventListener(*this);
921 SetSceneVisible(false);
922 __pLogPresentor->RemoveCalllogChangeListner(*this);
923 if (__pDataProvider != null)
925 __pDataProvider->ResetDetailsList();
927 if (__pLogPresentor != null)
929 __pLogPresentor = null;
935 DlLogsDetailForm::SetFormMode(bool editMode)
937 AppLogDebug("Enter");
938 if (editMode == false)
941 __isEditMode = false;
942 __pSelectAll->SetShowState(false);
943 __pDataProvider->SetViewMode(false);
944 __pFormFooter->RemoveItemAt(1);
945 if (__isPresentInContacts == false)
947 __pLabelBlocked->SetShowState(true);
948 __pPanelNumberUnsaved->SetShowState(true);
949 __pPanelName->SetShowState(false);
950 __pLabelNumber->SetShowState(false);
951 __pButtonContactImage->SetShowState(false);
955 __pPanelNumberUnsaved->SetShowState(false);
956 __pLabelBlocked->SetShowState(false);
957 __pPanelName->SetShowState(true);
958 __pLabelNumber->SetShowState(true);
959 __pButtonContactImage->SetShowState(true);
961 __pButtonCall->SetShowState(true);
962 __pButtonMessage->SetShowState(true);
963 int listY = __pButtonContactImage->GetBounds().height + __pButtonMessage->GetBounds().height + 40;
964 __listHeight = GetClientAreaBounds().height - __pButtonContactImage->GetBounds().height - __pButtonMessage->GetBounds().height - 40;
965 __pList->SetBounds(Rectangle(0, listY, GetClientAreaBounds().width, __listHeight));
966 __listItemCount = __pLogPresentor->GetCalllogCountByNumber();
967 __pFormFooter->SetItemEnabled(0, true);
968 __pList->RemoveGroupedListViewItemEventListener(*this);
969 __pSelectAll->SetSelected(false);
970 __pSelectedLabel->SetShowState(false);
971 __pSelectedLabel->Invalidate(false);
972 __pList->Invalidate(true);
977 __pSelectAll->SetShowState(true);
978 __pDataProvider->SetViewMode(true);
979 __pFormFooter->AddItem(__pFooterItemCancel);
980 __pList->AddGroupedListViewItemEventListener(*this);
981 if (__isPresentInContacts == false)
983 __pLabelBlocked->SetShowState(false);
984 __pPanelNumberUnsaved->SetShowState(false);
985 __pPanelName->SetShowState(false);
986 __pLabelNumber->SetShowState(false);
987 __pButtonContactImage->SetShowState(false);
991 __pPanelNumberUnsaved->SetShowState(false);
992 __pLabelBlocked->SetShowState(false);
993 __pPanelName->SetShowState(false);
994 __pLabelNumber->SetShowState(false);
995 __pButtonContactImage->SetShowState(false);
997 __pButtonCall->SetShowState(false);
998 __pButtonMessage->SetShowState(false);
999 __pList->SetBounds(GetClientAreaBounds().x, __pSelectAll->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - (__pSelectAll->GetHeight()+__pSelectedLabel->GetHeight()));
1000 __listItemCount = __pLogPresentor->GetCalllogCountByNumber();
1001 __pFormFooter->SetItemEnabled(0, false);
1002 __selectedItemCount = 0;
1003 String selStr = AppUtility::GetResourceString(IDS_SELECT_CALL_LOG);
1004 __pSelectedLabel->SetText(selStr);
1005 __pSelectedLabel->SetShowState(true);
1006 __pSelectedLabel->Invalidate(false);
1008 __pSelectAll->Invalidate(true);
1009 if(__number.Contains(L"@"))
1011 __pButtonCall->SetEnabled(false);
1015 __pButtonCall->SetEnabled(true);
1017 __pButtonCall->Draw();
1018 __pFormFooter->Draw();
1022 DlLogsDetailForm::UnCheckAllItems(void)
1024 AppLogDebug("Enter");
1025 SetListItemSelectStatus(false);
1026 __selectedItemCount = 0;
1029 DlLogsDetailForm::SetAllListItems(bool checked)
1031 AppLogDebug("Enter");
1032 SetListItemSelectStatus(true);
1033 __listItemCount = __pLogPresentor->GetCalllogCountByNumber();
1034 __selectedItemCount = __listItemCount;
1036 String selItemStr = L"";
1037 if(__selectedItemCount > 1)
1039 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEMS_STRING);
1043 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEM_STRING);
1045 text.Format(100, selItemStr.GetPointer(), __listItemCount);
1046 __pSelectedLabel->SetText(text);
1047 __pSelectedLabel->Invalidate(false);
1051 DlLogsDetailForm::SetListItemSelectStatus(bool status)
1057 __isSelectAll = status;
1058 CallLogDetails* pCalllogInfo = null;
1059 for (; groupIndex < __pList->GetGroupCount(); groupIndex++)
1061 itemCount = __pList->GetItemCountAt(groupIndex);
1062 for (itemIndex = 0; itemIndex < itemCount; itemIndex++)
1064 __pList->SetItemChecked(groupIndex, itemIndex, status);
1067 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
1068 __pCallLogId->Add(new Integer(pCalllogInfo->GetCalllogDbId()));
1072 __pFormFooter->SetItemEnabled(0, status);
1073 __pFormFooter->Invalidate(true);
1074 __pList->Invalidate(true);
1078 DlLogsDetailForm::OnFormBackRequested(Form& source)
1081 SceneManager* pSceneManager = SceneManager::GetInstance();
1082 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CALL_LOG, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1083 SCENE_HISTORY_OPTION_NO_HISTORY));
1087 DlLogsDetailForm::OnAppControlCompleteResponseReceived(const AppId& appId, const String& operationId, AppCtrlResult appControlResult, const IMap* pExtraData)
1089 if (__isMsgAppControlLaunched == true)
1091 //Message AppControl request completed.
1092 __isMsgAppControlLaunched = false;
1094 if (__isCallAppControlLaunched == true)
1096 //Call AppControl request completed.
1097 __isCallAppControlLaunched = false;
1101 DlLogsDetailForm::ShowDeletePopup(void)
1103 __isDeleteInProgress = true;
1104 if (__pDeletePopup != null)
1106 delete __pDeletePopup;
1107 __pDeletePopup = null;
1109 __deleteGroupIndex = 0;
1110 __deleteItemIndex = 0;
1111 __pDeletePopup = new (std::nothrow) Popup();
1112 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
1113 __pDeletePopup->AddWindowEventListener(*this);
1114 __pDeletePopup->SetPropagatedKeyEventListener(this);
1116 Rectangle clientBounds = __pDeletePopup->GetClientAreaBounds();
1118 Label* pLabelTitle = new (std::nothrow) Label();
1119 pLabelTitle->Construct(Rectangle(0, Y_DELETE_POPUP_TITLE, clientBounds.width, H_DELETE_POPUP_ELEMENT), AppUtility::GetResourceString(IDS_DELETING_CALL_LOGS));
1120 pLabelTitle->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1121 pLabelTitle->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_BOLD);
1122 pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1124 __pDeletePopup->AddControl(*pLabelTitle);
1126 Progress* pProgress = new (std::nothrow) Progress();
1127 pProgress->Construct(Rectangle(0, Y_DELETE_POPUP_TITLE + H_DELETE_POPUP_ELEMENT, clientBounds.width, H_DELETE_POPUP_PROGRESS), 0, __selectedItemCount);
1129 __pDeletePopup->AddControl(*pProgress);
1131 Label* pLabelPercentage = new (std::nothrow) Label();
1132 pLabelPercentage->Construct(Rectangle(0, pProgress->GetY() + pProgress->GetHeight(), clientBounds.width / 2, H_DELETE_POPUP_ELEMENT), Integer::ToString(pProgress->GetPercentComplete()) + L"%");
1133 pLabelPercentage->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1134 pLabelPercentage->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1135 pLabelPercentage->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
1137 __pDeletePopup->AddControl(*pLabelPercentage);
1139 String currentOfTotal(Integer::ToString(pProgress->GetValue()) + L" / " + Integer::ToString(__selectedItemCount));
1140 Label* pLabelTotal = new (std::nothrow) Label();
1141 pLabelTotal->Construct(Rectangle(clientBounds.width / 2, pLabelPercentage->GetY(), clientBounds.width / 2, H_DELETE_POPUP_ELEMENT), currentOfTotal);
1142 pLabelTotal->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1143 pLabelTotal->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1144 pLabelTotal->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
1146 __pDeletePopup->AddControl(*pLabelTotal);
1148 Button* pCancelButton = new (std::nothrow) Button();
1149 pCancelButton->Construct(Rectangle((clientBounds.width - W_DELETE_POPUP_CANCEL_BUTTON) / 2, Y_DELETE_POPUP_CANCEL_BUTTON, W_DELETE_POPUP_CANCEL_BUTTON, H_DELETE_POPUP_CANCEL_BUTTON));
1150 pCancelButton->SetText(AppUtility::GetResourceString(IDS_CANCEL_DELETING_CALL_LOGS));
1151 pCancelButton->SetActionId(IDA_POPUP_DELETE_CANCEL);
1152 pCancelButton->AddActionEventListener(*this);
1154 __pDeletePopup->AddControl(pCancelButton);
1155 __pDeletePopup->Show();
1159 DlLogsDetailForm::OnWindowActivated (const Tizen::Ui::Window &source)
1161 __deleteLogsTimer.Start(1);
1165 DlLogsDetailForm::OnTimerExpired(Tizen::Base::Runtime::Timer &timer)
1167 Progress* pProgress = static_cast<Progress *>(__pDeletePopup->GetControl(1));
1169 pProgress->SetValue(pProgress->GetValue() + 1);
1170 pProgress->Invalidate(false);
1172 Label* pLabelPercentage = static_cast<Label *>(__pDeletePopup->GetControl(2));
1174 pLabelPercentage->SetText(Integer::ToString(pProgress->GetPercentComplete()) + L"%");
1175 pLabelPercentage->Invalidate(false);
1177 Label* pLabelTotal = static_cast<Label *>(__pDeletePopup->GetControl(3));
1179 String currentOfTotal = pLabelTotal->GetText();
1180 currentOfTotal.Remove(0, Integer::ToString(pProgress->GetValue() - 1).GetLength());
1181 currentOfTotal.Insert(Integer::ToString(pProgress->GetValue()), 0);
1182 pLabelTotal->SetText(currentOfTotal);
1183 pLabelTotal->Invalidate(false);
1185 if (RemoveLogsList() == E_SUCCESS)
1187 __deleteLogsTimer.Start(1);
1196 DlLogsDetailForm::RemoveLogsList()
1198 result r = E_SUCCESS;
1200 CallLogDetails* pCalllogInfo = null;
1201 for(int groupIndex = __deleteGroupIndex; groupIndex < __pList->GetGroupCount(); groupIndex++)
1203 int itemCount = __pList->GetItemCountAt(groupIndex);
1204 for(int itemIndex = __deleteItemIndex; itemIndex < itemCount; itemIndex++)
1206 bool isSelected = __pList->IsItemChecked(groupIndex, itemIndex);
1207 if(isSelected == true)
1209 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
1210 if(pCalllogInfo != null)
1212 __pLogPresentor->DeleteCalllogByDbId(pCalllogInfo->GetCalllogDbId());
1213 __pCallLogId->Remove(*(new Integer(pCalllogInfo->GetCalllogDbId())));
1214 __deleteGroupIndex = groupIndex;
1215 __deleteItemIndex = ++itemIndex;
1220 __deleteItemIndex = 0;
1222 __deleteGroupIndex = 0;
1223 __deleteItemIndex = 0;
1229 DlLogsDetailForm::HideDeletePopup(void)
1231 __isDeleteInProgress = false;
1232 __deleteGroupIndex = 0;
1233 __deleteItemIndex = 0;
1234 if (__pDeletePopup != null)
1236 __pDeletePopup->SetShowState(false);
1237 __pDeletePopup->Invalidate(true);
1239 if (__calllogListByNum->GetItemsN(0, __calllogListByNum->GetCount())->GetCount() != __selectedItemCount)
1241 const wchar_t* pContact = __number.GetPointer();
1242 int len = __number.GetLength() + 1;
1243 char* pNumber = new (std::nothrow) char[len];
1244 wcstombs(pNumber, pContact, len);
1245 __calllogListByNum = __pLogPresentor->GetCallogListByNumberFromDatabaseN(pNumber);
1248 __pList->UpdateList();
1253 SceneManager* pSceneManager = SceneManager::GetInstance();
1254 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CALL_LOG, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1255 SCENE_HISTORY_OPTION_NO_HISTORY));
1260 DlLogsDetailForm::OnForeground(void)
1262 SetSceneVisible(true);
1263 if(__calllogCount == 0)
1267 SceneManager* pSceneManager = SceneManager::GetInstance();
1268 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CALL_LOG, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1269 SCENE_HISTORY_OPTION_NO_HISTORY));
1272 if(__isContactAppControlLaunched == false)
1274 ManageItemSelection();
1278 __isContactAppControlLaunched = false;
1280 if(__isEditMode == false)
1284 if (__isMsgAppControlLaunched == true)
1286 //Message AppControl request completed.
1287 __isMsgAppControlLaunched = false;
1289 if(__isCallAppControlLaunched == true)
1291 __isCallAppControlLaunched = false;
1296 DlLogsDetailForm::OnBackground(void)
1298 SetSceneVisible(false);
1302 DlLogsDetailForm::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus state)
1305 if (state == LIST_ITEM_STATUS_CHECKED)
1307 __selectedItemCount++;
1308 StoreItemselection(groupIndex, itemIndex, elementId, state);
1310 else if (state == LIST_ITEM_STATUS_UNCHECKED)
1312 __selectedItemCount--;
1313 StoreItemselection(groupIndex, itemIndex, elementId, state);
1316 if (__selectedItemCount == __listItemCount)
1318 __pSelectAll->SetSelected(true);
1322 __pSelectAll->SetSelected(false);
1324 __pSelectAll->Invalidate(false);
1325 if (__selectedItemCount == 0)
1327 __pFormFooter->SetItemEnabled(0, false);
1328 String selStr = AppUtility::GetResourceString(IDS_SELECT_CALL_LOG);
1329 __pSelectedLabel->SetText(selStr);
1333 __pFormFooter->SetItemEnabled(0, true);
1334 String selItemStr = L"";
1335 if(__selectedItemCount > 1)
1337 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEMS_STRING);
1341 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEM_STRING);
1343 text.Format(100, selItemStr.GetPointer(), __selectedItemCount);
1344 __pSelectedLabel->SetText(text);
1346 __pFormFooter->Draw();
1347 __pSelectedLabel->Invalidate(false);
1351 DlLogsDetailForm::OnCalllogChanged(void)
1353 if(__isEditMode == false)
1358 //Update the log list for all MO/MT/MSG if the log list is in edit mode and delete is not on progress
1359 if(__isEditMode == true && __isDeleteInProgress == false)
1363 if(IsScecneVisible() == true && __isDeleteInProgress == false)
1365 ManageItemSelection();
1370 DlLogsDetailForm::StoreItemselection(int groupIndex, int itemIndex, int elementId, ListItemStatus state)
1372 CallLogDetails* pCalllogInfo = null;
1373 if (state == LIST_ITEM_STATUS_CHECKED)
1375 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
1376 __pCallLogId->Add(new Integer(pCalllogInfo->GetCalllogDbId()));
1378 else if (state == LIST_ITEM_STATUS_UNCHECKED)
1380 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
1381 __pCallLogId->Remove(*(new Integer(pCalllogInfo->GetCalllogDbId())));
1385 DlLogsDetailForm:: ManageItemSelection(void)
1387 if(__isEditMode == true && __selectedItemCount > 0 && __listItemCount != __pLogPresentor->GetCalllogCountByNumber())
1391 CallLogDetails* pCalllogInfo = null;
1392 for(int groupIndex = 0; groupIndex < __pList->GetGroupCount(); groupIndex++)
1394 itemCount = __pList->GetItemCountAt(groupIndex);
1395 for(int itemIndex = itemCount-1; itemIndex >=0 ; itemIndex--)
1397 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
1398 if(__pCallLogId->Contains(*(new Integer(pCalllogInfo->GetCalllogDbId()))))
1400 __pList->SetItemChecked(groupIndex,itemIndex,true);
1401 ++__selectedItemCount;
1405 __listItemCount = __pLogPresentor->GetCalllogCountByNumber();
1406 if(__selectedItemCount == __listItemCount)
1408 __pSelectAll->SetSelected(true);
1412 __pSelectAll->SetSelected(false);
1414 String selItemStr = L"";
1416 if(__selectedItemCount == 0)
1418 __pFormFooter->SetItemEnabled(0, false);
1419 String selStr = AppUtility::GetResourceString(IDS_SELECT_CALL_LOG);
1420 __pSelectedLabel->SetText(selStr);
1424 if(__selectedItemCount > 1)
1426 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEMS_STRING);
1430 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEM_STRING);
1432 __pFormFooter->SetItemEnabled(0, true);
1433 text.Format(100, selItemStr.GetPointer(), __selectedItemCount);
1434 __pSelectedLabel->SetText(text);
1436 __pSelectedLabel->Invalidate(false);
1437 __pSelectAll->SetShowState(true);
1438 __pLabelBlocked->SetShowState(false);
1439 __pPanelNumberUnsaved->SetShowState(false);
1440 __pPanelName->SetShowState(false);
1441 __pLabelNumber->SetShowState(false);
1442 __pButtonContactImage->SetShowState(false);
1443 __listItemCount = __pLogPresentor->GetCalllogCountByNumber();
1448 DlLogsDetailForm::IsScecneVisible()
1450 AppLogDebug("Enter");
1451 return __isSceneVisible;
1456 DlLogsDetailForm::SetSceneVisible(bool sceneMode)
1458 AppLogDebug("Enter");
1459 __isSceneVisible = sceneMode;
1463 DlLogsDetailForm::ShowBlockPopup(void)
\r
1465 if(__pLogsBlockPopup != null)
\r
1467 delete __pLogsBlockPopup;
\r
1468 __pLogsBlockPopup = null;
\r
1470 SettingsPresentationModel* pSettingsPresentationModel = SettingsPresentationModel::GetInstance();
1471 __isCallBeRejected = pSettingsPresentationModel->IsCallToBeRejected(__number);
1473 __isMsgBeRejected = SettingsPresentationModel::GetInstance()->GetMsgFilterListIndex(__number);
\r
1474 __pLogsBlockPopup = new (std::nothrow) CallLogViewByPopup(*this);
\r
1475 __pLogsBlockPopup->ConstructBlockPopup(__number, __isCallBeRejected, __isMsgBeRejected);
\r
1476 __pLogsBlockPopup->SetShowState(true);
\r
1477 __pLogsBlockPopup->Draw();
\r
1478 __pLogsBlockPopup->Show();
\r
1482 DlLogsDetailForm::OnItemSelected()
1484 SendUserEvent(REQUEST_CHANGE_BLOCK, null);
1488 DlLogsDetailForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1492 case REQUEST_CHANGE_BLOCK:
1494 if(__pLogsBlockPopup->GetCallBlock() == true)
\r
1496 result r = SettingsPresentationModel::GetInstance()->AddToCallRejectList(__number, CALL_REJECT_MATCH_EXACTLY,true);
1497 if(r == E_OBJ_ALREADY_EXIST)
1499 IListT<CallRejectInfo>* pRejList = SettingsPresentationModel::GetInstance()->GetCallRejectList();
1500 IEnumeratorT<CallRejectInfo>* pRejEnum =pRejList->GetEnumeratorN();
1501 while(pRejEnum->MoveNext() == E_SUCCESS)
1503 CallRejectInfo rejectInfo;
1504 pRejEnum->GetCurrent(rejectInfo);
1505 if(rejectInfo.phoneNumber.Equals(__number))
1507 SettingsPresentationModel::GetInstance()->UpdateCallRejectRow(rejectInfo.rowId,rejectInfo.phoneNumber,true,rejectInfo.rejectCondition);
1516 if(__pLogsBlockPopup->GetMessageBlock() == true)
\r
1518 AppLog("block message");
1519 SettingsPresentationModel::GetInstance()->AddToMessageRejectList(__number, 1);
1528 DlLogsDetailForm::ShowDuplicateErrorMessageBox(String& message)
1530 // Creates an instance of MessageBox
1531 MessageBox duplicateMsgBox;
1532 duplicateMsgBox.Construct(L"", message, MSGBOX_STYLE_NONE, 2000);
1534 int modalResult = 0;
1535 // Calls ShowAndWait() : Draws and Shows itself and processes events
1536 duplicateMsgBox.ShowAndWait(modalResult);
1540 DlLogsDetailForm::ViewContactDetail(void)
1542 AppLogDebug("Enter");
1543 //Launch Contact AppControl
1544 Contact* pContact = null;
1545 AppControl* pAc = null;
1546 result r = E_SUCCESS;
1548 extraData.Construct();
1549 Addressbook* pAddressBook = AddressbookManager::GetInstance()->GetAddressbookN();
1550 if (pAddressBook != null)
1552 IList* pNumberContactsList = null;
1553 if(__number.Contains(L"@"))
1555 pNumberContactsList = pAddressBook->SearchContactsByEmailN(__number);
1559 pNumberContactsList = pAddressBook->SearchContactsByPhoneNumberN(__number);
1561 if(pNumberContactsList != null)
1563 IEnumerator* pContactListEnum = pNumberContactsList->GetEnumeratorN();
1564 while (pContactListEnum->MoveNext() == E_SUCCESS)
1566 pContact = static_cast<Contact*>(pContactListEnum->GetCurrent());
1567 if (pContact != null)
1569 IList* pPhoneNumberList = pContact->GetValuesN(CONTACT_MPROPERTY_ID_PHONE_NUMBERS);
1570 if (pPhoneNumberList != null)
1572 IEnumerator* pPhoneEnum = pPhoneNumberList->GetEnumeratorN();
1573 while (E_SUCCESS == pPhoneEnum->MoveNext())
1575 PhoneNumber* pPhoneNumber = (PhoneNumber*) pPhoneEnum->GetCurrent();
1576 //Check if this is the correct contact
1577 if (pPhoneNumber->GetPhoneNumber().Equals(__number))
1579 //save newly fetched contact info.
1580 AppLogDebug("View Contact");
1583 idVal.Append(pContact->GetRecordId());
1584 extraData.Add(new (std::nothrow) String(CONTACTS_VIEW_TYPE), new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT));
1585 extraData.Add(new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT), new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT));
1586 extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_ID), new (std::nothrow) String(idVal));
1587 extraData.Add(new (std::nothrow) String(CONTACTS_ID_KEY), new (std::nothrow) String(idVal));
1588 extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_TYPE), new (std::nothrow) String(ITEM_TYPE_PERSON));
1589 pAc = AppManager::FindAppControlN(PROVIDER_ID_CONTACTS, OPERATION_ID_VIEW);
1593 r = pAc->Start(null, null, &extraData, this);
1594 __isContactAppControlLaunched = true;
1601 pPhoneNumberList->RemoveAll(true);
1602 delete pPhoneNumberList;
1603 if(__isContactAppControlLaunched == true)
1616 DlLogsDetailForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1618 if((GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE )&& __isEditMode == true)
1620 __pList->SetBounds(GetClientAreaBounds().x, __pSelectAll->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - (__pSelectAll->GetHeight()+__pSelectedLabel->GetHeight()));
1622 else if((GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE) && __isEditMode == false)
1624 int listY = __pButtonContactImage->GetBounds().height + __pButtonMessage->GetBounds().height + 40;
1625 int listHeight = GetClientAreaBounds().height - __pButtonContactImage->GetBounds().height - __pButtonMessage->GetBounds().height - 40;
1626 __pList->SetBounds(Rectangle(0, listY, GetClientAreaBounds().width, listHeight));
1628 else if(__isEditMode == true)
1630 __pList->SetBounds(GetClientAreaBounds().x, __pSelectAll->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - (__pSelectAll->GetHeight()+__pSelectedLabel->GetHeight()));
1634 int listHeight = GetClientAreaBounds().height - __pButtonContactImage->GetBounds().height - __pButtonMessage->GetBounds().height - 40;
1635 int listY = __pButtonContactImage->GetBounds().height + __pButtonMessage->GetBounds().height + 40;
1636 __pList->SetBounds(Rectangle(0, listY, GetClientAreaBounds().width, listHeight));
1642 DlLogsDetailForm::OnSettingChanged(Tizen::Base::String& key)
1645 if(key.Equals(String(SETTING_INFO_KEY_TIME_FORMAT)) == true)
1647 __pList->UpdateList();
1653 DlLogsDetailForm::OnFormMenuRequested(Controls::Form& source)
1655 if(__isEditMode == false)
1662 DlLogsDetailForm::ShowOptionsMenu()
1664 if(__pOptionMenu != null)
1666 delete __pOptionMenu;
1667 __pOptionMenu = null;
1669 __pOptionMenu = new (std::nothrow) OptionMenu();
1670 __pOptionMenu->Construct();
1671 __pOptionMenu->AddActionEventListener(*this);
1672 __pOptionMenu->RemoveAllItems();
1674 if(__isPresentInContacts == true)
1676 __pOptionMenu->AddItem(AppUtility::GetResourceString(IDS_CONTEXTMENU_ITEM_DETAILS), IDA_CONTEXTMENU_DETAILS);
1677 if(!(__number.Contains(L"@")))
1679 __pOptionMenu->AddItem(AppUtility::GetResourceString(IDS_CONTEXTMENU_ITEM_BLOCK), IDA_CONTEXTMENU_BLOCK);
1684 __pOptionMenu->AddItem(AppUtility::GetResourceString(IDS_CONTEXTMENU_ITEM_ADDTOCONTACT), IDA_CONTEXTMENU_ADDTOCONTACT);
1685 if(!(__number.Contains(L"@")))
1687 __pOptionMenu->AddItem(AppUtility::GetResourceString(IDS_CONTEXTMENU_ITEM_BLOCK), IDA_CONTEXTMENU_BLOCK);
1690 __pOptionMenu->SetShowState(true);
1691 __pOptionMenu->Show();
1695 DlLogsDetailForm::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1698 if(keyEventInfo.GetKeyCode() == KEY_BACK)
1700 if(__pDeletePopup != null && __pDeletePopup->GetShowState() == true)