Fix for N_SE-40185
[apps/osp/MyFiles.git] / src / MfSubFolderSelection.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: MfSubFolderSelection.cpp
19  * @brief: This file contains the implementation of SubFolderSelection class,
20  *  which acts an AppControl for the SubDirectories.
21  */
22
23 #include "MfMyFilesApp.h"
24 #include "MfSubFolderSelection.h"
25 #include "MfSceneRegister.h"
26 #include "MfUtility.h"
27
28 using namespace Tizen::App;
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31 using namespace Tizen::Base::Utility;
32 using namespace Tizen::Content;
33 using namespace Tizen::Graphics;
34 using namespace Tizen::Io;
35 using namespace Tizen::Locales;
36 using namespace Tizen::Media;
37 using namespace Tizen::System;
38 using namespace Tizen::Telephony;
39 using namespace Tizen::Ui;
40 using namespace Tizen::Ui::Controls;
41 using namespace Tizen::Ui::Scenes;
42
43
44 SubFolderSelection::SubFolderSelection(void)
45         : __pReceivedFilename(null)
46         , __pHomeButton(null)
47         , __pUpButton(null)
48         , __pMoreContextMenu(null)
49         , __pLabelDisplayPath(null)
50         , __pFileEventManager(null)
51 {
52         //Do Nothing
53 }
54
55 SubFolderSelection::~SubFolderSelection(void)
56 {
57         if (__pHomeButton != null)
58         {
59                 delete __pHomeButton;
60         }
61
62         if (__pUpButton != null)
63         {
64                 delete __pUpButton;
65         }
66         if (__pMoreContextMenu != null)
67         {
68                 delete __pMoreContextMenu;
69         }
70         if (__pFileEventManager != null)
71         {
72                 __pFileEventManager->RemovePath(_rootMediaPath);
73                 delete __pFileEventManager;
74         }
75 }
76
77 SubFolderSelection&
78 SubFolderSelection::operator =(const SubFolderSelection& pSubFolderSelection)
79 {
80         return *this;
81 }
82
83 SubFolderSelection::SubFolderSelection(const SubFolderSelection& pSubFolderSelection)
84 {
85         //Do Nothing
86 }
87
88
89 bool
90 SubFolderSelection::Initialize(void)
91 {
92         AppLogDebug("Entry");
93         Form::Construct(L"IDL_SUB_FOLDER_FILE_SELECTION");
94         AppLogDebug("Exit");
95         return true;
96 }
97
98 result
99 SubFolderSelection::OnInitializing(void)
100 {
101         AppLogDebug("Entry");
102         result r = E_SUCCESS;
103         String buttonCancel;
104         String buttonAttach;
105         String buttonCreate;
106         String buttonFolder;
107         String buttonHome;
108         String buttonUp;
109         String buttonExport;
110         String buttonHere;
111         String buttonExportHere;
112         String displayPath;
113         ButtonItem footerItemMenu;
114         int xPos = 0, yPos = 0;
115
116         CreateItemSource createitemsource = CREATE_ITEM_SOURCE_SUB_FOLDER_SELECTION;
117
118         AppResource* pAppResource = null;
119         Bitmap* pBitmapHomeButton = null;
120         Bitmap* pBitmapUpButton = null;
121         Bitmap* pBitmapHomeButtonPress = null;
122         Bitmap* pBitmapUpButtonPress = null;
123         Bitmap* pBitmap = null;
124         Bitmap* pBitmapPress = null;
125         Bitmap* pBitmapDisabled = null;
126
127         __pReceivedFilename = new (std::nothrow) String();
128
129         _pListView = static_cast< ListView* >(GetControl("IDC_SUB_FOLDER_SELECTION_LISTVIEW"));
130         TryCatch(_pListView != null, , "Failed to get list view control");
131
132         _pListView->AddListViewItemEventListener(*this);
133         _pListView->SetItemProvider(*this);
134         _pListView->SetShowState(false);
135
136         _selectionMode = ((MyFilesApp*) Application::GetInstance())->GetCurrentSelectionMode();
137         _currentFileType = ((MyFilesApp*) Application::GetInstance())->GetCurrentFileType();
138         _currentViewStyle = ((MyFilesApp*) Application::GetInstance())->GetCurrentView();
139         _currentExportFileType = ((MyFilesApp*) Application::GetInstance())->GetCurrentExportFileType();
140
141         __pLabelDisplayPath = static_cast< Label* >(GetControl("IDC_SUB_FOLDER_SELECTION_LABEL_DISPLAY_PATH"));
142         TryCatch(__pLabelDisplayPath != null, , "Label is Null");
143
144         pAppResource = UiApp::GetInstance()->GetAppResource();
145         TryCatch(pAppResource != null, , "Resource manager not found!");
146
147         displayPath = defaultPhoneBody;
148         displayPath.Append("/");
149
150         //pAppResource->GetString(L"IDS_MF_BUTTON_HOME", buttonHome);
151         pAppResource->GetString(L"IDS_COM_POP_ATTACH", buttonAttach);
152         pAppResource->GetString(L"IDS_COM_POP_CANCEL", buttonCancel);
153         pAppResource->GetString(L"IDS_EXPORT_HERE", buttonExportHere);
154         //pAppResource->GetString(L"IDS_MF_TAB_UP", buttonUp);
155         pBitmap = pAppResource->GetBitmapN(IDB_MORE, BITMAP_PIXEL_FORMAT_ARGB8888);
156         pBitmapPress = pAppResource->GetBitmapN(IDB_MORE_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
157         pBitmapDisabled = pAppResource->GetBitmapN(IDB_MORE_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888);
158         pBitmapHomeButton = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
159         pBitmapUpButton = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
160         pBitmapHomeButtonPress = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
161         pBitmapUpButtonPress = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
162
163         __displayPath = displayPath;
164
165         _pFolderBitmap = pAppResource->GetBitmapN(IDB_FOLDER, BITMAP_PIXEL_FORMAT_ARGB8888);
166         _pDummyImage = pAppResource->GetBitmapN(IDB_DUMMY_IMG, BITMAP_PIXEL_FORMAT_ARGB8888);
167
168         _pAudioPlay = MfUtility::MergeBitmapN(IDB_PLAY_OUTER_CIRCLE, IDB_PLAY, 64, 64);
169         _pAudioPause = MfUtility::MergeBitmapN(IDB_PLAY_OUTER_CIRCLE, IDB_PAUSE, 64, 64);
170
171         _pFooter = GetFooter();
172
173         if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)
174         {
175                 pAppResource->GetString(L"IDS_EXPORT", buttonExport);
176
177                 footerItemMenu.Construct(BUTTON_ITEM_STYLE_ICON, IDA_BTN_MORE);
178                 if (pBitmap != null)
179                 {
180                         pBitmap->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
181                         footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmap);
182                 }
183                 if (pBitmapPress != null)
184                 {
185                         pBitmapPress->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
186                         footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapPress);
187                 }
188                 if (pBitmapDisabled != null)
189                 {
190                         pBitmapDisabled->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
191                         footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapDisabled);
192                 }
193                 if (_pFooter != null)
194                 {
195                         _pFooter->GetPosition(xPos, yPos);
196                 }
197                 __pMoreContextMenu = new (std::nothrow) ContextMenu();
198             __pMoreContextMenu->Construct(Point(0 , yPos), CONTEXT_MENU_STYLE_LIST);
199                 __pMoreContextMenu->AddActionEventListener(*this);
200                 __pMoreContextMenu->SetShowState(true);
201         }
202
203         _pHeader = GetHeader();
204         TryCatch(_pHeader != null, , "Header is Null");
205
206         __pHomeButton = new (std::nothrow) ButtonItem();
207         __pHomeButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_HOME);
208         __pHomeButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBitmapHomeButton);
209         __pHomeButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBitmapHomeButtonPress);
210
211         __pUpButton = new (std::nothrow) ButtonItem();
212         __pUpButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_UP);
213         __pUpButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBitmapUpButton);
214         __pUpButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBitmapUpButtonPress);
215
216         _pHeader->SetButton(BUTTON_POSITION_LEFT, *__pHomeButton);
217         _pHeader->SetButton(BUTTON_POSITION_RIGHT, *__pUpButton);
218         _pHeader->AddActionEventListener(*this);
219
220         if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)
221         {
222                 _pExport = new (std::nothrow) FooterItem();
223                 r = _pExport->Construct(IDA_BTN_EXPORT);
224                 _pExport->SetText(buttonExportHere);
225
226         }
227         else
228         {
229                 _pAttach = new (std::nothrow) FooterItem();
230                 r = _pAttach->Construct(IDA_BTN_ATTACH);
231                 _pAttach->SetText(buttonAttach);
232         }
233
234         TryCatch(_pFooter != null, , "Footer is Null");
235
236         if (_pFooter != null)
237         {
238                 _pFooter->RemoveAllButtons();
239                 _pFooter->RemoveAllItems();
240                 _pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
241
242                 if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)
243                 {
244                         _pFooter->AddItem(*_pExport);
245                         _pFooter->SetButton(BUTTON_POSITION_LEFT, footerItemMenu);
246                         //_pFooter->AddItem(*_pCreateFolder);
247                 }
248                 else
249                 {
250                         _pFooter->AddItem(*_pAttach);
251                 }
252
253                 //_pFooter->AddItem(*_pCancel);
254                 _pFooter->AddActionEventListener(*this);
255                 _pFooter->SetBackButton();
256                 SetFormBackEventListener(this);
257                 if (_currentViewStyle != APPCONTROL_VIEW_EXPORT)
258                 {
259                         _pFooter->SetItemEnabled(0, false);
260                 }
261                 _pFooter->Invalidate(true);
262         }
263
264         CreateLabelControl();
265
266         _defaultListViewBounds = _pListView->GetBounds();
267
268         _pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel();
269         TryCatch(_pFolderEntryPM != null, , "Failed to allocate memory");
270         _pFolderEntryPM->Construct();
271         _pFolderEntryPM->SetSourceForm(createitemsource);
272
273         _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath();
274         _rootStoragePath = BasePresentationModel::GetSdCardPath();
275
276         if (_currentViewStyle != APPCONTROL_VIEW_EXPORT)
277         {
278                 _pFolderEntryPM->SetFolderEntryType(_currentFileType);
279                 _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath);
280                 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
281                 TryCatch(_pFilenames != null, , "MfMyFilesApp::Failed to allocate Memory to Filenames ArrayList");
282         }
283
284         _pThumbnailManager = ThumbnailManager::GetInstance();
285         TryCatch(_pThumbnailManager != null, , "Thumbnail Manager not found!");
286
287         _pFileManager = FolderEntryEditorPresentationModel::GetInstance();
288         TryCatch(_pFileManager != null, , "File Manager not found!");
289
290         InitializeAppRegistry();
291
292         if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)
293         {
294                 __pLabelDisplayPath->SetShowState(true);
295                 _pLabelNumberOfItems->SetShowState(false);
296         }
297
298         _pCallManager = new (std::nothrow) CallManager();
299
300     r = _pCallManager->Construct(*this);
301     TryCatch(r == E_SUCCESS, , "Failed to Construct CallManager");
302
303         AppLogDebug("Exit %s", GetErrorMessage(r));
304
305 #if 0
306         DataBindingContext* pContext = null;
307
308         pContext = GetDataBindingContextN();
309         TryCatch(pContext != null, , "Failed to Fetch the DataBinding Context");
310
311         pContext->Bind(L"ID_APPCONTROL_DISPLAY_PATH", L"IDC_SUB_FOLDER_SELECTION_LABEL_DISPLAY_PATH", L"text", __displayPath, DATA_BINDING_DATA_TYPE_STRING, DATA_BINDING_FLOW_TWO_WAY, DATA_BINDING_TRIGGER_EXPLICIT, null, null, null);
312
313         delete pContext;
314
315 #endif
316
317         delete pBitmapHomeButton;
318         delete pBitmapUpButton;
319         delete pBitmapHomeButtonPress;
320         delete pBitmapUpButtonPress;
321         delete pBitmapDisabled;
322         delete pBitmap;
323         delete pBitmapPress;
324         AppLogDebug("Exit: %s", GetErrorMessage(r));
325         return r;
326
327 CATCH:
328         if (pBitmapHomeButton != null)
329         {
330                 delete pBitmapHomeButton;
331                 pBitmapHomeButton = null;
332         }
333
334         if (pBitmapUpButton != null)
335         {
336                 delete pBitmapUpButton;
337                 pBitmapUpButton = null;
338         }
339         if (pBitmapHomeButtonPress != null)
340         {
341                 delete pBitmapHomeButtonPress;
342                 pBitmapHomeButtonPress = null;
343         }
344         if (pBitmapUpButtonPress != null)
345         {
346                 delete pBitmapUpButtonPress;
347                 pBitmapUpButtonPress = null;
348         }
349         r = E_FAILURE;
350         AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
351         return r;
352 }
353
354 result
355 SubFolderSelection::OnTerminating(void)
356 {
357         result r = E_SUCCESS;
358
359         _pHeader = GetHeader();
360         if (_pHeader != null)
361         {
362                 _pHeader->RemoveAllButtons();
363                 _pHeader->RemoveAllItems();
364         }
365
366         _pFooter = GetFooter();
367         if (_pFooter != null)
368         {
369                 _pFooter->RemoveAllButtons();
370                 _pFooter->RemoveAllItems();
371         }
372
373         return r;
374 }
375
376 void
377 SubFolderSelection::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
378 {
379         //empty implementation
380 }
381
382 void
383 SubFolderSelection::OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
384 {
385         //empty implementation
386 }
387
388 void
389 SubFolderSelection::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
390 {
391         AppLogDebug("Entry");
392         result r = E_SUCCESS;
393         String selectFiles;
394         String selectedCount;
395         String selectedRootMediaPath;
396         DirectoryEntry* pDirStr = null;
397         String nextFilename;
398         int selectedItemsCount = 0;
399         int itemcount = 0;
400         AppResource* pAppResource = null;
401         SceneManager* pSceneManager = null;
402         ArrayList* pArgs = null;
403         bool itemStatus = false;
404         Integer currentIndex = index;
405         RelativeLayout* pLayout = null;
406
407         pArgs = new (std::nothrow) ArrayList();
408         pArgs->Construct();
409
410         pSceneManager = SceneManager::GetInstance();
411         pAppResource = Application::GetInstance()->GetAppResource();
412         TryCatch(pAppResource != null, , "Resource manager not found!");
413
414         pAppResource->GetString(L"IDS_SELECT_FILES", selectFiles);
415         pAppResource->GetString(L"IDS_COM_BODY_SELECTED", selectedCount);
416
417         itemStatus = _pFileManager->GetCheckedList()->ContainsKey(currentIndex /*,itemStatus*/);
418
419         if (elementId == CONTENT_LIST_ITEM_TYPE_PLAY || elementId == CONTENT_LIST_ITEM_TYPE_PAUSE)
420         {
421                 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
422                 TryCatch(pDirStr != null, , "pDirStr is null");
423
424                 if (!itemStatus)
425                 {
426                         listView.SetItemChecked(index, false);
427                 }
428                 else
429                 {
430                         listView.SetItemChecked(index, true);
431                 }
432
433                 if (_pAudioPlayer == null)
434                 {
435                         InitializePlayer();
436                         LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_INITIALIZED);
437                         _previousAudioSelected = index;
438                         _currentAudioPlayIndex = index;
439                         _pListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
440
441                         return;
442                 }
443
444                 if (_previousAudioSelected == index)
445                 {
446                         if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING)
447                         {
448                                 _pAudioPlayer->Pause();
449                         }
450                         else
451                         {
452                                 LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_INITIALIZED);
453                         }
454                 }
455                 else
456                 {
457                         _pAudioPlayer->Stop();
458                         _pAudioPlayer->Close();
459                         _pListView->RefreshList(_previousAudioSelected, LIST_REFRESH_TYPE_ITEM_MODIFY);
460                         _previousAudioSelected = index;
461
462                         LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_STOPPED);
463                 }
464                 _currentAudioPlayIndex = index;
465                 _pListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
466                 //listView.SetItemChecked(index, false);
467                 return;
468         }
469
470         if (_pFilenames != null) //start of FILENAME check if
471         {
472                 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
473
474                 if (pDirStr != null) //start of NULL check if
475                 {
476                         if (pDirStr->IsDirectory()) // start of DIRECTORY CHECK if
477                         {
478                                 selectedRootMediaPath = pDirStr->GetFullFilePath();
479                                 nextFilename = pDirStr->GetFileName();
480
481                                 if (_rootMediaPath != null)
482                                 {
483                                         _rootMediaPath.Clear();
484                                         _rootMediaPath.Append(selectedRootMediaPath);
485                                 }
486
487                                 if (_pAudioPlayer != null)
488                                 {
489                                         if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING || _pAudioPlayer->GetState() == PLAYER_STATE_PAUSED)
490                                         {
491                                                 _pAudioPlayer->Stop();
492                                                 _pAudioPlayer->Close();
493                                         }
494                                 }
495                                 FolderNavigationPresentationModel::SetCurrentFilePath(_rootMediaPath);
496
497                                 pArgs->Add(&nextFilename);
498                                 pArgs->Add(&_rootMediaPath);
499                                 ClearSelectedItems(listView);
500                                 pSceneManager->GoForward(ForwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
501                         } // end of DIRECTORY CHECK if
502                         else //start of FILE CHECK else
503                         {
504                                 if (listView.IsItemChecked(index) == true)
505                                 {
506                                         _pFileManager->AddCheckedListEntry(index, pDirStr);
507                                 }
508                                 else
509                                 {
510                                         _pFileManager->RemoveCheckedListEntry(index);
511                                 }
512
513                                 if (_selectionMode == SELECTION_MODE_SINGE)
514                                 {
515                                         if (listView.IsItemChecked(_storePreviousIndex) == true && _storePreviousIndex != index)
516                                         {
517                                                 listView.SetItemChecked(_storePreviousIndex, false);
518                                                 _pListView->RefreshList(_storePreviousIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
519                                                 _pFileManager->RemoveCheckedListEntry(_storePreviousIndex);
520                                         }
521                                         _storePreviousIndex = index;
522                                 }
523                         } //end of FILE CHECK else
524                 } //end of NULL check if
525
526                 for (itemcount = 0; itemcount <= GetItemCount(); itemcount++)
527                 {
528                         if (listView.IsItemChecked(itemcount) == true)
529                         {
530                                 selectedItemsCount++;
531                         }
532                 }
533
534                 if (selectedItemsCount != 0)
535                 {
536                         r = _pFooter->SetItemEnabled(0, true);
537                 }
538                 else
539                 {
540                         if (_currentViewStyle != APPCONTROL_VIEW_EXPORT)
541                         {
542                         _pFooter->SetItemEnabled(0, false);
543                         }
544                 }
545
546                 if (_selectionMode == SELECTION_MODE_MULTIPLE) // start of MULTIPLE_MODE_SELECTION if
547                 {
548
549                         pLayout = dynamic_cast <RelativeLayout*> (Form::GetLayoutN());
550                         if (pLayout != null)
551                         {
552                                 pLayout->SetRelation(*_pListView, _pLabelNumberOfItems,RECT_EDGE_RELATION_BOTTOM_TO_TOP);
553                         }
554
555                         if (selectedItemsCount > 0)
556                         {
557                                 _itemSelectedCount.Clear();
558                                 _itemSelectedCount.Append(selectedCount);
559                                 _itemSelectedCount.Append(L"\x200E");
560                                 _itemSelectedCount.Append(L"(");
561                                 _itemSelectedCount.Append(selectedItemsCount);
562                                 _itemSelectedCount.Append(L")");
563                                 _itemSelectedCount.Append(L"\x200E");
564                                 _pLabelNumberOfItems->SetText(_itemSelectedCount);
565                         }
566                         else
567                         {
568                                 _itemSelectedCount.Clear();
569                                 _itemSelectedCount.Append(selectFiles);
570                                 _pLabelNumberOfItems->SetText(_itemSelectedCount);
571                         }
572
573                         _pLabelNumberOfItems->Invalidate(true);
574
575                         delete pLayout;
576                 }
577         } //end of FILENAME check if
578
579         _pFooter->Invalidate(true);
580
581         AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
582         return;
583 CATCH:
584         r = GetLastResult();
585         if (_pFolderEntryPM != null)
586         {
587                 delete _pFolderEntryPM;
588                 _pFolderEntryPM = null;
589         }
590         AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
591 }
592
593 void
594 SubFolderSelection::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
595 {
596         //empty implementation
597 }
598
599 void
600 SubFolderSelection::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
601                                                                           const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
602 {
603
604         RelativeLayout* pLayout = null;
605
606         SceneManager::GetInstance()->AddSceneManagerEventListener(*this);
607
608         ((MyFilesApp*) Application::GetInstance())->SetAudioNotificationListener(this);
609         _itemSelectedCount.Clear();
610
611         if (_pFileManager != null)
612         {
613                 if (!_pFileManager->IsCheckedListNull())
614                 {
615                         _pFileManager->ClearCheckedList();
616                 }
617         }
618         if (_selectionMode == SELECTION_MODE_SINGE) // start of MULTIPLE_MODE_SELECTION if
619         {
620                 pLayout  = dynamic_cast <RelativeLayout*> (Form::GetLayoutN());
621                 if (pLayout != null)
622                 {
623                         pLayout->SetRelation(*_pListView, this ,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
624                 }
625
626                 delete pLayout;
627
628         }
629         if (pArgs != null)
630         {
631                 __pReceivedFilename->Clear();
632                 __pReceivedFilename->Append(*static_cast<String*>(pArgs->GetAt(0)));
633         }
634         else
635         {
636                 if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)
637                 {
638                         String headerDisplayPath = FolderNavigationPresentationModel::GetCurrentPath();
639                         SetHeaderTitleText(headerDisplayPath);
640                         __pReceivedFilename->Clear();
641                 }
642         }
643
644         ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
645
646         if (pArgs != null)
647         {
648                 pArgs->RemoveAll(false);
649                 delete pArgs;
650         }
651 }
652
653 void
654 SubFolderSelection::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
655                                                                            const Tizen::Ui::Scenes::SceneId& nextSceneId)
656 {
657         DeviceManager::RemoveAllDeviceEventListeners();
658         ((MyFilesApp*)Application::GetInstance())->SetCurrentView(null);
659         ((MyFilesApp*) Application::GetInstance())->SetAudioNotificationListener(null);
660         _pFolderEntryPM->StopThumbnailManager(true);
661
662         if(__pFileEventManager != null)
663         {
664                 __pFileEventManager->RemovePath(_rootMediaPath);
665                 delete __pFileEventManager;
666                 __pFileEventManager = null;
667         }
668 }
669
670 void
671 SubFolderSelection::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
672 {
673         AppLogDebug("Entry");
674
675         String createFolder;
676         Bitmap* pBitmapCreateFolder = null;
677         AppResource* pAppResource = null;
678         pAppResource = UiApp::GetInstance()->GetAppResource();
679         if (pAppResource != null)
680         {
681                 pAppResource->GetString(L"IDS_COM_BODY_CREATE_FOLDER", createFolder);
682                 pBitmapCreateFolder = pAppResource->GetBitmapN(IDB_POPUP_CREATE_FOLDER_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
683         }
684
685         switch (actionId)
686         {
687         case IDA_BTN_HOME:
688         {
689                 ShowHomeView();
690                 _pFolderEntryPM->InitThumbnailManager();
691         }
692         break;
693
694         case IDA_BTN_UP:
695         {
696                 ShowParentDirectoryView();
697                 _pFolderEntryPM->InitThumbnailManager();
698         }
699         break;
700
701         case IDA_BTN_MORE:
702         {
703                 __pMoreContextMenu->RemoveAllItems();
704                 __pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
705                 __pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
706                 __pMoreContextMenu->AddItem(createFolder, IDA_BTN_CREATE_FOLDER, *pBitmapCreateFolder, null, null);
707                 __pMoreContextMenu->SetShowState(true);
708                 __pMoreContextMenu->Show();
709         }
710         break;
711
712         default:
713         {
714                 SubBaseOnActionPerformed(source, actionId);
715         }
716         break;
717         }
718         AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
719 }
720
721 void
722 SubFolderSelection::ShowParentDirectoryView(void)
723 {
724         AppLogDebug("Entry");
725         result r = E_SUCCESS;
726         String displayPath;
727         String ParentPath;
728
729         displayPath = defaultPhoneBody;
730         displayPath.Append("/");
731
732         ParentPath = FolderNavigationPresentationModel::GetParentPath();
733         //_pFileManager->ClearCheckedList();
734
735         if (FolderNavigationPresentationModel::GetCurrentPath() == BasePresentationModel::GetMediaPath() || FolderNavigationPresentationModel::GetCurrentPath() == BasePresentationModel::GetSdCardPath())
736         {
737                 _pFileManager->ClearCheckedList();
738                 ShowHomeView();
739         }
740         else
741         {
742                 if (_currentViewStyle != APPCONTROL_VIEW_EXPORT)
743                 {
744                         ResetFooter();
745                 }
746
747                 if (_pAudioPlayer != null)
748                 {
749                         if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING || _pAudioPlayer->GetState() == PLAYER_STATE_PAUSED)
750                         {
751                                 _pAudioPlayer->Stop();
752                                 _pAudioPlayer->Close();
753                         }
754                 }
755                 _rootMediaPath.Clear();
756                 _rootMediaPath.Append(ParentPath);
757
758                 FolderNavigationPresentationModel::SetCurrentFilePath(_rootMediaPath);
759
760                 SetParentDisplayPath();
761                 SetHeaderTitleText(ParentPath);
762
763                 //Remove the current files from the filenames list
764                 if (_pFolderEntryPM != null)
765                 {
766                         _pFolderEntryPM->SetFolderEntryPath(ParentPath);
767                         //Get the files in the parent path of the current view
768                         _pFilenames = _pFolderEntryPM->GetFolderEntryList();
769                         TryCatch(_pFilenames != null, , "Failed to fetch ArrayList from the ContentBrowser!");
770                 }
771
772                 if (_pListView != null)
773                 {
774                         _pListView->UpdateList();
775                         _storePreviousIndex = 0;
776                         }
777         }
778
779         AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
780         return;
781 CATCH:
782         r = E_FAILURE;
783         if (_pFolderEntryPM != null)
784         {
785                 delete _pFolderEntryPM;
786                 _pFolderEntryPM = null;
787         }
788         AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
789 }
790
791 void
792 SubFolderSelection::SetParentDisplayPath(void)
793 {
794         String dislayPath;
795         String delim(L"/");
796         String parentDisplayPath;
797         String token;
798
799 #if 0
800         DataBindingContext* pContext = null;
801         pContext = GetDataBindingContextN();
802
803         if (pContext != null)
804         {
805                 //Update binding on the source to fetch the current display path.
806                 pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_SOURCE);
807         }
808 #endif
809
810         StringTokenizer tokenizer(__displayPath, delim);
811
812         //Use a string tokenizer to get the filepath until it's the last token, break the loop when
813         //it is the last token
814         while (tokenizer.HasMoreTokens())
815         {
816                 int tokenCount = tokenizer.GetTokenCount();
817
818                 if (tokenCount != 1)
819                 {
820                         tokenizer.GetNextToken(token);
821                         parentDisplayPath.Append(token);
822                         parentDisplayPath.Append(L"/");
823                 }
824                 else
825                 {
826                         break;
827                 }
828         }
829
830         //Set the display path to that of the generated filepath from the tokenizer
831         __displayPath = parentDisplayPath;
832
833 #if 0
834         if (pContext != null)
835         {
836                 //Update Binding on the Target control to display the currently constructed path.
837                 pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET);
838         }
839
840         if (pContext != null)
841         {
842                 delete pContext;
843         }
844 #endif
845
846         if (__pLabelDisplayPath != null)
847         {
848                 String displayPathToAppend(L"\x200E");
849                 displayPathToAppend.Append(__displayPath);
850
851                 __pLabelDisplayPath->SetText(displayPathToAppend);
852                 __pLabelDisplayPath->Invalidate(true);
853         }
854 }
855
856 void
857 SubFolderSelection::SetHeaderTitleText(Tizen::Base::String& filePath)
858 {
859         String token;
860         String parentFileName;
861         String delimiter(L"/");
862         StringTokenizer tokenizer(filePath, delimiter);
863
864         AppResource* pAppResource = null;
865
866         pAppResource = UiApp::App::GetInstance()->GetAppResource();
867
868         if (filePath == BasePresentationModel::GetMediaPath())
869         {
870                 if (pAppResource != null)
871                 {
872                         pAppResource->GetString(L"IDS_MF_TAB_PHONE", parentFileName);
873                 }
874         }
875         else if (filePath == BasePresentationModel::GetSdCardPath())
876         {
877                 if (pAppResource != null)
878                 {
879                         pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", parentFileName);
880                 }
881         }
882         else
883         {
884                 while (tokenizer.HasMoreTokens())
885                 {
886                         int tokenCount = tokenizer.GetTokenCount();
887
888                         if (tokenCount == 1)
889                         {
890                                 tokenizer.GetNextToken(parentFileName);
891                         }
892                         else
893                         {
894                                 tokenizer.GetNextToken(token);
895                         }
896                 }
897         }
898
899         if (_pHeader != null)
900         {
901                 if (!parentFileName.IsEmpty())
902                 {
903                         _pHeader->SetTitleText(parentFileName);
904                         _pHeader->Invalidate(true);
905                 }
906         }
907 }
908
909 void
910 SubFolderSelection::SetNextDisplayPath(void)
911 {
912         String displayPath;
913         String delim(L"/");
914         String token;
915         String fullPath;
916 #if 0
917         DataBindingContext* pContext = null;
918         pContext = GetDataBindingContextN();
919 #endif
920
921         fullPath = FolderNavigationPresentationModel::GetCurrentPath();
922         //fullPath = __rootMediaPath;
923
924         StringTokenizer tokenizer(fullPath, delim);
925
926         int Counter = 0;
927         switch (_storageType)
928         {
929         case MEMORY_TYPE_PHONE:
930         {
931                 Counter = 3;
932         }
933         break;
934
935         case MEMORY_TYPE_SD_CARD:
936         {
937                 Counter = 3;
938         }
939         break;
940
941         default:
942                 //Do Nothing.
943                 break;
944         }
945
946         //Use a string tokenizer to get the filepath until it's the last token, break the loop when
947         //it is the last token
948         while (tokenizer.HasMoreTokens())
949         {
950                 if (Counter > 0)
951                 {
952                         Counter--;
953                         tokenizer.GetNextToken(token);
954                 }
955                 else
956                 {
957                         tokenizer.GetNextToken(token);
958                         displayPath.Append(token);
959                         //displayPath.Append(L"\x200E");
960                         displayPath.Append(L"/");
961                         //displayPath.Append(L"\x200E");
962                 }
963         }
964
965         if (__pLabelDisplayPath != null)
966         {
967                 String displayPathToAppend(L"\x200E");
968
969                 __displayPath.Append(displayPath);
970                 displayPathToAppend.Append(__displayPath);
971
972                 __pLabelDisplayPath->SetText(displayPathToAppend);
973                 __pLabelDisplayPath->Invalidate(true);
974         }
975
976
977 #if 0
978         if (pContext != null)
979         {
980                 //UpdateBinding on the target label control.
981                 pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET);
982         }
983
984         if (pContext != null)
985         {
986                 delete pContext;
987         }
988 #endif
989 }
990
991 void
992 SubFolderSelection::OnDataBindingSourceUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName)
993 {
994         //Empty Implementation.
995 }
996
997 void
998 SubFolderSelection::OnDataBindingTargetUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName)
999 {
1000         //Empty Implementation.
1001 }
1002
1003 void
1004 SubFolderSelection::OnDataBindingValidationFailed(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName, Tizen::Ui::DataBindingDestinationType destType)
1005 {
1006         //Empty Implementation.
1007 }
1008
1009 void
1010 SubFolderSelection::OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state)
1011 {
1012         bool setMediaPath = false;
1013         MemoryType currentMemoryType = MEMORY_TYPE_PHONE;
1014         String unmounted = sdCardStatusUnmounted;
1015         String removed = usbDeviceStatusRemoved;
1016         String currentPath;
1017         IList* pArgs = null;
1018
1019         SceneManager* pSceneManager = null;
1020
1021         if (state == unmounted || state == removed)
1022         {
1023                 currentPath = FolderNavigationPresentationModel::GetCurrentPath();
1024                 if (state == unmounted)
1025                 {
1026                         if (currentPath.Contains(BasePresentationModel::GetSdCardPath()))
1027                         {
1028                                 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath());
1029                                 FolderNavigationPresentationModel::SetStorageType(currentMemoryType);
1030                                 setMediaPath = true;
1031                         }
1032                 }
1033
1034                 if (state == removed)
1035                 {
1036                         if (currentPath.Contains(BasePresentationModel::GetUsbPath()))
1037                         {
1038                                 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath());
1039                                 FolderNavigationPresentationModel::SetStorageType(currentMemoryType);
1040                                 setMediaPath = true;
1041                         }
1042                 }
1043
1044                 if (setMediaPath)
1045                 {
1046                         pSceneManager = SceneManager::GetInstance();
1047                         pArgs = new (std::nothrow) ArrayList();
1048                         pArgs->Add(new (std::nothrow) Integer(APPCONTROL_STATE_SELECTED));
1049
1050                         if (pSceneManager != null)
1051                         {
1052                                 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_DESTROY), pArgs);
1053                         }
1054                 }
1055         }
1056 }
1057
1058 void
1059 SubFolderSelection::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state)
1060 {
1061
1062         ComponentType currentDeviceType;
1063         switch (deviceType)
1064         {
1065         case StorageCard:
1066         {
1067                 currentDeviceType = COMPONENT_TYPE_STORAGE_CARD;
1068         }
1069         break;
1070
1071         case UsbClient:
1072         {
1073                 currentDeviceType = COMPONENT_TYPE_USB;
1074         }
1075         break;
1076
1077         default:
1078         {
1079                 //Do Nothing.
1080         }
1081         break;
1082         }
1083         OnDeviceChange(currentDeviceType, state);
1084 }
1085
1086 void
1087 SubFolderSelection::OnPlayerEndOfClip(void)
1088 {
1089         if (_pListView != null)
1090         {
1091                 _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
1092         }
1093 }
1094
1095
1096 void
1097 SubFolderSelection::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId &currentSceneId)
1098 {
1099         AppLogDebug("ENTER");
1100         SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);
1101         AppResource* pAppResource = null;
1102         String importText;
1103         String displayPath;
1104         String phone;
1105         String sdCard;
1106         String external;
1107         String received_Filepath;
1108         int receivedStorageType = -1;
1109         Tizen::Base::String parentPath;
1110         result r = E_SUCCESS;
1111         pAppResource = Application::GetInstance()->GetAppResource();
1112         TryCatch(pAppResource != null, , "Resource manager not found!");
1113
1114                 pAppResource->GetString(L"IDS_COM_OPT_IMPORT", importText);
1115                 pAppResource->GetString(L"IDS_MF_TAB_PHONE", phone);
1116                 pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCard);
1117                 pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", external);
1118                 phone.Append(L"/");
1119                 sdCard.Append(L"/");
1120                 external.Append(L"/");
1121
1122         if (_pListView != null)
1123         {
1124                 _pListView->SetShowState(true);
1125         }
1126
1127         if (__pFileEventManager != null)
1128         {
1129                 delete __pFileEventManager;
1130                 __pFileEventManager = null;
1131
1132         }
1133         __pFileEventManager = new (std::nothrow)FileEventManager();
1134         __pFileEventManager->Construct(*this);
1135
1136         _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath();                   //For Nabi issue related to Selection Form(AppControlView)
1137         r = __pFileEventManager->AddPath(_rootMediaPath, FILE_EVENT_TYPE_MOVED_FROM | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_CREATE );
1138         AppLogDebug("Result is %s",GetErrorMessage(r));
1139
1140 #if 0
1141                 if (_currentViewStyle == APPCONTROL_VIEW_EXPORT || _currentViewStyle == APPCONTROL_VIEW_IMPORT)
1142         {
1143                 AppLogDebug("inside view check");
1144                 String backupPath;
1145                 String backupCalendarpath;
1146                 String backupContactpath;
1147                 backupPath = BasePresentationModel::GetMediaPath();
1148                 backupPath.Append("Backup");
1149                 if (!File::IsFileExist(backupPath))
1150                 {
1151                         Directory::Create(backupPath, true);
1152                 }
1153
1154                 if ((_currentViewStyle == APPCONTROL_VIEW_IMPORT && _currentFileType == FILE_TYPE_CALENDER_TYPE)
1155                                 || (_currentViewStyle == APPCONTROL_VIEW_EXPORT && _currentExportFileType == EXPORT_TYPE_CALENDAR))
1156                 {
1157                         backupCalendarpath.Append(backupPath);
1158                         backupCalendarpath.Append("/");
1159                         backupCalendarpath.Append("Calendar");
1160                         if (!File::IsFileExist(backupCalendarpath))
1161                         {
1162                                 r = Directory::Create(backupCalendarpath, true);
1163                                 AppLogDebug("Result is %s",GetErrorMessage(r));
1164                         }
1165                 }
1166                 if ((_currentViewStyle == APPCONTROL_VIEW_IMPORT && _currentFileType == FILE_TYPE_CONTACTS_TYPE)
1167                                 || (_currentViewStyle == APPCONTROL_VIEW_EXPORT && _currentExportFileType == EXPORT_TYPE_CONTACTS))
1168                 {
1169                         backupContactpath.Append(backupPath);
1170                         backupContactpath.Append("/");
1171                         backupContactpath.Append("Contacts");
1172                         if (!File::IsFileExist(backupContactpath))
1173                         {
1174                                 r = Directory::Create(backupContactpath, true);
1175                                 AppLogDebug("Result is %s",GetErrorMessage(r));
1176                         }
1177                 }
1178
1179                 /*_pFolderEntryPM->SetFolderEntryType(_currentFileType);
1180                                 _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath);
1181                                 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
1182                  */
1183         }
1184 #endif
1185         if (__pReceivedFilename != null)
1186         {
1187                 //pReceived_Filename = static_cast< String* >(pArgs->GetAt(0));
1188                 received_Filepath = FolderNavigationPresentationModel::GetCurrentPath();
1189                 receivedStorageType = FolderNavigationPresentationModel::GetStorageType();
1190
1191                 if (__pReceivedFilename != null && !__pReceivedFilename->IsEmpty())
1192                 {
1193                         _pHeader = GetHeader();
1194                         if (_pHeader != null)
1195                         {
1196                                 _pHeader->SetTitleText(*__pReceivedFilename);
1197                                 _pHeader->Invalidate(true);
1198                         }
1199                 }
1200                 if (received_Filepath != null)
1201                 {
1202
1203                         //Clear the rootMediaPath and set it to the received filepath.
1204                         //if (_rootMediaPath != null)
1205                         {
1206                                 _rootMediaPath.Clear();
1207                                 _rootMediaPath.Append(received_Filepath);
1208                         }
1209
1210                                 if (__pLabelDisplayPath != null)
1211                                 {
1212                                         switch (receivedStorageType)
1213                                         {
1214                                         case MEMORY_TYPE_PHONE:
1215                                         {
1216                                                 __displayPath = phone;
1217                                                 _storageType = MEMORY_TYPE_PHONE;
1218                                                 //AppResource::GetInstance()->GetString(L"IDS_MF_TAB_PHONE", __tabSelected);
1219                                         }
1220                                         break;
1221
1222                                         case MEMORY_TYPE_SD_CARD:
1223                                         {
1224                                                 __displayPath = sdCard;
1225                                                 _storageType = MEMORY_TYPE_SD_CARD;
1226                                                 //AppResource::GetInstance()->GetString(L"IDS_SD_CARD", __tabSelected);
1227                                         }
1228                                         break;
1229
1230                                         case MEMORY_TYPE_EXTERNAL:
1231                                         {
1232                                                 __displayPath = external;
1233                                                 _storageType = MEMORY_TYPE_EXTERNAL;
1234                                         }
1235                                         break;
1236
1237                                         default:
1238                                         {
1239                                                 //Empty Implementation.
1240                                         }
1241                                         break;
1242                                         }
1243
1244                                         //Call the function to set the DisplayPath of the label.
1245                                         SetNextDisplayPath();
1246                                 }
1247
1248                         }
1249                 }
1250                 else
1251                 {
1252                         _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath();
1253                 }
1254
1255                 parentPath.Append(_rootMediaPath);
1256
1257                 if (_pFolderEntryPM != null)
1258                 {
1259                         _pFolderEntryPM->SetFolderEntryPath(parentPath);
1260                         _pFilenames = _pFolderEntryPM->GetFolderEntryList();
1261                         TryCatch(_pFilenames != null, , "Failed to allocate Memory to Filenames ArrayList");
1262                         _pFolderEntryPM->InitThumbnailManager();
1263                 }
1264
1265         if (_pListView != null)
1266         {
1267                 _pListView->UpdateList();
1268         }
1269
1270         DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
1271         AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
1272         return;
1273 CATCH:
1274         AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
1275 }
1276
1277 void
1278 SubFolderSelection::OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId &currentSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId)
1279 {
1280
1281 }
1282 void SubFolderSelection::OnPlayerAudioFocusChanged (void)
1283 {
1284         int AudioPlayerState = _pAudioPlayer->GetState();
1285
1286         AppLogDebug("SubFolderSelectionForm %d ++", AudioPlayerState);
1287         if (AudioPlayerState == PLAYER_STATE_PAUSED)
1288         {
1289                 AppLogDebug("Pause");
1290                 AppLogDebug("Refreshing  %d", _currentAudioPlayIndex);
1291                 _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
1292         }
1293
1294         AppLogDebug("SubFolderSelectionForm--");
1295 }
1296
1297 void
1298 SubFolderSelection::OnFileEventOccured(const unsigned long events,const Tizen::Base::String &  path, const unsigned int eventId)
1299 {
1300         AppLogDebug("SubFolderSelection::OnFileEventOccured:%S", path.GetPointer());
1301
1302         if (_pAudioPlayer != null)
1303         {
1304                 if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING || _pAudioPlayer->GetState() == PLAYER_STATE_PAUSED)
1305                 {
1306                         _pAudioPlayer->Stop();
1307                         _pAudioPlayer->Close();
1308                         _currentAudioPlayIndex = -1;
1309                         _previousAudioSelected = -1;
1310                 }
1311         }
1312
1313         ShowParentDirectoryView();
1314
1315 #if 0
1316 /*      if ((events & FILE_EVENT_TYPE_MOVED_FROM) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_TO ) || (events & FILE_EVENT_TYPE_CREATE))
1317         {
1318                 if (_pFolderEntryPM!=null)
1319                 {
1320                         _pFolderEntryPM->RefreshFolderEntries();
1321                 }
1322
1323                 if (_pListView != null && _pListView->IsVisible())
1324                 {
1325                         _pListView->UpdateList();
1326                 }
1327
1328                 ResetFooter();
1329
1330                 if (_pFolderEntryPM!=null)
1331                 {
1332                         _pFolderEntryPM->InitThumbnailManager();
1333                 }
1334         }*/
1335 #endif
1336
1337 }
1338
1339 void
1340 SubFolderSelection::OnAudioNotificationReceived(void)
1341 {
1342         int AudioPlayerState;
1343
1344         if (_pAudioPlayer != null)
1345         {
1346                 AudioPlayerState = _pAudioPlayer->GetState();
1347                 if (AudioPlayerState == PLAYER_STATE_PLAYING)
1348                 {
1349                         _pAudioPlayer->Pause();
1350                         _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
1351                 }
1352         }
1353 }