2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file: MfSearchForm.h
19 * @brief: This file contains declaration of of SearchForm class.
22 #ifndef _MF_SEARCH_FORM_H_
23 #define _MF_SEARCH_FORM_H_
28 #include <FGraphics.h>
30 #include <FSysEnvironment.h>
33 #include "MfBaseForm.h"
34 #include "MfFolderNavigationPresentationModel.h"
35 #include "MfContentListItem.h"
36 #include "MfCustomAppControl.h"
37 #include "MfDirectoryEntry.h"
38 #include "MfINotificationListener.h"
39 #include "MfMyFilesApp.h"
40 #include "MfSceneRegister.h"
41 #include "MfSearchPresentationModel.h"
42 #include "MfThumbnailManager.h"
44 #include "MfUtility.h"
48 , public Tizen::App::IAppControlResponseListener
49 , public Tizen::App::Package::IPackageInstallationEventListener
50 , public Tizen::App::Package::IPackageInstallationResponseListener
51 , public Tizen::Ui::IKeypadEventListener
52 , public Tizen::Ui::ITextEventListener
53 , public Tizen::Ui::Controls::ISearchBarEventListener
54 , public Tizen::Io::IFileEventListener
57 //! Constructor of the class.
59 * @brief Initializes the member variables of the class.
60 * @param Takes no parameters
61 * @return No value returned */
64 //! Destructor of the class.
66 * @brief Frees the memory allocated to the member variables.
67 * @param Takes no parameters
68 * @return No value returned
70 virtual ~SearchForm(void);
72 //!Initializes the SearchForm
74 * @brief constructs the SearchForm
75 * @param No parameters
76 * @return true if form is constructed successfully , false otherwise
78 bool Initialize(void);
80 result OnInitializing(void);
81 result OnTerminating(void);
83 //IActionEventListener
84 void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
86 //IFormBackEventListener
87 void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
89 // IListViewItemEventListener
90 virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
91 virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
92 virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
94 //IListViewItemProvider
95 virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
96 virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
97 virtual int GetItemCount(void);
100 virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
101 virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
103 //ISceneManagerEventListener
104 virtual void OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId);
105 virtual void OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId);
107 //IKeyPadActionEventListener
108 void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction);
109 void OnKeypadClosed(Tizen::Ui::Control& source);
110 void OnKeypadOpened(Tizen::Ui::Control& source);
111 void OnKeypadWillOpen(Tizen::Ui::Control& source);
114 void OnTextValueChangeCanceled(const Tizen::Ui::Control& source);
115 void OnTextValueChanged(const Tizen::Ui::Control& source);
118 void OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode);
120 //IAppControlEventListener
121 //virtual void OnAppControlCompleted(const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::Collection::IList* pResultList);
122 //! IAppControlResponseListener
123 /*! @fn OnAppControlCompleted(const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::Collection::IList* pResultList)
124 * @brief Called when the application control is completed. The client can get callback result for some application controls by implementing this listener.
126 void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
128 //IFileNotificationListener
129 void OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs);
131 //IContentSearchListener
132 virtual void OnFolderSearchStarted(Tizen::Base::String& folderName);
133 virtual void OnAllFoldersSearchCompleted(void);
135 //from IPackageInstallationEventListener
136 virtual void OnPackageInstallationCompleted(const Tizen::App::PackageId& packageId, Tizen::App::Package::PackageInstallationResult installationResult);
137 virtual void OnPackageInstallationInProgress(const Tizen::App::PackageId& packageId, int progress);
138 virtual void OnPackageUninstallationCompleted(const Tizen::App::PackageId& packageId, bool uninstallationResult);
140 // //IPackageInstallationResponseListener
141 virtual void OnPackageInstallationResponseReceived(const Tizen::App::PackageId& packageId, Tizen::App::Package::PackageInstallationResult installationResult);
142 virtual void OnPackageInstallationInProgressResponseReceived(const Tizen::App::PackageId& packageId, int progress);
144 //IFileProcessingListener
145 /*! A public virtual member function of IFileProcessingListener taking and returning no arguments.
146 * @fn OnFileManagingStart(void)
147 * @brief Used to show the FileProcessing Popup.
148 * @param No parameters
149 * @return No Return Values.
151 void OnFileManagingStart(void);
153 /*! A public virtual member function of IFileProcessingListener returning no arguments.
154 * @fn OnFileManagingStop(FileManagingResult fileManagingResult)
155 * @brief Used to hide the FileProcessing Popup.
156 * @param [FileManagingResult]Enumerator indicating the result of file processing.
157 * @return No Return Values.
159 void OnFileManagingStop(FileManagingResult fileManagingResult);
161 /*! A public purely virtual member function of IListViewStateChangeListener returning no arguments.
162 * @fn OnListViewItemStateChangedNotify(ViewType viewType)
163 * @brief Notifies the form if the view type is changed by the User and accordingly updates the lists.
164 * @param [ViewType] viewType, the enum indicating the selected view type: List, List and Details or Thumbnails.
165 * @return No Return Values.
167 virtual void OnListViewItemStateChangedNotify(ViewType viewType);
169 /*! A public purely virtual member function of IListViewStateChangeListener returning a pointer to the FileListPresentationModel.
170 * @fn OnThumbnailReceived(ThumbRequest* pThumbReq)
171 * @brief Used to refresh the image of the listitem from the default image to the generated thumbnail.
172 * @param [ThumbRequest] pThumbReq, the structure containing the thumbnail corresponding to a filepath.
173 * @return No Return Values.
175 virtual void OnThumbnailReceived(ThumbRequest* pThumbReq);
177 //IDeviceEventListener
178 virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state);
180 /*!IDeviceNotificationListener
181 * A public callback from the IDeviceNotificationListener taking deviceType and state as argument and returning nothing
183 * @brief Used to handle device event changes. When memory card is inserted, removed then this method will be called
184 * @param ComponentType, String
185 * @return no return value
187 void OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state);
190 virtual void OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId);
195 * A protected member function taking and returning no arguments.
196 * @fn CreateDeleteConfirmationPopUp()
197 * @brief Called OnContextItemStateChanged(), used to personalize the Delete Confirmation PopUp.
198 * @param No parameters taken.
199 * @return[result] An ErrorCode.
201 result CreateDeleteConfirmationPopup(void);
204 * A protected member function taking and returning no arguments.
205 * @fn CreateFileProgressingPopup()
206 * @brief Called during OnInitializing(), used to personalize the Animation PopUp.
207 * @param No parameters taken.
208 * @return[result] An ErrorCode.
210 result CreateFileProgressingPopup(void);
213 * A protected member function returning no arguments.
214 * @fn CreateInstallationConfirmationPopUp(void)
215 * @brief Called to create the InstallationConfirmationPopUp and all controls in it.
216 * @param No parameters taken.
217 * @return Void return type
219 result CreateInstallationConfirmationPopUp(void);
222 * A private member function returning no arguments.
223 * @fn CreateInstallationProgressPopUp(void)
224 * @brief Called to create the CreateInstallationProgressPopUp and all controls in it.
225 * @param No parameters taken.
226 * @return Void return type
228 result CreateInstallationProgressPopUp(void);
231 * A private member function taking a string as parameter and returning an error code.
232 * @fn DeleteFile(Tizen::Base::String&).
233 * @brief Used to delete the items selected in the Edit view.
234 * @param[String] Filepath of the String to be deleted.
235 * @return An ErrorCode.
237 void DeleteFile(Tizen::Base::String& filePath);
240 * A private member function taking and returning no arguments.
241 * @fn HideDeleteConfirmationPopup()
242 * @brief Called to hide the delete confirmation popup.
243 * @param No parameters
244 * @return Void return type
246 void HideDeleteConfirmationPopup(void);
249 * A protected member function taking and returning no arguments.
250 * @fn HideFileProgressingPopup()
251 * @brief Called to hide the Animation PopUp containing the progress bar from the form.
252 * @param No parameters
253 * @return Void return type
255 void HideFileProgressingPopup(void);
258 * A private member function taking and returning no arguments.
259 * @fn HideInstallationConfirmationPopup()
260 * @brief Called to hide the InstallationConfirmationPopup.
261 * @param No parameters
262 * @return Void return type
264 void HideInstallationConfirmationPopup(void);
267 * A private member function taking and returning no arguments.
268 * @fn HideInstallationProgressPopup()
269 * @brief Called to hide the InstallationProgressPopup containing the progress bar from the form.
270 * @param No parameters
271 * @return Void return type
273 void HideInstallationProgressPopup(void);
276 * A protected function taking a String parameter and returning no values
278 * @brief Called during OnActionPerformed() Loads the form which shows the details of selected file or folder
279 * @param[String] Fullpath containing the full filepath of the selected directory
280 * @return Void return type
282 void LoadDetailForm(Tizen::Base::String& Fullpath);
285 * A protected member function taking and returning no arguments.
286 * @fn LoadRenameForm(int index, DirectoryEntry* pDirectory)
287 * @brief Called OnActionPerformed on the ContextItem, initializes the Rename form.
288 * @param [int, DirectoryEntry*] index, of the element from where the context item was clicked, pDirectory, corresponding
289 * file information on DirectoryEntry.
290 * @return Void return type
292 void LoadRenameForm(int index, DirectoryEntry* pDirectory);
294 //!Opens SubDirectory View upon clicking on listview Items
295 /*! @fn LoadSubDirectoryForm
296 * @brief Opens SubDirectory view
297 * @param [Tizen::Base::String, Tizen::Base::String] Full file path and file name of Path of the selected content
298 * @returns No value returned
300 void LoadSubDirectoryForm(Tizen::Base::String& fullPath, Tizen::Base::String& fileName);
303 * A private member function taking and returning no arguments.
304 * @fn ShowDeleteConfirmationPopup()
305 * @brief Called to show the delete confirmation popup.
306 * @param No parameters
307 * @return Void return type
309 void ShowDeleteConfirmationPopup(void);
312 * A protected member function taking and returning no arguments.
313 * @fn ShowFileProgressingPopup()
314 * @brief Called to draw the Animation PopUp containing the progress bar on the form.
315 * @param No parameters
316 * @return Void return type
318 void ShowFileProgressingPopup(void);
321 * A private member function taking and returning no arguments.
322 * @fn ShowInstallationConfirmationPopup()
323 * @brief Called to show the InstallationConfirmationPopup.
324 * @param No parameters
325 * @return Void return type
327 void ShowInstallationConfirmationPopup(void);
330 * A private member function taking and returning no arguments.
331 * @fn ShowInstallationProgressPopup()
332 * @brief Called to show the InstallationProgressPopup.
333 * @param No parameters
334 * @return Void return type
336 void ShowInstallationProgressPopup(void);
339 * A Private member function to Start Searching after setting all required parameters
341 * @param No parameters
343 void StartSearch(void);
345 // Copy Constructor of the class.
346 /*@fn SearchForm(const SearchForm&)
347 * @brief Copy Constructor
348 * @param Takes Reference of the class
349 * @return No value returned
351 SearchForm(const SearchForm&);
353 // Assignment operator of the class.
354 /*@fn SearchForm& operator = (const SearchForm& pSearchForm)
355 * @brief Assignment operator of the class.
356 * @param Takes Reference of the class
357 * @return No value returned
359 SearchForm& operator =(const SearchForm& pSearchForm);
361 bool __searchedAllFolders;
362 bool __isSearchCompleted;
363 bool __isSearchStarted;
364 bool __isCancelClicked;
365 bool __bCheckArgsNull;
368 int __searchItemIndex;
369 int __selectedItemIndexForRename;
370 int __selectedItemIndexForDelete;
372 MemoryType __SelectedTab;
373 MemoryType __previouFormTab;
375 Tizen::App::Package::PackageManager* __pPackageManager;
377 Tizen::Base::Collection::ArrayList* __pContentListFromLastView;
378 Tizen::Base::Collection::ArrayList* __pSearchedContentList;
379 Tizen::Base::String __displayPath;
380 Tizen::Base::String __fileToDelete;
381 Tizen::Base::String __searchText;
382 Tizen::Base::String __previousFormPath;
383 Tizen::Base::String __previousSceneId;
384 Tizen::Base::String __pathOfSelectedFile;
386 Tizen::Graphics::Bitmap* __pDummyImage;
387 Tizen::Graphics::Bitmap* __pFolderBitmap;
388 Tizen::Graphics::Rectangle __listViewRectangle;
390 Tizen::Ui::Controls::Button* __pCancelDeletion;
391 Tizen::Ui::Controls::Button* __pCancelInstallation;
392 Tizen::Ui::Controls::Button* __pCancelSearch;
393 Tizen::Ui::Controls::Button* __pDelete;
394 Tizen::Ui::Controls::Button* __pFileProgressingCancelButton;
395 Tizen::Ui::Controls::Button* __pInstall;
397 Tizen::Ui::Controls::Label* __pDividerLabel;
398 Tizen::Ui::Controls::Label* __pFileProgressingHeaderLabel;
399 Tizen::Ui::Controls::Label* __pFileProgressingLabel;
400 Tizen::Ui::Controls::Label* __pPopUpLabel;
402 Tizen::Ui::Controls::ListContextItem* __pItemContext;
403 Tizen::Ui::Controls::ListView* __pListView;
405 Tizen::Ui::Controls::Panel* __pPopUpPanel;
407 Tizen::Ui::Controls::Popup* __pDeleteConfirmationPopUp;
408 Tizen::Ui::Controls::Popup* __pFileProgressingPopup;
409 Tizen::Ui::Controls::Popup* __pInstallationConfirmationPopUp;
410 Tizen::Ui::Controls::Popup* __pInstallationProgressPopup;
412 Tizen::Ui::Controls::Progress* __pFileProgressingProgress;
414 Tizen::Ui::Controls::SearchBar* __pSearchBar;
415 Tizen::Ui::Controls::SearchBarMode __searchBarMode;
417 Tizen::Io::FileEventManager* __pFileEventManager;
420 SearchPresentationModel* __pSearchModel;
421 ThumbnailManager* __pThumbnailManager;
422 FolderEntryPresentationModel* __pFolderEntryPM;
424 static int searchBackSelected;
426 static const int ID_BACK = 100;
428 static const int IDA_CONTEXT_DETAIL = 101;
429 static const int IDA_CONTEXT_RENAME = 102;
430 static const int IDA_CONTEXT_DELETE = 103;
432 static const int IDA_BTN_POPUP_SEARCH_CANCEL = 200;
433 static const int IDA_CANCEL_INSTALLATION = 303;
434 static const int IDA_INSTALL_APP = 304;
435 static const int IDA_CANCEL_DELETION = 203;
436 static const int IDA_DELETE_FILE = 204;
438 static const int IDA_BTN_ANIMATION_POPUP_CANCEL = 300;
441 #endif //_MF_SEARCH_FORM_H_