2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file 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 FolderContentListForm::FolderContentListForm(void)
43 : ContentListForm::ContentListForm()
44 , ThumbnailBase::ThumbnailBase()
45 , __pTableViewContextItem(null)
47 , __pCurrentFolderPath(null)
48 , __pPresentationModel(null)
49 , __checkedItemCount(0)
50 , __currentFolderIndex(0)
51 , __activatedStateContextItem(0)
57 FolderContentListForm::~FolderContentListForm(void)
64 FolderContentListForm::Initialize(void)
67 if (IsFailed(Form::Construct(IDL_CONTENT_LIST_FORM)))
69 AppLogDebug("Construct(IDL_CONTENT_LIST_FORM) failed(%s)", GetErrorMessage(GetLastResult()));
78 FolderContentListForm::Construct(void)
81 __pContentListTableView = static_cast<TableView*>(GetControl(IDC_TABLEVIEW_CONTENT_LIST));
82 __pContentListTableView->AddTableViewItemEventListener(*this);
83 __pContentListTableView->SetItemProvider(this);
85 SetContentList(__pContentListTableView);
87 return ContentListForm::Construct();
91 FolderContentListForm::OnInitializing(void)
94 __pTableViewContextItem = CommonUtil::CreateTableViewContextItemN(*this, GetWidth(), FLICK_MENU_STYLE_TYPE_01);
95 __fontSizeValue = CommonUtil::GetFontSizeValue();
96 __itemHeight = CommonUtil::GetItemHeight(__fontSizeValue);
99 return ThumbnailBase::Construct();
103 FolderContentListForm::OnTerminating(void)
105 AppLogDebug("ENTER");
106 ThumbnailBase::Stop();
107 __pPresentationModel = null;
108 delete __pTableViewContextItem;
109 __pTableViewContextItem = null;
111 delete __pCurrentFolderPath;
112 __pCurrentFolderPath = null;
114 return ContentListForm::OnTerminating();
118 FolderContentListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
119 const Tizen::Ui::Scenes::SceneId& currentSceneId,
120 Tizen::Base::Collection::IList* pArgs)
122 AppLogDebug("ENTER");
125 if (previousSceneId.Equals(IDSCN_PLAYLIST_CREATOR, false))
127 SetItemCheckedAll(false);
131 __prevSceneId.Clear();
132 __prevSceneId.Append(*static_cast<String*>(pArgs->GetAt(DATA_ITEM_SCENE_NAME)));
133 __currentFolderIndex = static_cast<Integer*>(pArgs->GetAt(DATA_ITEM_CONTENT_TYPE))->ToInt();
134 __pCurrentFolderPath = new (std::nothrow) String(*(static_cast<String*>(pArgs->GetAt(DATA_ITEM_CONTENT_NAME))));
136 __pPresentationModel = FolderListPresentationModel::GetInstance();
137 __pPresentationModel->UpdateFolderPathList();
138 __pPresentationModel->InitializeContentList(__currentFolderIndex);
140 int position = INIT_VALUE;
141 __pCurrentFolderPath->LastIndexOf(IDS_SEPARATOR_SLASH, __pCurrentFolderPath->GetLength() - 1, position);
142 __pCurrentFolderPath->SubString(position + 1, __headerTitle);
144 String ellipisiPath = CommonUtil::SetHighDepthToEllipsisPath(*__pCurrentFolderPath);
145 Rectangle rect(INIT_VALUE, INIT_VALUE, GetWidth(), 42);
147 Label* pAdditionalInfo = new (std::nothrow) Label();
148 if (!IsFailed(pAdditionalInfo->Construct(rect, ellipisiPath)))
150 pAdditionalInfo->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
151 pAdditionalInfo->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
152 pAdditionalInfo->SetTextConfig(32, LABEL_TEXT_STYLE_BOLD);
153 pAdditionalInfo->SetTextColor(COLOR_ITEM_SUB_TEXT);
155 SetExtraInformaionArea(*pAdditionalInfo);
159 if (GetScreenState() == SCREEN_STATE_EDITOR)
161 CommonUtil::SetEditHeaderStyle(*GetHeader(), ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
170 pArgs->RemoveAll(true);
177 FolderContentListForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
178 const Tizen::Ui::Scenes::SceneId& nextSceneId)
180 AppLogDebug("ENTER");
181 CancelAllThumbnailRequest();
186 FolderContentListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
188 AppLogDebug("ENTER");
189 SceneManager* pSceneManager = SceneManager::GetInstance();
190 AppAssert(pSceneManager);
194 case IDA_CONTEXT_MENU_ITEM_GO_TO_LIBARY:
200 case IDA_CONTEXT_MENU_ITEM_SEARCH:
202 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SEARCH, SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_HISTORY_OPTION_NO_HISTORY));
206 case IDA_CONTEXT_MENU_ITEM_EDIT:
208 ToggleScreenState(SCREEN_STATE_EDITOR);
212 case IDA_FOOTER_BUTTON_MORE:
214 Point anchorPoint(X_POINT_FOOTER_MORE, Y_POINT_PORTRAIT_FOOTER_MORE);
215 if ((GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE) || (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE))
217 anchorPoint.y = Y_POINT_LANDSCAPE_FOOTER_MORE;
219 CreateOptionMenuN(source);
220 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_GO_TO_LIBARY | CONTEXT_MENU_ITEM_STYLE_EDIT, anchorPoint);
224 case IDA_HEADER_BUTTON_SELECTE_ALL:
226 bool isChecked = true;
227 if (__checkedItemCount == __pContentListTableView->GetItemCount())
231 SetItemCheckedAll(isChecked);
235 case IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST:
237 LanucherPicker(PICKER_TYPE_PLAY_LIST_PICKER);
241 case IDA_FLICK_MENU_ITEM_SHARE:
243 CreateContextMenuN(source);
244 SetContextMenuItem(CONTEXT_MENU_ITEM_STYLE_EMAIL | CONTEXT_MENU_ITEM_STYLE_MESSAGE);
248 case IDA_FLICK_MENU_ITEM_SET_AS:
250 CreateContextMenuN(source);
251 SetContextMenuItem(CONTEXT_MENU_ITEM_STYLE_CALL | CONTEXT_MENU_ITEM_STYLE_CALLER);
255 case IDA_FLICK_MENU_ITEM_DELETE:
257 SetCommonPopup(CommonUtil::CreateContentDeletePopup(*this, IDA_COMMON_POPUP_DELETE, IDA_COMMON_POPUP_CANCEL));
259 if (__pContentListTableView->IsContextItemOpened(__activatedStateContextItem))
261 __pContentListTableView->CloseContextItem(__activatedStateContextItem);
266 case IDA_COMMON_POPUP_CANCEL:
272 case IDA_FLICK_MENU_ITEM_ADDTO:
274 LanucherPicker(PICKER_TYPE_PLAY_LIST_PICKER, PICKER_ARGUMENT_TYPE_ACTIVATED_STATE_CONTEXT_ITEM);
276 if (__pContentListTableView->IsContextItemOpened(__activatedStateContextItem))
278 __pContentListTableView->CloseContextItem(__activatedStateContextItem);
283 case IDA_COMMON_POPUP_DELETE:
285 if(GetScreenState() == SCREEN_STATE_NORMAL)
287 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(__activatedStateContextItem);
288 if (pContentInfo != null)
290 RemoveContentAt(pContentInfo->contentId);
291 __pPresentationModel->RefreshContentList(__currentFolderIndex);
292 __pContentListTableView->RefreshItem(__activatedStateContextItem, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
298 RemoveCheckedTableviewItem(true);
303 case IDA_CONTEXT_MENU_ITEM_EMAIL:
305 case IDA_CONTEXT_MENU_ITEM_MESSAGE:
307 result r = E_FAILURE;
308 String providerID = ((actionId == IDA_CONTEXT_MENU_ITEM_EMAIL) ? PROVIDER_ID_EMAIL : PROVIDER_ID_MESSAGE);
309 AppControl* pAppControl = AppManager::FindAppControlN(providerID, OPERATION_ID_COMPOSE);
310 if (pAppControl == null)
312 AppLogDebug("AppManager::FindAppControlN is null");
316 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(__activatedStateContextItem);
317 if (pContentInfo == null)
319 AppLogDebug("PresentationModel->GetContentInfoN is null");
325 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
326 pDataList->Construct();
328 Tizen::Base::Collection::ArrayList* pValueList = new (std::nothrow) ArrayList(SingleObjectDeleter);
329 pValueList->Construct();
330 pValueList->Add((new (std::nothrow) String(pContentInfo->ContentFilePath)));
332 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), pValueList);
335 r = pAppControl->Start(null, null, pDataList, this);
338 Frame* pFrame = MusicPlayerApp::GetInstance()->GetFrameAt(0);
340 pFrame->SetEnabled(false);
343 pDataList->RemoveAll(true);
349 if (__pContentListTableView->IsContextItemOpened(__activatedStateContextItem))
351 __pContentListTableView->CloseContextItem(__activatedStateContextItem);
356 case IDA_CONTEXT_MENU_ITEM_CALL:
358 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(__activatedStateContextItem);
359 if (pContentInfo == null)
361 AppLogDebug("PresentationModel->GetContentInfoN is null");
365 if (!IsFailed(SettingInfo::SetValue(CALL_RINGTONE_KEY, pContentInfo->ContentFilePath)))
367 MessageBox messageBox;
368 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_SUCCESS"),
370 COUNT_MESSAGE_BOX_TIMEOUT);
372 messageBox.ShowAndWait(modalResult);
376 if (__pContentListTableView->IsContextItemOpened(__activatedStateContextItem))
378 __pContentListTableView->CloseContextItem(__activatedStateContextItem);
383 case IDA_CONTEXT_MENU_ITEM_CALLER:
385 AppControl* pAppControl = AppManager::FindAppControlN(PROVIDER_ID_CONTACT, OPERATION_ID_SOCIAL_PICK);
386 if (pAppControl == null)
388 AppLogDebug("AppManager::FindAppControlN is null");
392 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
393 pDataList->Construct();
394 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SELECTION_MODE), new (std::nothrow) String(APPCONTROL_OPTION_SINGLE));
395 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SOCIAL_ITEM_TYPE), new (std::nothrow) String(APPCONTROL_OPTION_PERSON));
396 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SOCIAL_RESULT_TYPE), new (std::nothrow) String(APPCONTROL_OPTION_ITEM_ID));
398 pAppControl->Start(null, null, pDataList, this);
400 pDataList->RemoveAll(true);
405 if (__pContentListTableView->IsContextItemOpened(__activatedStateContextItem))
407 __pContentListTableView->CloseContextItem(__activatedStateContextItem);
412 // case IDA_FOOTER_BUTTON_DELETE:
414 // RemoveCheckedTableviewItem(true);
417 case IDA_FOOTER_BUTTON_DELETE:
419 SetCommonPopup(CommonUtil::CreateContentDeletePopup(*this, IDA_COMMON_POPUP_DELETE, IDA_COMMON_POPUP_CANCEL),this);
423 case IDA_CONTEXT_MENU_ITEM_SHARE_VIA:
425 ToggleScreenState(SCREEN_STATE_SHARE_VIA);
429 case IDA_FOOTER_BUTTON_SHARE:
431 LanucherPicker(PICKER_TYPE_SHARE_PICKER, PICKER_ARGUMENT_TYPE_CHECKED_ITEM_ALL);
439 TryRemoveContextMenu(actionId);
440 TryRemoveCommonPopup(actionId);
445 FolderContentListForm::GetItemCount(void)
447 AppLogDebug("ENTER");
449 return __pPresentationModel->GetContentCount(__currentFolderIndex);
452 Tizen::Ui::Controls::TableViewItem*
453 FolderContentListForm::CreateItem(const int itemIndex, int itemWidth)
455 AppLogDebug("ENTER");
456 RelativeLayout layout;
459 TableViewAnnexStyle tableViewAnnexStyle = TABLE_VIEW_ANNEX_STYLE_NORMAL;
460 if (GetScreenState() != SCREEN_STATE_NORMAL)
462 tableViewAnnexStyle = TABLE_VIEW_ANNEX_STYLE_MARK;
465 TableViewItem* pItem = new (std::nothrow) TableViewItem();
466 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(itemIndex);
468 result r = pItem->Construct(layout, Dimension(itemWidth, __itemHeight), tableViewAnnexStyle);
469 TryCatch(r == E_SUCCESS, , "pItem->Construct(%s)", GetErrorMessage(r));
470 TryCatch(pContentInfo != null, , "pContentInfo is null", GetErrorMessage(GetLastResult()));
472 r = CreateTableViewItem(*pItem, *pContentInfo);
473 TryCatch(r == E_SUCCESS, , "CreateTableViewItem failed(%s)", GetErrorMessage(r));
475 RequestThumbnail(pContentInfo->contentId, (new (std::nothrow) Integer(itemIndex)));
482 AppLogDebug("EXIT(%ls)", GetErrorMessage(GetLastResult()));
495 FolderContentListForm::OnFormMenuRequested(Tizen::Ui::Controls::Form& source)
497 if (GetScreenState() == SCREEN_STATE_NORMAL && IsEmptyContentList() == false)
499 CreateOptionMenuN(source);
500 SetOptionMenuItem(CONTEXT_MENU_ITEM_STYLE_SHARE_VIA | CONTEXT_MENU_ITEM_STYLE_EDIT);
505 FolderContentListForm::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView,
507 Tizen::Ui::Controls::TableViewItem* pItem,
508 Tizen::Ui::Controls::TableViewItemStatus status)
510 AppLogDebug("ENTER");
511 if (GetScreenState() != SCREEN_STATE_NORMAL)
513 SetItemCheckedStateChanged(status);
518 if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
520 SceneManager* pSceneManager = SceneManager::GetInstance();
521 AppAssert(pSceneManager);
523 ArrayList* pSceneArg = MakePlayerSceneParam(itemIndex);
524 if (pSceneArg != null)
526 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_PLAYER), pSceneArg);
533 FolderContentListForm::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex,
534 Tizen::Ui::Controls::TableViewContextItem* pContextItem,
537 AppLogDebug("ENTER");
540 AppLogDebug("INDEX %d", itemIndex);
541 __activatedStateContextItem = itemIndex;
547 FolderContentListForm::GetDefaultItemHeight(void)
549 AppLogDebug("ENTER");
555 FolderContentListForm::DeleteItem(const int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
557 AppLogDebug("ENTER");
563 FolderContentListForm::OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView,
567 AppLogDebug("ENTER");
571 Tizen::Base::Collection::ArrayList*
572 FolderContentListForm::MakePlayerSceneParam(int startIndex)
574 AppLogDebug("ENTER");
575 ArrayList* pSelectedMusicContent = __pPresentationModel->GetContentPathListN(__currentFolderIndex);
576 if (pSelectedMusicContent == null)
582 ArrayList* pTempList = new (std::nothrow) ArrayList();
583 pTempList->Construct();
584 pTempList->Add(*(new (std::nothrow) String(MUSIC)));
585 pTempList->Add(*(new (std::nothrow) Integer(startIndex)));
586 pTempList->Add(*(pSelectedMusicContent));
593 FolderContentListForm::CreateTableViewItem(Tizen::Ui::Controls::TableViewItem& parent, const ContentInformation& contentInfo)
595 AppLogDebug("ENTER");
596 Panel* pTableViewItem = new (std::nothrow) Panel();
598 if (GetScreenState() != SCREEN_STATE_NORMAL)
600 if (__fontSizeValue.Equals(STRING_FONT_SIZE_GIANT, false))
602 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_EDITOR_ITEM_PANEL_FONT_SIZE_GIANT)))
604 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
608 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_HUGE, false))
610 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_EDITOR_ITEM_PANEL_FONT_SIZE_HUGE)))
612 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
616 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_LARGE, false))
618 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_EDITOR_ITEM_PANEL_FONT_SIZE_LARGE)))
620 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
624 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_SMALL, false))
626 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_EDITOR_ITEM_PANEL_FONT_SIZE_SMALL)))
628 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
634 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_EDITOR_ITEM_PANEL_DEFAULT)))
636 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
643 if (__fontSizeValue.Equals(STRING_FONT_SIZE_GIANT, false))
645 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_ITEM_PANEL_FONT_SIZE_GIANT)))
647 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
651 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_HUGE, false))
653 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_ITEM_PANEL_FONT_SIZE_HUGE)))
655 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
659 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_LARGE, false))
661 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_ITEM_PANEL_FONT_SIZE_LARGE)))
663 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
667 else if (__fontSizeValue.Equals(STRING_FONT_SIZE_SMALL, false))
669 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_ITEM_PANEL_FONT_SIZE_SMALL)))
671 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
677 if (IsFailed(pTableViewItem->Construct(IDL_CONTENT_LIST_FOLDER_ITEM_PANEL_DEFAULT)))
679 AppLogDebug("Construct(IDL_CONTENTS_LIBARY_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
685 String filePath = contentInfo.ContentFilePath;
686 Bitmap* StorageIconBitmap = null;
689 String tempPath = contentInfo.ContentFilePath;
691 tempPath.LastIndexOf(L"/", tempPath.GetLength() - 1, indexOf);
692 tempPath.SubString(indexOf + 1, fileName);
694 String phonePath = IDS_STORAGE_PHONE_PATH;
695 phonePath.Remove(IDS_STORAGE_PHONE_PATH.GetLength() - 1, 1);
697 String sdCardPath = IDS_STORAGE_SDCARD_PATH;
698 sdCardPath.Remove(IDS_STORAGE_SDCARD_PATH.GetLength() - 1, 1);
700 if (filePath.Contains(phonePath))
702 StorageIconBitmap = ResourceManager::GetBitmapN(IDB_STORAGE_PHONE);
704 else if (filePath.Contains(sdCardPath))
706 StorageIconBitmap = ResourceManager::GetBitmapN(IDB_STORAGE_SDCARD);
710 StorageIconBitmap = ResourceManager::GetBitmapN(IDB_STORAGE_PHONE);
713 Label* pFolderStorageIcon = static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENT_FOLDER_STORAGE_ICON));
714 pFolderStorageIcon->SetBackgroundBitmap(*StorageIconBitmap);
715 delete StorageIconBitmap;
717 static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENT_TITLE_NAME))->SetText(fileName);
718 // static_cast<Label*>(pTableViewItem->GetControl(IDC_CONTENT_THUMBNAIL))->SetBackgroundBitmap(*GetDefaultThumbnail());
720 parent.AddControl(pTableViewItem);
721 parent.SetIndividualSelectionEnabled(pTableViewItem, true);
723 CommonUtil::SetLayoutFitToContainer(parent, *pTableViewItem);
730 FolderContentListForm::IsEmptyContentList(void)
732 AppLogDebug("ENTER");
733 if (__pPresentationModel->GetContentCount(__currentFolderIndex) != INIT_VALUE)
742 FolderContentListForm::SetHeader(void)
744 AppLogDebug("ENTER");
745 CommonUtil::SetSimpleTitleStyle(*GetHeader(), __headerTitle);
751 FolderContentListForm::OnAppControlCompleteResponseReceived(const AppId& appId,
752 const String& operationId, AppCtrlResult appControlResult,
753 const IMap* pExtraData)
755 AppLogDebug("ENTER");
756 if (pExtraData == null)
761 AppLogDebug("%ls, %ls", appId.GetPointer(), operationId.GetPointer());
762 if (appId.Equals(String(PROVIDER_ID_CONTACT)))
764 if (appControlResult == APP_CTRL_RESULT_SUCCEEDED)
768 ArrayList* pArrayListValue = null;
769 String* pResultString = null;
770 if (pExtraData != null)
772 IMapEnumerator* pEnum = pExtraData->GetMapEnumeratorN();
773 while (pEnum->MoveNext() == E_SUCCESS)
775 pKey = static_cast<String*>(pEnum->GetKey());
776 if (pKey->Equals(APPCONTROL_KEY_SOCIAL_ITEM_ID, true))
778 pArrayListValue = static_cast<ArrayList*>(pEnum->GetValue());
779 pResultString = static_cast<String*>(pArrayListValue->GetAt(0));
780 AppLogDebug("extraData : %ls:%ls", pKey->GetPointer(), pResultString->GetPointer());
781 Integer::Parse(*pResultString, contactId);
789 AppLogDebug("pKey is invaild");
795 AppLogDebug("pExtraData is null");
799 AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
800 Addressbook* pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
802 ContentInformation* pCcontentInfo = __pPresentationModel->GetContentInfoN(__activatedStateContextItem);
803 if (pCcontentInfo == null)
810 Contact* pContact = pAddressbook->GetContactN(contactId);
811 pContact->SetValue(CONTACT_PROPERTY_ID_RINGTONE, pCcontentInfo->ContentFilePath);
812 result r = pAddressbook->UpdateContact(*pContact);
816 ShowDelayedMessageBox(ResourceManager::GetString(L"IDS_COM_POP_SUCCESS"));
819 delete pCcontentInfo;
820 pCcontentInfo = null;
833 FolderContentListForm::OnThumbnailInfoReveivedN(ThumbnailInfo* pThumbnailInfo)
835 AppLogDebug("ENTER");
836 __pThumbnail = pThumbnailInfo->GetBitmapN();
837 Object* pParam = pThumbnailInfo->GetUserParamN();
840 __pContentListTableView->RefreshItem((static_cast<Integer*>(pParam))->ToInt(), TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
844 delete pThumbnailInfo;
849 FolderContentListForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
851 AppLogDebug("ENTER");
852 ContentListForm::OnUserEventReceivedN(requestId, pArgs);
857 FolderContentListForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
859 AppLogDebug("ENTER");
863 AppLogDebug("pItem is null");
869 Label* pThumbnailLabel = static_cast<Label*>(pItem->GetControl(IDC_CONTENT_THUMBNAIL, true));
870 if (__pThumbnail == null || pThumbnailLabel == null)
872 AppLogDebug("__pThumbnail or pThumbnailLabel is null");
877 pThumbnailLabel->SetBackgroundBitmap(*__pThumbnail);
880 pThumbnailLabel->Invalidate(true);
885 FolderContentListForm::GetCheckedItemCount(void)
887 AppLogDebug("ENTER");
889 return __checkedItemCount;
893 FolderContentListForm::UpdateTableView(void)
895 AppLogDebug("ENTER");
896 __pContentListTableView->UpdateTableView();
901 FolderContentListForm::UpdateContentList(void)
903 AppLogDebug("ENTER");
904 __currentFolderIndex = __pPresentationModel->GetFolderIndex(*__pCurrentFolderPath);
906 if (__currentFolderIndex < 0)
908 SceneManager* pSceneManager = SceneManager::GetInstance();
909 AppAssert(pSceneManager);
910 SetScreenState(SCREEN_STATE_NORMAL);
912 if (pSceneManager->GetCurrentSceneId().Equals(IDSCN_FOLDER_CONTENT_LIST,true))
914 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_DESTROY_OPTION_KEEP));
920 __pPresentationModel->InitializeContentList(__currentFolderIndex);
926 FolderContentListForm::SetItemCheckedAll(bool isChecked)
928 AppLogDebug("ENTER");
929 if (isChecked == true)
931 __checkedItemCount = __pContentListTableView->GetItemCount();
935 __checkedItemCount = INIT_VALUE;
937 CommonUtil::SetItemCheckedAll(isChecked, *__pContentListTableView);
938 if(GetFooter() != null)
940 CommonUtil::SetFooterItemEnabled(*GetFooter(), isChecked);
943 SetCheckedCountBallonTooltip(GetCheckedItemCount());
948 FolderContentListForm::RemoveCheckedTableviewItem(bool itemRemove)
950 AppLogDebug("ENTER");
953 int totalCount = __pContentListTableView->GetItemCount();
954 for (int iCount = 0; iCount < totalCount; iCount++)
956 if (__pContentListTableView->IsItemChecked(iCount) == true)
958 __pContentListTableView->SetItemChecked(iCount, false);
959 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(iCount);
960 RemoveContentAt(pContentInfo->contentId);
967 SetItemCheckedAll(false);
973 FolderContentListForm::SetItemCheckedStateChanged(Tizen::Ui::Controls::TableViewItemStatus status)
975 AppLogDebug("ENTER");
976 if (status == TABLE_VIEW_ITEM_STATUS_UNCHECKED)
978 __checkedItemCount--;
979 if (__checkedItemCount == INIT_VALUE)
981 if (GetFooter() != null)
983 CommonUtil::SetFooterItemEnabled(*GetFooter(), false);
987 else if (status == TABLE_VIEW_ITEM_STATUS_CHECKED)
989 if (__checkedItemCount == INIT_VALUE)
991 if (GetFooter() != null)
993 CommonUtil::SetFooterItemEnabled(*GetFooter(), true);
997 __checkedItemCount++;
1000 SetCheckedCountBallonTooltip(GetCheckedItemCount());
1001 AppLogDebug("EXIT");
1005 FolderContentListForm::GoToLibrary(void)
1007 IEnumeratorT<SceneId>* pIEnum = null;
1008 SceneManager* pSceneManager = SceneManager::GetInstance();
1009 IListT<SceneId>* pSceneIdList = pSceneManager->GetSceneHistoryN();
1010 if (pSceneIdList == null)
1012 AppLogDebug("EXIT(ScenList is null)");
1013 pSceneManager->GoBackward(BackwardSceneTransition());
1017 pSceneManager->ClearSceneHistory();
1019 pIEnum = pSceneIdList->GetEnumeratorN();
1023 while (pIEnum->MoveNext() == E_SUCCESS)
1026 pIEnum->GetCurrent(sceneID);
1028 if (!__prevSceneId.Equals(sceneID, false))
1030 pSceneManager->AddToSceneHistory(sceneID);
1034 pSceneManager->DestroyScene(sceneID);
1040 pSceneManager->GoBackward(BackwardSceneTransition());
1043 Tizen::Base::Collection::IList*
1044 FolderContentListForm::GetPickerArgumentListN(PickerType pickerType, PickerArgumentType argumentType)
1046 AppLogDebug("ENTER");
1047 Tizen::Base::Collection::ArrayList* pContentFilePathList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1048 if (IsFailed(pContentFilePathList->Construct()))
1050 AppLogDebug("pContentList->Construct failed(%s)", GetErrorMessage(GetLastResult()));
1051 delete pContentFilePathList;
1055 if (argumentType == PICKER_ARGUMENT_TYPE_ACTIVATED_STATE_CONTEXT_ITEM)
1057 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(__activatedStateContextItem);
1058 if (pContentInfo == null)
1060 delete pContentFilePathList;
1061 AppLogDebug("GetContentInfoN(%d) is null", __activatedStateContextItem);
1065 pContentFilePathList->Add(*(new (std::nothrow) String(pContentInfo->ContentFilePath)));
1066 delete pContentInfo;
1068 else if (argumentType == PICKER_ARGUMENT_TYPE_CHECKED_ITEM_ALL)
1070 int totalCount = __pContentListTableView->GetItemCount();
1071 for (int iCount = 0; iCount < totalCount; iCount++)
1073 if (__pContentListTableView->IsItemChecked(iCount) == true)
1075 ContentInformation* pContentInfo = __pPresentationModel->GetContentInfoN(iCount);
1076 if (pContentInfo == null)
1078 AppLogDebug("GetContentInfoN(%d) is null", iCount);
1079 delete pContentFilePathList;
1083 if (pickerType == PICKER_TYPE_PLAY_LIST_PICKER)
1085 pContentFilePathList->Add(*(new (std::nothrow) String(pContentInfo->ContentFilePath)));
1087 else if (pickerType == PICKER_TYPE_SHARE_PICKER)
1089 pContentFilePathList->Add(*(new (std::nothrow) String(pContentInfo->ContentFilePath)));
1091 delete pContentInfo;
1095 AppLogDebug("EXIT");
1096 return pContentFilePathList;
1100 FolderContentListForm::OnFontSizeChanged(void)
1102 __fontSizeValue = CommonUtil::GetFontSizeValue();
1103 __itemHeight = CommonUtil::GetItemHeight(__fontSizeValue);
1104 __pContentListTableView->UpdateTableView();