Tizen 2.1 base
[apps/osp/MyFiles.git] / src / MfSubBaseFolderEntryForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
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: MfSubBaseFolderEntryForm.cpp
19  * @brief: This file contains the implementation of SubBaseFolderEntryForm class, which acts as a base form for
20  * the TopMostFileFolderListForm and SubFileFolderListForm.
21  */
22
23 #include "MfSubBaseFolderEntryForm.h"
24
25 using namespace Tizen::App;
26 using namespace Tizen::App::Package;
27 using namespace Tizen::Base;
28 using namespace Tizen::Base::Collection;
29 using namespace Tizen::Base::Utility;
30 using namespace Tizen::Content;
31 using namespace Tizen::Graphics;
32 using namespace Tizen::Io;
33 using namespace Tizen::Locales;
34 using namespace Tizen::Media;
35 using namespace Tizen::System;
36 using namespace Tizen::Ui;
37 using namespace Tizen::Ui::Controls;
38 using namespace Tizen::Ui::Scenes;
39
40 SubBaseFolderEntryForm::SubBaseFolderEntryForm(void)
41         : _pFileEventManager(null)
42         , _pPackageManager(null)
43         , _pFilenames(null)
44         , _pCancelDeletion(null)
45         , _pCancelInstallation(null)
46         , _pCancelSortBy(null)
47         , _pCancelViewAs(null)
48         , _pDeleteFile(null)
49         , _pFileProgressingCancelButton(null)
50         , _pInstall(null)
51         , _pMoreContextMenu(null)
52         , _pFooter(null)
53         , _pEdit(null)
54         , _pMore(null)
55         , _pSearch(null)
56         , _pSortBy(null)
57         , _pIconListView(null)
58         , _pFileProgressingHeaderLabel(null)
59         , _pFileProgressingLabel(null)
60         , __pItemContext(null)
61         , _pListView(null)
62         , _pSortByListView(null)
63         , _pViewAsListView(null)
64         , _pDeleteConfirmationPopUp(null)
65         , _pFileProgressingPopup(null)
66         , _pInstallationConfirmationPopUp(null)
67         , _pInstallationProgressPopup(null)
68         , _pSortByPopup(null)
69         , _pViewAsPopup(null)
70         , _pBaseItemProvider(null)
71         , _pCustomListViewForPopup(null)
72         , _pFileManager(null)
73         , _pFolderEntryPM(null)
74         , _pMediaMetaData(null)
75         , _pThumbnailItemProvider(null)
76         , _pThumbnailManager(null)
77
78 {
79         _flagViewAsStatus = 0;
80         _indexToDelete = 0;
81         _indexTracker = 0;
82         _listItemCount = 0;
83         ;
84         _renameIndex = 0;
85         _renameOrCreate = 0;
86 }
87
88 SubBaseFolderEntryForm::~SubBaseFolderEntryForm(void)
89 {
90         AppLogDebug("Entry");
91
92         if (_pFolderEntryPM != null)
93         {
94                 delete _pFolderEntryPM;
95         }
96
97         if (_pMoreContextMenu != null)
98         {
99                 delete _pMoreContextMenu;
100         }
101
102         if (_pViewAsPopup != null)
103         {
104                 delete _pViewAsPopup;
105         }
106
107         if (_pDeleteConfirmationPopUp != null)
108         {
109                 delete _pDeleteConfirmationPopUp;
110         }
111
112         if (_pCustomListViewForPopup != null)
113         {
114                 delete _pCustomListViewForPopup;
115         }
116
117         if (_pMediaMetaData != null)
118         {
119                 delete _pMediaMetaData;
120         }
121
122         if (_pSortByPopup != null)
123         {
124                 delete _pSortByPopup;
125         }
126
127         if (_pFileProgressingPopup != null)
128         {
129                 delete _pFileProgressingPopup;
130         }
131
132         if (_pThumbnailItemProvider != null)
133         {
134                 delete _pThumbnailItemProvider;
135         }
136
137         if (_pBaseItemProvider != null)
138         {
139                 delete _pBaseItemProvider;
140         }
141
142         if (_pEdit != null)
143         {
144                 delete _pEdit;
145         }
146
147         if (_pSortBy != null)
148         {
149                 delete _pSortBy;
150         }
151
152         if (_pSearch != null)
153         {
154                 delete _pSearch;
155         }
156
157         if (_pMore != null)
158         {
159                 delete _pMore;
160         }
161
162         if (_pFileEventManager != null)
163         {
164                 delete _pFileEventManager;
165         }
166
167 }
168
169 SubBaseFolderEntryForm&
170 SubBaseFolderEntryForm::operator =(const SubBaseFolderEntryForm& pSubBaseFolderEntryForm)
171 {
172         return *this;
173 }
174
175 SubBaseFolderEntryForm::SubBaseFolderEntryForm(const SubBaseFolderEntryForm& pSubBaseFolderEntryForm)
176 {
177         //Do Nothing
178 }
179
180 result
181 SubBaseFolderEntryForm::CreateFooterControls(void)
182 {
183         AppLogDebug("ENTER");
184         //Create Footer and controls contained within the footer
185         result r = E_SUCCESS;
186
187         String buttonEdit;
188         String buttonSortBy;
189         String buttonSearch;
190         String buttonMore;
191
192         String buttonCancel;
193
194         AppResource* pAppResource = null;
195         pAppResource = Application::GetInstance()->GetAppResource();
196
197         if (pAppResource != null)
198         {
199                 //Get the Title texts for all the FooterItems
200                 pAppResource->GetString(L"IDS_MF_SK3_EDIT", buttonEdit);
201                 pAppResource->GetString(L"IDS_MF_SK3_SORT_BY", buttonSortBy);
202                 pAppResource->GetString(L"IDS_MORE", buttonMore);
203                 pAppResource->GetString(L"IDS_MF_SK3_SEARCH", buttonSearch);
204                 pAppResource->GetString(L"IDS_COM_POP_CANCEL", buttonCancel);
205         }
206
207         //Construct the 4 FooterItems Copy, Create , Sort By and More
208         //Edit
209         if(_pEdit == null)
210         {
211         _pEdit = new (std::nothrow) FooterItem();
212         _pEdit->Construct(IDA_BTN_EDIT);
213         _pEdit->SetText(buttonEdit);
214         }
215
216         //SortBy
217         if(_pSortBy == null)
218         {
219         _pSortBy = new (std::nothrow) FooterItem();
220         _pSortBy->Construct(IDA_BTN_SORT_BY);
221         _pSortBy->SetText(buttonSortBy);
222         }
223
224         //More
225         if(_pMore == null)
226         {
227         _pMore = new (std::nothrow) FooterItem();
228         _pMore->Construct(IDA_BTN_MORE);
229         _pMore->SetText(buttonMore);
230         }
231
232         //Search
233         if (CheckSearchHistory() == false)
234         {
235                 if(_pSearch == null)
236                 {
237                 _pSearch = new (std::nothrow) FooterItem();
238                 _pSearch->Construct(IDA_BTN_SEARCH);
239                 _pSearch->SetText(buttonSearch);
240                 }
241         }
242
243         //Get the Footer and set the FooterItems.
244         _pFooter = GetFooter();
245         if (_pFooter != null)
246         {
247                 _pFooter->RemoveAllButtons();
248                 _pFooter->RemoveAllItems();
249
250                 _pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
251                 _pFooter->AddItem(*_pEdit);
252                 _pFooter->AddItem(*_pSortBy);
253                 if (CheckSearchHistory() == false)
254                 {
255                         _pFooter->AddItem(*_pSearch);
256                 }
257
258                 _pFooter->AddItem(*_pMore);
259
260
261                 //Set am ActionEventListener to the Footer
262                 _pFooter->AddActionEventListener(*this);
263                 _pFooter->SetBackButton();
264                 _pFooter->SetBackButtonEnabled(true);
265                 _pFooter->Invalidate(true);
266         }
267
268         return r;
269 }
270
271 result
272 SubBaseFolderEntryForm::CreateDeleteConfirmationPopUp(void)
273 {
274         result r = E_SUCCESS;
275         Rectangle popupBounds;
276
277         Label* pPanelLabel = null;
278         Label* pPopupLabel = null;
279
280         Bitmap* pPanelBackground = null;
281         Bitmap* pPopUpBackground = null;
282
283         String deleteLabel = L"";
284
285         pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
286         pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
287
288         //Create a new popup control
289         _pDeleteConfirmationPopUp = new (std::nothrow) Popup();
290         _pDeleteConfirmationPopUp->Construct(L"IDL_DELETE_POPUP");
291
292         pPanelLabel = static_cast< Label* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_LABEL_BOTTOM_BACKGROUND", true));
293         TryCatch(pPanelLabel != null, , "MfMyFilesApp::pPanelLabel For Popup not created!");
294
295         pPopupLabel = static_cast< Label* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_LABEL_DELETE", true));
296         TryCatch(pPopupLabel != null, , "MfMyFilesApp::pPanelLabel For Popup not created!");
297
298         if (pPanelBackground != null)
299         {
300                 pPanelLabel->SetBackgroundBitmap(*pPanelBackground);
301         }
302         if (pPopUpBackground != null)
303         {
304                 pPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
305         }
306
307         AppResource::GetInstance()->GetString(L"IDS_MF_SK3_DELETE", deleteLabel);
308
309         if(deleteLabel.IsEmpty() == false)
310         {
311                 deleteLabel.Append("?");
312                 pPopupLabel->SetText(deleteLabel);
313         }
314
315         _pDeleteFile = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_DELETE", true));
316         TryCatch(_pDeleteFile != null, , "MfMyFilesApp::Button For Popup not created!");
317
318         _pDeleteFile->SetActionId(IDA_DELETE_FILE);
319         _pDeleteFile->AddActionEventListener(*this);
320         _pDeleteFile->SetShowState(true);
321
322         _pCancelDeletion = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_CANCEL", true));
323         TryCatch(_pCancelDeletion != null, , "MfMyFilesApp::Button For Popup not created!");
324
325         _pCancelDeletion->SetActionId(IDA_CANCEL_DELETION);
326         _pCancelDeletion->AddActionEventListener(*this);
327         _pCancelDeletion->SetShowState(true);
328
329         if (pPopUpBackground != null)
330         {
331                 delete pPopUpBackground;
332                 pPopUpBackground = null;
333         }
334         if (pPanelBackground != null)
335         {
336                 delete pPanelBackground;
337                 pPanelBackground = null;
338         }
339         return r;
340
341 CATCH:
342         if (pPopUpBackground != null)
343         {
344                 delete pPopUpBackground;
345                 pPopUpBackground = null;
346         }
347         if (pPanelBackground != null)
348         {
349                 delete pPanelBackground;
350                 pPanelBackground = null;
351         }
352         if (_pDeleteConfirmationPopUp != null)
353         {
354                 delete _pDeleteConfirmationPopUp;
355                 _pDeleteConfirmationPopUp = null;
356         }
357
358         return r;
359 }
360
361 void
362 SubBaseFolderEntryForm::ShowSortByPopup(void)
363 {
364
365         CreateSortByPopup();
366
367         //Set the showstate of the popup to true. so that it's displayed on the form.
368         if (_pSortByPopup != null)
369         {
370                 _pSortByPopup->SetShowState(true);
371                 _pSortByPopup->Show();
372         }
373
374         SetDefaultSelectionForSortByPopUp();
375
376 }
377
378 void
379 SubBaseFolderEntryForm::HideSortByPopup(void)
380 {
381         //Set the showstate of the popup to false. so that it's hidden on the form.
382         if (_pSortByPopup != null && _pSortByPopup->IsVisible())
383         {
384                 _pSortByPopup->SetShowState(false);
385         }
386
387 }
388
389 void
390 SubBaseFolderEntryForm::LoadRenameForm(int index)
391 {
392         result r = E_SUCCESS;
393         _renameOrCreate = SELECT_RENAME;
394         ArrayList* pArg = null;
395         Integer* pSourceSelected = null;
396         SceneManager* pSceneManager = null;
397         DirectoryEntry* pDirectory = null;
398
399         pDirectory = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
400         TryCatch(pDirectory != null, , "failed to allocate memeory to cast to DirectoryEntry");
401
402         pArg = new (std::nothrow) ArrayList();
403         r = pArg->Construct();
404
405         pSourceSelected = new (std::nothrow) Integer(_renameOrCreate);
406
407         pArg->Add(pSourceSelected);
408         TryCatch(r == E_SUCCESS, , "failed to construct parg");
409
410         //pArg->Add(__rootMediaPath);
411         pArg->Add(pDirectory);
412         TryCatch(r == E_SUCCESS, , "failed to construct parg");
413
414         pSceneManager = SceneManager::GetInstance();
415         TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
416
417         //pSceneManager->GoForward(SCENE_RENAME_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
418         r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
419
420         AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
421         return;
422
423 CATCH:
424         if (pSourceSelected != null)
425         {
426                 delete pSourceSelected;
427                 pSourceSelected = null;
428         }
429         if (pDirectory != null)
430         {
431                 delete pDirectory;
432                 pDirectory = null;
433         }
434         if (pArg != null)
435         {
436                 delete pArg;
437                 pArg = null;
438         }
439 }
440
441 void
442 SubBaseFolderEntryForm::LoadSearchForm(void)
443 {
444         ArrayList* pTopLevelDirectoryList = new (std::nothrow) ArrayList();
445
446         //String* pDirectoryPath = null;
447         //String* pTabSelected = null;
448         ArrayList* pFilepathList = null;
449         SceneManager* pSceneManager = null;
450
451         //pDirectoryPath = new (std::nothrow) String();
452         //pDirectoryPath->Append(FolderNavigationPresentationModel::GetCurrentPath());
453
454         //pTabSelected = new (std::nothrow) String();
455         //pTabSelected->Append(tabSelected);
456
457         if (pTopLevelDirectoryList != null && _pFilenames != null)
458         {
459                 //pTopLevelDirectoryList->Add(*pDirectoryPath);
460                 pFilepathList = new (std::nothrow) ArrayList();
461                 if (pFilepathList != null)
462                 {
463                         pFilepathList->Construct();
464                         pFilepathList->AddItems(*_pFilenames);
465                         pTopLevelDirectoryList->Add(pFilepathList);
466                 }
467                 //pTopLevelDirectoryList->Add(*pTabSelected);
468         }
469
470         TryCatch(pTopLevelDirectoryList != null, , "failed to Get SceneManager instance");
471
472         pSceneManager = SceneManager::GetInstance();
473         TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
474
475         //pSceneManager->GoForward(SCENE_SEARCH_FORM, pTopLevelDirectoryList, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
476         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pTopLevelDirectoryList);
477
478         return;
479 CATCH:
480
481         /*if (pDirectoryPath != null)
482         {
483             delete pDirectoryPath;
484             pDirectoryPath = null;
485         }
486
487         if (pTabSelected != null)
488         {
489             delete pTabSelected;
490             pTabSelected = null;
491         }*/
492         if (pFilepathList != null)
493         {
494                 delete pFilepathList;
495                 pFilepathList = null;
496         }
497
498         if (pTopLevelDirectoryList != null)
499         {
500                 delete pTopLevelDirectoryList;
501                 pTopLevelDirectoryList = null;
502         }
503 }
504
505 void
506 SubBaseFolderEntryForm::ShowViewAsPopup(void)
507 {
508         //Call functions to create the popups.
509         CreateViewAsPopupControl();
510
511         //Set the showstate of the popup to true. so that it's displayed on the form.
512         if (_pViewAsPopup != null)
513         {
514                 _pViewAsPopup->SetShowState(true);
515                 _pViewAsPopup->Show();
516         }
517
518         SetDefaultSelectionForViewAsPopUp();
519 }
520
521 void
522 SubBaseFolderEntryForm::HideViewAsPopup(void)
523 {
524         //Set the showstate of the popup to false. so that it's hidden on the form.
525         if (_pViewAsPopup != null && _pViewAsPopup->IsVisible())
526         {
527                 _pViewAsPopup->SetShowState(false);
528         }
529 }
530
531 void
532 SubBaseFolderEntryForm::LoadCreateFolderForm(void)
533 {
534         //Load the CreateFolder view in the current directory.
535         result r = E_SUCCESS;
536         Integer* pSourceSelected = null;
537         SceneManager* pSceneManager = null;
538         ArrayList* pArg = null;
539
540         pSourceSelected = new (std::nothrow) Integer(SELECT_CREATE_FOLDER);
541
542         pArg = new (std::nothrow) ArrayList();
543         r = pArg->Construct();
544
545         pArg->Add(pSourceSelected);
546         TryCatch(r == E_SUCCESS, , "failed to construct parg");
547
548         pSceneManager = SceneManager::GetInstance();
549         TryCatch(pSceneManager != null, , "failed to construct parg");
550
551         //pSceneManager->GoForward(SCENE_CREATE_FOLDER_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
552         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
553         return;
554
555 CATCH:
556
557         if (pSourceSelected != null)
558         {
559                 delete pSourceSelected;
560         }
561
562         if (pArg != null)
563         {
564                 delete pArg;
565         }
566 }
567
568 void
569 SubBaseFolderEntryForm::LoadDetailForm(Tizen::Base::String& Fullpath)
570 {
571         result r = E_SUCCESS;
572
573         SceneManager* pSceneManager = null;
574         ArrayList* pList = null;
575         String* pFullFilePath = null;
576
577         pList = new (std::nothrow) ArrayList();
578         r = pList->Construct();
579
580         pFullFilePath = new (std::nothrow) String(Fullpath);
581         pList->Add(pFullFilePath);
582
583         pSceneManager = SceneManager::GetInstance();
584         TryCatch(pSceneManager != null, , "Failed to allocate Memory to pSceneManager");
585
586         //pSceneManager->GoForward(SCENE_FILE_DETAIL_FORM, pList, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
587         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FILE_DETAIL_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
588         AppLogDebug("Exit: %s", GetErrorMessage(r));
589         return;
590 CATCH:
591
592         AppLogDebug("Exit: %s", GetErrorMessage(r));
593         if (pFullFilePath != null)
594         {
595                 delete pFullFilePath;
596                 pFullFilePath = null;
597         }
598
599         if (pList != null)
600         {
601                 pList->RemoveAll();
602                 delete pList;
603                 pList = null;
604         }
605 }
606
607 void
608 SubBaseFolderEntryForm::LoadEditForm(void)
609 {
610         //__pFileListPM->SetFileEventListener(null);
611         SceneManager* pSceneManager = SceneManager::GetInstance();
612         if (pSceneManager != null)
613         {
614                 //pSceneManager->GoForward(SCENE_EDIT_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
615                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), null);
616         }
617         return;
618 }
619
620 void
621 SubBaseFolderEntryForm::ShowFileProgressingPopup(void)
622 {
623         CreateFileProgressingPopup();
624
625         if (_pFileProgressingPopup != null)
626         {
627                 _pFileProgressingPopup->SetShowState(true);
628                 _pFileProgressingPopup->Show();
629         }
630 }
631
632 void
633 SubBaseFolderEntryForm::HideFileProgressingPopup(void)
634 {
635         if (_pFileProgressingPopup != null)
636         {
637                 _pFileProgressingPopup->SetShowState(false);
638
639                 if (_pFileProgressingPopup != null)
640                 {
641                         delete _pFileProgressingPopup;
642                         _pFileProgressingPopup = null;
643                 }
644         }
645 }
646
647 result
648 SubBaseFolderEntryForm::CreateFileProgressingPopup(void)
649 {
650         AppLogDebug("Enter");
651         result r = E_SUCCESS;
652         //String popUpTitle;
653         String deleting;
654         //String fileProgress;
655
656         if (_pFileProgressingPopup != null)
657         {
658                 AppLogDebug("_pFileProgressingPopup is not null");
659                 return r;
660         }
661
662         AppResource* pAppResource = null;
663         pAppResource = UiApp::GetInstance()->GetAppResource();
664         TryCatch(pAppResource != null, , "Failed to fetch AppResource");
665
666         //pAppResource->GetString(L"IDS_FILE_PROCESSING", popUpTitle);
667         pAppResource->GetString(L"IDS_COM_POP_DELETING", deleting);
668         //pAppResource->GetString(L"IDS_FILE_PROGRESS", fileProgress);
669
670         _pFileProgressingPopup = new (std::nothrow) Popup();
671         _pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
672         TryCatch(_pFileProgressingPopup != null, , "Failed to allocate memory to FileProgressing Popup.");
673
674         //_pFileProgressingPopup->SetTitleText(popUpTitle); //Not in UI
675
676
677         _pFileProgressingCancelButton = static_cast< Button* >(_pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
678         TryCatch(_pFileProgressingCancelButton != null, , "Failed to fetch _pFileProgressingCancelButton.");
679
680         _pFileProgressingCancelButton->SetActionId(IDA_BTN_ANIMATION_POPUP_CANCEL);
681         _pFileProgressingCancelButton->AddActionEventListener(*this);
682         _pFileProgressingCancelButton->SetShowState(true);
683
684         _pFileProgressingProgress = static_cast< Progress* >(_pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true));
685         TryCatch(_pFileProgressingProgress != null, , "Failed to fetch _pFileProgressingProgress.");
686
687         _pFileProgressingProgress->SetName(L"IDC_ANIMATION_PROGRESS");
688         _pFileProgressingProgress->SetValue(0);
689
690         _pFileProgressingHeaderLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true));
691         TryCatch(_pFileProgressingHeaderLabel != null, , "Failed to fetch _pFileProgressingHeaderLabel.");
692
693         _pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER");
694         _pFileProgressingHeaderLabel->SetText(deleting);
695         _pFileProgressingHeaderLabel->SetShowState(true);
696         _pFileProgressingHeaderLabel->Invalidate(true);
697
698
699         _pFileProgressingLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true));
700         TryCatch(_pFileProgressingLabel != null, , "Failed to fetch _pFileProgressingLabel.");
701
702         _pFileProgressingLabel->SetName(L"IDC_FILE_COUNT_LABEL");
703         //_pFileProgressingLabel->SetText(fileProgress);
704         _pFileProgressingLabel->SetShowState(true);
705
706
707         return r;
708
709 CATCH:
710
711         if (_pFileProgressingPopup != null)
712         {
713                 delete _pFileProgressingPopup;
714                 _pFileProgressingPopup = null;
715         }
716         return r;
717 }
718
719
720 void
721 SubBaseFolderEntryForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
722 {
723         int x_FooterPosition = 0;
724         int y_FooterPosition = 0;
725         int x_ContextMenu = 0;
726         int y_ContextMenu = 0;
727
728         Rectangle listViewBounds(GetClientAreaBounds().x, H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, GetClientAreaBounds().height);
729         Rectangle labelBounds(GetClientAreaBounds().x, 0, GetClientAreaBounds().width, H_DISPLAY_PATH_LABEL);
730
731         _pFooter = GetFooter();
732         if (_pFooter != null)
733         {
734                 _pFooter->GetPosition(x_FooterPosition, y_FooterPosition);
735         }
736
737         x_ContextMenu = x_FooterPosition + 3 * (listViewBounds.width / 4);
738         y_ContextMenu = y_FooterPosition;
739
740         switch (orientationStatus)
741         {
742         case ORIENTATION_STATUS_PORTRAIT:
743         {
744                 if (_pListView != null)
745                 {
746                         _pListView->SetBounds(listViewBounds);
747                 }
748                 if (_pIconListView != null)
749                 {
750                         _pIconListView->SetBounds(listViewBounds);
751                 }
752                 if (_pMoreContextMenu != null)
753                 {
754                         _pMoreContextMenu->SetAnchorPosition(Point(x_ContextMenu, y_ContextMenu));
755                 }
756                 /*              if (__pLabelDisplayPath != null)
757                 {
758                     __pLabelDisplayPath->SetBounds(labelBounds);
759                 }*/
760         }
761         break;
762
763         case ORIENTATION_STATUS_LANDSCAPE:
764         {
765                 if (_pListView != null)
766                 {
767                         _pListView->SetBounds(listViewBounds);
768                 }
769                 if (_pIconListView != null)
770                 {
771                         _pIconListView->SetBounds(listViewBounds);
772                 }
773                 if (_pMoreContextMenu != null)
774                 {
775                         _pMoreContextMenu->SetAnchorPosition(Point(x_ContextMenu, y_ContextMenu));
776                 }
777                 /*              if (__pLabelDisplayPath != null)
778                 {
779                     __pLabelDisplayPath->SetBounds(labelBounds);
780                 }*/
781         }
782         break;
783
784         default:
785         {
786                 //Do Nothing
787         }
788         break;
789         }
790
791         Invalidate(true);
792 }
793
794 void
795 SubBaseFolderEntryForm::OnFileManagingStart(void)
796 {
797         ShowFileProgressingPopup();
798 }
799
800 void
801 SubBaseFolderEntryForm::OnFileManagingStop(FileManagingResult fileManagingResult)
802 {
803         //Empty Implementation.
804 }
805
806 void
807 SubBaseFolderEntryForm::HideFileExtension(void)
808 {
809         int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
810         String viewStyleKeyName(L"ListDisplayType");
811
812         result r = E_SUCCESS;
813
814         AppRegistry* pAppRegistry = null;
815         pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
816
817
818         if (pAppRegistry != null)
819         {
820                 r = pAppRegistry->Set(_extensionKeyName, _hideExtension);
821                 r = pAppRegistry->Save();
822
823                 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
824         }
825         if (_pMoreContextMenu != null)
826         {
827                 r = _pMoreContextMenu->SetItemAt(2, _showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
828                 AppLogDebug("error %s", GetErrorMessage(r));
829         }
830
831         //Update the corresponding List.
832         if (listViewDisplayType == VIEW_TYPE_AS_THUMBNAILS)
833         {
834                 if (_pListView != null && _pListView->IsVisible())
835                 {
836                         _pListView->SetShowState(false);
837                 }
838                 if (_pIconListView != null)
839                 {
840                         _pIconListView->SetShowState(true);
841                         _pIconListView->UpdateList();
842                 }
843         }
844         else
845         {
846                 if (_pIconListView != null && _pIconListView->IsVisible())
847                 {
848                         _pIconListView->SetShowState(false);
849                 }
850                 if (_pListView != null)
851                 {
852                         _pListView->UpdateList();
853                         _pListView->SetShowState(true);
854                 }
855         }
856
857         if (_pMoreContextMenu != null)
858         {
859                 delete _pMoreContextMenu;
860                 _pMoreContextMenu = null;
861         }
862
863         Invalidate(true);
864
865         AppLogDebug("Exit : %s", GetErrorMessage(r));
866 }
867
868 void
869 SubBaseFolderEntryForm::ShowFileExtension(void)
870 {
871         int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
872         String viewStyleKeyName(L"ListDisplayType");
873
874         result r = E_SUCCESS;
875
876         AppRegistry* pAppRegistry = null;
877         pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
878
879         if (pAppRegistry != null)
880         {
881                 r = pAppRegistry->Set(_extensionKeyName, _showExtension);
882                 r = pAppRegistry->Save();
883
884                 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
885         }
886
887         if (_pMoreContextMenu != null)
888         {
889                 r = _pMoreContextMenu->SetItemAt(2, _hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
890                 AppLogDebug("error %s", GetErrorMessage(r));
891         }
892
893         if (listViewDisplayType == VIEW_TYPE_AS_THUMBNAILS)
894         {
895                 if (_pListView != null && _pListView->IsVisible())
896                 {
897                         _pListView->SetShowState(false);
898                 }
899                 if (_pIconListView != null)
900                 {
901                         _pIconListView->UpdateList();
902                         _pIconListView->SetShowState(true);
903                 }
904         }
905         else
906         {
907                 if (_pIconListView != null && _pIconListView->IsVisible())
908                 {
909                         _pIconListView->SetShowState(false);
910                 }
911                 if (_pListView != null)
912                 {
913                         _pListView->UpdateList();
914                         _pListView->SetShowState(true);
915                 }
916         }
917
918         if (_pMoreContextMenu != null)
919         {
920                 delete _pMoreContextMenu;
921                 _pMoreContextMenu = null;
922         }
923
924         Invalidate(true);
925         AppLogDebug("Exit: %s", GetErrorMessage(r));
926 }
927
928
929 void
930 SubBaseFolderEntryForm::HideDeleteConfirmationPopup(void)
931 {
932         if (_pDeleteConfirmationPopUp != null && _pDeleteConfirmationPopUp->IsVisible())
933         {
934                 _pDeleteConfirmationPopUp->SetShowState(false);
935         }
936 }
937
938 void
939 SubBaseFolderEntryForm::ShowDeleteConfirmationPopup(void)
940 {
941         CreateDeleteConfirmationPopUp();
942
943         if (_pDeleteConfirmationPopUp != null)
944         {
945                 _pDeleteConfirmationPopUp->SetShowState(true);
946                 _pDeleteConfirmationPopUp->Show();
947         }
948 }
949
950 result
951 SubBaseFolderEntryForm::CreateViewAsPopupControl(void)
952 {
953         AppLogDebug("ENTER");
954         //Creates a popup control for the ViewAs context item asking which view is to be shown
955
956         result r = E_SUCCESS;
957
958         if (_pViewAsPopup != null)
959         {
960                 AppLogDebug("_pViewAsPopup is not null");
961                 return r;
962         }
963
964         String viewAsPopupTitle;
965         String cancelButton;
966         String sortByPopupTitle;
967
968         Label* pViewAsPanelLabel = null;
969
970         Label* pViewAsPopupLabel = null;
971
972         Bitmap* pPanelBackground = null;
973         Bitmap* pPopUpBackground = null;
974
975         pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
976         pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
977
978         //Create a new popup control
979         _pViewAsPopup = new (std::nothrow) Popup();
980         _pViewAsPopup->Construct(L"IDL_VIEW_AS_POPUP");
981
982         //The cancel button inside the popup, hides the popup when clicked.
983         _pCancelViewAs = static_cast< Button* >(_pViewAsPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
984         TryCatch(_pCancelViewAs != null, , "MfMyFilesApp::Button For Popup not created!");
985
986         _pCancelViewAs->SetActionId(IDA_BTN_POPUP_CANCEL);
987         _pCancelViewAs->AddActionEventListener(*this);
988         _pCancelViewAs->SetShowState(true);
989
990         pViewAsPanelLabel = static_cast< Label* >(_pViewAsPopup->GetControl(L"IDC_LABEL_BOTTOM_BACKGROUND", true));
991         TryCatch(pViewAsPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
992
993         pViewAsPopupLabel = static_cast< Label* >(_pViewAsPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
994         TryCatch(pViewAsPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
995
996
997         if (pPanelBackground != null)
998         {
999                 pViewAsPanelLabel->SetBackgroundBitmap(*pPanelBackground);
1000         }
1001
1002         if (pPopUpBackground != null)
1003         {
1004                 pViewAsPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
1005
1006         }
1007         //The listview control which is to be added inside the popup. The itemprovider and listener are
1008         //implemented in another class because this class already contains an instance of Listview control
1009         //attached to an ItemProvider.
1010
1011         _pViewAsPopup->SetControlAlwaysOnTop(*_pCancelViewAs, true);
1012
1013
1014         _pViewAsListView = static_cast< ListView* >(_pViewAsPopup->GetControl(L"IDC_LISTVIEW_VIEW_AS", true));
1015         TryCatch(_pViewAsListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
1016
1017         _pViewAsListView->SetShowState(true);
1018         _pViewAsListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
1019         _pViewAsListView->SetItemProvider(*_pCustomListViewForPopup);
1020         _pViewAsListView->SetName(L"VIEW_AS_LISTVIEW");
1021         _pViewAsListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
1022
1023         AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
1024
1025         if (pPanelBackground != null)
1026         {
1027                 delete pPanelBackground;
1028                 pPanelBackground = null;
1029         }
1030         if (pPopUpBackground != null)
1031         {
1032                 delete pPopUpBackground;
1033                 pPopUpBackground = null;
1034         }
1035         return r;
1036 CATCH:
1037
1038         if (_pViewAsPopup != null)
1039         {
1040                 delete _pViewAsPopup;
1041                 _pViewAsPopup = null;
1042         }
1043
1044         if (_pCustomListViewForPopup != null)
1045         {
1046                 delete _pCustomListViewForPopup;
1047                 _pCustomListViewForPopup = null;
1048         }
1049
1050         if (pPanelBackground != null)
1051         {
1052                 delete pPanelBackground;
1053                 pPanelBackground = null;
1054         }
1055
1056         if (pPopUpBackground != null)
1057         {
1058                 delete pPopUpBackground;
1059                 pPopUpBackground = null;
1060         }
1061         return r;
1062 }
1063
1064 void
1065 SubBaseFolderEntryForm::ShowMoreContextMenu(void)
1066 {
1067         String extensionStatus;
1068
1069         AppRegistry* pAppRegistry = null;
1070         result r = E_SUCCESS;
1071         pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1072
1073         //Show ContextMenu with More Options
1074         if (pAppRegistry != null)
1075         {
1076                 r = pAppRegistry->Get(_extensionKeyName, extensionStatus);
1077         }
1078
1079         if (_pMoreContextMenu != null)
1080         {
1081                 if (extensionStatus == _hideExtension)
1082                 {
1083                         r = _pMoreContextMenu->SetItemAt(2, _showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
1084                 }
1085                 else
1086                 {
1087                         r = _pMoreContextMenu->SetItemAt(2, _hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
1088                 }
1089
1090                 _pMoreContextMenu->SetShowState(true);
1091                 _pMoreContextMenu->Show();
1092         }
1093         AppLogDebug("Exit: %s", GetErrorMessage(r));
1094 }
1095
1096 void
1097 SubBaseFolderEntryForm::OnListViewItemStateChangedNotify(ViewType listViewStyle)
1098 {
1099         AppLogDebug("ENTER");
1100
1101         int popupSource = POP_UP_VIEW_AS;
1102         int sortType = SORT_BY_TYPE_NAME_ASCENDING;
1103
1104         AppRegistry* pAppRegistry = null;
1105         String sortByKeyName(L"SortBy");
1106
1107         pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1108
1109         if (_pCustomListViewForPopup != null)
1110         {
1111                 popupSource = _pCustomListViewForPopup->GetSelectionPopup();
1112         }
1113
1114         pAppRegistry->Get(sortByKeyName, sortType);
1115
1116         if (popupSource == POP_UP_VIEW_AS)
1117         {
1118                 _flagViewAsStatus = listViewStyle;
1119
1120                 SwitchViewType();
1121
1122                 Invalidate(true);
1123
1124                 HideViewAsPopup();
1125         }
1126         else
1127         {
1128                 if (_pFolderEntryPM != null)
1129                 {
1130                         _pFolderEntryPM->SortFolderEntries();
1131                 }
1132                 HideSortByPopup();
1133                 if (_pListView != null && _pListView->IsVisible())
1134                 {
1135                         _pListView->UpdateList();
1136                 }
1137                 else
1138                 {
1139                         if (_pIconListView != null && _pIconListView->IsVisible())
1140                         {
1141                                 _pIconListView->UpdateList();
1142                         }
1143                 }
1144
1145                 if (_pFolderEntryPM != null)
1146                 {
1147                         _pFolderEntryPM->InitThumbnailManager();
1148                 }
1149
1150         }
1151
1152         if (_pMoreContextMenu != null)
1153         {
1154                 delete _pMoreContextMenu;
1155                 _pMoreContextMenu = null;
1156         }
1157 }
1158 void
1159 SubBaseFolderEntryForm::OnIconListViewItemStateChangeNotify()
1160 {
1161         if (_pIconListView != null && _pIconListView->IsVisible())
1162         {
1163                 _pIconListView->UpdateList();
1164         }
1165 }
1166 void
1167 SubBaseFolderEntryForm::OnFooterStateChangeNotify(void)
1168 {
1169         SetFooterVisibility(DISABLE_FOOTER_ITEM);
1170
1171         _pFooter = GetFooter();
1172         if (_pFooter != null)
1173         {
1174                 _pFooter->Invalidate(true);
1175         }
1176 }
1177
1178 void
1179 SubBaseFolderEntryForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1180 {
1181         AppLogDebug("OnAppControlCompleteResponseReceived");
1182         result r = E_SUCCESS;
1183         CustomAppControl::GetInstance()->SetAppControlInUse(null);
1184
1185         ContentType contentType = CONTENT_TYPE_UNKNOWN;
1186         contentType = ContentManagerUtil::CheckContentType(_pathOfSelectedFile);
1187         AppLogDebug("OnAppControlCompleteResponseReceived:%d", contentType);
1188
1189         if (GetLastResult() == E_FILE_NOT_FOUND)
1190         {
1191                 _pFolderEntryPM->RefreshFolderEntries();
1192                 if (_pListView != null && _pListView->IsVisible())
1193                 {
1194                         r = _pListView->UpdateList();
1195                 }
1196
1197                 if (_pIconListView != null && _pIconListView->IsVisible())
1198                 {
1199                         r = _pIconListView->UpdateList();
1200                 }
1201                 _pFolderEntryPM->InitThumbnailManager();
1202         }
1203 }
1204
1205 result
1206 SubBaseFolderEntryForm::SetDefaultSelectionForSortByPopUp(void)
1207 {
1208         result r = E_SUCCESS;
1209
1210         int defaultSortPopUpSelect = 0;
1211
1212         int sortType = SORT_BY_TYPE_NAME_ASCENDING;
1213
1214         int uncheckItem1 = 0;
1215         int uncheckItem2 = 0;
1216         int uncheckItem3 = 0;
1217         int uncheckItem4 = 0;
1218         int uncheckItem5 = 0;
1219
1220         String sortByKeyName(L"SortBy");
1221
1222         AppRegistry* pAppRegistry = null;
1223
1224         pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1225
1226         r = pAppRegistry->Get(sortByKeyName, sortType);
1227         TryCatch(r == E_SUCCESS, , "Failed To Get Value From AppRegistry");
1228
1229         switch (sortType)
1230         {
1231
1232         case SORT_BY_TYPE_NAME_ASCENDING:
1233         {
1234                 defaultSortPopUpSelect = 0;
1235                 uncheckItem1 = 1;
1236                 uncheckItem2 = 2;
1237                 uncheckItem3 = 3;
1238                 uncheckItem4 = 4;
1239                 uncheckItem5 = 5;
1240         }
1241         break;
1242
1243         case SORT_BY_TYPE_NAME_DESCENDING:
1244         {
1245                 defaultSortPopUpSelect = 1;
1246                 uncheckItem1 = 0;
1247                 uncheckItem2 = 2;
1248                 uncheckItem3 = 3;
1249                 uncheckItem4 = 4;
1250                 uncheckItem5 = 5;
1251         }
1252         break;
1253
1254         case SORT_BY_TYPE_DATE_RECENT:
1255         {
1256                 defaultSortPopUpSelect = 2;
1257                 uncheckItem1 = 0;
1258                 uncheckItem2 = 1;
1259                 uncheckItem3 = 3;
1260                 uncheckItem4 = 4;
1261                 uncheckItem5 = 5;
1262
1263         }
1264         break;
1265
1266         case SORT_BY_TYPE_DATE_OLDEST:
1267         {
1268                 defaultSortPopUpSelect = 3;
1269                 uncheckItem1 = 0;
1270                 uncheckItem2 = 1;
1271                 uncheckItem3 = 2;
1272                 uncheckItem4 = 4;
1273                 uncheckItem5 = 5;
1274         }
1275         break;
1276
1277         case SORT_BY_TYPE_SIZE_ASCENDING:
1278         {
1279                 defaultSortPopUpSelect = 4;
1280                 uncheckItem1 = 0;
1281                 uncheckItem2 = 1;
1282                 uncheckItem3 = 2;
1283                 uncheckItem4 = 3;
1284                 uncheckItem5 = 5;
1285         }
1286         break;
1287
1288         case SORT_BY_TYPE_SIZE_DESCENDING:
1289         {
1290                 defaultSortPopUpSelect = 4;
1291                 uncheckItem1 = 0;
1292                 uncheckItem2 = 1;
1293                 uncheckItem3 = 2;
1294                 uncheckItem4 = 3;
1295                 uncheckItem5 = 5;
1296         }
1297         break;
1298
1299         case SORT_BY_TYPE_ASCENDING:
1300         {
1301                 defaultSortPopUpSelect = 5;
1302                 uncheckItem1 = 0;
1303                 uncheckItem2 = 1;
1304                 uncheckItem3 = 2;
1305                 uncheckItem4 = 3;
1306                 uncheckItem5 = 4;
1307
1308         }
1309         break;
1310
1311         case SORT_BY_TYPE_DESCENDING:
1312         {
1313                 defaultSortPopUpSelect = 5;
1314                 uncheckItem1 = 0;
1315                 uncheckItem2 = 1;
1316                 uncheckItem3 = 2;
1317                 uncheckItem4 = 3;
1318                 uncheckItem5 = 4;
1319
1320         }
1321         break;
1322
1323         default:
1324         {
1325                 defaultSortPopUpSelect = 0;
1326                 AppLogDebug("UnSupported case reached");
1327         }
1328         break;
1329         }
1330
1331         if (_pCustomListViewForPopup != null)
1332         {
1333                 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1334         }
1335
1336         if (_pSortByPopup != null && _pSortByListView != null)
1337         {
1338                 _pSortByListView->UpdateList();
1339                 _pSortByListView->SetItemChecked(defaultSortPopUpSelect, true);
1340                 _pSortByListView->SetItemChecked(uncheckItem1, false);
1341                 _pSortByListView->SetItemChecked(uncheckItem2, false);
1342                 _pSortByListView->SetItemChecked(uncheckItem3, false);
1343                 _pSortByListView->SetItemChecked(uncheckItem4, false);
1344                 _pSortByListView->SetItemChecked(uncheckItem5, false);
1345
1346                 _pSortByListView->Invalidate(true);
1347         }
1348
1349         return r;
1350 CATCH:
1351         return r;
1352 }
1353
1354 void
1355 SubBaseFolderEntryForm::SwitchViewType(void)
1356 {
1357         String viewStyleKeyName(L"ListDisplayType");
1358
1359         switch (_flagViewAsStatus)
1360         {
1361
1362         case VIEW_TYPE_AS_DETAILED_LIST:
1363         {
1364                 if (_pIconListView != null && _pIconListView->IsVisible())
1365                 {
1366                         _pIconListView->SetShowState(false);
1367                 }
1368                 if (_pListView != null)
1369                 {
1370                         _pListView->UpdateList();
1371                         _pListView->ScrollToItem(0);
1372                         _pListView->SetShowState(true);
1373                 }
1374
1375         }
1376         break;
1377
1378         case VIEW_TYPE_AS_NORMAL_LIST:
1379         {
1380                 if (_pIconListView != null && _pIconListView->IsVisible())
1381                 {
1382                         _pIconListView->SetShowState(false);
1383                 }
1384
1385                 if (_pListView != null)
1386                 {
1387                         _pListView->UpdateList();
1388                         _pListView->ScrollToItem(0);
1389                         _pListView->SetShowState(true);
1390                 }
1391         }
1392         break;
1393
1394         case VIEW_TYPE_AS_THUMBNAILS:
1395         {
1396                 if (_pListView != null && _pListView->IsVisible())
1397                 {
1398                         _pListView->SetShowState(false);
1399                 }
1400                 if (_pIconListView != null)
1401                 {
1402                         _pIconListView->UpdateList();
1403                         _pIconListView->ScrollToItem(0);
1404                         _pIconListView->SetShowState(true);
1405                 }
1406         }
1407         break;
1408
1409         default:
1410         {
1411                 if (_pListView != null)
1412                 {
1413                         _pListView->UpdateList();
1414                 }
1415         }
1416         break;
1417         }
1418 }
1419
1420 FolderEntryPresentationModel*
1421 SubBaseFolderEntryForm::GetFoldeEntryPresentationModel(void)
1422 {
1423         return _pFolderEntryPM;
1424 }
1425
1426 result
1427 SubBaseFolderEntryForm::DeleteFile(String& filePath)
1428 {
1429         AppLogDebug("ENTER");
1430         result r = E_SUCCESS;
1431
1432         //_pFolderEntryPM->SetFileEventListener(null);
1433         ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
1434
1435         _pFileManager->DeleteFolderEntries(&filePath);
1436
1437         AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
1438         return r;
1439 }
1440
1441 void
1442 SubBaseFolderEntryForm::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int actionId)
1443 {
1444         DirectoryEntry* pDirStr = null;
1445         switch (actionId)
1446         {
1447         case IDA_BTN_EDIT:
1448         {
1449                 //If filenames is not empty then Load the edit form.
1450                 if (_pFilenames->GetCount() != 0)
1451                 {
1452                         //_pFolderEntryPM->SetFileEventListener(null);
1453
1454                         LoadEditForm();
1455                 }
1456         }
1457         break;
1458
1459         case IDA_BTN_MORE:
1460         {
1461                 CreateMoreContextMenu();
1462
1463                 ShowMoreContextMenu();
1464         }
1465         break;
1466
1467         case IDA_BTN_SORT_BY:
1468         {
1469                 //Show the SortBy PopUp.
1470                 if (_pCustomListViewForPopup != null)
1471                 {
1472                         _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1473                 }
1474
1475
1476                 ShowSortByPopup();
1477         }
1478         break;
1479
1480         case IDA_CONTEXT_MENU_CREATE_FOLDER:
1481         {
1482                 //Load the CreateFolder Form.
1483                 //_pFolderEntryPM->SetFileEventListener(null);
1484                 _renameOrCreate = SELECT_CREATE_FOLDER;
1485
1486                 if (_pMoreContextMenu != null)
1487                 {
1488                         delete _pMoreContextMenu;
1489                         _pMoreContextMenu = null;
1490                 }
1491
1492                 LoadCreateFolderForm();
1493         }
1494         break;
1495
1496         case IDA_CONTEXT_MENU_VIEW_AS:
1497         {
1498                 //Show the ViewAs Popup
1499                 if (_pCustomListViewForPopup != null)
1500                 {
1501                         _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
1502                 }
1503
1504                 ShowViewAsPopup();
1505         }
1506         break;
1507
1508         case IDA_BTN_POPUP_CANCEL:
1509         {
1510                 //Hide the ViewAs PopUp and redraw the form.
1511                 HideViewAsPopup();
1512         }
1513         break;
1514
1515         case IDA_BTN_SORT_POPUP_CANCEL:
1516         {
1517                 //Hide the SortBy PopUp and redraw the form.
1518                 HideSortByPopup();
1519
1520
1521         }
1522         break;
1523
1524         case IDA_BTN_SEARCH:
1525         {
1526                 //Load the SearchForm
1527                 //LoadSearchForm(_tabSelected);
1528                 LoadSearchForm();
1529         }
1530         break;
1531
1532         case IDA_DELETE_FILE:
1533         {
1534                 HideDeleteConfirmationPopup();
1535
1536                 if (_pDeleteConfirmationPopUp != null)
1537                 {
1538                         delete _pDeleteConfirmationPopUp;
1539                         _pDeleteConfirmationPopUp = null;
1540                 }
1541
1542                 _filePath.Clear();
1543
1544                 if (_pFilenames != null)
1545                 {
1546                         pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(_indexToDelete));
1547                 }
1548
1549                 if (pDirStr != null)
1550                 {
1551                         _filePath = pDirStr->GetFullFilePath();
1552                 }
1553
1554                 _indexTracker = _indexToDelete;
1555
1556                 //Call the DeleteFile Function.
1557                 DeleteFile(_filePath);
1558         }
1559         break;
1560
1561         case IDA_CANCEL_DELETION:
1562         {
1563                 HideDeleteConfirmationPopup();
1564
1565                 if (_pDeleteConfirmationPopUp != null)
1566                 {
1567                         delete _pDeleteConfirmationPopUp;
1568                         _pDeleteConfirmationPopUp = null;
1569                 }
1570         }
1571         break;
1572         case IDA_BTN_ANIMATION_POPUP_CANCEL:
1573         {
1574                 AppLogDebug("IDA_BTN_ANIMATION_POPUP_CANCEL");
1575                 HideFileProgressingPopup();
1576                 _pFileManager->ForceStopWorkerThread();
1577         }
1578         break;
1579         default:
1580         {
1581                 //Do Nothing.
1582         }
1583         break;
1584         }
1585 }
1586
1587 void
1588 SubBaseFolderEntryForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
1589 {
1590         DirectoryEntry* pDirStr = null;
1591
1592         if (_pFilenames != null)
1593         {
1594                 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
1595
1596                 if (pDirStr != null)
1597                 {
1598                         switch (elementId)
1599                         {
1600                         case IDA_CONTEXT_DETAIL:
1601                         {
1602                                 _filePath.Clear();
1603                                 //                      if (pDirStr != null)
1604                                 //                      {
1605                                 _filePath = pDirStr->GetFullFilePath();
1606                                 //                      }
1607                                 //Load the FileDetails View
1608                                 LoadDetailForm(_filePath);
1609                         }
1610                         break;
1611
1612                         case IDA_CONTEXT_RENAME:
1613                         {
1614                                 //                      if (pDirStr != null)
1615                                 //                      {
1616                                 _currentFileName.Clear();
1617                                 _currentFileName = pDirStr->GetFileName();
1618                                 //                      }
1619
1620                                 _renameIndex = index;
1621                                 _renameOrCreate = SELECT_RENAME;
1622                                 //Load the Rename View of the item selected.
1623                                 LoadRenameForm(index);
1624                         }
1625                         break;
1626
1627                         case IDA_CONTEXT_DELETE:
1628                         {
1629                                 _indexToDelete = index;
1630
1631                                 ShowDeleteConfirmationPopup();
1632                         }
1633                         break;
1634
1635                         default:
1636                         {
1637                                 //Empty Implementation.
1638                         }
1639                         break;
1640                         }
1641                 }
1642         }
1643 }
1644
1645 void
1646 SubBaseFolderEntryForm::OnThumbnailReceived(ThumbRequest* pThumbReq)
1647 {
1648         result res = E_SUCCESS;
1649         AppLogDebug("Enter");
1650
1651         if (_pFolderEntryPM)
1652         {
1653                 if (pThumbReq != null)
1654                 {
1655                         if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())
1656                         {
1657                                 if (pThumbReq->pBitmap != null)
1658                                 {
1659                                         delete pThumbReq->pBitmap;
1660                                 }
1661                                 return;
1662                         }
1663                 }
1664
1665                 if (pThumbReq)
1666                 {
1667                         if (pThumbReq->iRquestId < _pFilenames->GetCount())
1668                         {
1669                                 _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);
1670                                 if (_pListView && _pListView->IsVisible())
1671                                 {
1672                                         res = _pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1673                                 }
1674                                 else if (_pIconListView && _pIconListView->IsVisible())
1675                                 {
1676                                         res = _pIconListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1677                                 }
1678                         }
1679                         else
1680                                 AppLogDebug("Thumbnail Request is not valid");
1681                 }
1682                 else
1683                 {
1684                         _pFolderEntryPM->OnThumbnailResponseFailed();
1685                 }
1686         }
1687         AppLogDebug("Exit %s", GetErrorMessage(res));
1688         return;
1689 }
1690
1691 result
1692 SubBaseFolderEntryForm::CreateSortByPopup(void)
1693 {
1694         result r = E_SUCCESS;
1695
1696         if (_pSortByPopup != null)
1697         {
1698                 AppLogDebug("_pSortByPopup is not null");
1699                 return r;
1700         }
1701         String cancelButton;
1702         String sortByPopupTitle;
1703
1704         Label* pSortByPanelLabel = null;
1705         Label* pSortByPopupLabel = null;
1706
1707         Bitmap* pPanelBackground = null;
1708         Bitmap* pPopUpBackground = null;
1709
1710         pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
1711         pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
1712
1713         _pSortByPopup = new (std::nothrow) Popup();
1714         _pSortByPopup->Construct(L"IDL_SORT_BY_POPUP");
1715
1716         _pCancelSortBy = static_cast< Button* >(_pSortByPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
1717         TryCatch(_pCancelSortBy != null, , "MfMyFilesApp::Button For Popup not created!");
1718
1719         _pCancelSortBy->SetActionId(IDA_BTN_SORT_POPUP_CANCEL);
1720         _pCancelSortBy->AddActionEventListener(*this);
1721         _pCancelSortBy->SetShowState(true);
1722
1723         pSortByPanelLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_PANEL_BACKGROUND", true));
1724         TryCatch(pSortByPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1725
1726         pSortByPopupLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
1727         TryCatch(pSortByPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1728
1729         if (pPanelBackground != null)
1730         {
1731                 pSortByPanelLabel->SetBackgroundBitmap(*pPanelBackground);
1732         }
1733
1734         if (pPopUpBackground != null)
1735         {
1736                 pSortByPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
1737
1738         }
1739
1740         _pSortByListView = static_cast< ListView* >(_pSortByPopup->GetControl(L"IDC_LISTVIEW_SORT_BY", true));
1741         TryCatch(_pSortByListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
1742
1743         _pSortByListView->SetShowState(true);
1744         _pSortByListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
1745         _pSortByListView->SetItemProvider(*_pCustomListViewForPopup);
1746         _pSortByListView->SetName(L"SORT_BY_LISTVIEW");
1747         _pSortByListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
1748
1749         AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
1750
1751         _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPanelLabel, true);
1752         _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPopupLabel, true);
1753         _pSortByPopup->SetControlAlwaysOnTop(*_pSortByListView, true);
1754         _pSortByPopup->SetControlAlwaysOnTop(*_pCancelSortBy, true);
1755
1756         if (pPanelBackground != null)
1757         {
1758                 delete pPanelBackground;
1759                 pPanelBackground = null;
1760         }
1761         if (pPopUpBackground != null)
1762         {
1763                 delete pPopUpBackground;
1764                 pPopUpBackground = null;
1765         }
1766         return r;
1767
1768 CATCH:
1769         if (_pCustomListViewForPopup != null)
1770         {
1771                 delete _pCustomListViewForPopup;
1772                 _pCustomListViewForPopup = null;
1773         }
1774
1775         if (_pSortByPopup != null)
1776         {
1777                 delete _pSortByPopup;
1778                 _pSortByPopup = null;
1779         }
1780
1781         if (pPanelBackground != null)
1782         {
1783                 delete pPanelBackground;
1784                 pPanelBackground = null;
1785         }
1786
1787         if (pPopUpBackground != null)
1788         {
1789                 delete pPopUpBackground;
1790                 pPopUpBackground = null;
1791         }
1792
1793         return r;
1794 }
1795
1796 result
1797 SubBaseFolderEntryForm::CreateMoreContextMenu(void)
1798 {
1799         result r = E_SUCCESS;
1800
1801         int xPosition = 0;
1802         int yPosition = 0;
1803
1804         String viewAs;
1805         String extensionVisibility;
1806
1807         String buttonCreateFolder;
1808
1809         AppResource* pAppResource = null;
1810         AppRegistry* pAppRegistry = null;
1811         pAppResource = Application::GetInstance()->GetAppResource();
1812
1813         pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1814
1815         if (pAppResource != null)
1816         {
1817                 pAppResource->GetString(L"IDS_MF_OPT_VIEW_AS", viewAs);
1818                 pAppResource->GetString(L"IDS_MF_OPT_CREATE_FOLDER", buttonCreateFolder);
1819                 pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", _hideExtension);
1820                 pAppResource->GetString(L"IDS_MF_OPT_SHOW_FILE_EXTENSION", _showExtension);
1821         }
1822
1823         _pFooter = GetFooter();
1824         if (_pFooter != null)
1825         {
1826                 _pFooter->GetPosition(xPosition, yPosition);
1827         }
1828
1829         xPosition += 3 * (GetClientAreaBounds().width / 4);
1830
1831         //Create the ContextMenu
1832         _pMoreContextMenu = new (std::nothrow) ContextMenu();
1833
1834         _pMoreContextMenu->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
1835         _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
1836         _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
1837
1838         _pMoreContextMenu->AddItem(buttonCreateFolder, IDA_CONTEXT_MENU_CREATE_FOLDER);
1839
1840         _pMoreContextMenu->AddItem(viewAs, IDA_CONTEXT_MENU_VIEW_AS);
1841
1842         pAppRegistry->Get(_extensionKeyName, extensionVisibility);
1843
1844         if (extensionVisibility == _hideExtension)
1845         {
1846                 _pMoreContextMenu->AddItem(_showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
1847         }
1848         else
1849         {
1850                 _pMoreContextMenu->AddItem(_hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
1851         }
1852
1853         //Set the ContextMenu's ActionEventListener
1854         _pMoreContextMenu->AddActionEventListener(*this);
1855         _pMoreContextMenu->SetAnchorPosition(Point(xPosition, yPosition));
1856         _pMoreContextMenu->SetShowState(true);
1857
1858         return r;
1859 }
1860
1861 result
1862 SubBaseFolderEntryForm::SetDefaultSelectionForViewAsPopUp(void)
1863 {
1864         result r = E_SUCCESS;
1865
1866         int defaultViewAsPopUpSelect = 0;
1867         int uncheckItem1 = 0;
1868         int uncheckItem2 = 0;
1869
1870         int viewType = VIEW_TYPE_AS_NONE;
1871         String viewStyleKeyName(L"ListDisplayType");
1872
1873         AppRegistry* pAppRegistry = null;
1874
1875         pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1876
1877         r = pAppRegistry->Get(viewStyleKeyName, viewType);
1878
1879         switch (viewType)
1880         {
1881
1882         case VIEW_TYPE_AS_DETAILED_LIST:
1883         {
1884                 defaultViewAsPopUpSelect = 1;
1885                 uncheckItem1 = 0;
1886                 uncheckItem2 = 2;
1887         }
1888         break;
1889
1890         case VIEW_TYPE_AS_NORMAL_LIST:
1891         {
1892                 defaultViewAsPopUpSelect = 0;
1893                 uncheckItem1 = 1;
1894                 uncheckItem2 = 2;
1895         }
1896         break;
1897
1898         case VIEW_TYPE_AS_THUMBNAILS:
1899         {
1900                 defaultViewAsPopUpSelect = 2;
1901                 uncheckItem1 = 0;
1902                 uncheckItem2 = 1;
1903         }
1904         break;
1905
1906         default:
1907         {
1908                 //Empty Implementation.
1909         }
1910         break;
1911         }
1912
1913
1914         if (_pCustomListViewForPopup != null)
1915         {
1916                 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
1917         }
1918
1919         if (_pViewAsPopup != null && _pViewAsListView != null)
1920         {
1921                 _pViewAsListView->UpdateList();
1922                 _pViewAsListView->SetItemChecked(defaultViewAsPopUpSelect, true);
1923                 _pViewAsListView->SetItemChecked(uncheckItem1, false);
1924                 _pViewAsListView->SetItemChecked(uncheckItem2, false);
1925                 _pViewAsListView->Invalidate(true);
1926         }
1927         return r;
1928 }
1929
1930 void
1931 SubBaseFolderEntryForm::OnPackageInstallationCompleted(const Tizen::App::PackageId& packageId, Tizen::App::Package::PackageInstallationResult installationResult)
1932 {
1933         AppLogDebug("TopMostFolderFileListForm::OnPackageInstallationComplete");
1934         HideInstallationProgressPopup();
1935 }
1936
1937 void
1938 SubBaseFolderEntryForm::OnPackageInstallationInProgress(const Tizen::App::PackageId& packageId, int progress)
1939 {
1940         //Empty Implementation
1941 }
1942
1943 void
1944 SubBaseFolderEntryForm::OnPackageUninstallationCompleted(const Tizen::App::PackageId& packageId, bool uninstallationResult)
1945 {
1946         //Empty Implementation
1947 }
1948
1949 void
1950 SubBaseFolderEntryForm::OnPackageInstallationResponseReceived(const PackageId& packageId, PackageInstallationResult installationResult)
1951 {
1952         //Empty Implementation
1953 }
1954
1955 void
1956 SubBaseFolderEntryForm::OnPackageInstallationInProgressResponseReceived(const PackageId& packageId, int progress)
1957 {
1958         //Empty Implementation
1959 }
1960
1961 result
1962 SubBaseFolderEntryForm::CreateInstallationConfirmationPopUp(void)
1963 {
1964         AppLogDebug("Entry");
1965         result r = E_SUCCESS;
1966
1967         Label* pPanelLabel = null;
1968         Label* pPopupLabel = null;
1969
1970         Bitmap* pPanelBackground = null;
1971         Bitmap* pPopUpBackground = null;
1972
1973         pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
1974         pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
1975
1976         //Create a new popup control
1977         _pInstallationConfirmationPopUp = new (std::nothrow) Popup();
1978         _pInstallationConfirmationPopUp->Construct(L"IDL_INSTALL_POPUP");
1979         AppLogDebug("Install Popup:Error Message:%s", GetErrorMessage(GetLastResult()));
1980
1981         pPanelLabel = static_cast< Label* >(_pInstallationConfirmationPopUp->GetControl(L"IDC_LABEL_BOTTOM", true));
1982         AppLogDebug("Install Popup:Error Message:%s", GetErrorMessage(GetLastResult()));
1983         TryCatch(pPanelLabel != null, , "MfMyFilesApp::pPanelLabel For Popup not created!");
1984
1985
1986         if (pPanelBackground != null)
1987         {
1988                 pPanelLabel->SetBackgroundBitmap(*pPanelBackground);
1989         }
1990
1991         pPopupLabel = static_cast< Label* >(_pInstallationConfirmationPopUp->GetControl(L"IDC_LABEL_TOP", true));
1992         AppLogDebug("Install Popup:Error Message:%s", GetErrorMessage(GetLastResult()));
1993         TryCatch(pPopupLabel != null, , "MfMyFilesApp::pPanelLabel For Popup not created!");
1994
1995         if (pPopUpBackground != null)
1996         {
1997                 pPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
1998         }
1999
2000         _pInstall = static_cast< Button* >(_pInstallationConfirmationPopUp->GetControl(L"IDC_BUTTON_YES", true));
2001         AppLogDebug("Install Popup:Error Message:%s", GetErrorMessage(GetLastResult()));
2002         TryCatch(_pInstall != null, , "MfMyFilesApp::Button For Popup not created!");
2003
2004         _pInstall->SetActionId(IDA_INSTALL_APP);
2005         _pInstall->AddActionEventListener(*this);
2006         _pInstall->SetShowState(true);
2007
2008         _pCancelInstallation = static_cast< Button* >(_pInstallationConfirmationPopUp->GetControl(L"IDC_BUTTON_NO", true));
2009         AppLogDebug("Install Popup:Error Message:%s", GetErrorMessage(GetLastResult()));
2010         TryCatch(_pCancelInstallation != null, , "MfMyFilesApp::Button For Popup not created!");
2011
2012         _pCancelInstallation->SetActionId(IDA_CANCEL_INSTALLATION);
2013         _pCancelInstallation->AddActionEventListener(*this);
2014         _pCancelInstallation->SetShowState(true);
2015
2016         AppLogDebug("Exit");
2017         if (pPopUpBackground != null)
2018         {
2019                 delete pPopUpBackground;
2020                 pPopUpBackground = null;
2021         }
2022         if (pPanelBackground != null)
2023         {
2024                 delete pPanelBackground;
2025                 pPanelBackground = null;
2026         }
2027         return r;
2028
2029 CATCH:
2030         r = GetLastResult();
2031         if (pPopUpBackground != null)
2032         {
2033                 delete pPopUpBackground;
2034                 pPopUpBackground = null;
2035         }
2036         if (pPanelBackground != null)
2037         {
2038                 delete pPanelBackground;
2039                 pPanelBackground = null;
2040         }
2041         if (_pInstallationConfirmationPopUp != null)
2042         {
2043                 delete _pInstallationConfirmationPopUp;
2044                 _pInstallationConfirmationPopUp = null;
2045         }
2046
2047         return r;
2048 }
2049 result
2050 SubBaseFolderEntryForm::CreateInstallationProgressPopUp(void)
2051 {
2052         result r = E_SUCCESS;
2053
2054         Label* pinstProgPopupLabel = null;
2055         Bitmap* pPopUpBackground = null;
2056
2057
2058         _pInstallationProgressPopup = new (std::nothrow) Popup();
2059         _pInstallationProgressPopup->Construct(L"IDL_INSTALLATION_PROGRESS_POPUP");
2060
2061         pinstProgPopupLabel = static_cast< Label* >(_pInstallationProgressPopup->GetControl(L"IDC_LABEL1", true));
2062
2063         pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
2064         if (pinstProgPopupLabel && pPopUpBackground)
2065         {
2066                 pinstProgPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
2067         }
2068         _pInstallationProgressPopup->SetShowState(false);
2069
2070         if (pPopUpBackground != null)
2071         {
2072                 delete pPopUpBackground;
2073                 pPopUpBackground = null;
2074         }
2075         return r;
2076 }
2077
2078 void
2079 SubBaseFolderEntryForm::ShowInstallationProgressPopup(void)
2080 {
2081         CreateInstallationProgressPopUp();
2082         if (_pInstallationProgressPopup != null)
2083         {
2084                 _pInstallationProgressPopup->SetShowState(true);
2085                 _pInstallationProgressPopup->Invalidate(true);
2086         }
2087 }
2088 void
2089 SubBaseFolderEntryForm::HideInstallationProgressPopup(void)
2090 {
2091         if (_pInstallationProgressPopup != null && _pInstallationProgressPopup->IsVisible())
2092         {
2093                 _pInstallationProgressPopup->SetShowState(false);
2094
2095                 delete _pInstallationProgressPopup;
2096                 _pInstallationProgressPopup = null;
2097         }
2098 }
2099 void
2100 SubBaseFolderEntryForm::ShowInstallationConfirmationPopup(void)
2101 {
2102         CreateInstallationConfirmationPopUp();
2103
2104         if (_pInstallationConfirmationPopUp != null)
2105         {
2106                 _pInstallationConfirmationPopUp->SetShowState(true);
2107                 _pInstallationConfirmationPopUp->Show();
2108         }
2109 }
2110 void
2111 SubBaseFolderEntryForm::HideInstallationConfirmationPopup(void)
2112 {
2113         if (_pInstallationConfirmationPopUp != null && _pInstallationConfirmationPopUp->IsVisible())
2114         {
2115                 _pInstallationConfirmationPopUp->SetShowState(false);
2116
2117                 delete _pInstallationConfirmationPopUp;
2118                 _pInstallationConfirmationPopUp = null;
2119         }
2120 }
2121
2122 void
2123 SubBaseFolderEntryForm::SetFooterVisibility(int mode)
2124 {
2125         AppLogDebug("Entry");
2126         _pFooter = GetFooter();
2127
2128         if (mode == 0)
2129         {
2130                 _pFooter->SetItemEnabled(0, false);
2131                 _pFooter->SetItemEnabled(1, false);
2132                 if (CheckSearchHistory() == false)
2133                 {
2134                 _pFooter->SetItemEnabled(2, false);
2135                 }
2136         }
2137         else
2138         {
2139                 _pFooter->SetItemEnabled(0, true);
2140                 _pFooter->SetItemEnabled(1, true);
2141                 _pFooter->SetItemEnabled(2, true);
2142         }
2143
2144         _pFooter->Invalidate(true);
2145 }
2146
2147 bool
2148 SubBaseFolderEntryForm::CheckSearchHistory(void)
2149 {
2150         bool searchHistoryStatus = false;
2151         int itemCount = 0;
2152         String searchScene;
2153         SceneManager* pSceneManager = SceneManager::GetInstance();
2154         IListT< SceneId >* pSceneList = pSceneManager->GetSceneHistoryN();
2155
2156         if (pSceneList != null)
2157         {
2158                 itemCount = pSceneList->GetCount() - 1;
2159                 pSceneList->GetAt(itemCount, searchScene);
2160                 while (searchScene != IDSCN_SEARCH_FORM && itemCount >= 0)
2161                 {
2162                         itemCount--;
2163                         pSceneList->GetAt(itemCount, searchScene);
2164                 }
2165         }
2166
2167         if (searchScene == IDSCN_SEARCH_FORM)
2168         {
2169                 AppLogDebug("Search scene present");
2170                 searchHistoryStatus = true;
2171         }
2172         else
2173         {
2174                 AppLogDebug("Search scene not present");
2175                 searchHistoryStatus = false;
2176         }
2177
2178         if(pSceneList)
2179         {
2180                 pSceneList->RemoveAll();
2181                 delete pSceneList;
2182                 pSceneList = null;
2183         }
2184         return searchHistoryStatus;
2185 }
2186
2187 void
2188 SubBaseFolderEntryForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String &  path, const unsigned int     eventId)
2189 {
2190
2191 }