NABI_SE issues resolved
[apps/osp/MyFiles.git] / src / MfSearchForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file: SearchForm.cpp
19  * @brief: This file contains implementation of SearchForm.
20  */
21
22 #include "MfSearchForm.h"
23
24 using namespace Tizen::App;
25 using namespace Tizen::App::Package;
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Collection;
28 using namespace Tizen::Base::Utility;
29 using namespace Tizen::Content;
30 using namespace Tizen::Graphics;
31 using namespace Tizen::Io;
32 using namespace Tizen::System;
33 using namespace Tizen::Ui;
34 using namespace Tizen::Ui::Controls;
35 using namespace Tizen::Ui::Scenes;
36
37 int SearchForm::searchBackSelected = 0;
38 SearchForm::SearchForm(void)
39 {
40         __pContentListFromLastView = null;
41         __pSearchedContentList = null;
42
43         __pListView = null;
44         __pSearchBar = null;
45         __pSearchPopup = null;
46         __pLabelSearching = null;
47         __pCancelSearch = null;
48         __pFolderLabel = null;
49
50         __pThumbnailManager = null;
51         __pSearchModel = null;
52
53         __searchText = L"";
54         __currentSearchDirectoryPath = L"";
55         __directoryForFileEvent = L"";
56         __bIsResultList = false;
57
58         __searchedAllFolders = false;
59         __isSearchCompleted = false;
60         __isCancelClicked = false;
61         __isSearchStarted = false;
62         __bCheckArgsNull = false;
63         __isCurrentDirectoryRenamed = false;
64         __backFromAppControl = false;
65
66         __itemCount = -1;
67         __searchItemIndex = INVALID_LIST_INDEX;
68
69         __pFolderBitmap = null;
70         __pDummyImage = null;
71
72         __pDeleteConfirmationPopUp = null;
73
74         __selectedItemIndexForRename = 0;
75         __selectedItemIndexForDelete = 0;
76
77         __previouFormTab = MEMORY_TYPE_NONE;
78
79         __pCancelDeletion = null;
80         __pDelete = null;
81         __pFileProgressingCancelButton = null;
82         __pFileProgressingHeaderLabel = null;
83         __pItemContext = null;
84         __pFileProgressingPopup = null;
85         __pFileProgressingProgress = null;
86         __pFileEventManager = null;
87 }
88
89 SearchForm::~SearchForm(void)
90 {
91         AppLogDebug("Entry");
92
93         if (__pSearchedContentList != null)
94         {
95                 __pSearchedContentList->RemoveAll(true);
96                 delete __pSearchedContentList;
97         }
98
99         if (__pSearchModel != null)
100         {
101                 delete __pSearchModel;
102         }
103
104         if (__pItemContext != null)
105         {
106                 delete __pItemContext;
107         }
108
109         if (__pDeleteConfirmationPopUp != null)
110         {
111                 delete __pDeleteConfirmationPopUp;
112         }
113         if(__pFolderEntryPM != null)
114         {
115                 delete __pFolderEntryPM;
116         }
117         if (__pFileEventManager != null)
118         {
119                 delete __pFileEventManager;
120         }
121
122 }
123
124 SearchForm&
125 SearchForm::operator =(const SearchForm& pSearchForm)
126 {
127         return *this;
128 }
129
130 SearchForm::SearchForm(const SearchForm& pSearchForm)
131 {
132         __pContentListFromLastView = pSearchForm.__pContentListFromLastView;
133         __selectedItemIndexForRename = pSearchForm.__selectedItemIndexForRename;
134 }
135
136
137 bool
138 SearchForm::Initialize(void)
139 {
140         result r = Form::Construct(L"IDL_SEARCH");
141         if (r != E_SUCCESS)
142         {
143                 AppLogDebug("Form construct failed with %s", GetErrorMessage(r));
144                 return false;
145         }
146         return true;
147 }
148
149 result
150 SearchForm::OnInitializing(void)
151 {
152         AppLogDebug("ENTER::SearchForm::OnInitializing");
153         result r = E_SUCCESS;
154         String cancelButton(L"");
155
156         Bitmap* pDeleteNormalBmp = null;
157         Bitmap* pDeletePressBmp = null;
158         String renameButtonText;
159         String detailButtonText;
160         String deleteButtonText;
161         String strSearching ;
162         IListT< SceneId >* pSceneList = null;
163
164         __SelectedTab = MEMORY_TYPE_NONE;
165
166         __pFolderBitmap = AppResource::GetInstance()->GetBitmapN(IDB_FOLDER, BITMAP_PIXEL_FORMAT_ARGB8888);
167         __pDummyImage = AppResource::GetInstance()->GetBitmapN(IDB_DUMMY_IMG, BITMAP_PIXEL_FORMAT_ARGB8888);
168         AppResource::GetInstance()->GetString(L"IDS_MF_BODY_RENAME_ABB", renameButtonText);
169         AppResource::GetInstance()->GetString(L"IDS_MF_SK3_DELETE", deleteButtonText);
170         AppResource::GetInstance()->GetString(L"IDS_MF_SK_DETAILS", detailButtonText);
171
172         pDeleteNormalBmp = MfUtility::GetNinepatchedBitmapN(IDB_CONTEXT_DELETE_NORMAL, 150, 72);
173         pDeletePressBmp = MfUtility::GetNinepatchedBitmapN(IDB_CONTEXT_DELETE_PRESS, 150, 72);
174
175         Footer* pFooter = GetFooter();
176         pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
177         pFooter->SetBackButton();
178
179         SetFormBackEventListener(this);
180         __pThumbnailManager = ThumbnailManager::GetInstance();
181         TryCatch(__pThumbnailManager != null, , "ThumbnailManager::GetInstance() failed:%s", GetErrorMessage(GetLastResult()));
182
183         ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
184
185         __searchBarMode = SEARCH_BAR_MODE_INPUT;
186
187         __pSearchBar = static_cast< SearchBar* >(GetControl("IDC_SEARCHFORM_SEARCHBAR"));
188         TryCatch(__pSearchBar != null, , "__pSearchBar is Null");
189
190         __pSearchBar->AddSearchBarEventListener(*this);
191         __pSearchBar->AddTextEventListener(*this);
192         __pSearchBar->AddKeypadEventListener(*this);
193         __pSearchBar->SetShowState(true);
194
195         __pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel();
196         TryCatch(__pFolderEntryPM != null, , "Content Manager not found!");
197         __pFolderEntryPM->Construct();
198
199         __pSearchPopup = new (std::nothrow) Popup();
200         TryCatch(__pSearchPopup != null, , "Failed to allocate memory to __pSearchPopup");
201
202         r = __pSearchPopup->Construct(L"IDL_SEARCH_POPUP");
203         TryCatch(r == E_SUCCESS, , "failed to construct __pPopUpPanel");
204
205         __pLabelSearching = static_cast<Label*> (__pSearchPopup->GetControl(L"IDC_LABEL_SEARCHING"));
206         TryCatch(__pLabelSearching != null, , "Failed to get __pLabelSearching");
207
208         __pFolderLabel = static_cast<Label*> (__pSearchPopup->GetControl(L"IDC_LABEL_FOLDER"));
209         TryCatch(__pFolderLabel != null, r = GetLastResult(), "Failed to get __pFolderLabel");
210
211         __pCancelSearch = static_cast<Button*> (__pSearchPopup->GetControl(L"IDC_BUTTON_CANCEL"));
212         TryCatch(__pCancelSearch != null, , "Failed to get __pCancelSearch");
213
214         __pCancelSearch->SetActionId(IDA_BTN_POPUP_SEARCH_CANCEL);
215         __pCancelSearch->AddActionEventListener(*this);
216
217         __pSearchPopup->SetShowState(false);
218
219
220         __listViewRectangle.SetBounds(X_DEFAULT, H_SEARCH_BAR, GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCH_BAR);
221
222         __pListView = static_cast< ListView* >(GetControl("IDC_SEARCHFORM_LISTVIEW"));
223         TryCatch(__pListView != null, r = GetLastResult(), "__pListView is Null");
224
225         __pListView->SetItemProvider(*this);
226         __pListView->AddListViewItemEventListener(*this);
227
228         __pSearchModel = new (std::nothrow) SearchPresentationModel();
229         TryCatch(__pSearchModel != null, r = GetLastResult(), "SearchForm::OnInitializing::Failed to allocate memory to __PSearchModel");
230
231         r = __pSearchModel->Initialize();
232         TryCatch(r == E_SUCCESS, , "SearchPresentationModel:Init()failed with %s", GetErrorMessage(GetLastResult()));
233
234         __pSearchedContentList = new (std::nothrow) ArrayList();
235         TryCatch(__pSearchedContentList != null, , "SearchForm::GetCurrentFileControl::Failed to allocate Memory to __pSearchedContentList");
236
237         r = __pSearchedContentList->Construct();
238         TryCatch(r == E_SUCCESS, , "SearchForm::GetCurrentFileControl::Failed to construct __pSearchedContentList");
239
240         __pItemContext = new (std::nothrow) ListContextItem();
241
242         r = __pItemContext->Construct();
243         TryCatch(r == E_SUCCESS, r = GetLastResult(), "Failed to construct pitemcontext");
244
245         __pItemContext->AddElement(IDA_CONTEXT_RENAME, renameButtonText);
246         __pItemContext->AddElement(IDA_CONTEXT_DETAIL, detailButtonText);
247
248         __pItemContext->AddElement(IDA_CONTEXT_DELETE,
249                         deleteButtonText,
250                         *pDeleteNormalBmp,
251                         *pDeletePressBmp,
252                         null,
253                         true);
254
255         __previousFormPath = FolderNavigationPresentationModel::GetCurrentPath();
256         __previouFormTab = FolderNavigationPresentationModel::GetStorageType();
257         pSceneList = SceneManager::GetInstance()->GetSceneHistoryN();
258         if (pSceneList != null)
259         {
260                 __previousSceneId = SceneManager::GetInstance()->GetCurrentSceneId();
261         }
262
263         GetFolderName();
264
265         if (pDeleteNormalBmp != null)
266         {
267                 delete pDeleteNormalBmp;
268                 pDeleteNormalBmp = null;
269         }
270         if (pDeletePressBmp != null)
271         {
272                 delete pDeletePressBmp;
273                 pDeletePressBmp = null;
274         }
275         AppLogDebug("Exit");
276         return r;
277
278 CATCH:
279
280         if (__pSearchBar != null)
281         {
282                 delete __pSearchBar;
283         }
284         if (__pListView != null)
285         {
286                 delete __pListView;
287         }
288         if (__pSearchModel != null)
289         {
290                 delete __pSearchModel;
291         }
292
293         delete pDeleteNormalBmp;
294
295         delete pDeletePressBmp;
296
297         AppLogDebug("EXIT::SearchForm::OnInitializing");
298         return r;
299 }
300
301 result
302 SearchForm::OnTerminating(void)
303 {
304         result r = E_SUCCESS;
305         //((MfMyFilesApp*)Application::GetInstance())->SetCurrentView(null);
306
307         if (__pFolderBitmap)
308                 delete __pFolderBitmap;
309
310         if (__pDummyImage)
311                 delete __pDummyImage;
312         return r;
313 }
314
315
316 ////////////////////////////////////////////////////////////////////////
317 // Call-back functions
318 ////////////////////////////////////////////////////////////////////////
319
320 void
321 SearchForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
322                 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
323 {
324         AppLogDebug("ENTER:SearchForm::OnSceneActivatedN:%s", GetErrorMessage(GetLastResult()));
325
326         ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
327
328         FolderNavigationPresentationModel::SetCurrentFilePath(__previousFormPath);
329         DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
330
331 #if 0
332         DeviceManager::AddDeviceEventListener(DEVICE_TYPE_USB_CLIENT, *this);
333 #endif
334
335         SceneManager::GetInstance()->AddSceneManagerEventListener(*this);
336
337         if (pArgs != null)
338         {
339                 __bCheckArgsNull = true;
340
341                 __currentSearchDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
342                 __SelectedTab = FolderNavigationPresentationModel::GetStorageType();
343
344                 if (__pFolderEntryPM != null)
345                 {
346                         __pFolderEntryPM->SetSourceForm(CREATE_ITEM_SOURCE_SEARCH_FORM);
347                         if (__currentSearchDirectoryPath.IsEmpty() == false)
348                         {
349                                 __pFolderEntryPM->SetFolderEntryPath(__currentSearchDirectoryPath);
350                                 __pContentListFromLastView = __pFolderEntryPM->GetFolderEntryList();
351                                 TryCatch(__pContentListFromLastView != null, , "Failed to allocate Memory to __pContentListFromLastView");
352                         }
353                 }
354                 __isSearchCompleted = false;
355                 __isSearchStarted = false;
356
357                 String topLevelPath = L"";
358
359
360                 if (__SelectedTab == MEMORY_TYPE_PHONE)
361                 {
362                         topLevelPath = __pFolderEntryPM->GetMediaPath();
363                 }
364                 else if (__SelectedTab == MEMORY_TYPE_SD_CARD)
365                 {
366                         topLevelPath = __pFolderEntryPM->GetSdCardPath();
367                 }
368
369                 if (__currentSearchDirectoryPath.GetLength() > 0 && __currentSearchDirectoryPath != topLevelPath)
370                 {
371                         AppLogDebug("SearchForm::OnSceneActivatedN:%S:%S", __currentSearchDirectoryPath.GetPointer(), topLevelPath.GetPointer());
372                         __pFolderLabel->SetText(__currentSearchDirectoryPath);
373                 }
374
375                 pArgs->RemoveAll(false);
376                 delete pArgs;
377                 pArgs = null;
378
379         }
380         else
381         {
382                 __bCheckArgsNull = false;
383         }
384
385         AppLogDebug("EXIT:SearchForm::OnSceneActivatedN");
386         return;
387
388         CATCH:
389         AppLogDebug("EXIT:SearchForm::OnSceneActivatedN");
390         return;
391
392 }
393
394 void
395 SearchForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
396                 const Tizen::Ui::Scenes::SceneId& nextSceneId)
397 {
398         DeviceManager::RemoveAllDeviceEventListeners();
399         __pSearchBar->RemoveKeypadEventListener(*this);
400 }
401
402 void
403 SearchForm::OnFormBackRequested(Form& source)
404 {
405         TransitionScene();
406 }
407
408 void
409 SearchForm::TransitionScene(void)
410 {
411         //String rootMediaPath = BasePresentationModel::GetHomePath();
412         String rootMediaPath = BasePresentationModel::GetMediaPath();
413         SceneManager* pSceneManager = null;
414         pSceneManager = SceneManager::GetInstance();
415
416         if (__isSearchStarted == true && __isSearchCompleted == false)
417         {
418                 __pSearchModel->StopSearch();
419         }
420
421         if (__previousFormPath.CompareTo("") != 0)
422         {
423                 if (__isCurrentDirectoryRenamed == false)
424                         FolderNavigationPresentationModel::SetCurrentFilePath(__previousFormPath);
425                 FolderNavigationPresentationModel::SetStorageType(__previouFormTab);
426                 AppLogDebug("__previouspath is %S", __previousFormPath.GetPointer());
427         }
428
429         if(__pFileEventManager != null)
430                 __pFileEventManager->RemovePath(__directoryForFileEvent);
431
432 //      pSceneManager->GoBackward(BackwardSceneTransition(__previousSceneId, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
433
434         if (__previousSceneId == IDSCN_SPLIT_PANEL_FORM && GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT)
435         {
436                 if (__previousFormPath == BasePresentationModel::GetMediaPath() || __previousFormPath == BasePresentationModel::GetSdCardPath())
437                 {
438                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ROOT_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
439                 }
440                 else
441                 {
442                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
443                 }
444         }
445         /*else if ((__previousSceneId == IDSCN_ROOT_DIRECTORY_FORM ||  __previousSceneId == IDSCN_SUB_DIRECTORY_FORM) && GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
446         {
447                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SPLIT_PANEL_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
448         }*/
449         else
450         {
451                 pSceneManager->GoBackward(BackwardSceneTransition(__previousSceneId, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
452         }
453 }
454
455 void
456 SearchForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
457 {
458         int modalResult = 0;
459         CustomAppControl* pCustomAppControl = null;
460         String topLevelPath;
461         String emptySearchString;
462
463         DirectoryEntry* pFileDetails = null;
464         MessageBox messageEmptyString;
465
466         AppResource* pAppResource = null;
467
468
469         pAppResource = UiApp::GetInstance()->GetAppResource();
470         TryReturn(pAppResource != null, , "Failed to fetch AppResource");
471
472         pAppResource->GetString(L"IDS_SEARCH_STRING_CANNOT_BE_EMPTY", emptySearchString);
473
474         __pathOfSelectedFile = L"";
475
476         if (__isCancelClicked == true)
477         {
478                 return;
479         }
480         if (index == __itemCount && __searchedAllFolders == false)
481         {
482                 AppLogDebug("SearchPresentationModel::Search:%d", index);
483                 messageEmptyString.Construct(L"", emptySearchString , MSGBOX_STYLE_NONE, ID_MESSAGE_BOX_TIMEOUT_ONE_SECOND);
484
485                 if (__pSearchBar->GetText().IsEmpty())
486                 {
487                         messageEmptyString.ShowAndWait(modalResult);
488                         return;
489                 }
490
491                 //Set CurrentSearchDirectory to topLevelPath and StartSearch
492                 if (__SelectedTab == MEMORY_TYPE_PHONE)
493                 {
494                         topLevelPath = __pFolderEntryPM->GetMediaPath();
495                 }
496                 else if (__SelectedTab == MEMORY_TYPE_SD_CARD)
497                 {
498                         topLevelPath = __pFolderEntryPM->GetSdCardPath();
499                 }
500                 __currentSearchDirectoryPath = topLevelPath;
501                 StartSearch();
502         }
503         else
504         {
505
506                 if (__isSearchCompleted == false && __isSearchStarted == false)
507                 {
508                         pFileDetails = static_cast< DirectoryEntry* >(__pContentListFromLastView->GetAt(index));
509                 }
510                 else
511                 {
512                         pFileDetails = static_cast< DirectoryEntry* >(__pSearchedContentList->GetAt(index));
513                 }
514                 TryCatch(pFileDetails != null, , "pFileDetails is Null")
515
516
517                 __pathOfSelectedFile = pFileDetails->GetFullFilePath();
518
519                 if (pFileDetails->IsDirectory() == true)
520                 {
521                         String fileName = pFileDetails->GetFileName();
522                         String filePath = pFileDetails->GetFullFilePath();
523                         LoadSubDirectoryForm(filePath, fileName);
524                 }
525                 else
526                 {
527                         //Else launch the corresponding AppControl.
528                         if (__pathOfSelectedFile.EndsWith(L".tpk") || __pathOfSelectedFile.EndsWith(L".wgt"))
529                         {
530                                 String* pFileUriScheme = new (std::nothrow) String(L"file://");
531                                 pFileUriScheme->Append(__pathOfSelectedFile);
532
533                                 AppControl::FindAndStart(L"http://tizen.org/appcontrol/operation/view", pFileUriScheme, null, null, null, null);
534                                 delete pFileUriScheme;
535                         }
536                         else
537                         {
538                                 String FileName = pFileDetails->GetFileName() + "." + pFileDetails->GetFileExtension();
539                                 String parentDirectoryOfSelectedFile = L"";
540                                 __pathOfSelectedFile.SubString(0, __pathOfSelectedFile.GetLength() - FileName.GetLength() , parentDirectoryOfSelectedFile);
541
542                                 pCustomAppControl = CustomAppControl::GetInstance();
543                                 if (pCustomAppControl != null)
544                                 {
545                                         pCustomAppControl->SetAppControlListener(this);
546                                         if(__pFileEventManager != null)
547                                         {
548                                                         __pFileEventManager->RemovePath(__directoryForFileEvent);
549                                                         delete __pFileEventManager;
550                                                         __pFileEventManager = null;
551                                         }
552                                         __pFileEventManager = new (std::nothrow) FileEventManager();
553                                         __pFileEventManager->Construct(*this);
554
555                                         __directoryForFileEvent = parentDirectoryOfSelectedFile;
556                                         __pFileEventManager->AddPath(__directoryForFileEvent, FILE_EVENT_TYPE_CREATE | FILE_EVENT_TYPE_MOVED_FROM | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_DELETE );
557                                         AppControl* pAppControlInUse = pCustomAppControl->LaunchAppControl(__pathOfSelectedFile);
558                                         if (pAppControlInUse != null)
559                                                 CustomAppControl::SetAppControlInUse(pAppControlInUse);
560                                 }
561                         }
562                 }
563         }
564
565         __selectedItemIndex = index;
566         return;
567
568         CATCH:
569         return;
570 }
571
572 void
573 SearchForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
574 {
575         //Empty Implementation.
576 }
577
578 void
579 SearchForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
580 {
581         AppLogDebug("Enter");
582         AppLogDebug("ENTER: SearchForm::OnListViewContextItemStateChanged:%d, %d, %d, %d", index, elementId, __isSearchCompleted, __isSearchStarted);
583
584         String filePath = L"";
585         DirectoryEntry* pFileDetails = null;
586
587         if (__isSearchCompleted == false)
588         {
589                 if (__isSearchStarted == true)
590                 {
591                         pFileDetails = static_cast< DirectoryEntry* >(__pSearchedContentList->GetAt(index));
592                 }
593                 else
594                 {
595                         pFileDetails = static_cast< DirectoryEntry* >(__pContentListFromLastView->GetAt(index));
596                 }
597         }
598         else
599         {
600                 pFileDetails = static_cast< DirectoryEntry* >(__pSearchedContentList->GetAt(index));
601         }
602         TryCatch(pFileDetails != null, , "SearchForm::CreateItem::pFileDetails is null");
603
604         filePath.Append(pFileDetails->GetFullFilePath());
605
606         switch (elementId)
607         {
608         case IDA_CONTEXT_DETAIL:
609         {
610                 LoadDetailForm(filePath);
611         }
612         break;
613
614         case IDA_CONTEXT_RENAME:
615         {
616                 LoadRenameForm(index, pFileDetails);
617         }
618         break;
619
620         case IDA_CONTEXT_DELETE:
621         {
622                 __selectedItemIndexForDelete = index;
623                 __fileToDelete = pFileDetails->GetFullFilePath();
624
625                 ShowDeleteConfirmationPopup();
626
627         }
628         break;
629
630         default:
631         {
632                 //Do nothing
633         }
634         break;
635         }
636
637         CATCH:
638
639         AppLogDebug("EXIT: SearchForm::OnListViewContextItemStateChanged");
640 }
641
642 int
643 SearchForm::GetItemCount(void)
644 {
645         AppLogDebug("ENTER::SearchForm::GetItemCount:%d", __isSearchCompleted);
646         int count = 0;
647
648         TryCatch(__pSearchedContentList != null, , "__pContentListFromLastView is null!")
649
650         if (__isSearchCompleted == false)
651         {
652                 if (__isSearchStarted == true)
653                         count = __pSearchedContentList->GetCount();
654                 else
655                 {
656                         if (__pContentListFromLastView != null)
657                                 count = __pContentListFromLastView->GetCount();
658                 }
659         }
660         else
661         {
662                 count = __pSearchedContentList->GetCount();
663                 String topLevelPath = L"";
664
665                 if (__SelectedTab == MEMORY_TYPE_PHONE)
666                 {
667                         topLevelPath = defaultPhoneBody;
668                         topLevelPath.Append("/");
669                 }
670                 else if (__SelectedTab == MEMORY_TYPE_SD_CARD)
671                 {
672                         topLevelPath = defaultSdCardBody;
673                         topLevelPath.Append("/");
674                 }
675
676                 if (__currentSearchDirectoryPath != topLevelPath && __searchedAllFolders == false)
677                 {
678                         __itemCount = count++;
679                 }
680         }
681         AppLogDebug("EXIT::SearchForm::GetItemCount:%d", count);
682         return count;
683
684         CATCH:
685         AppLogDebug("EXIT::SearchForm::GetItemCount:%d", count);
686         return count;
687 }
688
689 ListItemBase*
690 SearchForm::CreateItem(int index, int itemWidth)
691 {
692         AppLogDebug("ENTER::SearchForm::CreateItem");
693         result r = E_SUCCESS;
694         String filename;
695         String imageIconPath;
696         String strHightlightedText;
697         String filepath;
698         String cacheImagePath;
699
700         Bitmap* pFetchedCacheImage = null;
701         Bitmap* pThumbnailImage = null;
702         HashMap* pCacheList = null;
703         ContentType contentType = CONTENT_TYPE_UNKNOWN;
704
705         Dimension thumbnailDimension(H_LISTVIEW_ITEM_BITMAP, W_LISTVIEW_ITEM_BITMAP);
706         Dimension textDimension(itemWidth - H_LISTVIEW_ITEM_BITMAP, H_ITEM_LISTVIEW);
707
708         AppResource* pAppResource = null;
709         DirectoryEntry* pFileDetails = null;
710         ContentListItem* pCustomItem = null;
711         ThumbRequest* pThumbReq = null;
712
713         ArrayList* pList = null;
714
715         if (index == __itemCount && __searchedAllFolders == false)
716         {
717                 CustomItem* pItem = null;
718                 String searchAllFolder = L"";
719                 AppResource::GetInstance()->GetString(L"IDS_MF_BUTTON_SEARCH_ALL_FOLDERS", searchAllFolder);
720                 pItem = new (std::nothrow) SearchAllFoldersItem(itemWidth, H_ITEM_LISTVIEW, searchAllFolder);
721                 return pItem;
722         }
723
724         pAppResource = Application::GetInstance()->GetAppResource();
725         TryCatch(pAppResource != null, , "Resource manager not found!");
726
727         if (__isSearchCompleted == false)
728         {
729                 if (__isSearchStarted == true)
730                 {
731                         pFileDetails = static_cast< DirectoryEntry* >(__pSearchedContentList->GetAt(index));
732                 }
733                 else
734                 {
735                         if (__pContentListFromLastView != null && __pContentListFromLastView->GetCount() != 0)
736                                 pFileDetails = static_cast< DirectoryEntry* >(__pContentListFromLastView->GetAt(index));
737                 }
738         }
739         else
740         {
741                 pFileDetails = static_cast< DirectoryEntry* >(__pSearchedContentList->GetAt(index));
742         }
743         TryCatch(pFileDetails != null, , "SearchForm::Failed to get pFileDetails");
744
745         pCustomItem = new (std::nothrow) ContentListItem(itemWidth, H_ITEM_LISTVIEW, true);
746         TryCatch(pCustomItem != null, , "SearchForm::Failed to create pCustomItem");
747
748         filename.Clear();
749         filename.Append(pFileDetails->GetFileName());
750
751         filepath.Clear();
752         filepath.Append(pFileDetails->GetFullFilePath());
753
754         if (pFileDetails->IsDirectory() == false)
755         {
756                 filename.Append(".");
757                 filename.Append(pFileDetails->GetFileExtension());
758         }
759
760         if (__searchText.GetLength() > 0)
761                 strHightlightedText.Append(__searchText);
762
763         pCustomItem->SetTitle(filename, strHightlightedText);
764
765 #if 0
766         if (__pThumbnailManager != null)
767         {
768                 if (pFileDetails->IsDirectory() == true)
769                 {
770                         pListBitmap = pAppResource->GetBitmapN(L"U01_icon_folder_Cropped.png", BITMAP_PIXEL_FORMAT_ARGB8888); //pFolderImage->DecodeN(folderIconPath, BITMAP_PIXEL_FORMAT_ARGB8888);
771                         AppLogDebug("MfMyFilesApp::Decode Folder Result: %s", GetErrorMessage(GetLastResult()));
772                 }
773                 else
774                 {
775                         imageIconPath = pFileDetails->GetFullFilePath();
776                         pListBitmap = __pThumbnailManager->InitThumbnailManagerN(imageIconPath, thumbnailDimension);
777                 }
778                 TryCatch(pListBitmap != null, , "SearchForm::CreateItem::pListBitmap is null");
779         }
780 #else
781
782         contentType = ContentManagerUtil::CheckContentType(pFileDetails->GetFullFilePath());
783         pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
784
785         if (pFileDetails->IsDirectory() == true)
786         {
787                 pCustomItem->SetThumbnail(__pFolderBitmap);
788         }
789         else
790         {
791                 if (pFileDetails->GetBitmap() == null)
792                 {
793                         if (pCacheList != null && (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO))
794                         {
795                                 if (pFileDetails != null)
796                                 {
797                                         cacheImagePath = pFileDetails->GetFullFilePath();
798                                         AppLogDebug("cache path is %S",cacheImagePath.GetPointer());
799                                 }
800
801                                 if ((pCacheList->GetValue(cacheImagePath)) != null)
802                                 {
803                                         pFetchedCacheImage = static_cast< Bitmap* >(pCacheList->GetValue(cacheImagePath));
804                                 }
805                         }
806
807                         if (pFetchedCacheImage != null)
808                         {
809                                 AppLogDebug("image taken from cachemanager");
810                                 pThumbnailImage = CacheManager::GetInstance()->GetCacheBitmapN(cacheImagePath);
811                                 pCustomItem->SetThumbnail(pThumbnailImage);
812                         }
813                         else
814                         {
815                         pCustomItem->SetThumbnail(__pDummyImage);
816
817                         pThumbReq = new (std::nothrow) ThumbRequest(CREATE_ITEM_SOURCE_SEARCH_FORM);
818                         TryCatch(pThumbReq != null, , "ThumbRequest is null!");
819
820                         pThumbReq->iRquestId = index;
821                         pThumbReq->FilePath = pFileDetails->GetFullFilePath();
822
823                         pList = new (std::nothrow) ArrayList();
824                         TryCatch(pList != null, , "Failed to create pList");
825
826                         r = pList->Construct();
827                         TryCatch(r == E_SUCCESS, , "Failed to construct pList");
828
829                         r = pList->Add(pThumbReq);
830                         TryCatch(r == E_SUCCESS, , "Failed to add object to  pList");
831
832                         __pThumbnailManager->SendUserEvent(ThumbnailManager::THUMB_MGR_GET_THUMBNAIL, pList);
833                         }
834                 }
835                 else
836                 {
837                         pCustomItem->SetThumbnail(pFileDetails->GetBitmap());
838                 }
839         }
840 #endif
841
842         pCustomItem->SetListAnnexStyle(ANNEX_STYLE_NORMAL);
843
844         if (__bIsResultList)
845         {
846                 GetParentFolderPath(&filepath);
847                 pCustomItem->SetFilepath(filepath);
848                 pCustomItem->MakeSearchFormListItem();
849         }
850         else
851         {
852                 pCustomItem->Make();
853         }       pCustomItem->SetContextItem(__pItemContext);
854
855         AppLogDebug("EXIT::SearchForm::CreateItem");
856         return pCustomItem;
857
858 CATCH:
859         if (pCustomItem != null)
860         {
861                 delete pCustomItem;
862         }
863         if (pList != null)
864         {
865                 delete pList;
866         }
867         if (pThumbReq)
868         {
869                 delete pThumbReq;
870         }
871         AppLogDebug("EXIT::SearchForm::CreateItem");
872         return null;
873 }
874
875 bool
876 SearchForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
877 {
878         AppLogDebug("ENTER::SearchForm::DeleteItem");
879         if (pItem != null)
880         {
881                 delete pItem;
882                 pItem = null;
883         }
884         AppLogDebug("EXIT::SearchForm::DeleteItem");
885         return true;
886 }
887
888 void
889 SearchForm::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
890 {
891         AppLogDebug("Enter:SearchForm::OnKeypadActionPerformed");
892         int modalResult = 0;
893         String emptySearchString;
894
895         MessageBox messageEmptyString;
896         AppResource* pAppResource = null;
897
898         pAppResource = UiApp::GetInstance()->GetAppResource();
899         TryReturn(pAppResource != null, , "Failed to fetch AppResource");
900
901         pAppResource->GetString(L"IDS_SEARCH_STRING_CANNOT_BE_EMPTY", emptySearchString);
902
903         messageEmptyString.Construct(L"", emptySearchString, MSGBOX_STYLE_NONE, ID_MESSAGE_BOX_TIMEOUT_ONE_SECOND);
904
905
906         if (__pSearchBar->GetText().IsEmpty())
907         {
908                 messageEmptyString.ShowAndWait(modalResult);
909                 __pSearchBar->ShowKeypad();
910                 return;
911         }
912
913         __isCancelClicked = false;
914
915         //Get the text entered in SearchBar
916         __searchText.Clear();
917         __searchText = __pSearchBar->GetText();
918
919         //Start Searching
920         if (__searchText.IsEmpty() == false)
921                 StartSearch();
922
923         AppLogDebug("Exit::SearchForm::OnKeypadActionPerformed");
924 }
925 void
926 SearchForm::OnKeypadClosed(Tizen::Ui::Control& source)
927 {
928         AppLogDebug("ENTER::SearchForm::OnKeypadClosed");
929
930         __pSearchBar->SetContentAreaSize(Dimension(GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCH_BAR));
931         __pListView->SetSize(Dimension(GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCH_BAR));
932
933         AppLogDebug("EXIT::SearchForm::OnKeypadClosed");
934 }
935 void
936 SearchForm::OnKeypadOpened(Tizen::Ui::Control& source)
937 {
938         SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
939
940         __pSearchBar->SetContentAreaSize(Dimension(GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCH_BAR));
941         __pListView->SetSize(Dimension(GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCH_BAR));
942
943 }
944 void
945 SearchForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
946 {
947         //Empty Implementation
948 }
949 void
950 SearchForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
951 {
952         AppLogDebug("ENTER::SearchForm::OnActionPerformed");
953         switch (actionId)
954         {
955         case IDA_BTN_POPUP_SEARCH_CANCEL:
956         {
957                 AppLogDebug("SearchForm::OnSearchBarModeChanged:Search Cancelled");
958                 __isSearchCompleted = true;
959
960                 __pSearchModel->StopSearch();
961
962                 __searchBarMode = SEARCH_BAR_MODE_NORMAL;
963                 __pSearchBar->SetMode(__searchBarMode);
964                 __pSearchBar->HideKeypad();
965
966                 __pSearchPopup->SetShowState(false);
967                 __pSearchBar->SetEnabled(true);
968                 __pSearchBar->SetText(__searchText);
969
970                 SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
971                 __searchText.Clear();
972
973         }
974         break;
975
976         case IDA_DELETE_FILE:
977         {
978                 HideDeleteConfirmationPopup();
979                 //Call the DeleteFile Function.
980                 DeleteFile(__fileToDelete);
981         }
982         break;
983
984         case IDA_CANCEL_DELETION:
985         {
986                 HideDeleteConfirmationPopup();
987         }
988         break;
989
990         default:
991         {
992                 //Do nothing
993         }
994         break;
995         }
996         AppLogDebug("EXIT::SearchForm::OnActionPerformed");
997 }
998 void
999 SearchForm::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
1000 {
1001         AppLogDebug("ENTER::SearchForm::OnTextValueChangeCanceled");
1002         if (__pSearchPopup->GetShowState() == true)
1003         {
1004                 __pSearchPopup->SetShowState(false);
1005                 __pSearchBar->SetEnabled(true);
1006         }
1007 }
1008
1009 void
1010 SearchForm::OnTextValueChanged(const Tizen::Ui::Control& source)
1011 {
1012         //Empty Implementation.
1013 }
1014
1015 //SearchBar Control
1016 void
1017 SearchForm::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode)
1018 {
1019         AppLogDebug("SearchForm::OnSearchBarModeChanged");
1020
1021         if (mode == SEARCH_BAR_MODE_INPUT)
1022         {
1023                 __searchBarMode = SEARCH_BAR_MODE_INPUT;
1024                 SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
1025         }
1026         else
1027         {
1028                 __searchBarMode = SEARCH_BAR_MODE_NORMAL;
1029                 SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
1030                 if (__isSearchStarted == true)
1031                 {
1032                         if (__isSearchCompleted == false)
1033                         {
1034                                 //Stop Search Thread
1035                                 __pSearchModel->StopSearch();
1036
1037                                 //Hide keypad of SearchBar
1038                                 __pSearchBar->HideKeypad();
1039
1040                                 //Hide popUp
1041                                 if (__pSearchPopup != null)
1042                                 {
1043                                         __pSearchPopup->SetShowState(false);
1044                                 }
1045                         }
1046                 }
1047                 __pListView->UpdateList();
1048         }
1049
1050         __pSearchBar->SetContentAreaSize(Dimension(GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCH_BAR));
1051         __pListView->SetSize(Dimension(GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCH_BAR));
1052
1053         __pSearchBar->Invalidate(true);
1054 }
1055
1056 void
1057 SearchForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1058 {
1059         CustomAppControl::GetInstance()->SetAppControlInUse(null);
1060         ContentType contentType = ContentManagerUtil::CheckContentType(__pathOfSelectedFile);
1061
1062         __pSearchBar->SetMode(__searchBarMode);
1063
1064         if (GetLastResult() == E_FILE_NOT_FOUND)
1065         {
1066                 __isSearchCompleted = false;
1067                 if (__searchText.IsEmpty() == false)
1068                         StartSearch();
1069         }
1070         else
1071         {
1072                 AppLogDebug("OnAppControlResponseReceived:ContentType:%s:%d", GetErrorMessage(GetLastResult()), contentType);
1073         }
1074
1075         if (__pListView != null)
1076                 __pListView->UpdateList();
1077 }
1078
1079 void
1080 SearchForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
1081 {
1082         AppLogDebug("ENTER::SearchForm::GetCurrentFileControl");
1083         result r = E_FAILURE;
1084         Integer* pEventType = null;
1085         DirectoryEntry* pResultDirEntry = null;
1086         HashMap* pCacheList = null;
1087         DirectoryEntry* pCurrentEntry = null;
1088         bool cacheKeyStatus = false;
1089         String cachePath;
1090
1091         TryCatch(pArgs != null, , "SearchForm::GetCurrentFileControl::pArg is null");
1092
1093         pEventType = static_cast< Integer* >(pArgs->GetAt(0));
1094         TryCatch(pEventType != null, , "SearchForm::GetCurrentFileControl::pArg is null");
1095
1096         switch (pEventType->ToInt())
1097         {
1098         case ID_FOLDER_SEARCH_STARTED:
1099         {
1100                 String* pFolderSearchResult = (String*) pArgs->GetAt(1);
1101                 TryCatch(pFolderSearchResult != null, , "SearchForm::GetCurrentFileControl::folderSearchResult is null");
1102
1103                 String defMediaPath(L"/opt/usr/media");
1104                 String defSdCardPath(L"/opt/storage/sdcard");
1105
1106                 String displayPhone = defaultPhoneBody;
1107                 String displaySdCard = defaultSdCardBody;
1108
1109
1110                 if (pFolderSearchResult->IsEmpty() == false)
1111                 {
1112                         if (pFolderSearchResult->StartsWith(defMediaPath, 0))
1113                         {
1114                                 pFolderSearchResult->Replace(defMediaPath, displayPhone);
1115                         }
1116                         else if (pFolderSearchResult->StartsWith(defSdCardPath, 0))
1117                         {
1118                                 pFolderSearchResult->Replace(defSdCardPath, displaySdCard);
1119                         }
1120
1121                         __pFolderLabel->SetText(*pFolderSearchResult);
1122                         __pFolderLabel->Invalidate(true);
1123                 }
1124         }
1125         break;
1126
1127         case ID_SEARCH_COMPLETED:
1128         {
1129                 AppLogDebug("ENTER::SearchForm::GetCurrentFileControl:Search Completed");
1130                 __isSearchCompleted = true;
1131
1132                 __pSearchPopup->SetShowState(false);
1133                 __pSearchBar->SetEnabled(true);
1134
1135                 __pSearchModel->StopSearch();
1136
1137                 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
1138                 {
1139                         __searchBarMode = SEARCH_BAR_MODE_NORMAL;
1140                         __pSearchBar->SetMode(__searchBarMode);
1141                         __pSearchBar->SetText(__searchText);
1142                 }
1143
1144                 //Scroll the List to top
1145                 __pListView->ScrollToItem(0);
1146         }
1147         break;
1148
1149         case ID_SEARCH_RESULT_FOUND:
1150         {
1151                 AppLogDebug("ENTER::SearchForm::GetCurrentFileControl:ID_SEARCH_RESULT_FOUND");
1152                 __isSearchCompleted = false;
1153                 __searchItemIndex++;
1154                 AppLogDebug("ItemCount::%d", __searchItemIndex);
1155
1156                 __pSearchBar->SetText(__searchText);
1157
1158                 DirectoryEntry* pSearchResult = static_cast< DirectoryEntry* >(pArgs->GetAt(1));
1159                 TryCatch(pSearchResult != null, , "GetCurrentFileControl::pSearchResult is null");
1160
1161                 AppLogDebug("ItemCount::%S", pSearchResult->GetFileName().GetPointer());
1162
1163                 pResultDirEntry = new (std::nothrow) DirectoryEntry(*pSearchResult);
1164                 r = __pSearchedContentList->InsertAt(pResultDirEntry, __searchItemIndex);
1165
1166                 AppLogDebug("Check Insert to SearchedContentList Result: %s", GetErrorMessage(r));
1167
1168                 TryCatch(r == E_SUCCESS, , "GetCurrentFileControl::Failed to add items to  __pSearchedContentList");
1169
1170                 AppLogDebug("Check SearchItemIndex: %d", __searchItemIndex);
1171
1172                 __bIsResultList = true;
1173
1174                 result res = __pListView->RefreshList(__searchItemIndex, LIST_REFRESH_TYPE_ITEM_ADD);
1175                 AppLogDebug("Check Refresh List Result: %s", GetErrorMessage(res));
1176         }
1177         break;
1178
1179         case FILE_MANAGING_RESULT_DELETING_SUCCESS:
1180         {
1181                 AppLogDebug("FILE_MANAGING_RESULT_DELETING_SUCCESS");
1182                 HideFileProgressingPopup();
1183                 pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
1184
1185                 if (__isSearchCompleted == true || __isSearchStarted == true)
1186                 {
1187                         pCurrentEntry = static_cast<DirectoryEntry*>(__pSearchedContentList->GetAt(__selectedItemIndexForDelete));
1188
1189                         if (pCurrentEntry != null)
1190                         {
1191                                 cachePath = pCurrentEntry->GetFullFilePath();
1192                         }
1193
1194                         if (pCacheList != null)
1195                         {
1196                                 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
1197                                 if (cacheKeyStatus)
1198                                 {
1199                                         CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
1200                                 }
1201                         }
1202                         __pSearchedContentList->RemoveAt(__selectedItemIndexForDelete, true);
1203                 }
1204                 else
1205                 {
1206                         pCurrentEntry = static_cast<DirectoryEntry*>(__pContentListFromLastView->GetAt(__selectedItemIndexForDelete));
1207
1208                         if (pCurrentEntry != null)
1209                         {
1210                                 cachePath = pCurrentEntry->GetFullFilePath();
1211                         }
1212
1213                         if (pCacheList != null)
1214                         {
1215                                 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
1216                                 if (cacheKeyStatus)
1217                                 {
1218                                         CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
1219                                 }
1220                         }
1221                         __pContentListFromLastView->RemoveAt(__selectedItemIndexForDelete, false);
1222                 }
1223                 __pListView->UpdateList();
1224
1225         }
1226         break;
1227
1228         default:
1229                 break;
1230         }
1231
1232         pArgs->RemoveAll(true);
1233         delete pArgs;
1234         pArgs = null;
1235
1236         AppLogDebug("EXIT::SearchForm::GetCurrentFileControl");
1237         return;
1238
1239         CATCH:
1240
1241         AppLogDebug("EXIT::SearchForm::GetCurrentFileControl");
1242         return;
1243 }
1244
1245 void
1246 SearchForm::OnFolderSearchStarted(Tizen::Base::String& folderName)
1247 {
1248         //Empty Implementation
1249 }
1250
1251 void
1252 SearchForm::OnAllFoldersSearchCompleted(void)
1253 {
1254         //Empty Implementation
1255 }
1256
1257 void
1258 SearchForm::LoadSubDirectoryForm(Tizen::Base::String& fullPath, Tizen::Base::String& fileName)
1259 {
1260         result r = E_SUCCESS;
1261         ArrayList* pArg = null;
1262         SceneManager* pSceneManager = null;
1263
1264         //SetStorageType
1265         if (fullPath.Contains(BasePresentationModel::GetMediaPath()) == true)
1266         {
1267                 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
1268         }
1269         else if (fullPath.Contains(BasePresentationModel::GetSdCardPath()) == true)
1270         {
1271                 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
1272         }
1273         //SetCurrentFilePath
1274         FolderNavigationPresentationModel::SetCurrentFilePath(fullPath);
1275
1276         pArg = new (std::nothrow) ArrayList();
1277         TryCatch(pArg != null, , "SearchForm::LoadSubDirectoryForm::Failed to allocate Memory to pArg");
1278
1279         r = pArg->Construct();
1280         TryCatch(r == E_SUCCESS, , "SearchForm::LoadSubDirectoryForm::Failed to construct pArg");
1281
1282         pArg->Add(&fileName);
1283
1284         pSceneManager = SceneManager::GetInstance();
1285         TryCatch(pSceneManager != null, , "SceneManager::GetInstance() failed:%s", GetErrorMessage(GetLastResult()));
1286
1287         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_KEEP), pArg);
1288         return;
1289
1290 CATCH:
1291         if (pArg != null)
1292         {
1293                 pArg->RemoveAll(true);
1294                 delete pArg;
1295                 pArg = null;
1296         }
1297         return;
1298
1299 }
1300 void
1301 SearchForm::OnListViewItemStateChangedNotify(ViewType viewType)
1302 {
1303         //Empty Implementation.
1304 }
1305 void
1306 SearchForm::OnThumbnailReceived(ThumbRequest* pThumbReq)
1307 {
1308         AppLogDebug("Enter:SearchForm::OnThumbnailReceived");
1309         ArrayList* pResultList = null;
1310         result res = E_SUCCESS;
1311         DirectoryEntry* pFileDetails = null;
1312
1313         TryCatch(pThumbReq != null, , "SearchForm::Thumbrequest is null");
1314
1315         if (pThumbReq != null)
1316         {
1317                 if (pThumbReq->GetCurrentSourceForm() != __pFolderEntryPM->GetSourceForm())
1318                 {
1319                         if (pThumbReq->pBitmap != null)
1320                         {
1321                                 AppLogDebug("This Bitmap is not requested from same form");
1322                                 delete pThumbReq->pBitmap;
1323                         }
1324                         return;
1325                 }
1326         }
1327
1328         if (__isSearchCompleted == false)
1329         {
1330                 if (__isSearchStarted == true)
1331                         pResultList = __pSearchedContentList;
1332                 else
1333                         pResultList = __pContentListFromLastView;
1334         }
1335         else
1336                 pResultList = __pSearchedContentList;
1337
1338         TryCatch(pResultList != null, , "SearchForm::CreateItem::pResultList is null");
1339
1340         if (pThumbReq->iRquestId < pResultList->GetCount())
1341         {
1342                 pFileDetails = static_cast< DirectoryEntry* >(pResultList->GetAt(pThumbReq->iRquestId));
1343                 TryCatch(pFileDetails != null, , "SearchForm::CreateItem::pFileDetails is null");
1344
1345                 pFileDetails->SetBitmap(pThumbReq->pBitmap);
1346                 if (__pListView && __pListView->IsVisible())
1347                 {
1348                         res = __pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1349                 }
1350         }
1351         else
1352                 AppLogDebug("Thumbnail Request is not valid");
1353
1354         AppLogDebug("Exit");
1355         return;
1356         CATCH:
1357         if (pThumbReq != null)
1358         {
1359                 if (pThumbReq->pBitmap != null)
1360                         delete pThumbReq->pBitmap;
1361         }
1362         AppLogDebug("Exit");
1363         return;
1364
1365 }
1366
1367 void
1368 SearchForm::LoadDetailForm(String& fullFilePath)
1369 {
1370         AppLogDebug("ENTER:SearchForm::LoadDetailForm:%S", fullFilePath.GetPointer());
1371         result r = E_FAILURE;
1372
1373         SceneManager* pSceneManager = null;
1374         ArrayList* pList = null;
1375         String* pFullFilePath = null;
1376
1377         FolderNavigationPresentationModel::SetCurrentFilePath(fullFilePath);
1378
1379         pList = new (std::nothrow) ArrayList();
1380         TryCatch(pList != null, , "Failed to create pList");
1381
1382         r = pList->Construct();
1383         TryCatch(r == E_SUCCESS, , "Failed to construct pList");
1384
1385         pFullFilePath = new (std::nothrow) String(fullFilePath);
1386
1387         r = pList->Add(pFullFilePath);
1388         TryCatch(r == E_SUCCESS, , "Failed to add pFullFilePath to ArrayList");
1389
1390         pSceneManager = SceneManager::GetInstance();
1391         TryCatch(pSceneManager != null, , "Failed to allocate Memory to pSceneManager");
1392
1393         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FILE_DETAIL_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
1394         AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
1395         return;
1396
1397         CATCH:
1398
1399         if (pFullFilePath != null)
1400         {
1401                 delete pFullFilePath;
1402                 pFullFilePath = null;
1403         }
1404         if (pList != null)
1405         {
1406                 delete pList;
1407                 pList = null;
1408         }
1409         return;
1410 }
1411
1412 void
1413 SearchForm::LoadRenameForm(int index, DirectoryEntry* pDirectory)
1414 {
1415         AppLogDebug("ENTER");
1416         result r = E_SUCCESS;
1417
1418         ArrayList* pArg = null;
1419         Integer* pSourceSelected = null;
1420         SceneManager* pSceneManager = null;
1421
1422         __selectedItemIndexForRename = index;
1423
1424         FolderNavigationPresentationModel::SetCurrentFilePath(pDirectory->GetFullFilePath());
1425
1426         if (pDirectory->IsDirectory() == true && (__currentSearchDirectoryPath == pDirectory->GetFullFilePath()))
1427                 __isCurrentDirectoryRenamed = true;
1428
1429         pSceneManager = SceneManager::GetInstance();
1430         TryCatch(pSceneManager != null, r = GetLastResult(), "Failed to Get SceneManager instance");
1431
1432         pArg = new (std::nothrow) ArrayList;
1433         r = pArg->Construct();
1434
1435         pSourceSelected = new (std::nothrow) Integer(SELECT_RENAME);
1436         r = pArg->Add(pSourceSelected);
1437         TryCatch(r == E_SUCCESS, r = GetLastResult(), "Failed to add sourceSelected");
1438
1439         r = pArg->Add(pDirectory);
1440         TryCatch(r == E_SUCCESS, r = GetLastResult(), "Failed to add pDirectory");
1441
1442         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
1443
1444         return;
1445
1446 CATCH:
1447         if (pSourceSelected != null)
1448         {
1449                 delete pSourceSelected;
1450         }
1451
1452
1453         delete pDirectory;
1454
1455         if (pArg != null)
1456         {
1457                 delete pArg;
1458                 pArg = null;
1459         }
1460         return;
1461 }
1462
1463
1464 void
1465 SearchForm::DeleteFile(String& filePath)
1466 {
1467         AppLogDebug("ENTER");
1468
1469         ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
1470         ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
1471
1472         FolderEntryEditorPresentationModel* __pFileManager = FolderEntryEditorPresentationModel::GetInstance();
1473         if (__pFileManager != null)
1474         {
1475                 __pFileManager->SetFileManagingListener(this);
1476                 __pFileManager->DeleteFolderEntries(&filePath);
1477         }
1478
1479         AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
1480 }
1481
1482
1483 void
1484 SearchForm::OnFileManagingStart(void)
1485 {
1486         AppLogDebug("Entry");
1487         ShowFileProgressingPopup();
1488 }
1489
1490 void
1491 SearchForm::OnFileManagingStop(FileManagingResult fileManagingResult)
1492 {
1493         //Empty Implementation
1494 }
1495
1496 void
1497 SearchForm::ShowFileProgressingPopup(void)
1498 {
1499         CreateFileProgressingPopup();
1500
1501         if (__pFileProgressingPopup != null)
1502         {
1503                 __pFileProgressingPopup->SetShowState(true);
1504                 __pFileProgressingPopup->Show();
1505         }
1506 }
1507
1508 void
1509 SearchForm::HideFileProgressingPopup(void)
1510 {
1511         AppLogDebug("HideFileProgressingPopup:ENTER");
1512         if (__pFileProgressingPopup != null && __pFileProgressingPopup->IsVisible())
1513         {
1514                 __pFileProgressingPopup->SetShowState(false);
1515
1516                 delete __pFileProgressingPopup;
1517                 __pFileProgressingPopup = null;
1518         }
1519 }
1520
1521 result
1522 SearchForm::CreateFileProgressingPopup(void)
1523 {
1524         AppLogDebug("ENTER");
1525         result r = E_SUCCESS;
1526         String deleting;
1527
1528         AppResource* pAppResource = null;
1529         pAppResource = UiApp::GetInstance()->GetAppResource();
1530         TryReturn(pAppResource != null, r, "Failed to fetch AppResource");
1531
1532         pAppResource->GetString(L"IDS_COM_POP_DELETING", deleting);
1533
1534         __pFileProgressingPopup = new (std::nothrow) Popup();
1535         __pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
1536
1537         __pFileProgressingCancelButton = static_cast< Button* >(__pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
1538         if (__pFileProgressingCancelButton != null)
1539         {
1540                 __pFileProgressingCancelButton->SetActionId(IDA_BTN_ANIMATION_POPUP_CANCEL);
1541                 __pFileProgressingCancelButton->AddActionEventListener(*this);
1542         }
1543         __pFileProgressingProgress = static_cast< Progress* >(__pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true));
1544         if (__pFileProgressingProgress != null)
1545         {
1546                 __pFileProgressingProgress->SetName(L"IDC_ANIMATION_PROGRESS");
1547                 __pFileProgressingProgress->SetValue(0);
1548         }
1549         __pFileProgressingHeaderLabel = static_cast< Label* >(__pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true));
1550         if (__pFileProgressingHeaderLabel != null)
1551         {
1552                 __pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER");
1553                 __pFileProgressingHeaderLabel->SetText(deleting);
1554         }
1555         __pFileProgressingLabel = static_cast< Label* >(__pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true));
1556         if (__pFileProgressingLabel != null)
1557         {
1558                 __pFileProgressingLabel->SetName(L"IDC_FILE_COUNT_LABEL");
1559         }
1560
1561         return r;
1562
1563 }
1564
1565 result
1566 SearchForm::CreateDeleteConfirmationPopup(void)
1567 {
1568         result r = E_SUCCESS;
1569         Rectangle popupBounds;
1570
1571         //Create a Delete popup control
1572         __pDeleteConfirmationPopUp = new (std::nothrow) Popup();
1573         __pDeleteConfirmationPopUp->Construct(L"IDL_DELETE_POPUP");
1574
1575         popupBounds = __pDeleteConfirmationPopUp->GetClientAreaBounds();
1576
1577
1578         __pDelete = static_cast< Button* >(__pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_DELETE", true));
1579         TryCatch(__pDelete != null, , "MfMyFilesApp::Button For Popup not created!");
1580
1581         __pDelete->SetActionId(IDA_DELETE_FILE);
1582         __pDelete->AddActionEventListener(*this);
1583         __pDelete->SetShowState(true);
1584
1585         __pCancelDeletion = static_cast< Button* >(__pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_CANCEL", true));
1586         TryCatch(__pCancelDeletion != null, , "MfMyFilesApp::Button For Popup not created!");
1587
1588         __pCancelDeletion->SetActionId(IDA_CANCEL_DELETION);
1589         __pCancelDeletion->AddActionEventListener(*this);
1590         __pCancelDeletion->SetShowState(true);
1591
1592         return r;
1593
1594 CATCH:
1595
1596         if (__pDeleteConfirmationPopUp != null)
1597         {
1598                 delete __pDeleteConfirmationPopUp;
1599                 __pDeleteConfirmationPopUp = null;
1600         }
1601
1602         return r;
1603
1604 }
1605
1606 void
1607 SearchForm::HideDeleteConfirmationPopup(void)
1608 {
1609         if (__pDeleteConfirmationPopUp != null && __pDeleteConfirmationPopUp->IsVisible())
1610         {
1611                 __pDeleteConfirmationPopUp->SetShowState(false);
1612
1613                 delete __pDeleteConfirmationPopUp;
1614                 __pDeleteConfirmationPopUp = null;
1615
1616         }
1617 }
1618
1619 void
1620 SearchForm::ShowDeleteConfirmationPopup(void)
1621 {
1622         CreateDeleteConfirmationPopup();
1623
1624         if (__pDeleteConfirmationPopUp != null)
1625         {
1626                 __pDeleteConfirmationPopUp->SetShowState(true);
1627                 __pDeleteConfirmationPopUp->Show();
1628         }
1629 }
1630
1631 void
1632 SearchForm::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state)
1633 {
1634         AppLogDebug("SearchForm::OnDeviceStateChanged");
1635
1636         HideDeleteConfirmationPopup();
1637         HideFileProgressingPopup();
1638
1639         if (__SelectedTab == MEMORY_TYPE_NONE )
1640         {
1641                 __pSearchBar->SetMode(__searchBarMode);
1642
1643                 if (__searchText.IsEmpty() == false)
1644                         StartSearch();
1645
1646                 if (__pListView != null)
1647                         __pListView->UpdateList();
1648         }
1649         else if (__SelectedTab == MEMORY_TYPE_SD_CARD )
1650         {
1651                 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
1652         }
1653 }
1654
1655
1656 void
1657 SearchForm::OnSceneTransitionCompleted(const Tizen::Ui::Scenes::SceneId &previousSceneId,
1658                 const Tizen::Ui::Scenes::SceneId &currentSceneId)
1659 {
1660         SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);
1661         __pSearchBar->SetMode(__searchBarMode);
1662
1663         if (__pFileEventManager != null)
1664         {
1665                 delete __pFileEventManager;
1666                 __pFileEventManager = null;
1667
1668         }
1669         __pFileEventManager = new (std::nothrow) FileEventManager();
1670         __pFileEventManager->Construct(*this);
1671
1672         __directoryForFileEvent = __currentSearchDirectoryPath;
1673         __pFileEventManager->AddPath(__directoryForFileEvent, FILE_EVENT_TYPE_CREATE | FILE_EVENT_TYPE_MOVED_FROM | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_DELETE );
1674         AppLogDebug("SearchForm::OnSceneTransitionCompleted:%S:%s", __directoryForFileEvent.GetPointer(), GetErrorMessage(GetLastResult()));
1675
1676         if (__bCheckArgsNull)
1677         {
1678                 if (__pListView != null)
1679                 {
1680                         __pListView->UpdateList();
1681                 }
1682         }
1683         else
1684         {
1685                 if (previousSceneId == IDSCN_CREATE_FOLDER_FORM)
1686                 {
1687                         __pListView->RefreshList(__selectedItemIndexForRename, LIST_REFRESH_TYPE_ITEM_MODIFY);
1688                 }
1689         }
1690 }
1691
1692 void
1693 SearchForm::OnSceneTransitionStarted(const Tizen::Ui::Scenes::SceneId &currentSceneId,
1694                 const Tizen::Ui::Scenes::SceneId &nextSceneId)
1695 {
1696         //Empty Implementation.
1697 }
1698
1699 void
1700 SearchForm::StartSearch(void)
1701 {
1702         String searchtext;
1703         String folderToSearch;
1704         String topLevelPath;
1705
1706         //Hide keypad of Search bar
1707         __pSearchBar->HideKeypad();
1708         __pSearchBar->SetContentAreaVisible(true);
1709         __pSearchBar->SetEnabled(false);
1710         __pSearchBar->SetMode(__searchBarMode);
1711
1712         //Show Popup if Application is in FOREGROUND
1713         if ( Application::GetInstance()->GetAppUiState() == APP_UI_STATE_FOREGROUND)
1714         {
1715                 __pFolderLabel->SetText(folderToSearch);
1716                 __pSearchPopup->SetShowState(true);
1717                 __pSearchPopup->Show();
1718         }
1719
1720         ///Set Application Notification Listener to current form
1721         ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
1722
1723         if (__SelectedTab == MEMORY_TYPE_PHONE)
1724         {
1725                 topLevelPath = __pFolderEntryPM->GetMediaPath();
1726         }
1727         else if (__SelectedTab == MEMORY_TYPE_SD_CARD)
1728         {
1729                 topLevelPath = __pFolderEntryPM->GetSdCardPath();
1730         }
1731
1732         if ( (__currentSearchDirectoryPath.GetLength() > 0 && __currentSearchDirectoryPath == topLevelPath ) || (FolderNavigationPresentationModel::GetCurrentPath().IsEmpty() == true))
1733         {
1734                 __searchedAllFolders = true;
1735         }
1736
1737         if (__pSearchedContentList != null)
1738         {
1739                 __pSearchedContentList->RemoveAll(true);
1740         }
1741         __searchItemIndex = INVALID_LIST_INDEX;
1742         __isSearchCompleted = false;
1743         __isSearchStarted = true;
1744
1745         __pListView->UpdateList();
1746
1747         __pSearchModel->SetFolderToSearch(__currentSearchDirectoryPath);
1748         __pSearchModel->SetStringToSearch(__searchText);
1749         __pSearchModel->Start();
1750 }
1751
1752 void
1753 SearchForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String &  path, const unsigned int eventId)
1754 {
1755         AppLogDebug("SearchForm::OnFileEventOccured");
1756         bool cacheKeyStatus = false;
1757         HashMap* pCacheList = null;
1758         DirectoryEntry* pCurrentEntry = null;
1759
1760         String cachePath;
1761
1762         ArrayList*              pCurrentList = null;
1763
1764         if ((events & FILE_EVENT_TYPE_CREATE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM) || (events & FILE_EVENT_TYPE_MOVED_TO ))
1765         {
1766                 __backFromAppControl = true;
1767
1768                 //changes added for Nabi issue # N_SE-38472
1769                 if ( (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM))
1770                 {
1771                         pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
1772                         if (pCacheList != null)
1773                         {
1774                                 if (__isSearchCompleted == false)
1775                                 {
1776                                         if (__isSearchStarted == true)
1777                                                 pCurrentList = __pSearchedContentList;
1778                                         else
1779                                                 pCurrentList = __pContentListFromLastView;
1780                                 }
1781                                 else
1782                                         pCurrentList = __pSearchedContentList;
1783
1784                                 if( pCurrentList )
1785                                 {
1786                                         pCurrentEntry = static_cast<DirectoryEntry*>(pCurrentList->GetAt(__selectedItemIndex));
1787                                         if (pCurrentEntry != null)
1788                                         {
1789                                                 cachePath = pCurrentEntry->GetFullFilePath();
1790                                         }
1791                                         cacheKeyStatus = pCacheList->ContainsKey(cachePath);
1792                                         if (cacheKeyStatus)
1793                                         {
1794                                                 CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
1795                                         }
1796                                 }
1797                         }
1798                 }
1799                 if (((MyFilesApp*) Application::GetInstance())->IsAppControlLaunched() == false)
1800                 {
1801                         AppLogDebug("SearchForm::OnFileEventOccured");
1802                         if (__searchText.IsEmpty() == false)
1803                                 StartSearch();
1804
1805                         if (__pListView != null)
1806                                 __pListView->UpdateList();
1807                 }
1808         }
1809
1810         __selectedItemIndex  =-1;
1811 }
1812
1813 void
1814 SearchForm::GetFolderName(void)
1815 {
1816         String delim(L"/");
1817         String token;
1818         String fullPath;
1819         String folderName;
1820
1821         AppResource::GetInstance()->GetString(L"IDS_MF_SK3_SEARCH", folderName);
1822
1823         folderName.Append(L" ");
1824
1825         fullPath = FolderNavigationPresentationModel::GetCurrentPath();
1826
1827         StringTokenizer tokenizer(fullPath, delim);
1828
1829 #if 0
1830         DataBindingContext* pContext = null;
1831         pContext = GetDataBindingContextN();
1832 #endif
1833
1834         int Counter = 3;
1835
1836         //Use a string tokenizer to get the filepath until it's the last token, break the loop when
1837         //it is the last token
1838         while (tokenizer.HasMoreTokens())
1839         {
1840                 if (Counter > 0)
1841                 {
1842                         Counter--;
1843                         tokenizer.GetNextToken(token);
1844                 }
1845                 else
1846                 {
1847                         tokenizer.GetNextToken(token);
1848                         folderName.Append(token);
1849                 }
1850         }
1851
1852         if (__pSearchBar != null)
1853         {
1854                 __pSearchBar->SetGuideText(folderName);
1855         }
1856 }
1857
1858 void
1859 SearchForm::GetParentFolderPath(Tizen::Base::String* filePath)
1860 {
1861         String displayPath;
1862         String delim(L"/");
1863         String token;
1864
1865         StringTokenizer tokenizer(*filePath, delim);
1866
1867         filePath->Clear();
1868
1869         //Use a string tokenizer to get the filepath until it's the last token, break the loop when
1870         //it is the last token
1871         while (tokenizer.HasMoreTokens())
1872         {
1873                 if (tokenizer.GetTokenCount() != 1)
1874                 {
1875                         filePath->Append(L"/");
1876                         tokenizer.GetNextToken(token);
1877                         filePath->Append(token);
1878                 }
1879                 else
1880                 {
1881                         break;
1882                 }
1883         }
1884
1885         filePath->Append(L"/");
1886
1887         if (filePath->StartsWith(BasePresentationModel::GetMediaPath(),0))
1888         {
1889                 filePath->Replace(BasePresentationModel::GetMediaPath(),"Phone/",0);
1890         }
1891         else if(filePath->StartsWith(BasePresentationModel::GetSdCardPath(),0))
1892         {
1893                 filePath->Replace(BasePresentationModel::GetSdCardPath(),"Memory Card/",0);
1894         }
1895
1896 }
1897
1898 void
1899 SearchForm::OnAppControlCompleted(void)
1900 {
1901         AppLogDebug("OnAppControlCompleted++");
1902         if ( __backFromAppControl==true )
1903         {
1904                 if (__pFileEventManager != null)
1905                 {
1906                         __pFileEventManager->RemovePath(__directoryForFileEvent);
1907                         delete __pFileEventManager;
1908                         __pFileEventManager = null;
1909                 }
1910
1911                 __pFileEventManager = new (std::nothrow) FileEventManager();
1912                 __pFileEventManager->Construct(*this);
1913
1914                 __directoryForFileEvent = __currentSearchDirectoryPath;
1915                 __pFileEventManager->AddPath(__directoryForFileEvent, FILE_EVENT_TYPE_CREATE | FILE_EVENT_TYPE_MOVED_FROM | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_DELETE );
1916
1917
1918                 __pSearchBar->SetMode(__searchBarMode);
1919
1920                 if (__searchText.IsEmpty() == false)
1921                         StartSearch();
1922
1923                 if (__pListView != null)
1924                         __pListView->UpdateList();
1925                 __backFromAppControl = false;
1926         }
1927         AppLogDebug("OnAppControlCompleted--");
1928 }
1929
1930 void
1931 SearchForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1932 {
1933         __pSearchBar->SetContentAreaSize(Dimension(GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCH_BAR));
1934         __pListView->SetSize(Dimension(GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCH_BAR));
1935 }