04da7984e07fbeebbe2f046e06d60c357537a104
[apps/osp/Dial.git] / src / PhnTabLogs.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 /**
18  * @file        PhnTabLogs.cpp
19  * @brief       The Logs Tab
20  */
21
22 #include <FApp.h>
23 #include <FBase.h>
24 #include <FMedia.h>
25 #include <FGraphics.h>
26 #include "PhnPhoneApp.h"
27 #include "PhnAppUtility.h"
28 #include "PhnTypes.h"
29 #include "PhnCommonUtils.h"
30 #include "PhnTabLogs.h"
31 #include "PhnSceneRegister.h"
32 #include "PhnCalllogManager.h"
33 #include "PhnTypes.h"
34
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Base::Utility;
39 using namespace Tizen::Ui::Controls;
40 using namespace Tizen::Graphics;
41 using namespace Tizen::Media;
42 using namespace Tizen::Ui;
43 using namespace Tizen::Ui::Scenes;
44
45 const int W_NOCONTENTS_IMAGE = 280;
46 const int H_NOCONTENTS_IMAGE = 280;
47 //List view height
48 const int H_TOAST_MSG = 48;
49 const int H_SELECTALL_CHK_BOX = 112;
50
51 const wchar_t* IDL_PANEL_LOGS = L"IDL_PANEL_LOGS";
52 const wchar_t* IDC_LABEL_SELECTED_POPUP = L"IDC_LABEL_SELECTED_POPUP";
53 const unsigned int COLOR_LABEL_SELECTED = Color32<215, 225, 232, 255>::Value;
54
55 static const int W_DELETE_POPUP = 720;
56 static const int H_DELETE_POPUP = 308;
57 static const int Y_DELETE_POPUP_TITLE = 20;
58 static const int H_DELETE_POPUP_ELEMENT = 60;
59 static const int H_DELETE_POPUP_PROGRESS = 60;
60 static const int Y_DELETE_POPUP_CANCEL_BUTTON = 214;
61 static const int H_DELETE_POPUP_CANCEL_BUTTON = 74;
62 static const int W_DELETE_POPUP_CANCEL_BUTTON = 394;
63
64 static const int FONT_SIZE_DELETE_POPUP_TEXT = 36;
65 //static const int X_MORE = 55;
66
67 static const unsigned int COLOR_DELETE_POPUP_TEXT = Color32<128, 128, 128>::Value;
68 DialTabLogs::DialTabLogs(void)
69 {
70         __pDataProvider = new CustomDataProvider();
71         __pFormFooter = null;
72         __plogsListView = null;
73         __isEditMode = false;
74         __pButtonSelectAll = null;
75         __groupCount = 0;
76         __itemCount = 0;
77         __isSelectAll = false;
78         __selectedItemCount = 0;
79         __pLogPresentor = null;
80         __pArgs = null;
81         __deleteLogsTimer.Construct(*this);
82         __deleteGroupIndex = 0;
83         __deleteItemIndex = 0;
84         __pDeletePopup = null;
85         __pGroupContextDeletePopup = null;
86         __pCallLogId = null;
87         __isSceneVisible = false;
88         __pLogsViewbyPopup = null;
89         __isMsgAppControlLaunched = false;
90         __isCallAppControlLaunched = false;
91         __pOptionMenu = null;
92         __isDeleteInProgress = false;
93 }
94
95 DialTabLogs::~DialTabLogs(void)
96 {
97         AppLogDebug("Enter");
98         if (__pDataProvider != null)
99         {
100                 delete __pDataProvider;
101                 __pDataProvider = null;
102         }
103         if (__pLogPresentor != null)
104         {
105                 __pLogPresentor->RemoveCalllogChangeListner(*this);
106                 __pLogPresentor = null;
107         }
108         if (__pCallLogId != null)
109         {
110                 __pCallLogId->RemoveAll();
111                 delete __pCallLogId;
112                 __pCallLogId = null;
113         }
114         if(__pLogsViewbyPopup != null)
115         {
116                 delete __pLogsViewbyPopup;
117                 __pLogsViewbyPopup = null;
118         }
119 }
120
121 bool
122 DialTabLogs::Initialize(void)
123 {
124         result r = Construct(IDL_PANEL_LOGS);
125         TryCatch(r == E_SUCCESS, , "DialTabLogs::Initialise() - Fail to initialise Call log panel");
126         return true;
127
128         CATCH:
129         return false;
130 }
131
132 result
133 DialTabLogs::OnInitializing(void)
134 {
135         result r = E_SUCCESS;
136         // Layout setting
137         Form* pForm = dynamic_cast<Form*>(GetParent());
138         if(pForm == null)
139         {
140                 return E_FAILURE;
141         }
142
143         pForm->AddOrientationEventListener(*this);
144
145         RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(pForm->GetLandscapeLayoutN());
146         if (pRelativeLayout != null)
147         {
148                 pRelativeLayout->SetHorizontalFitPolicy(*this, FIT_POLICY_PARENT);
149                 pRelativeLayout->SetVerticalFitPolicy(*this, FIT_POLICY_PARENT);
150                 delete pRelativeLayout;
151         }
152
153         pRelativeLayout = dynamic_cast<RelativeLayout*>(pForm->GetPortraitLayoutN());
154         if (pRelativeLayout != null)
155         {
156                 pRelativeLayout->SetHorizontalFitPolicy(*this, FIT_POLICY_PARENT);
157                 pRelativeLayout->SetVerticalFitPolicy(*this, FIT_POLICY_PARENT);
158                 delete pRelativeLayout;
159         }
160
161         __pFormFooter = pForm->GetFooter();
162         if (__pFormFooter != null)
163         {
164                 __pFormFooter->SetShowState(true);
165                 __pFormFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
166                 __pFormFooter->AddActionEventListener(*this);
167
168                 __footerItemDelete.Construct(IDA_FOOTER_LOG_DELETE);
169                 String delStr = AppUtility::GetResourceString(IDS_DELETE_BTN_STRING);
170                 __footerItemDelete.SetText(delStr);
171                 __pFormFooter->AddItem(__footerItemDelete);
172
173                 String cancelStr = AppUtility::GetResourceString(IDS_CANCEL_BTN_STRING);
174                 __footerItemCancel.Construct(IDA_FOOTER_LOG_CANCEL);
175                 __footerItemCancel.SetText(cancelStr);
176         }
177
178         __pButtonSelectAll = static_cast<CheckButton*>(GetControl("IDC_CHECKBUTTON_SELECTALL"));
179         if (__pButtonSelectAll != null)
180         {
181                 __pButtonSelectAll->SetShowState(false);
182                 __pButtonSelectAll->SetActionId(IDA_CHECKBUTTON_SELECT_ALL, IDA_CHECKBUTTON_UNSELECT_ALL);
183                 __pButtonSelectAll->AddActionEventListener(*this);
184                 __pButtonSelectAll->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
185         }
186
187         //create a list view
188         __plogsListView = new (std::nothrow) GroupedListView();
189         if (__plogsListView != null)
190         {
191                 __plogsListView->Construct(Rectangle(pForm->GetX(), pForm->GetY(), pForm->GetWidth(), pForm->GetClientAreaBounds().height), GROUPED_LIST_VIEW_STYLE_INDEXED, true, SCROLL_STYLE_FADE_OUT);
192                 __plogsListView->AddGroupedListViewItemEventListener(*this);
193                 Bitmap* pNoContentBitmap = AppUtility::GetBitmapFromResourcesN(IDB_LOG_NO_CONTENT,W_NOCONTENTS_IMAGE,H_NOCONTENTS_IMAGE);
194                 if(pNoContentBitmap != null)
195                 {
196                         __plogsListView->SetBitmapOfEmptyList(pNoContentBitmap);
197                 }
198                 __plogsListView->SetTextOfEmptyList(AppUtility::GetResourceString(IDS_NO_LOGS));
199                 __plogsListView->SetTextColorOfEmptyList(Color(128,128,128));
200                 r = AddControl(__plogsListView);
201                 TryCatch(r == E_SUCCESS, , "Calllog list control not added");
202         }
203
204         __pSelectedLabel = static_cast<Label*>(GetControl(IDC_LABEL_SELECTED_POPUP));
205         if(__pSelectedLabel != null)
206         {
207                 SetControlAlwaysOnTop(*__pSelectedLabel,true);
208                 __pSelectedLabel->SetBackgroundColor(COLOR_LABEL_SELECTED);
209                 __pSelectedLabel->SetShowState(false);
210         }
211
212         __pCallLogId = new(std::nothrow) ArrayList();
213         r = __pCallLogId->Construct();
214
215         CATCH:
216         return r;
217 }
218
219 result
220 DialTabLogs::OnTerminating(void)
221 {
222         result r = E_SUCCESS;
223         delete __pDeletePopup;
224         __pDeletePopup = null;
225         delete __pGroupContextDeletePopup;
226         __pGroupContextDeletePopup = null;
227         __plogsListView = null;
228         delete __pOptionMenu;
229         return r;
230 }
231
232 void
233 DialTabLogs::DeleteSelectedCalllog(void)
234 {
235         ShowDeletePopup();
236 }
237
238 void
239 DialTabLogs::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
240 {
241         AppUtility::GetGlobalFontAndItemHeight(&__fontSize, &__itemHeight);
242         __pLogPresentor = CalLogPresentationModel::GetInstance();
243         __pLogPresentor->AddCalllogChangeListener(*this);
244
245         PhoneApp* pPhoneApp = static_cast<PhoneApp*>(PhoneApp::GetInstance());
246         pPhoneApp->AddAppStateChangeListener(*this);
247         Tizen::System::SettingInfo::AddSettingEventListener(*this);
248
249         __plogsListView->SetItemProvider(*__pDataProvider);
250         __isMsgAppControlLaunched = false;
251         __isCallAppControlLaunched = false;
252
253         if (__pFormFooter != null)
254         {
255                 __pFormFooter->SetShowState(true);
256                 if(__pLogPresentor->GetAllCallLogCount() > 0)\r
257                 {
258                         __pFormFooter->SetItemEnabled(0, true);
259                 }
260                 else
261                 {
262                         __pFormFooter->SetItemEnabled(0, false);
263                 }
264         }
265         //Check if opened in edit mode
266         if(__isEditMode == true)
267         {
268                 //Check if "select all" is already selected
269                 if (__pButtonSelectAll->IsSelected() == true)
270                 {
271                         //HandleAllItemSelection();
272                 }
273                 //If there is no items selected the reset the display mode
274                 else if(__selectedItemCount == 0)
275                 {
276                         SetCallLogDisplayMode(false);
277                 }
278         }
279         UpdateCallLogList();
280         SetSceneVisible(true);
281         ManageItemSelection();
282         const Form* pForm = dynamic_cast<Form*>(GetParent());
283         if(pForm != null)
284         {
285                 if((pForm->GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || pForm->GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE) && __isEditMode == true)
286                 {
287                         Rectangle newRect(pForm->GetX(), H_SELECTALL_CHK_BOX + 20, pForm->GetWidth(), (pForm->GetClientAreaBounds().height - H_SELECTALL_CHK_BOX - H_TOAST_MSG));
288                         __plogsListView->SetBounds(newRect);
289                 }
290                 else if(__isEditMode == true)
291                 {
292                         Rectangle newRect(pForm->GetX(), H_SELECTALL_CHK_BOX, pForm->GetWidth(), (pForm->GetClientAreaBounds().height - H_SELECTALL_CHK_BOX - H_TOAST_MSG));
293                         __plogsListView->SetBounds(newRect);
294                 }
295                 else
296                 {
297                         __plogsListView->SetBounds(pForm->GetX(), pForm->GetY(), pForm->GetWidth(), pForm->GetClientAreaBounds().height);
298                 }
299         }
300 }
301
302 void
303 DialTabLogs::HandleAllItemSelection(void)
304 {
305         SetListItemSelectStatus(true);
306         __itemCount = __pLogPresentor->GetCallLogsViewedCount();\r
307         __selectedItemCount = __itemCount;
308         String text;
309         String selItemStr = L"";
310         if(__selectedItemCount > 1)
311         {
312                 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEMS_STRING);
313         }
314         else
315         {
316                 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEM_STRING);
317         }
318         text.Format(100, selItemStr.GetPointer(), __itemCount);
319         __pSelectedLabel->SetText(text);
320         __pSelectedLabel->Invalidate(false);
321 }
322
323 void
324 DialTabLogs::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
325 {
326         AppLogDebug("Enter");
327         PhoneApp* pPhoneApp = static_cast<PhoneApp*>(PhoneApp::GetInstance());
328         pPhoneApp->RemoveAppStateChangeListener(*this);
329         Tizen::System::SettingInfo::RemoveSettingEventListener(*this);
330         SetSceneVisible(false);
331         __pLogPresentor->RemoveCalllogChangeListner(*this);
332         __pLogPresentor = null;
333 }
334
335 void
336 DialTabLogs::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus state)
337 {
338         if (__isMsgAppControlLaunched == true || __isCallAppControlLaunched == true)
339         {
340                 //AppControl already launched.
341                 return;
342         }
343
344         if (__isEditMode == false)
345         {
346                 __pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
347                 __pArgs->Construct();
348                 CallLogDetails* pCalllogInfo = null;
349                 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
350                 if(pCalllogInfo != null && pCalllogInfo->GetPhoneNumber() == null)
351                 {
352                         //handling hidden call
353                         return;
354                 }
355                 if(pCalllogInfo != null)
356                 {
357                         __pArgs->Add((new String(pCalllogInfo->GetPhoneNumber())));
358                 }
359                 SceneManager* pSceneManager = SceneManager::GetInstance();
360                 pSceneManager->GoForward( ForwardSceneTransition(IDSCN_CALL_LOG_DETAILS, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
361                                 SCENE_HISTORY_OPTION_NO_HISTORY), __pArgs);
362                 __pArgs = null;
363         }
364         else
365         {
366                 String text;
367                 if (state == LIST_ITEM_STATUS_CHECKED)
368                 {
369                         __selectedItemCount++;
370                         StoreItemselection(groupIndex, itemIndex, elementId, state);
371                 }
372                 else if (state == LIST_ITEM_STATUS_UNCHECKED)
373                 {
374                         __selectedItemCount--;
375                         StoreItemselection(groupIndex, itemIndex, elementId, state);
376                 }
377                 if (__selectedItemCount == __itemCount)
378                 {
379                         __pButtonSelectAll->SetSelected(true);
380                 }
381                 else
382                 {
383                         __pButtonSelectAll->SetSelected(false);
384                 }
385                 if (__selectedItemCount == 0)
386                 {
387                         __pFormFooter->SetItemEnabled(0, false);
388                         String selStr = AppUtility::GetResourceString(IDS_SELECT_CALL_LOG);
389                         __pSelectedLabel->SetText(selStr);
390                 }
391                 else
392                 {
393                         __pFormFooter->SetItemEnabled(0, true);
394                         String selItemStr = L"";
395                         if(__selectedItemCount > 1)
396                         {
397                                 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEMS_STRING);
398                         }
399                         else
400                         {
401                                 selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEM_STRING);
402                         }
403                         text.Format(100, selItemStr.GetPointer(), __selectedItemCount);
404                         __pSelectedLabel->SetText(text);
405                 }
406                 __pFormFooter->Invalidate(true);
407                 __pButtonSelectAll->Invalidate(false);
408                 __pSelectedLabel->Invalidate(false);
409         }
410 }
411
412 void
413 DialTabLogs::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus state)
414 {
415         //Empty implementation
416         CallLogDetails* pCalllogInfo = null;
417         __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
418         __deleteGroupIndex = groupIndex;
419         __deleteItemIndex = itemIndex;
420         if(pCalllogInfo != null)
421         {
422
423                 switch (elementId)
424                 {
425                 case IDA_LIST_ELEMENT_DELETE:
426                 {
427                         if(__pGroupContextDeletePopup != null)
428                         {
429                                 delete __pGroupContextDeletePopup;
430                                 __pGroupContextDeletePopup = null;
431                         }
432
433                         __pGroupContextDeletePopup = new (std::nothrow) Popup();
434                         __pGroupContextDeletePopup->Construct(true, Dimension(640,250));
435                         __pGroupContextDeletePopup->SetPropagatedKeyEventListener(this);
436                         __pGroupContextDeletePopup->SetTitleText(AppUtility::GetResourceString(IDS_DELETE_CONFORMATION_STRING));
437
438                         //Yes button
439                         Rectangle yesRect(10, 80, 300, 80);
440                         Button* pYesButton = new Button();
441                         pYesButton->Construct(yesRect, AppUtility::GetResourceString(IDS_DELETE_YES));
442                         pYesButton->SetActionId(IDA_POPUP_DELETE_YES);
443                         pYesButton->AddActionEventListener(*this);
444                         __pGroupContextDeletePopup->AddControl(pYesButton);
445
446                         //No button
447                         yesRect.x = yesRect.x + yesRect.width + 10;
448                         Button* pNoButton = new Button();
449                         pNoButton->Construct(yesRect, AppUtility::GetResourceString(IDS_DELETE_NO));
450                         pNoButton->SetActionId(IDA_POPUP_DELETE_NO);
451                         pNoButton->AddActionEventListener(*this);
452                         __pGroupContextDeletePopup->AddControl(pNoButton);
453                         __pGroupContextDeletePopup->SetShowState(true);
454                         __pGroupContextDeletePopup->Show();
455
456                 }
457                 break;
458                 case IDA_LIST_ELEMENT_CALL:
459                 {
460                         __isCallAppControlLaunched = true;
461                         char* pPhoneNumber = pCalllogInfo->GetPhoneNumber();
462                         if(pPhoneNumber == null)
463                         {
464                                 __isCallAppControlLaunched = false;
465                                 break;
466                         }
467                         PhoneApp* pPhoneApp = static_cast<PhoneApp*>(UiApp::GetInstance());
468                         if (pPhoneApp->IsOpenAsAppControl() == false)
469                         {
470                         __pLogPresentor->DialCall(String(pPhoneNumber));
471                         }
472                         else
473                         {
474                                 //launched as AppControl
475                                 HashMap resultData;
476                                 resultData.Construct();
477                                 resultData.Add(new (std::nothrow) String(PARAM_PHONE_NUMBER), new (std::nothrow) String(pPhoneNumber));
478                                 //send "APP_CTRL_RESULT_SUCCEEDED" and 'contactNumber' as result.
479                                 pPhoneApp->SendAppControlResponseMessage(APP_CTRL_RESULT_SUCCEEDED, &resultData);
480                                 resultData.RemoveAll(true);
481                                 pPhoneApp->Terminate();
482                         }
483                 }
484                         break;
485
486                 case IDA_LIST_ELEMENT_MESSAGE:
487                 {
488                         result r = E_SUCCESS;
489                         char* pPhoneNumber = pCalllogInfo->GetPhoneNumber();
490                         if(pPhoneNumber == null)
491                         {
492                                 break;
493                         }
494                         //launch message AppControl
495                         __isMsgAppControlLaunched = true;
496                         String phoneNumber=L"";
497                         phoneNumber.Append(pPhoneNumber);
498
499                         HashMap extraData;
500                         extraData.Construct();
501
502                         extraData.Add(new (std::nothrow) String(MESSAGE_TYPE), new (std::nothrow) String(MESSAGE_SMS_TYPE));
503                         extraData.Add(new (std::nothrow) String(MESSAGE_TO), new (std::nothrow) String(phoneNumber));
504
505                         AppControl* pAc = AppManager::FindAppControlN(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE);
506                         if (pAc != null)
507                         {
508                                 r = pAc->Start(null, null, &extraData, null);
509                                 if(r != E_SUCCESS)
510                                 {
511                                         //AppControl request failed, reset flag.
512                                         __isMsgAppControlLaunched = false;
513                                 }
514
515                                 delete pAc;
516                         }
517
518                         extraData.RemoveAll(true);
519
520                 }
521                         break;
522                 case IDA_LIST_ELEMENT_VIDEO_CALL:
523                 {
524                         //todo: call once video call implemented
525                         return;
526                 }
527                         break;
528                 default:
529                         break;
530                 }
531         }
532         listView.UpdateList();
533 }
534
535 void
536 DialTabLogs::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
537 {
538         //Empty implementation
539 }
540
541 void
542 DialTabLogs::OnActionPerformed(const Control& source, int actionId)
543 {
544         CallLogDetails* pCalllogInfo = null;
545         __pDataProvider->GetItemAtGroupIndex(__deleteGroupIndex, __deleteItemIndex, &pCalllogInfo);
546         switch (actionId)
547         {
548         case IDA_CONTEXTMENU_VIEWBY:
549         {
550                 ShowLogsViewByPopup();
551         }
552         break;
553
554         case IDA_FOOTER_LOG_DELETE:
555         {
556                 if (__isEditMode == false)
557                 {
558                         SetCallLogDisplayMode(true);
559                 }
560                 else
561                 {
562                         DeleteSelectedCalllog();
563                 }
564         }
565         break;
566
567         case IDA_FOOTER_LOG_CANCEL:
568         {
569                 __pCallLogId->RemoveAll();
570                 SetCallLogDisplayMode(false);
571         }
572         break;
573
574         case IDA_CHECKBUTTON_SELECT_ALL:
575         {
576                 __pCallLogId->RemoveAll();
577                 HandleAllItemSelection();
578         }
579         break;
580
581         case IDA_CHECKBUTTON_UNSELECT_ALL:
582         {
583                 SetListItemSelectStatus(false);
584                 __pCallLogId->RemoveAll();
585                 __selectedItemCount = 0;
586                 String selStr = AppUtility::GetResourceString(IDS_SELECT_CALL_LOG);
587                 __pSelectedLabel->SetText(selStr);
588                 __pSelectedLabel->Invalidate(false);
589         }
590         break;
591
592         case IDA_POPUP_DELETE_CANCEL:
593         {
594                 __deleteLogsTimer.Cancel();
595                 HideDeletePopup();
596         }
597         break;
598
599         case IDA_POPUP_DELETE_YES:
600         {
601                 if(pCalllogInfo != null)
602                 {
603                         if(pCalllogInfo->GetConsecutiveNoCounter() > 1)\r
604                         {\r
605                                 Tizen::Base::Collection::ArrayList* dbIds = pCalllogInfo->GetCallLogDbIds();\r
606                                 for(int i=0; i < dbIds->GetCount(); ++i)\r
607                                 {\r
608                                         Integer* in = (Integer*)dbIds->GetAt(i);\r
609                                         int p = in->ToInt();\r
610                                         __pLogPresentor->DeleteCalllogByDbId(p);\r
611                                 }\r
612                         }\r
613                         else\r
614                         {\r
615                                 __pLogPresentor->DeleteCalllogByDbId(pCalllogInfo->GetCalllogDbId());\r
616                         }\r
617                         __pLogPresentor->DeleteItemAtGroupIndex(__deleteGroupIndex, __deleteItemIndex);\r
618                         if(__pLogPresentor->GetAllCallLogCount() > 0)\r
619                         {
620                                 __pFormFooter->SetItemEnabled(0, true);
621                         }
622                         else
623                         {
624                                 __pFormFooter->SetItemEnabled(0, false);
625                         }
626                         __pFormFooter->Invalidate(true);
627                         if(__pGroupContextDeletePopup != null)
628                         {
629                                 __pGroupContextDeletePopup->SetShowState(false);
630                         }
631                         __deleteGroupIndex = 0;
632                         __deleteItemIndex = 0;
633                 }
634         }
635         break;
636
637         case IDA_POPUP_DELETE_NO:
638         {
639                 if(__pGroupContextDeletePopup != null)
640                 {
641                         __pGroupContextDeletePopup->SetShowState(false);
642                 }
643         }
644         break;
645
646         default:
647                 break;
648         }
649 }
650
651 void
652 DialTabLogs::SetListItemSelectStatus(bool status)
653 {
654         int groupIndex = 0;
655         int itemIndex = 0;
656         int itemCount = 0;
657
658         __isSelectAll = status;
659         CallLogDetails* pCalllogInfo = null;
660         for (; groupIndex < __groupCount; groupIndex++)
661         {
662                 itemCount = __plogsListView->GetItemCountAt(groupIndex);
663                 for (itemIndex = 0; itemIndex < itemCount; itemIndex++)
664                 {
665                         __plogsListView->SetItemChecked(groupIndex, itemIndex, status);
666                         if(status == true)
667                         {
668                                 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
669                                 __pCallLogId->Add(new Integer(pCalllogInfo->GetCalllogDbId()));
670                         }
671                 }
672         }
673         __pFormFooter->SetItemEnabled(0, status);
674         __pFormFooter->Invalidate(true);
675         __plogsListView->Invalidate(true);
676 }
677
678 void
679 DialTabLogs::SetCallLogDisplayMode(bool isEdit)
680 {
681         AppLogDebug("Enter %d",isEdit);
682         if(isEdit == __isEditMode)
683         {
684                 AppLog("Delete process return");
685                 return;
686         }
687         if( __pFormFooter == null)
688         {
689                 AppLog("__pFormFooter == null");
690                 return;
691         }
692
693         __itemCount = __pLogPresentor->GetCallLogsViewedCount();\r
694         __groupCount = __plogsListView->GetGroupCount();
695         __pButtonSelectAll->SetSelected(false);
696         if (isEdit == false)
697         {
698                 __isEditMode = false;
699                 __pDataProvider->SetListItemStyle(false);
700                 __plogsListView->SetSweepEnabled(true);
701                 const Form* pForm = dynamic_cast<Form*>(GetParent());
702                 if(pForm == null)
703                 {
704                         return;
705                 }
706                 __plogsListView->SetBounds(pForm->GetX(), pForm->GetY(), pForm->GetWidth(), pForm->GetClientAreaBounds().height);
707                 __plogsListView->UpdateList();
708                 __pFormFooter->RemoveItemAt(1);
709
710                 if(__pLogPresentor->GetCallLogsViewedCount() > 0)\r
711                 {
712                         __pFormFooter->SetItemEnabled(0, true);
713                 }
714                 else
715                 {
716                         __pFormFooter->SetItemEnabled(0, false);
717                 }
718                 __pButtonSelectAll->SetShowState(false);
719                 __pSelectedLabel->SetShowState(false);
720                 __pSelectedLabel->Invalidate(false);
721                 __pFormFooter->Invalidate(true);
722         }
723         else
724         {
725                 __isEditMode = true;
726                 const Form* pForm = dynamic_cast<Form*>(GetParent());
727                 if(pForm == null)
728                 {
729                         return;
730                 }
731                 __pDataProvider->SetListItemStyle(isEdit);
732                 __plogsListView->SetSweepEnabled(false);
733
734                 //reset size to allow "SELECT ALL" & "TOAST MSG"
735                 if(pForm->GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || pForm->GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
736                 {
737                         Rectangle newRect(pForm->GetX(), H_SELECTALL_CHK_BOX + 20, pForm->GetWidth(), (pForm->GetClientAreaBounds().height - H_SELECTALL_CHK_BOX - H_TOAST_MSG));
738                         __plogsListView->SetBounds(newRect);
739                 }
740                 else
741                 {
742                         Rectangle newRect(pForm->GetX(), H_SELECTALL_CHK_BOX, pForm->GetWidth(), (pForm->GetClientAreaBounds().height - H_SELECTALL_CHK_BOX - H_TOAST_MSG));
743                         __plogsListView->SetBounds(newRect);
744                 }
745                 UnCheckAllItems();
746                 __plogsListView->UpdateList();
747                 __pFormFooter->AddItem(__footerItemCancel);
748                 __pButtonSelectAll->SetShowState(true);
749                 __pFormFooter->SetItemEnabled(0, false);
750                 __selectedItemCount = 0;
751                 String selStr = AppUtility::GetResourceString(IDS_SELECT_CALL_LOG);
752                 __pSelectedLabel->SetText(selStr);
753                 __pSelectedLabel->SetShowState(true);
754                 __pSelectedLabel->Invalidate(false);
755                 __pFormFooter->Invalidate(true);
756         }
757         Draw();
758 }
759
760 void
761 DialTabLogs::UnCheckAllItems(void)
762 {
763         int itemCount = 0;
764         __groupCount = __plogsListView->GetGroupCount();\r
765         for(int groupIndex = 0; groupIndex < __groupCount; groupIndex++)
766         {
767                 itemCount = __plogsListView->GetItemCountAt(groupIndex);
768                 for(int itemIndex = itemCount-1; itemIndex >=0 ; itemIndex--)
769                 {
770                         bool isSelected = __plogsListView->IsItemChecked(groupIndex, itemIndex);
771                         if(isSelected == true)
772                         {
773                                 __plogsListView->SetItemChecked(groupIndex,itemIndex,false);
774                         }
775                 }
776         }
777         __plogsListView->Invalidate(true);
778         __selectedItemCount = 0;
779 }
780
781 void DialTabLogs::OnCalllogChanged(void)
782 {
783         // If select all was selected before and some new calls are added (Auto rejeted call)
784         //Then we will not update the call log list.
785         if(__isEditMode == false)
786         {
787                 if(__pGroupContextDeletePopup != null)
788                 {
789                         delete __pGroupContextDeletePopup;
790                         __pGroupContextDeletePopup = null;
791                 }
792                 UpdateCallLogList();
793         }
794         //It won't update the log list when delete is on progress.
795         /*else if(__isEditMode == true && __isDeleteInProgress == false)
796         {
797                 __plogsListView->UpdateList();
798                 __plogsListView->Invalidate(false);
799         }*/
800         //Update the log list for all MO/MT/MSG if the log list is in edit mode and delete is not on progress
801         else if(__isEditMode == true && __isDeleteInProgress == false)
802         {
803                 if(__plogsListView != null)
804                 {
805                         __pLogPresentor->UpdateCallLogList();
806                         __plogsListView->UpdateList();
807                         __plogsListView->Invalidate(false);
808                 }
809         }
810         if(IsScecneVisible() == true && __isDeleteInProgress == false)
811         {
812                 ManageItemSelection();
813         }
814 }
815
816 void
817 DialTabLogs::UpdateCallLogList()
818 {
819         AppLogDebug("Enter");
820
821         __pLogPresentor->UpdateCallLogList();\r
822         __plogsListView->UpdateList();\r
823         if (__pFormFooter != null)\r
824         {\r
825                 if(__pLogPresentor->GetAllCallLogCount() > 0)\r
826                 {\r
827                         __pFormFooter->SetShowState(true);\r
828                         __pFormFooter->SetItemEnabled(0,true);
829                 }\r
830                 if(__pLogPresentor->GetCallLogsViewedCount() > 0)\r
831                 {\r
832                         __pFormFooter->SetItemEnabled(0, true);\r
833                 }\r
834                 else\r
835                 {\r
836                         __pFormFooter->SetItemEnabled(0, false);\r
837                 }
838                 __pFormFooter->Invalidate(true);\r
839         }\r
840 }
841
842 void
843 DialTabLogs::ShowDeletePopup(void)
844 {
845         __isDeleteInProgress = true;
846         if (__pDeletePopup != null)
847         {
848                 delete __pDeletePopup;
849                 __pDeletePopup = null;
850         }
851         if(__selectedItemCount == 0)
852         {
853                 AppLogDebug("Wrong state");
854                 return;
855         }
856         __deleteGroupIndex = 0;
857         __deleteItemIndex = 0;
858
859         __pDeletePopup = new (std::nothrow) Popup();
860         __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
861         __pDeletePopup->AddWindowEventListener(*this);
862         __pDeletePopup->SetPropagatedKeyEventListener(this);
863
864         Rectangle clientBounds = __pDeletePopup->GetClientAreaBounds();
865
866         Label* pLabelTitle = new (std::nothrow) Label();
867         pLabelTitle->Construct(Rectangle(0, Y_DELETE_POPUP_TITLE, clientBounds.width, H_DELETE_POPUP_ELEMENT), AppUtility::GetResourceString(IDS_DELETING_CALL_LOGS));
868         pLabelTitle->SetTextColor(COLOR_DELETE_POPUP_TEXT);
869         pLabelTitle->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_BOLD);
870         pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
871
872         __pDeletePopup->AddControl(*pLabelTitle);
873
874         Progress* pProgress = new (std::nothrow) Progress();
875         pProgress->Construct(Rectangle(0, Y_DELETE_POPUP_TITLE + H_DELETE_POPUP_ELEMENT, clientBounds.width, H_DELETE_POPUP_PROGRESS), 0, __selectedItemCount);
876
877         __pDeletePopup->AddControl(*pProgress);
878
879         Label* pLabelPercentage = new (std::nothrow) Label();
880         pLabelPercentage->Construct(Rectangle(0, pProgress->GetY() + pProgress->GetHeight(), clientBounds.width / 2, H_DELETE_POPUP_ELEMENT), Integer::ToString(pProgress->GetPercentComplete()) + L"%");
881         pLabelPercentage->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
882         pLabelPercentage->SetTextColor(COLOR_DELETE_POPUP_TEXT);
883         pLabelPercentage->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
884
885         __pDeletePopup->AddControl(*pLabelPercentage);
886
887         String currentOfTotal(Integer::ToString(pProgress->GetValue()) + L" / " + Integer::ToString(__selectedItemCount));
888         Label* pLabelTotal = new (std::nothrow) Label();
889         pLabelTotal->Construct(Rectangle(clientBounds.width / 2, pLabelPercentage->GetY(), clientBounds.width / 2, H_DELETE_POPUP_ELEMENT), currentOfTotal);
890         pLabelTotal->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
891         pLabelTotal->SetTextColor(COLOR_DELETE_POPUP_TEXT);
892         pLabelTotal->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
893
894         __pDeletePopup->AddControl(*pLabelTotal);
895
896         Button* pCancelButton = new (std::nothrow) Button();
897         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));
898         pCancelButton->SetText(AppUtility::GetResourceString(IDS_CANCEL_DELETING_CALL_LOGS));
899         pCancelButton->SetActionId(IDA_POPUP_DELETE_CANCEL);
900         pCancelButton->AddActionEventListener(*this);
901
902         __pDeletePopup->AddControl(pCancelButton);
903         __pDeletePopup->Show();
904
905 }
906
907 void
908 DialTabLogs::OnWindowActivated (const Tizen::Ui::Window &source)
909 {
910         __deleteLogsTimer.Start(1);
911 }
912
913 void
914 DialTabLogs::OnTimerExpired(Tizen::Base::Runtime::Timer &timer)
915 {
916         Progress* pProgress = static_cast<Progress *>(__pDeletePopup->GetControl(1));
917
918         pProgress->SetValue(pProgress->GetValue() + 1);
919         pProgress->Invalidate(false);
920
921         Label* pLabelPercentage = static_cast<Label *>(__pDeletePopup->GetControl(2));
922
923         pLabelPercentage->SetText(Integer::ToString(pProgress->GetPercentComplete()) + L"%");
924         pLabelPercentage->Invalidate(false);
925
926         Label* pLabelTotal = static_cast<Label *>(__pDeletePopup->GetControl(3));
927
928         String currentOfTotal = pLabelTotal->GetText();
929         currentOfTotal.Remove(0, Integer::ToString(pProgress->GetValue() - 1).GetLength());
930         currentOfTotal.Insert(Integer::ToString(pProgress->GetValue()), 0);
931         pLabelTotal->SetText(currentOfTotal);
932         pLabelTotal->Invalidate(false);
933
934         if (RemoveLogsList() == E_SUCCESS)
935         {
936                 __deleteLogsTimer.Start(1);
937         }
938         else
939         {
940                 HideDeletePopup();
941         }
942 }
943
944 result
945 DialTabLogs::RemoveLogsList(void)
946 {
947         result r = E_FAILURE;
948
949         CallLogDetails* pCalllogInfo = null;
950         for(int groupIndex = __deleteGroupIndex; groupIndex < __plogsListView->GetGroupCount(); groupIndex++)
951         {
952                 int itemCount = __plogsListView->GetItemCountAt(groupIndex);
953                 for(int itemIndex = __deleteItemIndex; itemIndex < itemCount ; itemIndex++)
954                 {
955                         bool isSelected = __plogsListView->IsItemChecked(groupIndex, itemIndex);
956                         if(isSelected == true)
957                         {
958                                 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
959                                 if(pCalllogInfo != null)
960                                 {
961                                         if(pCalllogInfo->GetConsecutiveNoCounter() > 1)\r
962                                         {\r
963                                                 Tizen::Base::Collection::ArrayList* dbIds = pCalllogInfo->GetCallLogDbIds();\r
964                                                 for(int i=0; i < dbIds->GetCount(); ++i)\r
965                                                 {\r
966                                                         Integer* in = (Integer*)dbIds->GetAt(i);\r
967                                                         int p = in->ToInt();\r
968                                                         __pLogPresentor->DeleteCalllogByDbId(p);\r
969                                                 }\r
970                                         }\r
971                                         else\r
972                                         {\r
973                                                 __pLogPresentor->DeleteCalllogByDbId(pCalllogInfo->GetCalllogDbId());\r
974                                         }\r
975 \r
976                                         r = E_SUCCESS;
977                                         __deleteGroupIndex = groupIndex;
978                                         __deleteItemIndex = ++itemIndex;
979                                         __pCallLogId->Remove(*(new Integer(pCalllogInfo->GetCalllogDbId())));
980                                         return r;
981                                 }
982                         }
983                 }
984                 __deleteItemIndex = 0;
985         }
986         __deleteGroupIndex = 0;
987         __deleteItemIndex = 0;
988
989         return r;
990 }
991
992 void
993 DialTabLogs::HideDeletePopup(void)
994 {
995         __isDeleteInProgress = false;
996         if (__pDeletePopup != null)
997         {
998                 __pDeletePopup->SetShowState(false);
999                 __pDeletePopup->Invalidate(true);
1000                 SendUserEvent(REQUEST_CHANGE_EDIT_MODE,null);
1001         }
1002         if(__pLogPresentor->GetCallLogsViewedCount() > 0)\r
1003         {
1004                 __pFormFooter->SetItemEnabled(0, true);
1005         }
1006         else
1007         {
1008                 __pFormFooter->SetItemEnabled(0, false);
1009         }
1010         __pFormFooter->Invalidate(true);
1011 }
1012
1013 void
1014 DialTabLogs::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1015 {
1016         switch(requestId)
1017         {
1018                 case REQUEST_CHANGE_EDIT_MODE:
1019                 {
1020                         //CustomDataProvider::setCallLogViewbyID(CALL_LOG_TYPE_ALL);
1021                         UpdateCallLogList();
1022                         SetCallLogDisplayMode(false);
1023                 }
1024                 break;
1025
1026                 case REQUEST_CHANGE_VIEWBY:
1027                 {
1028                         UpdateCallLogList();
1029                         if(__pLogPresentor->GetCallLogsViewedCount() > 0)\r
1030                         {
1031                                 __pFormFooter->SetItemEnabled(0, true);
1032                         }
1033                         else
1034                         {
1035                                 __pFormFooter->SetItemEnabled(0, false);
1036                         }
1037                 }
1038                 break;
1039         }
1040
1041 }
1042
1043 void
1044 DialTabLogs::OnForeground(void)
1045 {
1046         AppLogDebug("Enter");
1047         if (__isMsgAppControlLaunched == true)
1048         {
1049                 //Message AppControl request completed.
1050                 __isMsgAppControlLaunched = false;
1051         }
1052         if (__isCallAppControlLaunched == true)
1053         {
1054                 //Call AppControl request completed.
1055                 __isCallAppControlLaunched = false;
1056         }
1057         if(__pLogsViewbyPopup != null && __pLogPresentor->GetAllCallLogCount() == 0)
1058         {
1059                 delete __pLogsViewbyPopup;
1060                 __pLogsViewbyPopup = null;
1061         }
1062         SetSceneVisible(true);
1063         ManageItemSelection();
1064
1065         //change the font, if font has been changed from backgroung
1066         float fontSize = 0.0;
1067         float itemHeight = 0.0;
1068         AppUtility::GetGlobalFontAndItemHeight(&fontSize, &itemHeight);
1069         if(__fontSize != fontSize)
1070         {
1071                 __fontSize = fontSize;
1072                 __itemHeight = itemHeight;
1073                 __plogsListView->UpdateList();
1074                 if(__pLogsViewbyPopup != null && __pLogsViewbyPopup->GetShowState() == true)
1075                 {
1076                         __pLogsViewbyPopup->UpdateViewByPopupList();
1077                 }
1078         }
1079 }
1080
1081 void
1082 DialTabLogs::OnBackground(void)
1083 {
1084         SetSceneVisible(false);\r
1085 }
1086
1087 void
1088 DialTabLogs::StoreItemselection(int groupIndex, int itemIndex, int elementId, ListItemStatus state)
1089 {
1090         CallLogDetails* pCalllogInfo = null;
1091         if (state == LIST_ITEM_STATUS_CHECKED)
1092         {
1093                 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
1094                 __pCallLogId->Add(new Integer(pCalllogInfo->GetCalllogDbId()));
1095         }
1096         else if (state == LIST_ITEM_STATUS_UNCHECKED)
1097         {
1098                 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
1099                 __pCallLogId->Remove(*(new Integer(pCalllogInfo->GetCalllogDbId())));
1100         }
1101 }
1102 void
1103 DialTabLogs:: ManageItemSelection(void)
1104 {
1105         if(__isEditMode == true && __selectedItemCount > 0 && __pLogPresentor->GetCallLogsViewedCount() != __itemCount)
1106         {
1107                 UnCheckAllItems();
1108                 int itemCount = 0;
1109                 CallLogDetails* pCalllogInfo = null;
1110                 for(int groupIndex = 0; groupIndex < __groupCount; groupIndex++)
1111                 {
1112                         itemCount = __plogsListView->GetItemCountAt(groupIndex);
1113                         for(int itemIndex = itemCount-1; itemIndex >=0 ; itemIndex--)
1114                         {
1115                                 __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo);
1116 \r
1117                                 if(pCalllogInfo->GetConsecutiveNoCounter() > 1)\r
1118                                 {
1119                                         Tizen::Base::Collection::ArrayList* dbIds = pCalllogInfo->GetCallLogDbIds();\r
1120                                         for(int i=0; i < dbIds->GetCount(); ++i)\r
1121                                         {\r
1122                                                 Integer* in = (Integer*)dbIds->GetAt(i);\r
1123                                                 if(__pCallLogId->Contains(*in))\r
1124                                                 {\r
1125                                                         __plogsListView->SetItemChecked(groupIndex,itemIndex,true);\r
1126                                                         ++__selectedItemCount;\r
1127                                                         break;\r
1128                                                 }\r
1129                                         }\r
1130                                 }\r
1131                                 else\r
1132                                 {\r
1133                                         if(__pCallLogId->Contains(*(new Integer(pCalllogInfo->GetCalllogDbId()))))\r
1134                                         {\r
1135                                                 __plogsListView->SetItemChecked(groupIndex,itemIndex,true);\r
1136                                                 ++__selectedItemCount;\r
1137                                         }\r
1138                                 }
1139                         }
1140                 }
1141                 __itemCount = __pLogPresentor->GetCallLogsViewedCount();\r
1142                 if(__selectedItemCount == __itemCount)
1143                 {
1144                         __pButtonSelectAll->SetSelected(true);
1145                 }
1146                 else
1147                 {
1148                         __pButtonSelectAll->SetSelected(false);
1149                 }
1150                 String selItemStr = L"";
1151                 String text;
1152                 if(__selectedItemCount == 0)
1153                 {
1154                         selItemStr = AppUtility::GetResourceString(IDS_SELECT_CALL_LOG);
1155                 }
1156                 else if(__selectedItemCount > 1)
1157                 {
1158                         selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEMS_STRING);
1159                 }
1160                 else
1161                 {
1162                         selItemStr = AppUtility::GetResourceString(IDS_SELECTED_ITEM_STRING);
1163                 }
1164                 text.Format(100, selItemStr.GetPointer(), __selectedItemCount);
1165                 __pSelectedLabel->SetText(text);
1166                 __pSelectedLabel->Invalidate(false);
1167         }
1168 }
1169
1170 bool
1171 DialTabLogs::IsScecneVisible()
1172 {
1173         return __isSceneVisible;
1174 }
1175
1176
1177 void
1178 DialTabLogs::SetSceneVisible(bool sceneMode)
1179 {
1180         __isSceneVisible = sceneMode;
1181 }
1182
1183 void
1184 DialTabLogs::ShowLogsViewByPopup(void)
1185 {
1186         if(__pLogsViewbyPopup != null)
1187         {
1188                 delete __pLogsViewbyPopup;
1189                 __pLogsViewbyPopup = null;
1190         }
1191
1192         __pLogsViewbyPopup = new (std::nothrow) CallLogViewByPopup(*this);
1193         __pLogsViewbyPopup->ConstructViewbyPopup();
1194         __pLogsViewbyPopup->SetShowState(true);
1195         __pLogsViewbyPopup->Draw();
1196         __pLogsViewbyPopup->Show();
1197 }
1198
1199 void
1200 DialTabLogs::OnItemSelected()
1201 {
1202         SendUserEvent(REQUEST_CHANGE_VIEWBY, null);
1203 }
1204
1205 void
1206 DialTabLogs::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1207 {
1208         const Form* pForm = dynamic_cast<Form*>(GetParent());
1209         if(pForm == null)
1210         {
1211                 return;
1212         }
1213         if((pForm->GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || pForm->GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE) && __isEditMode == true)
1214         {
1215                 Rectangle newRect(pForm->GetX(), H_SELECTALL_CHK_BOX + 20, pForm->GetWidth(), (pForm->GetClientAreaBounds().height - H_SELECTALL_CHK_BOX - H_TOAST_MSG));
1216                 __plogsListView->SetBounds(newRect);
1217         }
1218         else if(__isEditMode == true)
1219         {
1220                 Rectangle newRect(pForm->GetX(), H_SELECTALL_CHK_BOX, pForm->GetWidth(), (pForm->GetClientAreaBounds().height - H_SELECTALL_CHK_BOX - H_TOAST_MSG));
1221                 __plogsListView->SetBounds(newRect);
1222         }
1223         else
1224         {
1225                 __plogsListView->SetBounds(pForm->GetX(), pForm->GetY(), pForm->GetWidth(), pForm->GetClientAreaBounds().height);
1226         }
1227 }
1228
1229 void
1230 DialTabLogs::OnSettingChanged(Tizen::Base::String& key)
1231 {
1232         AppLog("Enter");
1233         if(key.Equals(String(SETTING_INFO_KEY_TIME_FORMAT)) == true)
1234         {
1235                 __plogsListView->UpdateList();
1236         }
1237         AppLog("Exit");
1238 }
1239
1240 void
1241 DialTabLogs::ShowOptionsMenu()
1242 {
1243         if(__isEditMode == false && __pLogPresentor->GetAllCallLogCount() > 0)
1244         {
1245                 if(__pOptionMenu != null)
1246                 {
1247                         delete __pOptionMenu;
1248                         __pOptionMenu = null;
1249                 }
1250                 __pOptionMenu = new (std::nothrow) OptionMenu();
1251                 __pOptionMenu->Construct();
1252                 __pOptionMenu->RemoveAllItems();
1253                 __pOptionMenu->AddItem(AppUtility::GetResourceString(IDS_CONTEXTMENU_ITEM_VIEWBY), IDA_CONTEXTMENU_VIEWBY);
1254                 __pOptionMenu->AddActionEventListener(*this);
1255                 __pOptionMenu->SetShowState(true);
1256                 __pOptionMenu->Show();
1257         }
1258 }
1259
1260 bool
1261 DialTabLogs::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1262 {
1263         AppLogDebug("Enter");
1264         if(keyEventInfo.GetKeyCode() == KEY_BACK)
1265         {
1266                 if(__pGroupContextDeletePopup != null && __pGroupContextDeletePopup->GetShowState() == true)
1267                 {
1268                         __pGroupContextDeletePopup->SetShowState(false);
1269                 }
1270                 else if(__pDeletePopup != null && __pDeletePopup->GetShowState() == true)
1271                 {
1272                         HideDeletePopup();
1273                 }
1274         }
1275         return false;
1276 }