Fixed Jira issues 50249, 50683, 50387
[apps/osp/MusicPlayer.git] / src / MpArtistContentListForm.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                MpArtistContentListForm.cpp
19  * @brief               This is the implementation file for ArtistContentListForm class.
20  */
21
22 #include <FSocial.h>
23 #include "MpArtistContentListForm.h"
24 #include "MpArtistListPresentationModel.h"
25 #include "MpMusicPlayerApp.h"
26 #include "MpPlaylistPickerPopup.h"
27 #include "MpSharePopup.h"
28 #include "MpThumbnailInfo.h"
29
30 using namespace Tizen::App;
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Collection;
33 using namespace Tizen::Content;
34 using namespace Tizen::Ui;
35 using namespace Tizen::Ui::Controls;
36 using namespace Tizen::Ui::Scenes;
37 using namespace Tizen::Graphics;
38 using namespace Tizen::Io;
39 using namespace Tizen::System;
40 using namespace Tizen::Social;
41
42
43 #define ALL_SONG_INDEX_COUNT_PLUS(n) (n + 1)
44 #define ALL_SONG_INDEX_COUNT_MINUS(n) (n - 1)
45
46 ArtistContentListForm::ArtistContentListForm(void)
47         : ContentListForm::ContentListForm()
48         , ThumbnailBase::ThumbnailBase()
49         , __pContentGroupedTableView(null)
50         , __pTableViewContextItem(null)
51         , __pCheckedItemCountMultiHashMap(null)
52         , __pThumbnail(null)
53         , __activatedStateContextItem(0)
54         , __pPresentationModel(null)
55 {
56         AppLogDebug("ENTER");
57         AppLogDebug("EXIT");
58 }
59
60 ArtistContentListForm::~ArtistContentListForm(void)
61 {
62         AppLogDebug("ENTER");
63         AppLogDebug("EXIT");
64 }
65
66 result
67 ArtistContentListForm::Initialize(void)
68 {
69         AppLogDebug("ENTER");
70         if (IsFailed(Form::Construct(IDL_CONTENT_LIST_ARTIST_FORM)))
71         {
72                 AppLogDebug("Form::Construct(IDL_CONTENT_LIST_ARTIST_FORM) failed(%s)", GetErrorMessage(GetLastResult()));
73                 return GetLastResult();
74         }
75
76         AppLogDebug("EXIT");
77         return Construct();
78 }
79
80 result
81 ArtistContentListForm::Construct(void)
82 {
83         AppLogDebug("ENTER");
84         __pContentGroupedTableView = static_cast<GroupedTableView*>(GetControl(IDC_GROUPEDTABLEVIEW_CONTENT_LIST));
85         __pContentGroupedTableView->AddGroupedTableViewItemEventListener(*this);
86         __pContentGroupedTableView->SetItemProvider(this);
87
88         SetContentList(__pContentGroupedTableView);
89
90         result r = InitCheckedItemMultiHashMap();
91         if (IsFailed(r))
92         {
93                 AppLogDebug("InitCheckedItemMultiHashMap failed(%s)", GetErrorMessage(r));
94                 return r;
95         }
96
97         AppLogDebug("EXIT");
98         return ContentListForm::Construct();
99 }
100
101 result
102 ArtistContentListForm::OnInitializing(void)
103 {
104         AppLogDebug("ENTER");
105         __fontSizeValue = CommonUtil::GetFontSizeValue();
106         __itemHeight = CommonUtil::GetItemHeight(__fontSizeValue);
107         __pPresentationModel = ArtistListPresentationModel::GetInstance();
108         __pTableViewContextItem = CommonUtil::CreateTableViewContextItemN(*this, GetWidth(), FLICK_MENU_STYLE_TYPE_01);
109         AppLogDebug("EXIT");
110         return ThumbnailBase::Construct();
111 }
112
113 result
114 ArtistContentListForm::OnTerminating(void)
115 {
116         AppLogDebug("ENTER");
117         ThumbnailBase::Stop();
118         RemoveCheckedItemMultiHashMap();
119
120         delete __pTableViewContextItem;
121         __pTableViewContextItem = null;
122
123         __pContentGroupedTableView = null;
124         __pPresentationModel = null;
125         AppLogDebug("EXIT");
126         return ContentListForm::OnTerminating();
127 }
128
129 void
130 ArtistContentListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
131                                         const Tizen::Ui::Scenes::SceneId& currentSceneId,
132                                         Tizen::Base::Collection::IList* pArgs)
133 {
134         AppLogDebug("ENTER");
135         if (pArgs != null)
136         {
137                 if (previousSceneId.Equals(IDSCN_PLAYLIST_CREATOR, false))
138                 {
139                         SetItemCheckedAll(false);
140                 }
141                 else
142                 {
143                         __prevSceneId.Clear();
144                         __headerTitle.Clear();
145                         __prevSceneId.Append(*static_cast<String*>(pArgs->GetAt(DATA_ITEM_SCENE_NAME)));
146                         __headerTitle.Append(*static_cast<String*>(pArgs->GetAt(DATA_ITEM_CONTENT_NAME)));
147                         __artistName = __headerTitle;
148                         __pPresentationModel->UpdateArtistList();
149                         __pPresentationModel->InitializeArtistAlbumList(__artistName);
150                         __pPresentationModel->InitializeContentList(INIT_VALUE);
151                 }
152                 SetHeader();
153                 UpdateScreenState();
154                 UpdateTableView();
155
156                 pArgs->RemoveAll(true);
157                 delete pArgs;
158         }
159         AppLogDebug("EXIT");
160 }
161
162 void
163 ArtistContentListForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
164                                                                         const Tizen::Ui::Scenes::SceneId& nextSceneId)
165 {
166         AppLogDebug("ENTER");
167         CancelAllThumbnailRequest();
168         AppLogDebug("EXIT");
169 }
170
171 void
172 ArtistContentListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
173 {
174         AppLogDebug("ENTER");
175         SceneManager* pSceneManager = SceneManager::GetInstance();
176         AppAssert(pSceneManager);
177
178         switch (actionId)
179         {
180         case IDA_HEADER_BUTTON_SELECTE_ALL:
181                 {
182                         bool isChecked = true;
183                         if (GetCheckedItemCount() == GetTotalItemCount())
184                         {
185                                 isChecked = false;
186                         }
187                         SetItemCheckedAll(isChecked);
188                 }
189                 break;
190
191         case IDA_FOOTER_BUTTON_SHARE:
192                 {
193                         LanucherPicker(PICKER_TYPE_SHARE_PICKER);
194                 }
195                 break;
196
197         case IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST:
198                 {
199                         LanucherPicker(PICKER_TYPE_PLAY_LIST_PICKER);
200                 }
201                 break;
202
203         case IDA_CONTEXT_MENU_ITEM_SEARCH:
204                 {
205                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SEARCH, SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_HISTORY_OPTION_NO_HISTORY));
206                 }
207                 break;
208
209         case IDA_CONTEXT_MENU_ITEM_EDIT:
210                 {
211                         ToggleScreenState(SCREEN_STATE_EDITOR);
212                 }
213                 break;
214
215         case IDA_CONTEXT_MENU_ITEM_SHARE_VIA:
216                 {
217                         ToggleScreenState(SCREEN_STATE_SHARE_VIA);
218                 }
219                 break;
220
221         case IDA_FOOTER_BUTTON_MORE:
222                 {
223                         CreateOptionMenuN(source);
224                         SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SHARE_VIA | CONTEXT_MENU_ITEM_STYLE_EDIT);
225                 }
226                 break;
227
228         case IDA_FLICK_MENU_ITEM_ADDTO:
229                 {
230                         LanucherPicker(PICKER_TYPE_PLAY_LIST_PICKER, PICKER_ARGUMENT_TYPE_ACTIVATED_STATE_CONTEXT_ITEM);
231
232                         if (__pContentGroupedTableView->IsContextItemOpened(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex))
233                         {
234                                 __pContentGroupedTableView->CloseContextItem(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex);
235                         }
236                 }
237                 break;
238
239         case IDA_FLICK_MENU_ITEM_SHARE:
240                 {
241                         CreateContextMenuN(source);
242                         SetContextMenuItem(CONTEXT_MENU_ITEM_STYLE_EMAIL | CONTEXT_MENU_ITEM_STYLE_MESSAGE);
243                 }
244                 break;
245
246         case IDA_FLICK_MENU_ITEM_SET_AS:
247                 {
248                         CreateContextMenuN(source);
249                         SetContextMenuItem(CONTEXT_MENU_ITEM_STYLE_CALL | CONTEXT_MENU_ITEM_STYLE_CALLER);
250                 }
251                 break;
252
253         case IDA_FLICK_MENU_ITEM_DELETE:
254                 {
255                         SetCommonPopup(CommonUtil::CreateContentDeletePopup(*this, IDA_COMMON_POPUP_DELETE, IDA_COMMON_POPUP_CANCEL));
256
257                         if (__pContentGroupedTableView->IsContextItemOpened(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex))
258                         {
259                                 __pContentGroupedTableView->CloseContextItem(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex);
260                         }
261                 }
262                 break;
263
264         case IDA_COMMON_POPUP_DELETE:
265                 {
266                         ContentInformation* pContentInfo = GetContentInformationActivatedStateContextItem();
267                         if (pContentInfo != null)
268                         {
269                                 RemoveContentAt(pContentInfo->contentId);
270                                 __pPresentationModel->InitializeArtistAlbumList(__artistName);
271                                 __pPresentationModel->InitializeContentList(INIT_VALUE);
272
273                                 SetItemCheckedAll(false);
274                                 __pContentGroupedTableView->RefreshItem(__activatedStateContextItem.__groupIndex, __activatedStateContextItem.__itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);;
275                                 delete pContentInfo;
276                         }
277                 }
278                 break;
279
280         case IDA_CONTEXT_MENU_ITEM_EMAIL:
281                 {
282                         ContentInformation* pContentInfo = GetContentInformationActivatedStateContextItem();
283                         if (pContentInfo != null)
284                         {
285                                 EventHandlerContextMenuItemMessageEmail(*pContentInfo, PROVIDER_ID_EMAIL);
286                                 delete pContentInfo;
287                         }
288
289                         if (__pContentGroupedTableView->IsContextItemOpened(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex))
290                         {
291                                 __pContentGroupedTableView->CloseContextItem(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex);
292                         }
293                 }
294                 break;
295
296         case IDA_CONTEXT_MENU_ITEM_MESSAGE:
297                 {
298                         ContentInformation* pContentInfo = GetContentInformationActivatedStateContextItem();
299                         if (pContentInfo != null)
300                         {
301                                 EventHandlerContextMenuItemMessageEmail(*pContentInfo, PROVIDER_ID_MESSAGE);
302                                 delete pContentInfo;
303                         }
304
305                         SetItemCheckedAll(false);
306
307                         if (__pContentGroupedTableView->IsContextItemOpened(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex))
308                         {
309                                 __pContentGroupedTableView->CloseContextItem(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex);
310                         }
311                 }
312                 break;
313
314         case IDA_CONTEXT_MENU_ITEM_CALL:
315                 {
316                         ContentInformation* pContentInfo =  GetContentInformationActivatedStateContextItem();
317                         if (pContentInfo != null)
318                         {
319                                 EventHandlerContextMenuItemCall(*pContentInfo);
320                                 delete pContentInfo;
321                         }
322
323                         if (__pContentGroupedTableView->IsContextItemOpened(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex))
324                         {
325                                 __pContentGroupedTableView->CloseContextItem(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex);
326                         }
327                 }
328                 break;
329
330         case IDA_CONTEXT_MENU_ITEM_CALLER:
331                 {
332                         EventHandlerContextMenuItemCaller();
333
334                         if (__pContentGroupedTableView->IsContextItemOpened(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex))
335                         {
336                                 __pContentGroupedTableView->CloseContextItem(__activatedStateContextItem.__groupIndex,__activatedStateContextItem.__itemIndex);
337                         }
338                 }
339                 break;
340
341         case IDA_FOOTER_BUTTON_DELETE:
342                 {
343                         RemoveConentCheckedAll();
344                 }
345                 break;
346
347         default:
348                 break;
349         }
350
351         TryRemoveCommonPopup(actionId);
352         TryRemoveContextMenu(actionId);
353         AppLogDebug("EXIT");
354 }
355
356 void
357 ArtistContentListForm::OnFormMenuRequested(Tizen::Ui::Controls::Form& source)
358 {
359         if (GetScreenState() == SCREEN_STATE_NORMAL && IsEmptyContentList() == false)
360         {
361                 CreateOptionMenuN(source);
362                 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SHARE_VIA | CONTEXT_MENU_ITEM_STYLE_EDIT);
363         }
364 }
365 void
366 ArtistContentListForm::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex,
367                                                                                         Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
368 {
369         AppLogDebug("ENTER");
370         if (status == TABLE_VIEW_ITEM_STATUS_SELECTED && GetScreenState() != SCREEN_STATE_NORMAL)
371         {
372                 bool ischeck = true;
373                 if (tableView.GetItemCountAt(groupIndex) == GetCheckedItemCountAt(groupIndex))
374                 {
375                         ischeck = false;
376                 }
377
378                 SetItemCheckedAt(groupIndex, ischeck);
379                 SetCheckedCountBallonTooltip(GetCheckedItemCount());
380                 tableView.Invalidate(true);
381
382                 if (GetFooter() != null)
383                 {
384                         CommonUtil::SetFooterItemEnabled(*GetFooter(), ischeck);
385                 }
386         }
387         AppLogDebug("EXIT");
388 }
389
390 void
391 ArtistContentListForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex,
392                                                                                         Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
393 {
394         AppLogDebug("ENTER");
395         if (GetScreenState() != SCREEN_STATE_NORMAL)
396         {
397                 SetItemCheckedStateChanged(status, groupIndex, itemIndex);
398                 AppLogDebug("EXIT");
399                 return;
400         }
401
402         if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
403         {
404                 SceneManager* pSceneManager = SceneManager::GetInstance();
405                 AppAssert(pSceneManager);
406
407                 ArrayList* pSceneArg = MakePlayerSceneParam(groupIndex, itemIndex);
408                 if (pSceneArg != null)
409                 {
410                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_PLAYER), pSceneArg);
411                 }
412         }
413         AppLogDebug("EXIT");
414 }
415
416 void
417 ArtistContentListForm::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex,
418                                                                                         int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
419 {
420         AppLogDebug("ENTER");
421         if (activated == true)
422         {
423                 __activatedStateContextItem.__groupIndex = groupIndex;
424                 __activatedStateContextItem.__itemIndex = itemIndex;
425         }
426         AppLogDebug("EXIT");
427 }
428
429 int
430 ArtistContentListForm::GetGroupCount(void)
431 {
432         AppLogDebug("ENTER");
433         if (__pPresentationModel == null)
434         {
435                 return INIT_VALUE;
436         }
437
438         AppLogDebug("EXIT");
439         return __pPresentationModel->GetArtistAlbumListCount();
440 }
441
442 int
443 ArtistContentListForm::GetItemCount(int groupIndex)
444 {
445         AppLogDebug("ENTER");
446         if (__pPresentationModel == null)
447         {
448                 return INIT_VALUE;
449         }
450         AppLogDebug("EXIT");
451         return __pPresentationModel->GetArtistAlbumContentCount(groupIndex);
452 }
453
454 Tizen::Ui::Controls::TableViewGroupItem*
455 ArtistContentListForm::CreateGroupItem(int groupIndex, int itemWidth)
456 {
457         AppLogDebug("ENTER");
458         RelativeLayout layout;
459         layout.Construct();
460         FloatDimension size = CoordinateSystem::AlignToDevice(FloatDimension(itemWidth,H_TABLEVIEW_GROUP_ITEM));
461         TableViewGroupItem* pGroupItem = new (std::nothrow) TableViewGroupItem();
462         if (IsFailed(pGroupItem->Construct(layout, FloatDimension(size.width, size.height))))
463         {
464                 AppLogDebug("TableViewGroupItem.Construct() failed(%s)", GetErrorMessage(GetLastResult()));
465                 delete pGroupItem;
466                 return null;
467         }
468
469         ContentInformation* pContentInfo = __pPresentationModel->GetArtistAlbumInfoN(groupIndex);
470         if (pContentInfo != null)
471         {
472                 CreateTableViewGroupItem(*pGroupItem, *pContentInfo);
473                 RequestThumbnail(pContentInfo->contentId, (new (std::nothrow) TableviewItemTag(groupIndex, -1)));
474                 delete pContentInfo;
475         }
476
477         AppLogDebug("EXIT");
478         return pGroupItem;
479 }
480
481 bool
482 ArtistContentListForm::DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem)
483 {
484         AppLogDebug("ENTER");
485         AppLogDebug("EXIT");
486         return false;
487 }
488
489 void
490 ArtistContentListForm::UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem)
491 {
492         AppLogDebug("ENTER");
493         Panel* pItemPanel = static_cast<Panel*>(pItem->GetControl(IDL_CONTENT_LIST_ARTIST_GROUPITEM_PANEL));
494         if (pItemPanel == null)
495         {
496                 AppLogDebug("pItemPanel is null");
497                 delete __pThumbnail;
498                 __pThumbnail = null;
499                 return;
500         }
501
502         Label* pThumbnailLabel = static_cast<Label*>(pItemPanel->GetControl(IDC_LABEL_CONTENT_THUMBNAIL));
503         if (__pThumbnail == null || pThumbnailLabel == null)
504         {
505                 AppLogDebug("__pThumbnail or pThumbnailLabel is null");
506                 delete __pThumbnail;
507                 __pThumbnail = null;
508                 return;
509         }
510         pThumbnailLabel->SetBackgroundBitmap(*__pThumbnail);
511         delete __pThumbnail;
512         __pThumbnail = null;
513         pThumbnailLabel->Invalidate(true);
514         AppLogDebug("EXIT");
515 }
516
517 Tizen::Ui::Controls::TableViewItem*
518 ArtistContentListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
519 {
520         AppLogDebug("ENTER");
521         RelativeLayout layout;
522         layout.Construct();
523
524         TableViewAnnexStyle tableViewAnnexStyle = TABLE_VIEW_ANNEX_STYLE_NORMAL;
525         if (GetScreenState() != SCREEN_STATE_NORMAL)
526         {
527                 tableViewAnnexStyle = TABLE_VIEW_ANNEX_STYLE_MARK;
528         }
529
530         if (__pPresentationModel->GetCurrentArtistAlbumIndex() != groupIndex)
531         {
532                 __pPresentationModel->InitializeContentList(groupIndex);
533         }
534
535         TableViewItem* pItem = new (std::nothrow) TableViewItem();
536         ContentInformation* pContentInfo = __pPresentationModel->GetArtistAlbumContentInfoN(itemIndex);
537
538         result r = pItem->Construct(layout, Dimension(itemWidth, __itemHeight), tableViewAnnexStyle);
539         TryCatch(r == E_SUCCESS, delete pItem, "pItem->Construct(%s)", GetErrorMessage(r));
540         TryCatch(pContentInfo != null, delete pItem, "pContentInfo is null", GetErrorMessage(GetLastResult()));
541
542         r = CreateTableViewItem(*pItem, *pContentInfo);
543         TryCatch(r == E_SUCCESS, delete pItem, "CreateTableViewItem failed(%s)", GetErrorMessage(r));
544         delete pContentInfo;
545
546         AppLogDebug("EXIT");
547         return pItem;
548
549 CATCH:
550         AppLogDebug("EXIT(%ls)", GetErrorMessage(GetLastResult()));
551         delete pContentInfo;
552         return null;
553 }
554
555 bool
556 ArtistContentListForm::DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
557 {
558         AppLogDebug("ENTER");
559         AppLogDebug("EXIT");
560         return false;
561 }
562
563 void
564 ArtistContentListForm::UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
565 {
566         AppLogDebug("ENTER");
567         AppLogDebug("EXIT");
568 }
569
570 int
571 ArtistContentListForm::GetDefaultItemHeight(void)
572 {
573         AppLogDebug("ENTER");
574         AppLogDebug("EXIT");
575         return H_TABLEVIEW_IITEM;
576 }
577
578 int
579 ArtistContentListForm::GetDefaultGroupItemHeight(void)
580 {
581         AppLogDebug("ENTER");
582         AppLogDebug("EXIT");
583         return H_TABLEVIEW_GROUP_ITEM;
584 }
585
586 void
587 ArtistContentListForm::OnThumbnailInfoReveivedN(ThumbnailInfo* pThumbnailInfo)
588 {
589         AppLogDebug("ENTER");
590         __pThumbnail = pThumbnailInfo->GetBitmapN();
591         Object* pParam = pThumbnailInfo->GetUserParamN();
592         if (pParam != null)
593         {
594                 TableviewItemTag* pTableviewItemTag = static_cast<TableviewItemTag*>(pParam);
595                 __pContentGroupedTableView->RefreshItem(pTableviewItemTag->__groupIndex, pTableviewItemTag->__itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
596                 delete pParam;
597         }
598
599         delete pThumbnailInfo;
600         AppLogDebug("EXIT");
601 }
602
603 bool
604 ArtistContentListForm::IsEmptyContentList(void)
605 {
606         AppLogDebug("ENTER");
607         if (__pPresentationModel != null && __pPresentationModel->GetArtistContentListCount() != INIT_VALUE)
608         {
609                 AppLogDebug("EXIT");
610                 return false;
611         }
612
613         AppLogDebug("EXIT");
614         return true;
615 }
616
617 result
618 ArtistContentListForm::SetHeader(void)
619 {
620         AppLogDebug("ENTER");
621         CommonUtil::SetSimpleTitleStyle(*GetHeader(), __headerTitle);
622         AppLogDebug("EXIT");
623         return E_SUCCESS;
624 }
625
626 result
627 ArtistContentListForm::CreateTableViewGroupItem(Tizen::Ui::Controls::TableViewGroupItem& parent, const ContentInformation& contentInfo)
628 {
629         AppLogDebug("ENTER");
630         RelativeLayout* pLayOutPortrait = null;
631         Label* pTitleLabel = null;
632         Label* pInnerThumbStroke = null;
633         RelativeLayout* pLayOutLandscape = null;
634         Panel* pItem =  new (std::nothrow) Panel();
635         result r = pItem->Construct(IDL_CONTENT_LIST_ARTIST_GROUPITEM_PANEL);
636         if (IsFailed(r))
637         {
638                 AppLogDebug("pItem->Construct() failed(%s)", GetErrorMessage(r));
639                 delete pItem;
640                 return r;
641         }
642
643         pLayOutPortrait = dynamic_cast<RelativeLayout*>(pItem->GetPortraitLayoutN());
644         pTitleLabel = static_cast<Label*>(pItem->GetControl(IDC_LABEL_CONTENT_TITLE_NAME));
645         pInnerThumbStroke = static_cast<Label*>(pItem->GetControl(IDC_LABEL_THUMBNAIL_INNER_STROKE));
646
647         if (pLayOutPortrait != null)
648         {
649                 pLayOutPortrait->SetMargin(*pInnerThumbStroke,CoordinateSystem::ConvertToLogicalX(MARGIN_LEFT_THUMBNAIL_INNER_STROKE),0.0f,CoordinateSystem::ConvertToPhysicalY(MARGIN_TOP_THUMBNAIL_INNER_STROKE),0.0f);
650                 pLayOutPortrait->Update();
651                 delete pLayOutPortrait;
652         }
653
654         pLayOutLandscape = dynamic_cast<RelativeLayout*>(pItem->GetLandscapeLayoutN());
655         if (pLayOutLandscape != null)
656         {
657                 pLayOutLandscape->SetMargin(*pInnerThumbStroke,CoordinateSystem::ConvertToLogicalX(MARGIN_LEFT_THUMBNAIL_INNER_STROKE),0.0f,CoordinateSystem::ConvertToPhysicalY(MARGIN_TOP_THUMBNAIL_INNER_STROKE),0.0f);
658                 pLayOutLandscape->Update();
659                 delete pLayOutLandscape;
660         }
661         if (CoordinateSystem::GetPhysicalResolution().width == W_WVGA_RESOLUTION)
662         {
663                 FloatRectangle rect = CoordinateSystem::AlignToDevice(pTitleLabel->GetBoundsF());
664                 pTitleLabel->SetPosition(pTitleLabel->GetXF(),pTitleLabel->GetYF()-Y_GAP_THUMBNAIL);
665                 pTitleLabel->SetSize(CoordinateSystem::AlignToDevice(FloatDimension(pTitleLabel->GetWidthF(),pTitleLabel->GetHeightF())));
666         }
667
668         (static_cast<Label*>(pItem->GetControl(IDC_LABEL_CONTENT_THUMBNAIL)))->SetBackgroundBitmap(*GetDefaultThumbnail());
669         pTitleLabel->SetText(contentInfo.AlbumName);
670
671         parent.AddControl(pItem);
672         parent.SetEnabled(false);
673
674         CommonUtil::SetLayoutFitToContainer(parent, *pItem);
675
676         AppLogDebug("EXIT");
677         return r;
678 }
679
680 result
681 ArtistContentListForm::CreateTableViewItem(Tizen::Ui::Controls::TableViewItem& parent, const ContentInformation& contentInfo)
682 {
683         AppLogDebug("ENTER");
684         Panel* pItem =  new (std::nothrow) Panel();
685
686         if (GetScreenState() != SCREEN_STATE_NORMAL)
687         {
688                 if (__fontSizeValue.Equals(STRING_FONT_SIZE_GIANT, false))
689                 {
690                         if (IsFailed(pItem->Construct(IDL_CONTENT_NOTHUMBNAIL_EDITOR_ITEM_PANEL_FONT_SIZE_GIANT)))
691                         {
692                                 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
693                                 return E_FAILURE;
694                         }
695                 }
696                 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_HUGE, false))
697                 {
698                         if (IsFailed(pItem->Construct(IDL_CONTENT_NOTHUMBNAIL_EDITOR_ITEM_PANEL_FONT_SIZE_HUGE)))
699                         {
700                                 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
701                                 return E_FAILURE;
702                         }
703                 }
704                 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_LARGE, false))
705                 {
706                         if (IsFailed(pItem->Construct(IDL_CONTENT_NOTHUMBNAIL_EDITOR_ITEM_PANEL_FONT_SIZE_LARGE)))
707                         {
708                                 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
709                                 return E_FAILURE;
710                         }
711                 }
712                 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_SMALL, false))
713                 {
714                         if (IsFailed(pItem->Construct(IDL_CONTENT_NOTHUMBNAIL_EDITOR_ITEM_PANEL_FONT_SIZE_SMALL)))
715                         {
716                                 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
717                                 return E_FAILURE;
718                         }
719                 }
720                 else
721                 {
722                         if (IsFailed(pItem->Construct(IDL_CONTENT_NOTHUMBNAIL_EDITOR_ITEM_PANEL_DEFAULT)))
723                         {
724                                 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
725                                 return E_FAILURE;
726                         }
727                 }
728         }
729         else
730         {
731                 if (__fontSizeValue.Equals(STRING_FONT_SIZE_GIANT, false))
732                 {
733                         if (IsFailed(pItem->Construct(IDL_CONTENT_NOTHUMBNAIL_ITEM_PANEL_FONT_SIZE_GIANT)))
734                         {
735                                 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
736                                 return E_FAILURE;
737                         }
738                 }
739                 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_HUGE, false))
740                 {
741                         if (IsFailed(pItem->Construct(IDL_CONTENT_NOTHUMBNAIL_ITEM_PANEL_FONT_SIZE_HUGE)))
742                         {
743                                 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
744                                 return E_FAILURE;
745                         }
746                 }
747                 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_LARGE, false))
748                 {
749                         if (IsFailed(pItem->Construct(IDL_CONTENT_NOTHUMBNAIL_ITEM_PANEL_FONT_SIZE_LARGE)))
750                         {
751                                 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
752                                 return E_FAILURE;
753                         }
754                 }
755                 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_SMALL, false))
756                 {
757                         if (IsFailed(pItem->Construct(IDL_CONTENT_NOTHUMBNAIL_ITEM_PANEL_FONT_SIZE_SMALL)))
758                         {
759                                 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
760                                 return E_FAILURE;
761                         }
762                 }
763                 else
764                 {
765                         if (IsFailed(pItem->Construct(IDL_CONTENT_NOTHUMBNAIL_ITEM_PANEL_DEFAULT)))
766                         {
767                                 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
768                                 return E_FAILURE;
769                         }
770                 }
771         }
772
773         (static_cast<Label*>(pItem->GetControl(IDC_LABEL_CONTENT_TITLE_NAME)))->SetText(contentInfo.TitleName);
774         (static_cast<Label*>(pItem->GetControl(IDC_LABEL_CONTENT_ADDITIONAL_INFO)))->SetText(CommonUtil::GetFormatDate(contentInfo.Duration));
775
776         parent.AddControl(pItem);
777         parent.SetIndividualSelectionEnabled(pItem, true);
778
779         CommonUtil::SetLayoutFitToContainer(parent, *pItem);
780
781         AppLogDebug("EXIT");
782         return E_SUCCESS;
783 }
784
785 result
786 ArtistContentListForm::InitCheckedItemMultiHashMap(void)
787 {
788         AppLogDebug("ENTER");
789         __pCheckedItemCountMultiHashMap =  new (std::nothrow) MultiHashMapT<int, int>();
790         result r = __pCheckedItemCountMultiHashMap->Construct();
791         if (IsFailed(r))
792         {
793                 delete __pCheckedItemCountMultiHashMap;
794                 __pCheckedItemCountMultiHashMap = null;
795                 return r;
796         }
797         AppLogDebug("EXIT");
798         return r;
799 }
800
801 void
802 ArtistContentListForm::RemoveCheckedItemMultiHashMap(void)
803 {
804         AppLogDebug("ENTER");
805         if (__pCheckedItemCountMultiHashMap != null)
806         {
807                 __pCheckedItemCountMultiHashMap->RemoveAll();
808                 delete __pCheckedItemCountMultiHashMap;
809                 __pCheckedItemCountMultiHashMap = null;
810         }
811         AppLogDebug("EXIT");
812 }
813
814 Tizen::Base::Collection::ArrayList*
815 ArtistContentListForm::MakePlayerSceneParam(int albumIndex, int startIndex)
816 {
817         AppLogDebug("ENTER");
818 #if 0
819         ArrayList* pSelectedMusicContent = __pPresentationModel->GetContentPathListN(albumIndex, SEARCH_MODE_ARTIST_ALBUM);
820 #else
821         ArrayList* pRetList = new (std::nothrow) ArrayList();
822         pRetList->Construct();
823
824         for (int i = 0; i < __pPresentationModel->GetArtistAlbumListCount(); i++)
825         {
826                 if (__pPresentationModel->GetCurrentArtistAlbumIndex() != i)
827                 {
828                         __pPresentationModel->InitializeContentList(i);
829                 }
830
831                 for (int j = 0; j < __pPresentationModel->GetArtistAlbumContentCount(i); j++ )
832                 {
833                         ContentInformation* pContentInfo = __pPresentationModel->GetArtistAlbumContentInfoN(j);
834                         pRetList->Add(new String(pContentInfo->ContentFilePath));
835                         delete pContentInfo;
836                 }
837         }
838         //ArrayList* pSelectedMusicContent = __pPresentationModel->GetAllContentPathListN();
839         startIndex = startIndex + GetOffsetContentIndex(albumIndex);
840 #endif
841         if (pRetList->GetCount() == 0)
842         {
843                 AppLogDebug("EXIT");
844                 delete pRetList;
845                 return null;
846         }
847
848         ArrayList* pTempList = new (std::nothrow) ArrayList();
849         if (IsFailed(pTempList->Construct()))
850         {
851                 AppLogDebug("Construct failed(%s)", GetErrorMessage(GetLastResult()));
852                 delete pTempList;
853
854                 pRetList->RemoveAll();
855                 delete pRetList;
856                 return null;
857         }
858
859         pTempList->Add(*(new (std::nothrow) String(MUSIC)));
860         pTempList->Add(*(new (std::nothrow) Integer(startIndex)));
861         pTempList->Add(*(pRetList));
862
863         AppLogDebug("EXIT");
864         return pTempList;
865 }
866
867 void
868 ArtistContentListForm::OnAppControlCompleteResponseReceived(const AppId& appId,
869                 const String& operationId, AppCtrlResult appControlResult,
870                 const IMap* pExtraData)
871 {
872         AppLogDebug("ENTER");
873         if (pExtraData == null)
874         {
875                 AppLogDebug("EXIT");
876                 return;
877         }
878
879         AppLogDebug("%ls, %ls", appId.GetPointer(), operationId.GetPointer());
880         if (appId.Equals(String(PROVIDER_ID_CONTACT)))
881         {
882                 if (appControlResult == APP_CTRL_RESULT_SUCCEEDED)
883                 {
884                         int contactId = -1;
885                         String* pKey = null;
886                         ArrayList* pArrayListValue = null;
887                         String* pResultString = null;
888                         if (pExtraData != null)
889                         {
890                                 IMapEnumerator* pEnum = pExtraData->GetMapEnumeratorN();
891                                 while (pEnum->MoveNext() == E_SUCCESS)
892                                 {
893                                         pKey = static_cast<String*>(pEnum->GetKey());
894                                         if (pKey->Equals(APPCONTROL_KEY_SOCIAL_ITEM_ID, true))
895                                         {
896                                                 pArrayListValue = static_cast<ArrayList*>(pEnum->GetValue());
897                                                 pResultString = static_cast<String*>(pArrayListValue->GetAt(0));
898                                                 AppLogDebug("extraData : %ls:%ls", pKey->GetPointer(), pResultString->GetPointer());
899                                                 Integer::Parse(*pResultString, contactId);
900                                                 break;
901                                         }
902                                 }
903                                 delete pEnum;
904
905                                 if (contactId < 0)
906                                 {
907                                         AppLogDebug("pKey is invaild");
908                                         return;
909                                 }
910                         }
911                         else
912                         {
913                                 AppLogDebug("pExtraData is null");
914                                 return;
915                         }
916
917                         AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
918                         Addressbook* pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
919
920                         ContentInformation* pCcontentInfo = GetContentInformationActivatedStateContextItem();
921                         if (pCcontentInfo == null)
922                         {
923                                 delete pAddressbook;
924                                 pAddressbook = null;
925                                 return;
926                         }
927
928                         Contact* pContact = pAddressbook->GetContactN(contactId);
929                         pContact->SetValue(CONTACT_PROPERTY_ID_RINGTONE, pCcontentInfo->ContentFilePath);
930                         result r = pAddressbook->UpdateContact(*pContact);
931
932                         if (r == E_SUCCESS)
933                         {
934                                 ShowDelayedMessageBox(ResourceManager::GetString(L"IDS_COM_POP_SUCCESS"));
935                         }
936
937                         delete pCcontentInfo;
938                         pCcontentInfo = null;
939
940                         delete pContact;
941                         pContact = null;
942
943                         delete pAddressbook;
944                         pAddressbook = null;
945                 }
946         }
947         AppLogDebug("EXIT");
948 }
949
950 result
951 ArtistContentListForm::AddCheckedItem(int groupIndex, int itemIndex)
952 {
953         AppLogDebug("ENTER");
954         bool isFind = false;
955         __pCheckedItemCountMultiHashMap->Contains(groupIndex, itemIndex, isFind);
956         if (isFind == true)
957         {
958                 AppLogDebug("This item Already Set (groupIndex:%d, itemIndex:%d)", groupIndex, itemIndex);
959                 return E_ALREADY_SET;
960         }
961         AppLogDebug("EXIT");
962         return __pCheckedItemCountMultiHashMap->Add(groupIndex, itemIndex);
963 }
964
965 result
966 ArtistContentListForm::RemoveCheckedItem(int groupIndex, int itemIndex)
967 {
968         AppLogDebug("ENTER");
969         bool isFind = false;
970         __pCheckedItemCountMultiHashMap->Contains(groupIndex, itemIndex, isFind);
971         if (isFind == false)
972         {
973                 AppLogDebug("This item not found(groupIndex:%d, itemIndex:%d)", groupIndex, itemIndex);
974                 return E_DATA_NOT_FOUND;
975         }
976         AppLogDebug("EXIT");
977         return __pCheckedItemCountMultiHashMap->Remove(groupIndex, itemIndex);
978 }
979
980 result
981 ArtistContentListForm::SetItemChecked(int groupIndex, int itemIndex, bool check)
982 {
983         AppLogDebug("ENTER");
984         result r = E_FAILURE;
985         if (check == true)
986         {
987                 r = AddCheckedItem(groupIndex, itemIndex);
988         }
989         else
990         {
991                 r = RemoveCheckedItem(groupIndex, itemIndex);
992         }
993         AppLogDebug("EXIT");
994         return r;
995 }
996
997 int
998 ArtistContentListForm::GetCheckedItemCountAt(int groupIndex)
999 {
1000         AppLogDebug("ENTER");
1001         int itemCount = 0;
1002         __pCheckedItemCountMultiHashMap->GetCount(groupIndex, itemCount);
1003         AppLogDebug("EXIT");
1004         return itemCount;
1005 }
1006
1007 int
1008 ArtistContentListForm::GetTotalItemCount(void)
1009 {
1010         AppLogDebug("ENTER");
1011         int totalItemCount = 0;
1012         int groupCount = __pContentGroupedTableView->GetGroupCount();
1013         for (int iCount = 0; iCount < groupCount; iCount++)
1014         {
1015                 totalItemCount = totalItemCount + __pContentGroupedTableView->GetItemCountAt(iCount);
1016         }
1017         AppLogDebug("EXIT");
1018         return totalItemCount;
1019 }
1020
1021 int
1022 ArtistContentListForm::GetCheckedItemCount(void)
1023 {
1024         AppLogDebug("ENTER");
1025         AppLogDebug("EXIT");
1026         return __pCheckedItemCountMultiHashMap->GetCount();
1027 }
1028
1029 void
1030 ArtistContentListForm::SetItemCheckedAt(int groupIndex, bool check)
1031 {
1032         AppLogDebug("ENTER");
1033         int groupItemCount = __pContentGroupedTableView->GetItemCountAt(groupIndex);
1034         if (check == true)
1035         {
1036                 groupItemCount = __pContentGroupedTableView->GetItemCountAt(groupIndex);
1037                 for (int iCount= 0; iCount < groupItemCount; iCount++)
1038                 {
1039                         __pContentGroupedTableView->SetItemChecked(groupIndex, iCount, check);
1040                         SetItemChecked(groupIndex, iCount, check);
1041                 }
1042         }
1043         else
1044         {
1045                 __pCheckedItemCountMultiHashMap->Remove(groupIndex);
1046                 for (int iCount= 0; iCount < groupItemCount; iCount++)
1047                 {
1048                         __pContentGroupedTableView->SetItemChecked(groupIndex, iCount, check);
1049                 }
1050         }
1051         AppLogDebug("EXIT");
1052 }
1053
1054 void
1055 ArtistContentListForm::SetItemCheckedAll(bool isChecked)
1056 {
1057         AppLogDebug("ENTER");
1058         int groupCount = __pContentGroupedTableView->GetGroupCount();
1059         for (int iCount= 0; iCount < groupCount; iCount++)
1060         {
1061                 SetItemCheckedAt(iCount, isChecked);
1062         }
1063
1064         if (GetFooter() != null)
1065         {
1066                 CommonUtil::SetFooterItemEnabled(*GetFooter(), isChecked);
1067         }
1068
1069         SetCheckedCountBallonTooltip(GetCheckedItemCount());
1070         __pContentGroupedTableView->Invalidate(true);
1071         AppLogDebug("EXIT");
1072 }
1073
1074 void
1075 ArtistContentListForm::UpdateTableView(void)
1076 {
1077         AppLogDebug("ENTER");
1078         __pContentGroupedTableView->UpdateTableView();
1079         AppLogDebug("EXIT");
1080 }
1081
1082 void
1083 ArtistContentListForm::UpdateContentList(void)
1084 {
1085         AppLogDebug("ENTER");
1086         __pPresentationModel->UpdateArtistList();
1087         __pPresentationModel->InitializeArtistAlbumList(__artistName);
1088         __pPresentationModel->InitializeContentList(INIT_VALUE);
1089
1090         if (__pPresentationModel->GetArtistAlbumListCount() == 0)
1091         {
1092                 __headerTitle = L"";
1093                 SceneManager* pSceneManager = SceneManager::GetInstance();
1094                 AppAssert(pSceneManager);
1095                 SetScreenState(SCREEN_STATE_NORMAL);
1096                 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_DESTROY_OPTION_KEEP));
1097
1098         }
1099         else
1100         {
1101                 __headerTitle = __artistName;
1102         }
1103
1104         if (GetScreenState() == SCREEN_STATE_NORMAL)
1105         {
1106                 SetHeader();
1107         }
1108
1109
1110         UpdateTableView();
1111         AppLogDebug("EXIT");
1112 }
1113
1114 ContentInformation*
1115 ArtistContentListForm::GetContentInformationActivatedStateContextItem(void)
1116 {
1117         AppLogDebug("ENTER");
1118         if (__pPresentationModel->GetCurrentArtistAlbumIndex() != __activatedStateContextItem.__groupIndex)
1119         {
1120                 __pPresentationModel->InitializeContentList(__activatedStateContextItem.__groupIndex);
1121         }
1122
1123         AppLogDebug("EXIT");
1124         return __pPresentationModel->GetArtistAlbumContentInfoN(__activatedStateContextItem.__itemIndex);
1125 }
1126
1127 result
1128 ArtistContentListForm::EventHandlerContextMenuItemCaller(void)
1129 {
1130         AppLogDebug("ENTER");
1131         AppControl* pAppControl = AppManager::FindAppControlN(PROVIDER_ID_CONTACT, OPERATION_ID_SOCIAL_PICK);
1132         if (pAppControl == null)
1133         {
1134                 AppLogDebug("AppManager::FindAppControlN is null");
1135                 return E_FAILURE;
1136         }
1137
1138         HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1139         result r = pDataList->Construct();
1140         if (IsFailed(r))
1141         {
1142                 AppLogDebug("pDataList->Construct() failed(%s)", GetErrorMessage(r));
1143                 delete pDataList;
1144                 return r;
1145         }
1146         pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SELECTION_MODE), new (std::nothrow) String(APPCONTROL_OPTION_SINGLE));
1147         pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SOCIAL_ITEM_TYPE), new (std::nothrow) String(APPCONTROL_OPTION_PERSON));
1148         pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SOCIAL_RESULT_TYPE), new (std::nothrow) String(APPCONTROL_OPTION_ITEM_ID));
1149
1150         r = pAppControl->Start(null, null, pDataList, this);
1151         if (r == E_SUCCESS)
1152         {
1153                 Frame* pFrame = MusicPlayerApp::GetInstance()->GetFrameAt(0);
1154                 AppAssert(pFrame);
1155                 pFrame->SetEnabled(false);
1156         }
1157         else
1158         {
1159                 AppLogDebug("AppControl Start fail");
1160         }
1161
1162         pDataList->RemoveAll(true);
1163         delete pDataList;
1164         pDataList = null;
1165
1166         delete pAppControl;
1167         pAppControl = null;
1168
1169         AppLogDebug("EXIT");
1170         return E_SUCCESS;
1171 }
1172
1173 result
1174 ArtistContentListForm::EventHandlerContextMenuItemCall(ContentInformation& contentInfo)
1175 {
1176         AppLogDebug("ENTER");
1177         result r = SettingInfo::SetValue(CALL_RINGTONE_KEY, contentInfo.ContentFilePath);
1178         if (IsFailed(r))
1179         {
1180                 AppLogDebug("SettingInfo::SetValue failed(%s)", GetErrorMessage(r));
1181                 return r;
1182         }
1183
1184         MessageBox messageBox;
1185         messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_SUCCESS"),
1186                                                 MSGBOX_STYLE_OK,
1187                                                 COUNT_MESSAGE_BOX_TIMEOUT);
1188         int modalResult = 0;
1189         messageBox.ShowAndWait(modalResult);
1190
1191         AppLogDebug("EXIT");
1192         return r;
1193 }
1194
1195 result
1196 ArtistContentListForm::EventHandlerContextMenuItemMessageEmail(ContentInformation& contentInfo, Tizen::Base::String providerId)
1197 {
1198         AppLogDebug("ENTER");
1199         result r = E_FAILURE;
1200         if (!providerId.Equals(PROVIDER_ID_EMAIL, false) && !providerId.Equals(PROVIDER_ID_MESSAGE, false))
1201         {
1202                 AppLogDebug("worng providerId(%s)", providerId.GetPointer());
1203                 return E_FAILURE;
1204         }
1205
1206         AppControl* pAppControl = AppManager::FindAppControlN(providerId, OPERATION_ID_COMPOSE);
1207         if (pAppControl == null)
1208         {
1209                 AppLogDebug("AppManager::FindAppControlN is null");
1210                 return E_FAILURE;
1211         }
1212
1213         HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1214         pDataList->Construct();
1215
1216         Tizen::Base::Collection::ArrayList* pValueList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1217         pValueList->Construct();
1218         pValueList->Add(*(new (std::nothrow) String(contentInfo.ContentFilePath)));
1219
1220         pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), pValueList);
1221
1222         r = pAppControl->Start(null, null, pDataList, this);
1223         if (r == E_SUCCESS)
1224         {
1225                 Frame* pFrame = MusicPlayerApp::GetInstance()->GetFrameAt(0);
1226                 AppAssert(pFrame);
1227                 pFrame->SetEnabled(false);
1228         }
1229         else
1230         {
1231                 AppLogDebug("AppControl Start fail");
1232         }
1233
1234         pDataList->RemoveAll(true);
1235         delete pDataList;
1236         pDataList = null;
1237
1238         delete pAppControl;
1239         pAppControl = null;
1240
1241         AppLogDebug("EXIT");
1242         return E_SUCCESS;
1243 }
1244
1245 result
1246 ArtistContentListForm::RemoveConentCheckedAll(void)
1247 {
1248         AppLogDebug("ENTER");
1249         IMapEnumeratorT< int, int >* pMapEnum = __pCheckedItemCountMultiHashMap->GetMapEnumeratorN();
1250         while (pMapEnum->MoveNext() == E_SUCCESS)
1251         {
1252                 int key = 0;
1253                 int value = 0;
1254                 pMapEnum->GetKey(key);
1255                 pMapEnum->GetValue(value);
1256
1257                 if (__pPresentationModel->GetCurrentArtistAlbumIndex() != key)
1258                 {
1259                         __pPresentationModel->InitializeContentList(key);
1260                 }
1261
1262                 ContentInformation* pContentInfo = __pPresentationModel->GetArtistAlbumContentInfoN(value);
1263                 if (pContentInfo != null)
1264                 {
1265                         RemoveContentAt(pContentInfo->contentId);
1266                         delete pContentInfo;
1267                 }
1268         }
1269         delete pMapEnum;
1270 //
1271 //      SetItemCheckedAll(false);
1272 //
1273 //      __pPresentationModel->InitializeArtistAlbumList(__headerTitle);
1274 //      __pPresentationModel->InitializeContentList(INIT_VALUE);
1275
1276         AppLogDebug("EXIT");
1277         return E_SUCCESS;
1278 }
1279
1280 Tizen::Base::Collection::IList*
1281 ArtistContentListForm::GetPickerArgumentListN(PickerType pickerType, PickerArgumentType argumentType)
1282 {
1283         AppLogDebug("ENTER");
1284         ArrayList* pContentFilePathList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1285         if (IsFailed(pContentFilePathList->Construct()))
1286         {
1287                 AppLogDebug("pContentFilePathList->Construct() failed(%s)", GetErrorMessage(GetLastResult()));
1288                 return null;
1289         }
1290
1291         if (argumentType == PICKER_ARGUMENT_TYPE_ACTIVATED_STATE_CONTEXT_ITEM)
1292         {
1293                 ContentInformation* pContentInfo = GetContentInformationActivatedStateContextItem();
1294                 if (pContentInfo != null)
1295                 {
1296                         pContentFilePathList->Add(*(new (std::nothrow) String(pContentInfo->ContentFilePath)));
1297                         delete pContentInfo;
1298                 }
1299                 AppLogDebug("EXIT");
1300                 return pContentFilePathList;
1301         }
1302
1303         int key = 0;
1304         int value = 0;
1305
1306         IMapEnumeratorT<int, int>* pMapEnum = __pCheckedItemCountMultiHashMap->GetMapEnumeratorN();
1307         while (pMapEnum->MoveNext() == E_SUCCESS)
1308         {
1309                 pMapEnum->GetKey(key);
1310                 pMapEnum->GetValue(value);
1311
1312 #if 1
1313                 if (__pPresentationModel->GetCurrentArtistAlbumIndex() != key)
1314                 {
1315                         __pPresentationModel->InitializeContentList(key);
1316                 }
1317
1318                 ContentInformation* pContentInfo = __pPresentationModel->GetArtistAlbumContentInfoN(value);
1319 #else
1320                 int offset = GetOffsetContentIndex(iCount);
1321                 ContentInformation* pContentInfo = __pPresentationModel->GetArtistContentInfoN(offset + value);
1322 #endif
1323                 if (pContentInfo == null)
1324                 {
1325                         AppLogDebug("__pPresentationModel->GetArtistAlbumContentInfoN(%d) is null", value);
1326                         delete pContentFilePathList;
1327                         return null;
1328                 }
1329
1330                 if (pickerType == PICKER_TYPE_SHARE_PICKER)
1331                 {
1332                         pContentFilePathList->Add(*(new (std::nothrow) String(pContentInfo->ContentFilePath)));
1333                 }
1334                 else if (pickerType == PICKER_TYPE_PLAY_LIST_PICKER)
1335                 {
1336                         pContentFilePathList->Add(new (std::nothrow) String(pContentInfo->ContentFilePath));
1337                 }
1338                 delete pContentInfo;
1339         }
1340         delete pMapEnum;
1341
1342         AppLogDebug("EXIT");
1343         return pContentFilePathList;
1344 }
1345
1346 void
1347 ArtistContentListForm::SetItemCheckedStateChanged(Tizen::Ui::Controls::TableViewItemStatus status, int groupIndex, int itemIndex)
1348 {
1349         AppLogDebug("ENTER");
1350         if (status == TABLE_VIEW_ITEM_STATUS_CHECKED)
1351         {
1352                 SetItemChecked(groupIndex, itemIndex, true);
1353                 if (GetCheckedItemCount() == 1)
1354                 {
1355                         if (GetFooter() != null)
1356                         {
1357                                 CommonUtil::SetFooterItemEnabled(*GetFooter(), true);
1358                         }
1359                 }
1360         }
1361         else if (status == TABLE_VIEW_ITEM_STATUS_UNCHECKED)
1362         {
1363                 SetItemChecked(groupIndex, itemIndex, false);
1364                 if (GetCheckedItemCount() == 0)
1365                 {
1366                         if (GetFooter() != null)
1367                         {
1368                                 CommonUtil::SetFooterItemEnabled(*GetFooter(), false);
1369                         }
1370                 }
1371         }
1372         SetCheckedCountBallonTooltip(GetCheckedItemCount());
1373         AppLogDebug("EXIT");
1374 }
1375
1376 int
1377 ArtistContentListForm::GetOffsetContentIndex(const int groupIndex)
1378 {
1379         AppLogDebug("ENTER");
1380         if (__pContentGroupedTableView == null)
1381         {
1382                 AppLogDebug("__pContentGroupedTableView is null");
1383                 return INIT_VALUE;
1384         }
1385
1386         int contentIndex = INIT_VALUE;
1387         for (int iCount = 0; iCount < groupIndex; iCount++)
1388         {
1389                 contentIndex = contentIndex + __pContentGroupedTableView->GetItemCountAt(iCount);
1390         }
1391
1392         AppLogDebug("EXIT");
1393         return contentIndex;
1394 }
1395
1396 void
1397 ArtistContentListForm::OnFontSizeChanged(void)
1398 {
1399         __fontSizeValue = CommonUtil::GetFontSizeValue();
1400         __itemHeight = CommonUtil::GetItemHeight(__fontSizeValue);
1401         __pContentGroupedTableView->UpdateTableView();
1402 }