2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file MpFolderContentListForm.cpp
19 * @brief This is the implementation file for FolderContentListForm class.
23 #include "MpFolderContentListForm.h"
24 #include "MpFolderListPresentationModel.h"
25 #include "MpMusicPlayerApp.h"
26 #include "MpPlaylistPickerPopup.h"
27 #include "MpSharePopup.h"
28 #include "MpThumbnailInfo.h"
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::Graphics;
35 using namespace Tizen::Io;
36 using namespace Tizen::Social;
37 using namespace Tizen::System;
38 using namespace Tizen::Ui;
39 using namespace Tizen::Ui::Controls;
40 using namespace Tizen::Ui::Scenes;
42 static const int COUNT_MESSAGE_BOX_TIMEOUT = 3000;
44 FolderContentListForm::FolderContentListForm(void)
45 : ContentListForm::ContentListForm()
46 , ThumbnailBase::ThumbnailBase()
47 , __pTableViewContextItem(null)
49 , __pPresentationModel(null)
50 , __checkedItemCount(0)
51 , __currentFolderIndex(0)
52 , __activatedStateContextItem(0)
58 FolderContentListForm::~FolderContentListForm(void)
65 FolderContentListForm::Initialize(void)
68 if (IsFailed(Form::Construct(IDL_CONTENT_LIST_FORM)))
70 AppLogDebug("Construct(IDL_CONTENT_LIST_FORM) failed(%s)", GetErrorMessage(GetLastResult()));
79 FolderContentListForm::Construct(void)
82 __pContentListTableView = static_cast<TableView*>(GetControl(IDC_TABLEVIEW_CONTENT_LIST));
83 __pContentListTableView->AddTableViewItemEventListener(*this);
84 __pContentListTableView->SetItemProvider(this);
86 SetContentList(__pContentListTableView);
88 return ContentListForm::Construct();
92 FolderContentListForm::OnInitializing(void)
96 __pTableViewContextItem = CommonUtil::CreateTableViewContextItemN(*this, GetWidth(), FLICK_MENU_STYLE_TYPE_01);
98 return ThumbnailBase::Construct();
102 FolderContentListForm::OnTerminating(void)
104 AppLogDebug("ENTER");
105 ThumbnailBase::Stop();
106 __pPresentationModel = null;
107 delete __pTableViewContextItem;
108 __pTableViewContextItem = null;
110 return ContentListForm::OnTerminating();
114 FolderContentListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
115 const Tizen::Ui::Scenes::SceneId& currentSceneId,
116 Tizen::Base::Collection::IList* pArgs)
118 AppLogDebug("ENTER");
121 __prevSceneId.Append(*static_cast<String*>(pArgs->GetAt(DATA_ITEM_SCENE_NAME)));
122 __currentFolderIndex = static_cast<Integer*>(pArgs->GetAt(DATA_ITEM_CONTENT_TYPE))->ToInt();
123 String* pStrContentPath = static_cast<String*>(pArgs->GetAt(DATA_ITEM_CONTENT_NAME));
125 __pPresentationModel = FolderListPresentationModel::GetInstance();
126 __pPresentationModel->UpdateFolderPathList();
127 __pPresentationModel->InitializeContentList(__currentFolderIndex);
129 int position = INIT_VALUE;
130 pStrContentPath->LastIndexOf(IDS_SEPARATOR_SLASH, pStrContentPath->GetLength() - 1, position);
131 pStrContentPath->SubString(position + 1, __headerTitle);
133 String ellipisiPath = CommonUtil::SetHighDepthToEllipsisPath(*pStrContentPath);
134 Rectangle rect(INIT_VALUE, INIT_VALUE, GetWidth(), 42);
136 Label* pAdditionalInfo = new (std::nothrow) Label();
137 if (!IsFailed(pAdditionalInfo->Construct(rect, ellipisiPath)))
139 pAdditionalInfo->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
140 pAdditionalInfo->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
141 pAdditionalInfo->SetTextConfig(32, LABEL_TEXT_STYLE_BOLD);
142 pAdditionalInfo->SetTextColor(COLOR_ITEM_SUB_TEXT);
144 SetExtraInformaionArea(*pAdditionalInfo);
151 pArgs->RemoveAll(true);
158 FolderContentListForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
159 const Tizen::Ui::Scenes::SceneId& nextSceneId)
161 AppLogDebug("ENTER");
162 CancelAllThumbnailRequest();
167 FolderContentListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
169 AppLogDebug("ENTER");
170 SceneManager* pSceneManager = SceneManager::GetInstance();
171 AppAssert(pSceneManager);
175 case IDA_CONTEXT_MENU_ITEM_GO_TO_LIBARY:
177 IListT<SceneId>* pSceneIdList = pSceneManager->GetSceneHistoryN();
178 if (pSceneIdList == null)
180 AppLogDebug("EXIT(ScenList is null)");
181 pSceneManager->GoBackward(BackwardSceneTransition());
185 pSceneManager->ClearSceneHistory();
187 IEnumeratorT<SceneId>* pIEnum = pSceneIdList->GetEnumeratorN();
188 while (pIEnum->MoveNext() == E_SUCCESS)
191 pIEnum->GetCurrent(sceneID);
192 if (!__prevSceneId.Equals(sceneID, false))
194 pSceneManager->AddToSceneHistory(sceneID);
198 pSceneManager->DestroyScene(sceneID);
202 pSceneManager->GoBackward(BackwardSceneTransition());
206 case IDA_CONTEXT_MENU_ITEM_SEARCH:
208 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SEARCH, SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_HISTORY_OPTION_NO_HISTORY));
212 case IDA_CONTEXT_MENU_ITEM_EDIT:
214 ToggleScreenState(SCREEN_STATE_EDITOR);
218 case IDA_FOOTER_BUTTON_MORE:
220 Point anchorPoint(X_POINT_FOOTER_MORE, Y_POINT_PORTRAIT_FOOTER_MORE);
221 if ((GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE) || (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE))
223 anchorPoint.y = Y_POINT_LANDSCAPE_FOOTER_MORE;
225 CreateContextMenuN(source);
226 SetContextMenuItem(CONTEXT_MENU_ITEM_STYLE_GO_TO_LIBARY | CONTEXT_MENU_ITEM_STYLE_EDIT, anchorPoint);
230 case IDA_HEADER_BUTTON_SELECTE_ALL:
232 bool isChecked = true;
233 if (__checkedItemCount == __pContentListTableView->GetItemCount())
237 SetItemCheckedAll(isChecked);
241 case IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST:
243 LanucherPicker(PICKER_TYPE_PLAY_LIST_PICKER);
247 case IDA_FLICK_MENU_ITEM_SHARE:
249 CreateContextMenuN(source);
250 SetContextMenuItem(CONTEXT_MENU_ITEM_STYLE_EMAIL);
254 case IDA_FLICK_MENU_ITEM_SET_AS:
256 CreateContextMenuN(source);
257 SetContextMenuItem(CONTEXT_MENU_ITEM_STYLE_CALL | CONTEXT_MENU_ITEM_STYLE_CALLER);
261 case IDA_FLICK_MENU_ITEM_DELETE:
263 SetCommonPopup(CommonUtil::CreateContentDeletePopup(*this, IDA_COMMON_POPUP_DELETE, IDA_COMMON_POPUP_CANCEL));
267 case IDA_COMMON_POPUP_CANCEL:
273 case IDA_FLICK_MENU_ITEM_ADDTO:
275 LanucherPicker(PICKER_TYPE_PLAY_LIST_PICKER, PICKER_ARGUMENT_TYPE_ACTIVATED_STATE_CONTEXT_ITEM);
279 case IDA_COMMON_POPUP_DELETE:
281 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(__activatedStateContextItem);
282 if (pContentInfo != null)
284 RemoveContentAt(pContentInfo->contentId);
285 __pPresentationModel->RefreshContentList(__currentFolderIndex);
286 __pContentListTableView->RefreshItem(__activatedStateContextItem, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
292 case IDA_CONTEXT_MENU_ITEM_EMAIL:
294 case IDA_CONTEXT_MENU_ITEM_MESSAGE:
296 String providerID = ((actionId == IDA_CONTEXT_MENU_ITEM_EMAIL) ? PROVIDER_ID_EMAIL : PROVIDER_ID_MESSAGE);
297 AppControl* pAppControl = AppManager::FindAppControlN(providerID, OPERATION_ID_COMPOSE);
298 if (pAppControl == null)
300 AppLogDebug("AppManager::FindAppControlN is null");
304 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(__activatedStateContextItem);
305 if (pContentInfo == null)
307 AppLogDebug("PresentationModel->GetContentInfoN is null");
311 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
312 pDataList->Construct();
314 Tizen::Base::Collection::ArrayList* pValueList = new (std::nothrow) ArrayList(SingleObjectDeleter);
315 pValueList->Construct();
316 pValueList->Add(*(new (std::nothrow) String(pContentInfo->ContentFilePath)));
318 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), pValueList);
321 pAppControl->Start(null, null, pDataList, this);
323 Frame* pFrame = MusicPlayerApp::GetInstance()->GetFrameAt(0);
325 pFrame->SetEnabled(false);
331 case IDA_CONTEXT_MENU_ITEM_CALL:
333 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(__activatedStateContextItem);
334 if (pContentInfo == null)
336 AppLogDebug("PresentationModel->GetContentInfoN is null");
340 if (!IsFailed(SettingInfo::SetValue(CALL_RINGTONE_KEY, pContentInfo->ContentFilePath)))
342 MessageBox messageBox;
343 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_SUCCESS"),
345 COUNT_MESSAGE_BOX_TIMEOUT);
347 messageBox.ShowAndWait(modalResult);
353 case IDA_CONTEXT_MENU_ITEM_CALLER:
355 AppControl* pAppControl = AppManager::FindAppControlN(PROVIDER_ID_CONTACT, OPERATION_ID_SOCIAL_PICK);
356 if (pAppControl == null)
358 AppLogDebug("AppManager::FindAppControlN is null");
362 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
363 pDataList->Construct();
364 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SELECTION_MODE), new (std::nothrow) String(APPCONTROL_OPTION_SINGLE));
365 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SOCIAL_ITEM_TYPE), new (std::nothrow) String(APPCONTROL_OPTION_PERSON));
366 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SOCIAL_RESULT_TYPE), new (std::nothrow) String(APPCONTROL_OPTION_ITEM_ID));
368 pAppControl->Start(null, null, pDataList, this);
373 case IDA_FOOTER_BUTTON_DELETE:
375 RemoveCheckedTableviewItem(true);
383 TryRemoveContextMenu(actionId);
384 TryRemoveCommonPopup(actionId);
389 FolderContentListForm::GetItemCount(void)
391 AppLogDebug("ENTER");
393 return __pPresentationModel->GetContentCount(__currentFolderIndex);
396 Tizen::Ui::Controls::TableViewItem*
397 FolderContentListForm::CreateItem(const int itemIndex, int itemWidth)
399 AppLogDebug("ENTER");
400 RelativeLayout layout;
403 TableViewAnnexStyle tableViewAnnexStyle = TABLE_VIEW_ANNEX_STYLE_NORMAL;
404 if (GetScreenState() != SCREEN_STATE_NORMAL)
406 tableViewAnnexStyle = TABLE_VIEW_ANNEX_STYLE_MARK;
409 TableViewItem* pItem = new (std::nothrow) TableViewItem();
410 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(itemIndex);
412 result r = pItem->Construct(layout, Dimension(itemWidth, ITEM_HEIGHT), tableViewAnnexStyle);
413 TryCatch(r == E_SUCCESS, delete pItem, "pItem->Construct(%s)", GetErrorMessage(r));
414 TryCatch(pContentInfo != null, delete pItem, "pContentInfo is null", GetErrorMessage(GetLastResult()));
416 r = CreateTableViewItem(*pItem, *pContentInfo);
417 TryCatch(r == E_SUCCESS, delete pItem, "CreateTableViewItem failed(%s)", GetErrorMessage(r));
419 RequestThumbnail(pContentInfo->contentId, (new (std::nothrow) Integer(itemIndex)));
426 AppLogDebug("EXIT(%ls)", GetErrorMessage(GetLastResult()));
432 FolderContentListForm::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView,
434 Tizen::Ui::Controls::TableViewItem* pItem,
435 Tizen::Ui::Controls::TableViewItemStatus status)
437 AppLogDebug("ENTER");
438 if (GetScreenState() != SCREEN_STATE_NORMAL)
440 SetItemCheckedStateChanged(status);
445 if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
447 SceneManager* pSceneManager = SceneManager::GetInstance();
448 AppAssert(pSceneManager);
450 ArrayList* pSceneArg = MakePlayerSceneParam(itemIndex);
451 if (pSceneArg != null)
453 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_PLAYER), pSceneArg);
460 FolderContentListForm::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex,
461 Tizen::Ui::Controls::TableViewContextItem* pContextItem,
464 AppLogDebug("ENTER");
467 AppLogDebug("INDEX %d", itemIndex);
468 __activatedStateContextItem = itemIndex;
474 FolderContentListForm::GetDefaultItemHeight(void)
476 AppLogDebug("ENTER");
482 FolderContentListForm::DeleteItem(const int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
484 AppLogDebug("ENTER");
490 FolderContentListForm::OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView,
494 AppLogDebug("ENTER");
498 Tizen::Base::Collection::ArrayList*
499 FolderContentListForm::MakePlayerSceneParam(int startIndex)
501 AppLogDebug("ENTER");
502 ArrayList* pSelectedMusicContent = __pPresentationModel->GetContentPathListN(__currentFolderIndex);
503 if (pSelectedMusicContent == null)
509 ArrayList* pTempList = new (std::nothrow) ArrayList();
510 pTempList->Construct();
511 pTempList->Add(*(new (std::nothrow) String(MUSIC)));
512 pTempList->Add(*(new (std::nothrow) Integer(startIndex)));
513 pTempList->Add(*(pSelectedMusicContent));
520 FolderContentListForm::CreateTableViewItem(Tizen::Ui::Controls::TableViewItem& parent, const ContentInformation& contentInfo)
522 AppLogDebug("ENTER");
523 Panel* pTableViewItem = new (std::nothrow) Panel();
524 if (GetScreenState() != SCREEN_STATE_NORMAL)
526 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_EDITOR_ITEM_PANEL)))
528 AppLogDebug("Construct(IDL_CONTENT_LIST_FOLDER_EDITOR_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
534 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_ITEM_PANEL)))
536 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
539 parent.SetContextItem(__pTableViewContextItem);
542 String filePath = contentInfo.ContentFilePath;
543 Bitmap* StorageIconBitmap = null;
546 String tempPath = contentInfo.ContentFilePath;
547 String fileName = null;
548 tempPath.LastIndexOf(L"/", tempPath.GetLength() - 1, indexOf);
549 tempPath.SubString(indexOf + 1, fileName);
551 if (filePath.Contains(IDS_STORAGE_PHONE_PATH))
553 StorageIconBitmap = ResourceManager::GetBitmapN(IDB_STORAGE_PHONE);
555 else if (filePath.Contains(IDS_STORAGE_SDCARD_PATH))
557 StorageIconBitmap = ResourceManager::GetBitmapN(IDB_STORAGE_SDCARD);
559 else if (filePath.Contains(IDS_STORAGE_EXTERNAL_PATH))
561 StorageIconBitmap = ResourceManager::GetBitmapN(IDB_STORAGE_EXTERNAL);
565 StorageIconBitmap = ResourceManager::GetBitmapN(IDB_STORAGE_PHONE);
568 Label* pFolderStorageIcon = static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENT_FOLDER_STORAGE_ICON));
569 pFolderStorageIcon->SetBackgroundBitmap(*StorageIconBitmap);
570 delete StorageIconBitmap;
572 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENT_TITLE_NAME))->SetText(fileName);
573 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENT_THUMBNAIL))->SetBackgroundBitmap(*GetDefaultThumbnail());
575 parent.AddControl(*pTableViewItem);
576 parent.SetIndividualSelectionEnabled(pTableViewItem, true);
578 CommonUtil::SetLayoutFitToContainer(parent, *pTableViewItem);
585 FolderContentListForm::IsEmptyContentList(void)
587 AppLogDebug("ENTER");
588 if (__pPresentationModel->GetContentCount(__currentFolderIndex) != INIT_VALUE)
597 FolderContentListForm::SetHeader(void)
599 AppLogDebug("ENTER");
600 CommonUtil::SetSimpleTitleStyle(*GetHeader(), __headerTitle);
606 FolderContentListForm::SetFooter(void)
608 AppLogDebug("ENTER");
609 CommonUtil::SetBackButtonStyleFooter(*GetFooter(), STYLE_MORE_ADD);
615 FolderContentListForm::OnAppControlCompleteResponseReceived(const AppId& appId,
616 const String& operationId, AppCtrlResult appControlResult,
617 const IMap* pExtraData)
619 AppLogDebug("ENTER");
620 if (pExtraData == null)
625 AppLogDebug("%ls, %ls", appId.GetPointer(), operationId.GetPointer());
626 if (appId.Equals(String(PROVIDER_ID_CONTACT)))
628 if (appControlResult == APP_CTRL_RESULT_SUCCEEDED)
632 ArrayList* pArrayListValue = null;
633 String* pResultString = null;
634 if (pExtraData != null)
636 IMapEnumerator* pEnum = pExtraData->GetMapEnumeratorN();
637 while (pEnum->MoveNext() == E_SUCCESS)
639 pKey = static_cast<String*>(pEnum->GetKey());
640 if (pKey->Equals(APPCONTROL_KEY_SOCIAL_ITEM_ID, true))
642 pArrayListValue = static_cast<ArrayList*>(pEnum->GetValue());
643 pResultString = static_cast<String*>(pArrayListValue->GetAt(0));
644 AppLogDebug("extraData : %ls:%ls", pKey->GetPointer(), pResultString->GetPointer());
645 Integer::Parse(*pResultString, contactId);
653 AppLogDebug("pKey is invaild");
659 AppLogDebug("pExtraData is null");
663 AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
664 Addressbook* pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
666 ContentInformation* pCcontentInfo = __pPresentationModel->GetContentInfoN(__activatedStateContextItem);
667 if (pCcontentInfo == null)
674 Contact* pContact = pAddressbook->GetContactN(contactId);
675 pContact->SetValue(CONTACT_PROPERTY_ID_RINGTONE, pCcontentInfo->ContentFilePath);
676 result r = pAddressbook->UpdateContact(*pContact);
680 MessageBox messageBox;
681 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_SUCCESS"),
683 COUNT_MESSAGE_BOX_TIMEOUT);
685 messageBox.ShowAndWait(modalResult);
688 delete pCcontentInfo;
689 pCcontentInfo = null;
702 FolderContentListForm::OnThumbnailInfoReveivedN(ThumbnailInfo* pThumbnailInfo)
704 AppLogDebug("ENTER");
705 __pThumbnail = pThumbnailInfo->GetBitmapN();
706 Object* pParam = pThumbnailInfo->GetUserParamN();
709 __pContentListTableView->RefreshItem((static_cast<Integer*>(pParam))->ToInt(), TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
713 delete pThumbnailInfo;
718 FolderContentListForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
720 AppLogDebug("ENTER");
721 ContentListForm::OnUserEventReceivedN(requestId, pArgs);
726 FolderContentListForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
728 AppLogDebug("ENTER");
729 Panel* pItemPanel = null;
730 if (GetScreenState() != SCREEN_STATE_NORMAL)
732 pItemPanel = static_cast<Panel*>(pItem->GetControl(IDL_CONTENT_LIST_FOLDER_EDITOR_ITEM_PANEL));
736 pItemPanel = static_cast<Panel*>(pItem->GetControl(IDL_CONTENT_LIST_FOLDER_ITEM_PANEL));
739 if (pItemPanel == null)
741 AppLogDebug("pItemPanel is null");
747 Label* pThumbnailLabel = static_cast<Label*>(pItemPanel->GetControl(IDC_CONTENT_THUMBNAIL));
748 if (__pThumbnail == null || pThumbnailLabel == null)
750 AppLogDebug("__pThumbnail or pThumbnailLabel is null");
755 pThumbnailLabel->SetBackgroundBitmap(*__pThumbnail);
758 pThumbnailLabel->Invalidate(true);
763 FolderContentListForm::GetCheckedItemCount(void)
765 AppLogDebug("ENTER");
767 return __checkedItemCount;
771 FolderContentListForm::UpdateTableView(void)
773 AppLogDebug("ENTER");
774 __pContentListTableView->UpdateTableView();
779 FolderContentListForm::UpdateContentList(void)
781 AppLogDebug("ENTER");
782 __pPresentationModel->UpdateFolderPathList();
783 __pPresentationModel->InitializeContentList(__currentFolderIndex);
788 FolderContentListForm::SetItemCheckedAll(bool isChecked)
790 AppLogDebug("ENTER");
791 if (isChecked == true)
793 __checkedItemCount = __pContentListTableView->GetItemCount();
797 __checkedItemCount = INIT_VALUE;
799 CommonUtil::SetItemCheckedAll(isChecked, *__pContentListTableView);
800 CommonUtil::SetFooterItemEnabled(*GetFooter(), isChecked);
801 SetCheckedCountBallonTooltip(GetCheckedItemCount());
806 FolderContentListForm::RemoveCheckedTableviewItem(bool itemRemove)
808 AppLogDebug("ENTER");
811 int totalCount = __pContentListTableView->GetItemCount();
812 for (int iCount = 0; iCount < totalCount; iCount++)
814 if (__pContentListTableView->IsItemChecked(iCount) == true)
816 __pContentListTableView->SetItemChecked(iCount, false);
817 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(iCount);
818 RemoveContentAt(pContentInfo->contentId);
825 SetItemCheckedAll(false);
831 FolderContentListForm::SetItemCheckedStateChanged(Tizen::Ui::Controls::TableViewItemStatus status)
833 AppLogDebug("ENTER");
834 if (status == TABLE_VIEW_ITEM_STATUS_UNCHECKED)
836 __checkedItemCount--;
837 if (__checkedItemCount == INIT_VALUE)
839 CommonUtil::SetFooterItemEnabled(*GetFooter(), false);
842 else if (status == TABLE_VIEW_ITEM_STATUS_CHECKED)
844 if (__checkedItemCount == INIT_VALUE)
846 CommonUtil::SetFooterItemEnabled(*GetFooter(), true);
849 __checkedItemCount++;
852 SetCheckedCountBallonTooltip(GetCheckedItemCount());
856 Tizen::Base::Collection::IList*
857 FolderContentListForm::GetPickerArgumentListN(PickerType pickerType, PickerArgumentType argumentType)
859 AppLogDebug("ENTER");
860 Tizen::Base::Collection::ArrayList* pContentFilePathList = new (std::nothrow) ArrayList(SingleObjectDeleter);
861 if (IsFailed(pContentFilePathList->Construct()))
863 AppLogDebug("pContentList->Construct failed(%s)", GetErrorMessage(GetLastResult()));
864 delete pContentFilePathList;
868 if (argumentType == PICKER_ARGUMENT_TYPE_ACTIVATED_STATE_CONTEXT_ITEM)
870 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(__activatedStateContextItem);
871 if (pContentInfo == null)
873 delete pContentFilePathList;
874 AppLogDebug("GetContentInfoN(%d) is null", __activatedStateContextItem);
878 pContentFilePathList->Add(*(new (std::nothrow) String(pContentInfo->ContentFilePath)));
881 else if (argumentType == PICKER_ARGUMENT_TYPE_CHECKED_ITEM_ALL)
883 int totalCount = __pContentListTableView->GetItemCount();
884 for (int iCount = 0; iCount < totalCount; iCount++)
886 if (__pContentListTableView->IsItemChecked(iCount) == true)
888 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(iCount);
889 if (pContentInfo == null)
891 AppLogDebug("GetContentInfoN(%d) is null", iCount);
892 delete pContentFilePathList;
896 if (pickerType == PICKER_TYPE_PLAY_LIST_PICKER)
898 pContentFilePathList->Add(*(new (std::nothrow) String(pContentInfo->ContentFilePath)));
900 else if (pickerType == PICKER_TYPE_SHARE_PICKER)
902 pContentFilePathList->Add(*(new (std::nothrow) String(L"attachment:" + pContentInfo->ContentFilePath)));
909 return pContentFilePathList;