4060e01763f4ea146373180be9d0f953badb4233
[apps/osp/MyFiles.git] / src / MfSplitPanelForm.cpp
1 //
2 // Tizen Native SDK
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /*@file: MfSplitPanelForm.cpp
19  *@brief: This file contains the implementation of the MfSplitPanelForm class,
20  which is the landscape view for the application.
21  */
22
23 #include "MfSplitPanelForm.h"
24
25 using namespace Tizen::App;
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Collection;
28 using namespace Tizen::Base::Utility;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::Io;
31 using namespace Tizen::System;
32 using namespace Tizen::Ui;
33 using namespace Tizen::Ui::Controls;
34 using namespace Tizen::Ui::Scenes;
35
36 SplitPanelForm::SplitPanelForm(void)
37         : __pSplitPanel(null)
38         , __pFirstPanePanel(null)
39         , __pSecondPanePanel(null)
40         , __pHeader(null)
41         , __pUpButton(null)
42         , __pHomeButton(null)
43         , __pDirectoryTreeProvider(null)
44         , __pDirectoryTreePM(null)
45         , __pDirectoryTreeItemProvider(null)
46         , __pDirectoryList(null)
47         ,_pFileEventManager(null)
48         , __dirTreeCurrentSelection(0)
49         , __selectedIndex(0)
50 {
51 }
52
53 SplitPanelForm::~SplitPanelForm(void)
54 {
55 }
56
57 bool
58 SplitPanelForm::Initialize(void)
59 {
60         AppLogDebug("ENTER");
61         Form::Construct(L"IDL_SPLIT_PANEL");
62         return true;
63 }
64
65 result
66 SplitPanelForm::OnInitializing(void)
67 {
68         AppLogDebug("ENTER");
69         result r = E_SUCCESS;
70         //AddOrientationEventListener(*this);
71         SetFormBackEventListener(this);
72
73         //initialize header
74         __pHeader = GetHeader();
75         if (__pHeader != null)
76         {
77                 __pHeader->SetTitleText("MyFiles");
78                 __pHomeButton = new (std::nothrow) ButtonItem();
79                 __pHomeButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_HOME);
80                 __pHomeButton->SetText(L"Home");
81
82                 __pUpButton = new (std::nothrow) ButtonItem();
83                 __pUpButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_UP);
84                 __pUpButton->SetText("Up");
85
86                 __pHeader->AddActionEventListener(*this);
87         }
88         //initialize footer
89         CreateFooterControls();
90
91         //Rectangle clientBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height);
92         int sourceForm = THUMBNAIL_PROVIDER_SOURCEID_SPLIT_PANEL_FORM;
93
94         //initialize presentation models
95         __currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
96         if (_pFolderEntryPM == null)
97         {
98                 _pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel();
99                 AppAssert(_pFolderEntryPM != null);
100                 r = _pFolderEntryPM->Construct();
101                 AppAssert(r==E_SUCCESS);
102                 _pFolderEntryPM->SetSourceForm(CREATE_ITEM_SOURCE_SPLIT_PANEL_LIST);
103         }
104         _pFolderEntryPM->SetFolderEntryPath(__currentDirectoryPath);
105         _pFilenames = _pFolderEntryPM->GetFolderEntryList();
106
107         //initialize itemproviders
108         _pBaseItemProvider = new (std::nothrow) BaseItemProvider();
109         _pBaseItemProvider->Construct();
110         _pBaseItemProvider->SetSourceForm(CREATE_ITEM_SOURCE_SPLIT_PANEL_LIST);
111         _pBaseItemProvider->SetFolderEntryProvider(this);
112
113         //initialize pm, item provider and listner for directory tree
114         __pDirectoryTreePM = new (std::nothrow) FolderEntryPresentationModel();
115         AppAssert(__pDirectoryTreePM != null);
116         __pDirectoryTreePM->Construct();
117         __pDirectoryTreePM->SetSourceForm(CREATE_ITEM_SOURCE_SPLIT_PANEL_DIR_TREE);
118         __pDirectoryTreePM->SetFolderEntryPath(BasePresentationModel::GetMediaPath());
119         __pDirectoryTreePM->SetSortEnabled(false);
120         __pDirectoryList = __pDirectoryTreePM->GetFolderEntryList();
121         //add root directory
122         DirectoryEntry* pRootDirectory = new (std::nothrow) DirectoryEntry();
123         pRootDirectory->SetFullFilePath(BasePresentationModel::GetMediaPath());
124         pRootDirectory->SetFileName(L"Phone");
125         pRootDirectory->SetDirectoryOpenStatus(true);
126         pRootDirectory->SetCheckDirectory(true);
127         __pDirectoryList->InsertAt(pRootDirectory,0);
128
129         __pDirectoryTreeProvider = new (std::nothrow) DirectoryTreeProvider(__pDirectoryTreePM);
130         __pDirectoryTreeItemProvider = new (std::nothrow) BaseItemProvider();
131         __pDirectoryTreeItemProvider->Construct();
132         __pDirectoryTreeItemProvider->SetSourceForm(CREATE_ITEM_SOURCE_SPLIT_PANEL_DIR_TREE);
133         __pDirectoryTreeItemProvider->SetFolderEntryProvider(__pDirectoryTreeProvider);
134
135         _pThumbnailItemProvider = new (std::nothrow) ThumbnailItemProviderAndListener(__currentDirectoryPath, sourceForm);
136         _pThumbnailItemProvider->SetFolderEntryProvider(this);
137         _pThumbnailItemProvider->SetFooterItemStateChangeListener(this);
138
139         if (_pCustomListViewForPopup == null)
140         {
141                 _pCustomListViewForPopup = new (std::nothrow) CustomListViewForPopup();
142         }
143         _pCustomListViewForPopup->SetEventListener(this);
144
145         CreateViewAsPopupControl();
146         CreateFileProgressingPopup();
147         CreateDeleteConfirmationPopUp();
148
149         //create panel
150         __pFirstPanePanel = new (std::nothrow) Panel();
151         __pFirstPanePanel->Construct(Rectangle(0,0,GetClientAreaBounds().width, GetClientAreaBounds().height), GROUP_STYLE_NONE);
152
153         __pSecondPanePanel = new (std::nothrow) Panel();
154         __pSecondPanePanel->Construct(Rectangle(0,0,GetClientAreaBounds().width, GetClientAreaBounds().height), GROUP_STYLE_NONE);
155
156         __pDirTreeListView = new (std::nothrow) ListView();
157         __pDirTreeListView->Construct(Rectangle(__pFirstPanePanel->GetBounds()), true, false);
158         __pDirTreeListView->SetTextOfEmptyList(L"No Files!");
159         __pDirTreeListView->SetItemProvider(*__pDirectoryTreeItemProvider);
160         __pDirTreeListView->AddListViewItemEventListener(*this);
161         __pDirTreeListView->SetBackgroundColor(Color::GetColor(COLOR_ID_WHITE));
162         __pDirTreeListView->SetSweepEnabled(false);
163
164         _pListView = new (std::nothrow) ListView();
165         _pListView->Construct(Rectangle(0, H_DISPLAY_PATH_LABEL, __pSecondPanePanel->GetBounds().width, __pSecondPanePanel->GetBounds().height - H_DISPLAY_PATH_LABEL), true, false);
166         _pListView->SetTextOfEmptyList(L"No Files!");
167         _pListView->SetItemProvider(*_pBaseItemProvider);
168         _pListView->AddListViewItemEventListener(*this);
169         _pListView->SetBackgroundColor(Color::GetColor(COLOR_ID_WHITE));
170
171         _pIconListView = new (std::nothrow) IconListView();
172         _pIconListView->Construct(Rectangle(0, H_DISPLAY_PATH_LABEL, __pSecondPanePanel->GetBounds().width, __pSecondPanePanel->GetBounds().height - H_DISPLAY_PATH_LABEL),
173                         Dimension(160,160),
174                         ICON_LIST_VIEW_STYLE_NORMAL,
175                         ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL,
176                         ICON_LIST_SCROLL_STYLE_FIXED);
177         _pIconListView->SetItemSpacing(10, 10);
178         _pIconListView->SetBackgroundColor(Color::GetColor(COLOR_ID_WHITE));
179         _pIconListView->SetItemTextColor(ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL, Color::GetColor(COLOR_ID_BLACK));
180         _pIconListView->SetItemTextSize(36);
181         _pIconListView->SetTextOfEmptyList(L"No Files!");
182         _pIconListView->SetTextVerticalAlignment(ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_BOTTOM);
183         _pIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_SHADOW);
184         _pIconListView->SetItemProvider(*_pThumbnailItemProvider);
185         _pIconListView->AddIconListViewItemEventListener(*this);
186
187         __pFirstPanePanel->AddControl(*__pDirTreeListView);
188         __pSecondPanePanel->AddControl(*_pListView);
189         __pSecondPanePanel->AddControl(*_pIconListView);
190
191         _pLabelDisplayPath = new (std::nothrow) Label();
192         _pLabelDisplayPath->Construct(Rectangle(0, 0, __pSecondPanePanel->GetBounds().width, H_DISPLAY_PATH_LABEL),__currentDirectoryPath);//>SetBounds(0, 0, __pSecondPanePanel->GetBounds().width, H_DISPLAY_PATH_LABEL);
193         _pLabelDisplayPath->SetBackgroundColor(Color(IDC_RGB_GREY,IDC_RGB_GREY,IDC_RGB_GREY));
194         _pLabelDisplayPath->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
195         _pLabelDisplayPath->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
196         __pSecondPanePanel->AddControl(*_pLabelDisplayPath);
197
198         int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
199         AppRegistry* pAppRegistry = null;
200         pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
201         pAppRegistry->Get(L"ListDisplayType", listViewDisplayType);
202         if (listViewDisplayType == VIEW_TYPE_AS_NORMAL_LIST || listViewDisplayType == VIEW_TYPE_AS_DETAILED_LIST)
203         {
204                 _pIconListView->SetShowState(false);
205         }
206         else
207         {
208                 _pListView->SetShowState(false);
209         }
210
211         __pSplitPanel = new (std::nothrow) SplitPanel();
212         __pSplitPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), SPLIT_PANEL_DIVIDER_STYLE_MOVABLE, SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL );
213         __pSplitPanel->AddSplitPanelEventListener(*this);
214         __pSplitPanel->SetDividerPosition(GetClientAreaBounds().width / 3);
215         __pSplitPanel->SetPane(__pFirstPanePanel, SPLIT_PANEL_PANE_ORDER_FIRST);
216         __pSplitPanel->SetPane(__pSecondPanePanel, SPLIT_PANEL_PANE_ORDER_SECOND);
217
218         AddControl(*__pSplitPanel);
219         _pFileManager = FolderEntryEditorPresentationModel::GetInstance();
220
221         return r;
222 }
223
224 result
225 SplitPanelForm::OnTerminating(void)
226 {
227         return E_SUCCESS;
228 }
229
230 void
231 SplitPanelForm::OnActionPerformed(const Control& source, int actionId)
232 {
233         String rootPath;
234         String displayPath;
235         String tabSelected;
236
237         switch (actionId)
238         {
239         case IDA_BTN_HOME:
240         {
241                 //ShowHomeView();
242                 String homeRootPath;
243                 homeRootPath.Append(__currentDirectoryPath);
244                 while ((homeRootPath != BasePresentationModel::GetMediaPath()) && (homeRootPath != BasePresentationModel::GetSdCardPath()))
245                 {
246                         FolderNavigationPresentationModel::SetCurrentFilePath(homeRootPath);
247                         homeRootPath.Clear();
248                         homeRootPath = FolderNavigationPresentationModel::GetParentPath();
249                 }
250                 FolderNavigationPresentationModel::SetCurrentFilePath(homeRootPath);
251                 ShowHomeView();
252         }
253         break;
254         case IDA_BTN_UP:
255         {
256                 bool searchHistory = CheckSearchHistory();
257                 String previousPath;
258                 if (searchHistory)
259                 {
260                         previousPath = FolderNavigationPresentationModel::GetCurrentPath();
261                         AppLogDebug("previousPath is %S", previousPath.GetPointer());
262                         FolderNavigationPresentationModel::SetSearchPreviousPath(previousPath);
263                 }
264                 ShowParentDirectoryView();
265                 //update display label with current path
266                 _displayPath = __rootDirectory;
267                 _displayPath.Append(L"/");
268                 SetNextDisplayPath();
269         }
270         break;
271         case IDA_CONTEXT_MENU_HIDE_EXTENSION:
272         {
273                 __currentDirectoryPath.Clear();
274                 __currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
275
276                 if (_pFolderEntryPM != null)
277                 {
278                         _pFolderEntryPM->SetFolderEntryPath(__currentDirectoryPath);
279                         _pFilenames = _pFolderEntryPM->GetFolderEntryList();
280                 }
281                 HideFileExtension();
282         }
283         break;
284         case IDA_CONTEXT_MENU_SHOW_EXTENSION:
285         {
286                 __currentDirectoryPath.Clear();
287                 __currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
288
289                 if (_pFolderEntryPM != null)
290                 {
291                         _pFolderEntryPM->SetFolderEntryPath(__currentDirectoryPath);
292                         _pFilenames = _pFolderEntryPM->GetFolderEntryList();
293                 }
294                 ShowFileExtension();
295         }
296         break;
297         default:
298         {
299                 SubBaseOnActionPerformed(source, actionId);
300         }
301         break;
302         }
303         __pFirstPanePanel->Invalidate(true);
304         __pSecondPanePanel->Invalidate(true);
305         return;
306 }
307
308 void
309 SplitPanelForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
310 {
311         AppLogDebug("ENTER");
312
313         switch (orientationStatus)
314         {
315         case ORIENTATION_STATUS_PORTRAIT:
316         {
317                 ChangeOrientationToPortrait();
318         }
319         break;
320         default:
321         break;
322         }
323 }
324
325 void
326 SplitPanelForm::ChangeOrientationToPortrait(void)
327 {
328         AppLogDebug("ENTER");
329         SceneManager* pSceneManager = SceneManager::GetInstance();
330         String checkPath = FolderNavigationPresentationModel::GetCurrentPath();
331
332         if (checkPath == BasePresentationModel::GetMediaPath() || checkPath == BasePresentationModel::GetSdCardPath())
333         {
334                 if (pSceneManager != null)
335                 {
336                         if (pSceneManager->IsSceneAlive(IDSCN_ROOT_DIRECTORY_FORM))
337                         {
338                                 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ROOT_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_NONE), null);
339                         }
340                         else
341                         {
342                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ROOT_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_NONE), null);
343                         }
344                 }
345         }
346         else
347         {
348                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_NONE), null);
349         }
350 }
351
352 void
353 SplitPanelForm::OnDividerPositionChanged(SplitPanel& source, int position)
354 {
355         int dividerPosition;
356
357         dividerPosition = source.GetDividerPosition();
358         AppLogDebug("Divider Position = %d", dividerPosition);
359
360         TryCatch(__pFirstPanePanel != null, , "MfMyFilesApp::First Pane in SplitPanel is null");
361         TryCatch(__pSecondPanePanel != null, , "MfMyFilesApp::Second Pane in SplitPanel is null");
362
363         __pFirstPanePanel->SetBounds(Rectangle(0,0,dividerPosition, GetClientAreaBounds().height));
364         __pSecondPanePanel->SetBounds(Rectangle(dividerPosition + 13,0,GetClientAreaBounds().width - dividerPosition - 13, GetClientAreaBounds().height));
365
366         if (_pListView != null)
367         {
368                 _pListView->SetBounds(Rectangle(0, H_DISPLAY_PATH_LABEL, __pSecondPanePanel->GetBounds().width, __pSecondPanePanel->GetBounds().height - H_DISPLAY_PATH_LABEL));
369
370         }
371         if (_pIconListView != null)
372         {
373                 _pIconListView->SetBounds(Rectangle(0, H_DISPLAY_PATH_LABEL, __pSecondPanePanel->GetBounds().width, __pSecondPanePanel->GetBounds().height - H_DISPLAY_PATH_LABEL));
374
375         }
376         if (__pDirTreeListView != null)
377         {
378                 __pDirTreeListView->SetBounds(Rectangle(__pFirstPanePanel->GetBounds()));
379
380         }
381
382         __pFirstPanePanel->Invalidate(true);
383         __pSecondPanePanel->Invalidate(true);
384
385         AppLogDebug("EXIT");
386         return;
387
388 CATCH:
389         return;
390 }
391
392 void
393 SplitPanelForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
394 {
395         if (&listView == __pDirTreeListView)
396         {
397                 UpdateListsOnDirTreeSelection(index);
398         }
399         else
400         {
401                 DirectoryEntry* pDirEntry;
402                 pDirEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
403                 if (pDirEntry->IsDirectory() == true)
404                 {
405                         UpdateListsOnFolderSelection(index);
406                 }
407                 else
408                 {
409                         _pathOfSelectedFile = pDirEntry->GetFullFilePath();
410                         __selectedIndex = index;
411                         OpenFile();
412                 }
413         }
414         SetHeaderTitleText(__currentDirectoryPath);
415         _displayPath = __rootDirectory;
416         _displayPath.Append(L"/");
417         SetNextDisplayPath();
418         return;
419 }
420
421 void
422 SplitPanelForm::OnIconListViewItemStateChanged(IconListView& listView, int index, IconListViewItemStatus status)
423 {
424         AppLogDebug("ENTER");
425         if (_pFilenames == null)
426         {
427                 return;
428         }
429
430         DirectoryEntry* pDirEntry;
431         pDirEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
432         if (pDirEntry->IsDirectory() == true)
433         {
434                 UpdateListsOnFolderSelection(index);
435                 _displayPath = __rootDirectory;
436                 _displayPath.Append(L"/");
437                 SetNextDisplayPath();
438         }
439         else
440         {
441                 AppLogDebug("not directory");
442                 _pathOfSelectedFile = pDirEntry->GetFullFilePath();
443                 __selectedIndex = index;
444                 OpenFile();
445         }
446         return;
447 }
448
449 void
450 SplitPanelForm::OpenFile()
451 {
452         if (_pathOfSelectedFile.EndsWith(L".tpk"))
453         {
454                 //Will Handle Later
455         }
456         else
457         {
458                 CustomAppControl* customAppControl = CustomAppControl::GetInstance();
459                 if (customAppControl != null)
460                 {
461                         customAppControl->SetAppControlListener(this);
462                         AppControl* pAppControlInUse = customAppControl->LaunchAppControl(_pathOfSelectedFile);
463                         if (pAppControlInUse != null)
464                         {
465                                 CustomAppControl::SetAppControlInUse(pAppControlInUse);
466                         }
467                 }
468         }
469 }
470
471 void
472 SplitPanelForm::UpdateListsOnDirTreeSelection(int index)
473 {
474         DirectoryEntry* pDirStr = null;
475         if (__pDirectoryList == null)
476         {
477                 return;
478         }
479         pDirStr = static_cast< DirectoryEntry* >(__pDirectoryList->GetAt(index));
480
481         //update right pane
482         RefreshIconListView(pDirStr);
483
484         //update the directory tree
485         if (pDirStr->IsDirectoryOpened() == false)
486         {
487                 __pDirectoryTreePM->AddFolderEntryList(__currentDirectoryPath,index);
488                 pDirStr->SetDirectoryOpenStatus(true);
489         }
490         else if (__dirTreeCurrentSelection == index)
491         {
492                 __pDirectoryTreePM->RemoveFolderEntryList(index);
493                 pDirStr->SetDirectoryOpenStatus(false);
494         }
495         if (__pDirTreeListView != null)
496         {
497                 __pDirTreeListView->UpdateList();
498         }
499         __dirTreeCurrentSelection = index;
500         __pFirstPanePanel->Invalidate(true);
501         __pSecondPanePanel->Invalidate(true);
502         return;
503 }
504
505 void
506 SplitPanelForm::UpdateListsOnFolderSelection(int index)
507 {
508         AppLogDebug("__dirTreeCurrentSelection = %d", __dirTreeCurrentSelection);
509         DirectoryEntry* pDirEntryList = null;
510         String selectedFilePath = null;
511         if (_pFilenames != null)
512         {
513                 pDirEntryList = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
514                 selectedFilePath = pDirEntryList->GetFullFilePath();
515                 //update right pane
516                 RefreshIconListView(pDirEntryList);
517         }
518
519         //update left pane: directory tree
520         DirectoryEntry* pDirTreeEntry = null;
521         if (__pDirectoryList != null)
522         {
523                 pDirTreeEntry = static_cast< DirectoryEntry* >(__pDirectoryList->GetAt(__dirTreeCurrentSelection));
524                 if (pDirTreeEntry->IsDirectoryOpened() == false)
525                 {//if current selected dir is not opened, open it
526                         __pDirectoryTreePM->AddFolderEntryList(pDirTreeEntry->GetFullFilePath(),__dirTreeCurrentSelection);
527                         pDirTreeEntry->SetDirectoryOpenStatus(true);
528                         __dirTreeCurrentSelection = __pDirectoryTreePM->GetDirectoryTreeIndex(selectedFilePath, __dirTreeCurrentSelection + 1);
529                 }
530                 else
531                 {//if current dir is already opened, open sub dir if the sub directory is not yet opened
532                         __dirTreeCurrentSelection = __pDirectoryTreePM->GetDirectoryTreeIndex(selectedFilePath, __dirTreeCurrentSelection + 1);
533                         pDirTreeEntry = static_cast< DirectoryEntry* >(__pDirectoryList->GetAt(__dirTreeCurrentSelection));
534                         if (pDirTreeEntry->IsDirectoryOpened() == false)
535                         {
536                                 __pDirectoryTreePM->AddFolderEntryList(pDirTreeEntry->GetFullFilePath(),__dirTreeCurrentSelection);
537                                 pDirTreeEntry->SetDirectoryOpenStatus(true);
538                         }
539                 }
540         }
541         if (__pDirTreeListView != null)
542         {
543                 __pDirTreeListView->UpdateList();
544         }
545         __pFirstPanePanel->Invalidate(true);
546         __pSecondPanePanel->Invalidate(true);
547
548         if (_pFileEventManager != null)
549         {
550                 delete _pFileEventManager;
551                 _pFileEventManager = null;
552
553         }
554         _pFileEventManager = new (std::nothrow)FileEventManager();
555         _pFileEventManager->Construct(*this);
556
557         _pFileEventManager->AddPath(__currentDirectoryPath, FILE_EVENT_TYPE_ATTRIBUTE | FILE_EVENT_TYPE_DELETE );
558
559         return;
560 }
561
562 void
563 SplitPanelForm::RefreshIconListView(DirectoryEntry* pDirStr)
564 {
565         AppLogDebug("ENTER");
566
567         if (pDirStr != null)
568         {
569                 if (pDirStr->IsDirectory())
570                 {
571                         __currentDirectoryPath = pDirStr->GetFullFilePath();
572                         _currentFileName.Clear();
573                         _currentFileName = pDirStr->GetFileName();
574
575                         FolderNavigationPresentationModel::SetCurrentFilePath(__currentDirectoryPath);
576
577
578                         if (_pFolderEntryPM != null)
579                         {
580                                 _pFolderEntryPM->SetFileEventListener(null);
581                                 _pFolderEntryPM->SetFolderEntryPath(__currentDirectoryPath);
582                                 _pFolderEntryPM->InitThumbnailManager();
583                                 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
584                                 TryCatch(_pFilenames != null, , "MfMyFilesApp::Failed to allocate Memory to Filenames ArrayList");
585                                 if (_pFilenames->GetCount() == 0)
586                                 {
587                                         SetFooterVisibility(DISABLE_FOOTER_ITEM);
588                                 }
589                                 else
590                                 {
591                                         SetFooterVisibility(ENABLE_FOOTER_ITEM);
592                                 }
593                         }
594                 }
595         }
596         if (_pListView != null && _pListView->IsVisible())
597         {
598                 _pListView->UpdateList();
599         }
600         if (_pIconListView != null && _pIconListView->IsVisible())
601         {
602                 _pIconListView->UpdateList();
603         }
604         return;
605
606         CATCH:
607         if (_pFolderEntryPM != null)
608         {
609                 delete _pFolderEntryPM;
610                 _pFolderEntryPM = null;
611         }
612         return;
613 }
614
615 void
616 SplitPanelForm::ShowParentDirectoryView(void)
617 {
618         AppLogDebug("ENTER");
619         String displayPath;
620         String pPoppedPath;
621         String backupCurrentPath;
622
623         backupCurrentPath = FolderNavigationPresentationModel::GetCurrentPath();
624
625         if (backupCurrentPath == BasePresentationModel::GetMediaPath() || backupCurrentPath == BasePresentationModel::GetSdCardPath())
626         {
627                 ShowHomeView();
628                 return;
629         }
630         else
631         {
632                 //set current path
633                 String parentPath;
634                 parentPath = FolderNavigationPresentationModel::GetParentPath();
635                 __currentDirectoryPath.Clear();
636                 __currentDirectoryPath.Append(parentPath);
637                 FolderNavigationPresentationModel::SetCurrentFilePath(__currentDirectoryPath);
638                 //SetParentDisplayPath();
639                 SetHeaderTitleText(parentPath);
640
641                 //update the current files from the filenames list
642                 if (_pFolderEntryPM != null)
643                 {
644                         _pFolderEntryPM->SetFolderEntryPath(parentPath);
645                         //Get the files in the parent path of the current view
646                         _pFilenames = _pFolderEntryPM->GetFolderEntryList();
647                         TryCatch(_pFilenames != null, , "Failed to fetch ArrayList from the ContentBrowser!");
648                         _pFolderEntryPM->InitThumbnailManager();
649                 }
650
651                 SetFooterVisibility(ENABLE_FOOTER_ITEM);
652                 if (_pFooter != null)
653                 {
654                         _pFooter->RequestRedraw(true);
655                 }
656
657                 //Update the icon list to view the files of the parent directory
658                 if (__pDirTreeListView != null)
659                 {
660                         __pDirTreeListView->UpdateList();
661                 }
662                 if (_pListView != null && _pListView->IsVisible())
663                 {
664                         _pListView->UpdateList();
665                 }
666                 if (_pIconListView != null && _pIconListView->IsVisible())
667                 {
668                         _pIconListView->UpdateList();
669                 }
670                 __pFirstPanePanel->Invalidate(true);
671                 __pSecondPanePanel->Invalidate(true);
672
673                 __dirTreeCurrentSelection = __pDirectoryTreePM->GetDirectoryTreeIndex(__currentDirectoryPath, 1);
674         }
675         return;
676
677         CATCH:
678         if (_pFolderEntryPM != null)
679         {
680                 delete _pFolderEntryPM;
681                 _pFolderEntryPM = null;
682         }
683 }
684
685 result
686 SplitPanelForm::ShowHomeView(void)
687 {
688         AppLogDebug("Enter");
689         SceneManager* pSceneManager = null;
690         result r = E_SUCCESS;
691         pSceneManager = SceneManager::GetInstance();
692         if (pSceneManager != null)
693         {
694                 if (CheckSearchHistory())
695                 {
696                         r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
697                         TryCatch(r == E_SUCCESS, , "scene transition failed");
698                 }
699                 else
700                 {
701                         r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_DESTROY), null);
702                         TryCatch(r == E_SUCCESS, , "scene transition failed");
703                 }
704         }
705
706         if (_pFolderEntryPM != null)
707         {
708                 _pFolderEntryPM->InitThumbnailManager();
709         }
710
711         AppLogDebug("Exit");
712         return r;
713 CATCH:
714         return r;
715 }
716
717 void
718 SplitPanelForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
719 {
720         AppLogDebug("ENTER");
721
722         ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
723
724         int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
725         int fileCount = 0;
726         int folderCount = 0;
727         int sourceForm = THUMBNAIL_PROVIDER_SOURCEID_SPLIT_PANEL_FORM;
728
729         String viewStyleKeyName(L"ListDisplayType");
730
731         AppResource* pAppResource = null;
732         AppRegistry* pAppRegistry = null;
733
734         pAppResource = UiApp::GetInstance()->GetAppResource();
735         //TryCatch(pAppResource != null, , "Failed to fetch AppResource");
736         pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
737         pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
738         _flagViewAsStatus = listViewDisplayType;
739         __currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
740
741         //update header
742         SetHeaderTitleText(__currentDirectoryPath);
743         __pHeader->SetButton(BUTTON_POSITION_LEFT, *__pHomeButton);
744         __pHeader->SetButton(BUTTON_POSITION_RIGHT, *__pUpButton);
745         __pHeader->RequestRedraw(true);
746
747         if (_pMoreContextMenu != null)
748         {
749                 _pMoreContextMenu->SetShowState(false);
750         }
751
752         //update iconlistview list
753         if (_pFolderEntryPM != null)
754         {
755                 _pFolderEntryPM->SetFolderEntryPath(__currentDirectoryPath);
756                 _pFolderEntryPM->GetFolderEntryCount(__currentDirectoryPath,folderCount, fileCount);
757
758                 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
759         }
760
761         if (_pThumbnailItemProvider)
762         {
763                 _pThumbnailItemProvider->SetCreateItemSource(sourceForm);
764         }
765
766         //update footer
767         if (_pFilenames->GetCount() == 0)
768         {
769                 SetFooterVisibility(DISABLE_FOOTER_ITEM);
770         }
771         else
772         {
773                 SetFooterVisibility(ENABLE_FOOTER_ITEM);
774
775                 if (fileCount == 0)
776                 {
777                         _pFooter = GetFooter();
778                         if (_pFooter)
779                         {
780                                 _pFooter->SetItemEnabled(1, false);
781                         }
782                 }
783         }
784
785         //update directorytree
786         DirectoryEntry* pRootDirectory = new (std::nothrow) DirectoryEntry();
787         switch (FolderNavigationPresentationModel::GetStorageType())
788         {
789         case MEMORY_TYPE_PHONE:
790         {
791                 __pDirectoryTreePM->SetFolderEntryPath(BasePresentationModel::GetMediaPath());
792                 pRootDirectory->SetFullFilePath(BasePresentationModel::GetMediaPath());
793                 pAppResource->GetString(L"IDS_MF_TAB_PHONE", __rootDirectory);
794         }
795         break;
796
797         case MEMORY_TYPE_SD_CARD:
798         {
799                 __pDirectoryTreePM->SetFolderEntryPath(BasePresentationModel::GetSdCardPath());
800                 pRootDirectory->SetFullFilePath(BasePresentationModel::GetSdCardPath());
801                 //pRootDirectory->SetFileName(defaultSdCardBody);
802                 pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", __rootDirectory);
803         }
804         break;
805
806         case MEMORY_TYPE_EXTERNAL:
807         {
808                 __pDirectoryTreePM->SetFolderEntryPath(BasePresentationModel::GetUsbPath());
809                 pRootDirectory->SetFullFilePath(BasePresentationModel::GetUsbPath());
810                 //pRootDirectory->SetFileName(defaultExternalStorageBody);
811                 pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", __rootDirectory);
812         }
813         break;
814
815         default:
816         break;
817         }
818
819         //set the folder path to be displayed
820         _displayPath = __rootDirectory;
821         _displayPath.Append(L"/");
822         SetNextDisplayPath();
823
824         //set the root directory for the directory tree
825         pRootDirectory->SetFileName(__rootDirectory);
826         pRootDirectory->SetDirectoryOpenStatus(true);
827         pRootDirectory->SetCheckDirectory(true);
828         //construct directory tree
829         __pDirectoryList = __pDirectoryTreePM->GetFolderEntryList();
830         __pDirectoryList->InsertAt(pRootDirectory,0);
831         ConstructDirTreeList(__currentDirectoryPath);
832         if (__pDirTreeListView != null)
833         {
834                 __pDirTreeListView->UpdateList();
835         }
836
837         //update iconlist view
838         if (_pListView != null && _pListView->IsVisible())
839         {
840                 _pListView->UpdateList();
841         }
842
843         if (_pIconListView != null && _pIconListView->IsVisible())
844         {
845                 _pIconListView->UpdateList();
846         }
847
848         _pFolderEntryPM->InitThumbnailManager();
849         __pFirstPanePanel->Invalidate(true);
850         __pSecondPanePanel->Invalidate(true);
851
852         if (_pFileManager != null)
853         {
854                 _pFileManager->SetFileManagingListener(this);
855         }
856
857         if (pArgs != null)
858         {
859                 pArgs->RemoveAll(false);
860                 delete pArgs;
861         }
862         return;
863 }
864
865 void
866 SplitPanelForm::SetHeaderTitleText(String& filePath)
867 {
868         String token;
869         String parentFileName;
870         String delimiter(L"/");
871         StringTokenizer tokenizer(filePath, delimiter);
872
873         AppResource* pAppResource = null;
874         pAppResource = UiApp::App::GetInstance()->GetAppResource();
875
876         //pAppResource->GetString(L"IDS_MF_TAB_UP", buttonUp);
877         if (pAppResource != null)
878         {
879                 pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", _hideExtension);
880         }
881
882         if (filePath == BasePresentationModel::GetMediaPath())
883         {
884                 if (pAppResource != null)
885                 {
886                         pAppResource->GetString(L"IDS_MF_TAB_PHONE", parentFileName);
887                 }
888         }
889         else if (filePath == BasePresentationModel::GetSdCardPath())
890         {
891                 if (pAppResource != null)
892                 {
893                         pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", parentFileName);
894                 }
895         }
896         else
897         {
898                 while (tokenizer.HasMoreTokens())
899                 {
900                         int tokenCount = tokenizer.GetTokenCount();
901
902                         if (tokenCount == 1)
903                         {
904                                 tokenizer.GetNextToken(parentFileName);
905                         }
906                         else
907                         {
908                                 tokenizer.GetNextToken(token);
909                         }
910                 }
911         }
912
913         __pHeader = GetHeader();
914         if (__pHeader != null)
915         {
916                 if (!parentFileName.IsEmpty())
917                 {
918                         __pHeader->SetTitleText(parentFileName);
919                         __pHeader->Invalidate(true);
920                 }
921         }
922 }
923
924 void SplitPanelForm::ConstructDirTreeList(String rootMediaPath)
925 {
926         AppLogDebug("__dirTreeCurrentSelection = %d", __dirTreeCurrentSelection);
927
928         if (rootMediaPath == BasePresentationModel::GetMediaPath() || rootMediaPath == BasePresentationModel::GetSdCardPath())
929         {
930                 __dirTreeCurrentSelection = 0;
931                 return;
932         }
933
934         FolderNavigationPresentationModel::SetCurrentFilePath(rootMediaPath);
935         ConstructDirTreeList(FolderNavigationPresentationModel::GetParentPath());
936         FolderNavigationPresentationModel::SetCurrentFilePath(rootMediaPath);
937
938         __dirTreeCurrentSelection = __pDirectoryTreePM->GetDirectoryTreeIndex(rootMediaPath, __dirTreeCurrentSelection + 1);
939         DirectoryEntry* pDirTreeEntry = static_cast< DirectoryEntry* >(__pDirectoryList->GetAt(__dirTreeCurrentSelection));
940
941         //if dir is opened, close and open it again, as the dir structure might have changed (onSceneActivated)
942         if (pDirTreeEntry->IsDirectoryOpened() == true)
943         {
944                 __pDirectoryTreePM->RemoveFolderEntryList(__dirTreeCurrentSelection);
945         }
946         __pDirectoryTreePM->AddFolderEntryList(rootMediaPath,__dirTreeCurrentSelection);
947         pDirTreeEntry->SetDirectoryOpenStatus(true);
948
949         return;
950 }
951
952 void
953 SplitPanelForm::OnSceneDeactivated(const SceneId& currentSceneId,
954                                                                                   const SceneId& nextSceneId)
955 {
956         ((MyFilesApp*)Application::GetInstance())->SetCurrentView(null);
957         DeviceManager::RemoveAllDeviceEventListeners();
958         TryReturn(_pFolderEntryPM!=null, , "FolderEntryPresentationModel is NULL") ;
959         _pFolderEntryPM->StopThumbnailManager(true);
960         _pFolderEntryPM->SetCurrentReqId(0);
961
962         if(_pFileEventManager != null)
963         {
964                 _pFileEventManager->RemovePath(__currentDirectoryPath);
965         }
966 }
967
968 void
969 SplitPanelForm::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId &currentSceneId)
970 {
971         AppLogDebug("Enter");
972         AppRegistry* pAppRegistry = null;
973         String sortbyKeyName(L"SortBy");
974         int sortStyle = SORT_BY_TYPE_DATE_RECENT;
975
976         SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);
977         pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
978
979         if (previousSceneId == IDSCN_CREATE_FOLDER_FORM)
980         {
981                 if (_renameOrCreate == SELECT_RENAME)
982                 {
983                         pAppRegistry->Get(sortbyKeyName, sortStyle);
984
985                         if (sortStyle == SORT_BY_TYPE_NAME_ASCENDING || sortStyle == SORT_BY_TYPE_NAME_DESCENDING)
986                         {
987                                 _pFolderEntryPM->SetFolderEntryPath(FolderNavigationPresentationModel::GetCurrentPath());
988                                 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
989
990                                 if (_pListView != null && _pListView->IsVisible())
991                                 {
992                                         _pListView->UpdateList();
993                                 }
994                         }
995                         else
996                         {
997                                 _pListView->RefreshList(_renameIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
998                         }
999
1000                         return;
1001                 }
1002         }
1003
1004         SwitchViewType();
1005
1006         if (_pThumbnailItemProvider != null)
1007         {
1008                 _pThumbnailItemProvider->SetFileEventListener(this);
1009         }
1010 }
1011
1012 void
1013 SplitPanelForm::OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId &currentSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId)
1014 {
1015         //Empty Implementation.
1016 }
1017
1018 void
1019 SplitPanelForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1020 {
1021         CustomAppControl::GetInstance()->SetAppControlInUse(null);
1022         if ( _pFolderEntryPM != null)
1023         {
1024                 _pFolderEntryPM->RefreshFolderEntries();
1025                 _pFolderEntryPM->InitThumbnailManager();
1026         }
1027 }
1028
1029 void
1030 SplitPanelForm::OnThumbnailReceived(ThumbRequest* pThumbReq)
1031 {
1032         result res = E_SUCCESS;
1033         AppLogDebug("Enter");
1034
1035         if (_pFolderEntryPM)
1036         {
1037                 if (pThumbReq != null)
1038                 {
1039                         if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())
1040                         {
1041                                 if (pThumbReq->pBitmap != null)
1042                                 {
1043                                         delete pThumbReq->pBitmap;
1044                                 }
1045                                 return;
1046                         }
1047                 }
1048
1049                 if (pThumbReq)
1050                 {
1051                         if (pThumbReq->iRquestId < _pFilenames->GetCount())
1052                         {
1053                                 _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);
1054                                 if (_pListView && _pListView->IsVisible())
1055                                 {
1056                                         res = _pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1057                                 }
1058                                 if (_pIconListView && _pIconListView->IsVisible())
1059                                 {
1060                                         res = _pIconListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1061                                 }
1062                         }
1063                         else
1064                                 AppLogDebug("Thumbnail Request is not valid");
1065                 }
1066                 else
1067                 {
1068                         _pFolderEntryPM->OnThumbnailResponseFailed();
1069                 }
1070         }
1071         __pFirstPanePanel->Invalidate(true);
1072         __pSecondPanePanel->Invalidate(true);
1073         AppLogDebug("Exit %s", GetErrorMessage(res));
1074         return;
1075 }
1076
1077 void
1078 SplitPanelForm::OnFormBackRequested(Form& source)
1079 {
1080         ShowParentDirectoryView();
1081 }
1082
1083 SplitPanelForm::DirectoryTreeProvider::DirectoryTreeProvider(FolderEntryPresentationModel* pDirectoryTreePM)
1084         :__pDirectoryTreePM(pDirectoryTreePM)
1085 {
1086
1087 }
1088
1089 FolderEntryPresentationModel*
1090 SplitPanelForm::DirectoryTreeProvider::GetFolderEntryPresentationModel(void)
1091 {
1092         return __pDirectoryTreePM;
1093 }
1094
1095 void
1096 SplitPanelForm::OnFileEventExecuted(const Tizen::Base::String& path, const unsigned long eventId)
1097 {
1098         AppLogDebug("ENTER");
1099
1100         int badgeNumber = 0;
1101         result r = E_SUCCESS;
1102
1103         //      Tizen::Shell::NotificationManager* pNotiMgr = null;
1104
1105         NotificationManager* pNotiMgr = null;
1106         AppResource* pAppResource = null;
1107         pAppResource = UiApp::GetInstance()->GetAppResource();
1108         TryCatch(pAppResource != null, , "Failed to fetch AppResource");
1109
1110         pNotiMgr = new (std::nothrow) NotificationManager();
1111         TryCatch(pNotiMgr != null, , "Failed to fetch AppNotificationManager");
1112
1113         pNotiMgr->Construct();
1114         badgeNumber = pNotiMgr->GetBadgeNumber();
1115         badgeNumber++;
1116
1117         if (_pFolderEntryPM != null)
1118         {
1119                 //_pFolderEntryPM->SetFileEventListener(null);
1120                 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
1121                 TryCatch(_pFilenames != null, , "File Names List retrieval failed");
1122         }
1123
1124         switch (eventId)
1125         {
1126         case FILE_EVENT_TYPE_CREATE:
1127         {
1128                 if (_pListView != null && _pListView->IsVisible())
1129                 {
1130                         _pListView->RefreshList(_pFilenames->GetCount() - 1, LIST_REFRESH_TYPE_ITEM_ADD);
1131                 }
1132                 if (_pIconListView != null && _pIconListView->IsVisible())
1133                 {
1134                         _pIconListView->RefreshList(_pFilenames->GetCount() - 1, LIST_REFRESH_TYPE_ITEM_ADD);
1135                 }
1136
1137         }
1138         break;
1139
1140         case FILE_EVENT_TYPE_DELETE:
1141         {
1142                 if (_pListView != null && _pListView->IsVisible())
1143                 {
1144                         _pListView->RefreshList(__selectedIndex, LIST_REFRESH_TYPE_ITEM_REMOVE);
1145                 }
1146                 if (_pIconListView != null && _pIconListView->IsVisible())
1147                 {
1148                         if (_pThumbnailItemProvider != null)
1149                         {
1150                                 __selectedIndex = _pThumbnailItemProvider->GetPressedIndex();
1151                         }
1152                         _pIconListView->RefreshList(__selectedIndex, LIST_REFRESH_TYPE_ITEM_REMOVE);
1153                 }
1154
1155         }
1156         break;
1157
1158         case FILE_EVENT_TYPE_DELETE_SELF:
1159         {
1160                 ShowHomeView();
1161         }
1162         break;
1163
1164         default:
1165         {
1166                 //Do Nothing.
1167         }
1168         break;
1169         }
1170
1171         AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
1172
1173         if (pNotiMgr != null)
1174         {
1175                 delete pNotiMgr;
1176                 pNotiMgr = null;
1177         }
1178         return;
1179
1180 CATCH:
1181         if (pNotiMgr != null)
1182         {
1183                 delete pNotiMgr;
1184                 pNotiMgr = null;
1185         }
1186         return;
1187 }
1188
1189 void
1190 SplitPanelForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
1191 {
1192         Integer* pFileProcessingResult = null;
1193         HashMap* pCacheList = null;
1194         DirectoryEntry* pCurrentEntry = null;
1195         bool cacheKeyStatus = false;
1196         String cachePath;
1197         TryCatch(pArgs != null, , "Argument list received is invalid!");
1198         pFileProcessingResult = (Integer*) pArgs->GetAt(0);
1199
1200         TryCatch(pFileProcessingResult != null, , "FileProcessing Result  list is invalid!");
1201
1202         switch (pFileProcessingResult->ToInt())
1203         {
1204         case FILE_MANAGING_RESULT_DELETING_SUCCESS:
1205         {
1206                 if (_pFilenames != null)
1207                 {
1208                         pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
1209
1210                         if (pCacheList != null)
1211                         {
1212                                 pCurrentEntry = static_cast<DirectoryEntry*>(_pFilenames->GetAt(_indexTracker));
1213
1214                                 if (pCurrentEntry != null)
1215                                 {
1216                                         cachePath = pCurrentEntry->GetFullFilePath();
1217                                 }
1218
1219                                 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
1220
1221                                 if (cacheKeyStatus)
1222                                 {
1223                                         CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
1224                                 }
1225                         }
1226
1227                         _pFilenames->RemoveAt(_indexTracker, true);
1228                         //r = __pListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_REMOVE);
1229                         if (_pListView != null)
1230                         {
1231                                 //_pListView->UpdateList();
1232                                 _pListView->RefreshList(_indexTracker, LIST_REFRESH_TYPE_ITEM_REMOVE);
1233                         }
1234                         if (_pIconListView != null && _pIconListView->IsVisible())
1235                         {
1236                                 _pIconListView->RefreshList(_indexTracker, LIST_REFRESH_TYPE_ITEM_REMOVE);
1237                         }
1238                 }
1239                 HideFileProgressingPopup();
1240         }
1241         break;
1242
1243         case FILE_MANAGING_RESULT_DELETING_FAILED:
1244         {
1245                 HideFileProgressingPopup();
1246         }
1247         break;
1248         case FILE_MANAGING_RESULT_THREAD_STOP:
1249         {
1250                 HideFileProgressingPopup();
1251         }
1252         break;
1253         default:
1254         {
1255                 //Do Nothing.
1256         }
1257         break;
1258         }
1259         CATCH:
1260         if (pArgs != null)
1261         {
1262                 pArgs->RemoveAll(true);
1263                 delete pArgs;
1264         }
1265         ///return this;
1266 }
1267
1268 void
1269 SplitPanelForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String &  path, const unsigned int     eventId)
1270 {
1271         AppLogDebug("TopMostFolderFileListForm::OnFileEventOccured");
1272         if ((events & FILE_EVENT_TYPE_ATTRIBUTE) || (events & FILE_EVENT_TYPE_DELETE))
1273         {
1274                 if (_pFolderEntryPM!=null)
1275                 {
1276                         _pFolderEntryPM->RefreshFolderEntries();
1277                 }
1278
1279                 if (_pListView != null && _pListView->IsVisible())
1280                 {
1281                         _pListView->UpdateList();
1282                 }
1283
1284                 if (_pIconListView != null && _pIconListView->IsVisible())
1285                 {
1286                         _pIconListView->UpdateList();
1287                 }
1288
1289                 if (_pFolderEntryPM!=null)
1290                 {
1291                         _pFolderEntryPM->InitThumbnailManager();
1292                 }
1293         }
1294 }