NABI_SE issues resolved
[apps/osp/MyFiles.git] / src / MfMyFilesApp.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: MfMyFilesApp.cpp
19  * @brief:  This file contains the declaration of MyFilesApp Class,
20  * which provides basic features necessary to define an UiApp.
21  */
22
23 #include <FSystem.h>
24 #include <FUiScenes.h>
25
26 #include "MfCustomAppControl.h"
27 #include "MfFolderEntryPresentationModel.h"
28 #include "MfFormFactory.h"
29 #include "MfMainFrame.h"
30 #include "MfMyFilesApp.h"
31 #include "MfPanelFactory.h"
32 #include "MfSceneRegister.h"
33
34
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Base::Utility;
39 using namespace Tizen::System;
40 using namespace Tizen::Ui;
41 using namespace Tizen::Ui::Controls;
42 using namespace Tizen::Ui::Scenes;
43
44 MyFilesApp::MyFilesApp(void)
45         : __pResultList(null)
46         , __pCurrentListToUpdate(null)
47         , __pNotificationListener(null)
48         , __pAudioNotificationListener(null)
49 {
50         __operationId.Append(L"");
51         __mimeType.Append(L"");
52         __bAppControlEnabled = false;
53         __inputSource = APPCONTROL_STATE_MAINVIEW_SELECTED;
54         __currentFileType = FILE_TYPE_ALL;
55         __currentSelectionMode = SELECTION_MODE_SINGE;
56         __currentView = APPCONTROL_VIEW_DEFAULT;
57         __currentExportFileType = EXPORT_TYPE_CONTACTS;
58         __bImgAppControlLaunched = true;
59         __currentAppControlResult = APP_CTRL_RESULT_FAILED;
60
61         __currentSceneId = L"";
62         __previousSceneId = L"";
63
64         __bIsAppInBackground = false;
65 }
66
67 MyFilesApp::~MyFilesApp(void)
68 {
69         // Do Nothing
70 }
71
72 UiApp*
73 MyFilesApp::CreateInstance(void)
74 {
75         // Create the instance through the constructor.
76
77         return new (std::nothrow) MyFilesApp();
78 }
79
80 bool
81 MyFilesApp::OnAppInitializing(AppRegistry& appRegistry)
82 {
83         result r = E_SUCCESS;
84
85         InitializeListeners();
86         r = AppControlProviderManager::GetInstance()->SetAppControlProviderEventListener(this);
87         //r = AppControlProviderManager::GetInstance()->SendAppControlResult()
88         return true;
89 }
90
91 bool
92 MyFilesApp::OnAppInitialized(void)
93 {
94         result r = E_SUCCESS;
95
96         SceneManager* pSceneManager = null;
97         MfMainFrame* pMyFileMainFrame = null;
98         MessageBox messageBox;
99         String languageKey = L"http://tizen.org/setting/locale.language";
100
101         // Create a Frame
102         pMyFileMainFrame = new (std::nothrow) MfMainFrame();
103         TryCatch(pMyFileMainFrame != null, , "MainFrame pointer is null!");
104
105         r = pMyFileMainFrame->Construct();
106         TryCatch(r == E_SUCCESS, , "MainFrame creation failed!");
107
108         //pMyFileMainFrame->SetOperationIdAndInputSource(__operationId, __inputSource);
109         pMyFileMainFrame->SetName(L"MyFilesAppFrame");
110         AddFrame(*pMyFileMainFrame);
111
112         ThumbnailManager::GetInstance();
113
114         SceneRegister::RegisterAllScenes();
115         // Prepare Scene management.
116         pSceneManager = SceneManager::GetInstance();
117         TryCatch(pSceneManager != null, , "ScneManager is null!");
118
119         // Goto the scene.
120         if (pSceneManager != null)
121         {
122                 if (__operationId.CompareTo("http://tizen.org/appcontrol/operation/pick") == 0)
123                 {
124                         if (__currentView != APPCONTROL_VIEW_IMPORT)
125                         {
126                                 __inputSource = APPCONTROL_STATE_SELECTED;
127                                 /*IList* pArgs = new (std::nothrow) ArrayList();
128                                 pArgs->Add(new (std::nothrow) Integer(APPCONTROL_STATE_SELECTED));*/
129                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM), null);
130                         }
131
132 #if 0
133                         else if (__currentView == APPCONTROL_VIEW_EXPORT)
134                         {
135                                 if (__pResultList == null)
136                                 {
137                                         __pResultList = new (std::nothrow) HashMap();
138                                         __pResultList->Construct();
139                                 }
140                                 ArrayList* pArgs = null;
141                                 String currentFilePath;
142                                 String headertitle;
143                                 pArgs = new (std::nothrow) ArrayList();
144
145                                 if (__currentExportFileType == EXPORT_TYPE_CALENDAR)
146                                 {
147                                         currentFilePath = BasePresentationModel::GetMediaPath();
148                                         currentFilePath.Append("Backup/Calendar/");
149                                         headertitle.Append("Calendar");
150                                 }
151                                 if (__currentExportFileType == EXPORT_TYPE_CONTACTS)
152                                 {
153                                         currentFilePath = BasePresentationModel::GetMediaPath();
154                                         currentFilePath.Append("Backup/Contacts/");
155                                         headertitle.Append("Contacts");
156                                 }
157
158                                 pArgs->Add(new String (headertitle));
159                                 FolderNavigationPresentationModel::SetCurrentFilePath(currentFilePath);
160                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_FOLDER_SELECTION_FORM), pArgs);
161                         }
162                         else if (__currentView == APPCONTROL_VIEW_IMPORT)
163                         {
164                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_MOST_SELECTION_FORM), null);
165                         }
166 #endif
167                 }
168                 else
169                 {
170                         //pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ROOT_DIRECTORY_FORM));
171                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM));
172                         __bAppControlMode = false;
173                 }
174         }
175
176
177         //Setting Application setting change event listener.
178         SettingInfo::GetValue(languageKey, __currentDisplayLanguage);
179         SettingInfo::AddSettingEventListener(*this);
180         //Ends
181         return true;
182 CATCH:
183         return false;           //Returning false changes app state to TERMINATING and app's OnAppTerminating function will be called.
184 }
185
186 void
187 MyFilesApp::OnAppControlRequestReceivedN(RequestId reqId, const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::String& category,
188                                                                                  const Tizen::Base::String* pDataType, const Tizen::Base::String* pUriScheme, Tizen::Base::Collection::IList* pArgs)
189 {
190         //Empty Implementation.
191 }
192
193 bool
194 MyFilesApp::OnAppWillTerminate(void)
195 {
196         return true;
197 }
198
199 bool
200 MyFilesApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
201 {
202         AppLogDebug("ENTER");
203         String resultList;
204         result r = E_SUCCESS;
205         ArrayList* pAppControlResultList = null;
206
207         // Deallocate resources allocated by this App for termination.
208         // The App's permanent data and context can be saved via appRegistry.
209
210         if (__bAppControlEnabled == true)
211         {
212                 if (__currentView == APPCONTROL_VIEW_EXPORT)
213                 {
214                         if (__currentAppControlResult == APP_CTRL_RESULT_CANCELED)
215                         {
216                                 if (__pResultList != null)
217                                 {
218                                         __pResultList->RemoveAll(true);
219                                         delete __pResultList;
220                                         __pResultList = null;
221                                 }
222                                 r = AppControlProviderManager::GetInstance()->SendAppControlResult(__currentRequestId, __currentAppControlResult, null);
223                         }
224                         else
225                         {
226                                 pAppControlResultList = new (std::nothrow) ArrayList();
227                                 pAppControlResultList->Construct();
228                                 resultList = FolderNavigationPresentationModel::GetCurrentPath();
229                                 pAppControlResultList->Add(new (std::nothrow) String(resultList));
230                                 if (__pResultList != null && resultList.CompareTo("") != 0)
231                                 {
232                                         __pResultList->Add(new (std::nothrow) String(appcontroldataKey),pAppControlResultList);
233                                 }
234                                 AppLog("Result added is %S",resultList.GetPointer());
235                                 r = AppControlProviderManager::GetInstance()->SendAppControlResult(__currentRequestId, __currentAppControlResult, __pResultList);
236                         }
237                 }
238                 else
239                 {
240                         const HashMap* pResultHash = null;
241                         IMapEnumerator* pResultMapEnum = null;
242                         DirectoryEntry* pDirStr = null;
243
244                 pResultHash = FolderEntryEditorPresentationModel::GetInstance()->GetCheckedList();
245
246                         if (__currentAppControlResult != APP_CTRL_RESULT_CANCELED)
247                         {
248                                 if (pResultHash != null)
249                                 {
250                                         pResultMapEnum = pResultHash->GetMapEnumeratorN();
251
252                                         if (pResultMapEnum != null)
253                                         {
254                                                 pAppControlResultList = new (std::nothrow) ArrayList();
255                                                 pAppControlResultList->Construct();
256
257                                                 if (pResultHash->GetCount() != 0)
258                                                 {
259                                                         //__pResultList->Add(*new (std::nothrow) String(APPCONTROL_RESULT_SUCCEEDED));
260
261                                                         while (pResultMapEnum->MoveNext() == E_SUCCESS)
262                                                         {
263                                                                 pDirStr = static_cast< DirectoryEntry* >(pResultMapEnum->GetValue());
264
265                                                                 if (pDirStr != null)
266                                                                 {
267                                                                         pAppControlResultList->Add(new (std::nothrow) String(pDirStr->GetFullFilePath()));
268                                                                 }
269                                                         }
270                                                 }
271                                                 delete pResultMapEnum;
272                                         }
273                                 }
274                         }
275
276                         if (__pResultList != null && __currentAppControlResult != APP_CTRL_RESULT_CANCELED)
277                         {
278                                 //__pResultList->Add(new (std::nothrow) String(appcontrolKey), new (std::nothrow) String(resultList));
279                                 __pResultList->Add(new (std::nothrow) String(appcontroldataKey), pAppControlResultList);
280                         }
281
282                         if (__currentAppControlResult == APP_CTRL_RESULT_CANCELED)
283                         {
284                                 if (__pResultList != null)
285                                 {
286                                         __pResultList->RemoveAll(true);
287                                         delete __pResultList;
288                                         __pResultList = null;
289                                 }
290                                 r = AppControlProviderManager::GetInstance()->SendAppControlResult(__currentRequestId, __currentAppControlResult, null);
291                         }
292                         else
293                         {
294                                 r = AppControlProviderManager::GetInstance()->SendAppControlResult(__currentRequestId, __currentAppControlResult, __pResultList);
295                         }
296                 }
297         }
298
299         //Following code stops FolderEntryEditor thread and thumbnail manager thread. Don't remove this code as it's must to gracefully terminate the spawned thread from main threads.
300         FolderEntryEditorPresentationModel::GetInstance()->StopFolderEntryEditorThread();
301         ThumbnailManager::GetInstance()->StopThumbnailManagerThread();
302
303         InitializeListeners();
304
305         AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
306         return true;
307 }
308
309 void
310 MyFilesApp::OnForeground(void)
311 {
312         // Start or resume drawing when the application is moved to the foreground.
313         Frame* pCurrentFrame = null;
314         CustomAppControl::GetInstance()->SetAppControlInUse(null);
315         pCurrentFrame =  Application::GetInstance()->GetAppFrame()->GetFrame();
316
317         __bIsAppInBackground = false;
318
319         if (pCurrentFrame != null)
320         {
321                 pCurrentFrame->SetEnabled(true);
322         }
323
324         if (__pCurrentListToUpdate != null && IsAppControlLaunched() == true)
325         {
326                 AppLogDebug("OnAppControlCompleted Called");
327                 __pCurrentListToUpdate->OnAppControlCompleted();
328         }
329
330         SetAppControlLaunched(false);
331 }
332
333 void
334 MyFilesApp::OnBackground(void)
335 {
336         AppLogDebug("ENTER");
337         __bIsAppInBackground = true;
338         if (__inputSource == APPCONTROL_STATE_SELECTED)
339         {
340                 if (__pAudioNotificationListener != null)
341                 {
342                         __pAudioNotificationListener->OnAudioNotificationReceived();
343                 }
344         }
345         AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
346 }
347
348 void
349 MyFilesApp::OnLowMemory(void)
350 {
351         //Empty Implementation
352 }
353
354 void
355 MyFilesApp::OnBatteryLevelChanged(BatteryLevel batteryLevel)
356 {
357         //Empty Implementation
358 }
359
360 void
361 MyFilesApp::OnScreenOn(void)
362 {
363         //Empty Implementation
364 }
365
366 void
367 MyFilesApp::OnScreenOff(void)
368 {
369         // Empty Implementation
370 }
371 void
372 MyFilesApp::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
373 {
374         AppLogDebug("ENTER");
375         ThumbRequest* pCurrentThumbReq = null;
376
377         switch (requestId)
378         {
379         case THUMBNAIL_LAODED:
380         case THUMBNAIL_FAILED:
381         {
382                 if (__pCurrentListToUpdate == null)
383                 {
384                         if (pArgs != null)
385                         {
386                                 pCurrentThumbReq = (ThumbRequest*) pArgs->GetAt(0);
387                                 if (pCurrentThumbReq != null && pCurrentThumbReq->pBitmap != null)
388                                         delete pCurrentThumbReq->pBitmap;
389
390                                 if (pArgs != null)
391                                 {
392                                         pArgs->RemoveAll(true);
393                                         delete pArgs;
394                                         pArgs = null;
395                                 }
396                         }
397                 }
398                 else
399                 {
400                         if (pArgs != null)
401                         {
402                                 pCurrentThumbReq = (ThumbRequest*) pArgs->GetAt(0);
403                                 __pCurrentListToUpdate->OnThumbnailReceived(pCurrentThumbReq);
404
405                                 if (pArgs != null)
406                                 {
407                                         pArgs->RemoveAll(true);
408                                         delete pArgs;
409                                         pArgs = null;
410                                 }
411                         }
412                         else
413                                 __pCurrentListToUpdate->OnThumbnailReceived(null);
414                 }
415         }
416         break;
417
418         case ID_COPY_COMPLETE:
419         case ID_FILE_RENAME_COMPLETE:
420         case ID_DELETE_COMPLETE:
421         case ID_MOVING_COMPLETE:
422         case ID_CREATE_FOLDER_COMPLETE:
423         case ID_FILE_MANAGING_FAILED:
424         case ID_FOLDER_SEARCH_STARTED:
425         case ID_SEARCH_COMPLETED:
426         case ID_SEARCH_RESULT_FOUND:
427         {
428                 if (__pNotificationListener != null)
429                 {
430                         __pNotificationListener->OnNotificationReceived((Tizen::Base::Collection::ArrayList*) pArgs);
431                 }
432         }
433         break;
434
435         default:
436         {
437                 //Empty Implementation.
438         }
439         break;
440         }
441
442         return;
443 }
444
445 void
446 MyFilesApp::LaunchCacheManager(void)
447 {
448         //Empty Implementation
449 }
450
451 void
452 MyFilesApp::SetAppControlSelected(void)
453 {
454         __bAppControlEnabled = true;
455 }
456
457 String
458 MyFilesApp::ExtractType(Tizen::Base::String& inputType)
459 {
460         AppLogDebug("ENTER");
461         String type = L"";
462         StringTokenizer strTok(inputType, L":");
463
464         while (strTok.HasMoreTokens())
465         {
466                 type.Clear();
467                 strTok.GetNextToken(type);
468         }
469         AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
470         return type;
471 }
472
473 void
474 MyFilesApp::AddAppControlResult(Tizen::App::AppCtrlResult result)
475 {
476         AppLogDebug("ENTER");
477         if (__pResultList != null)
478         {
479                 //if (result.CompareTo(APPCONTROL_RESULT_CANCELED) == 0)
480                 if (result == APP_CTRL_RESULT_CANCELED)
481                 {
482                         FolderEntryEditorPresentationModel::GetInstance()->ClearCheckedList();
483                 }
484                 //__pResultList->Add(new (std::nothrow) String(result));
485                 __currentAppControlResult = result;
486         }
487         AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
488 }
489
490 SelectionMode
491 MyFilesApp::GetCurrentSelectionMode(void)
492 {
493         return __currentSelectionMode;
494 }
495
496 FileType
497 MyFilesApp::GetCurrentFileType(void)
498 {
499         return __currentFileType;
500 }
501
502 AppControlView
503 MyFilesApp::GetCurrentView(void)
504 {
505         return __currentView;
506 }
507
508 AppControlState
509 MyFilesApp::GetCurrentState(void)
510 {
511         return __inputSource;
512 }
513
514 ExportFileType
515 MyFilesApp::GetCurrentExportFileType(void)
516 {
517         return __currentExportFileType;
518 }
519
520 void
521 MyFilesApp::SetNotifyListener(INotificationListener* listener)
522 {
523         __pNotificationListener = listener;
524 }
525
526 void
527 MyFilesApp::SetImageAppControlLanched(bool bAppControlLaunched)
528 {
529         __bImgAppControlLaunched = bAppControlLaunched;
530 }
531
532 bool
533 MyFilesApp::IsImageAppControlLanched(void)
534 {
535         return __bImgAppControlLaunched;
536 }
537
538 result
539 MyFilesApp::SetCurrentView(IListViewStateChangeListener* pListToUpdate)
540 {
541         result res = E_SUCCESS;
542         __pCurrentListToUpdate = pListToUpdate;
543         return res;
544 }
545
546 IListViewStateChangeListener*
547 MyFilesApp::GetCurrentViewToUpdate(void)
548 {
549         return __pCurrentListToUpdate;
550 }
551
552 //End of changes
553 void
554 MyFilesApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData)
555 {
556         __bAppControlEnabled = false;
557         __currentRequestId = reqId;
558         __operationId.Clear();
559         __operationId.Append(operationId);
560
561         if (operationId.CompareTo(L"http://tizen.org/appcontrol/operation/pick") == 0)
562         {
563
564                 const String* inputSelectionType = null;
565                 const String* inputFileType = null;
566
567                 __bAppControlMode = true;
568
569                 if (pMimeType != null)
570                 {
571                         inputFileType = pMimeType;
572                         __mimeType.Clear();
573                         __mimeType.Append(*pMimeType);
574                 }
575
576                 if (pExtraData != null)
577                 {
578                         inputSelectionType = static_cast< const String* >(pExtraData->GetValue(String(L"http://tizen.org/appcontrol/data/selection_mode")));
579                 }
580
581                 if (__pResultList == null)
582                 {
583                         __pResultList = new (std::nothrow) HashMap();
584                         __pResultList->Construct();
585                 }
586
587                 __inputSource = APPCONTROL_STATE_SELECTED;
588
589                 if (inputFileType != null)
590                 {
591                         if (inputFileType->CompareTo("*/*") == 0)
592                         {
593                                 __currentFileType = FILE_TYPE_ALL;
594                         }
595                         else if (inputFileType->CompareTo("image/*") == 0)
596                         {
597                                 __currentFileType = FILE_TYPE_IMAGE_TYPE;
598                         }
599                         else if (inputFileType->CompareTo("audio/*") == 0)
600                         {
601                                 __currentFileType = FILE_TYPE_AUDIO_TYPE;
602                         }
603                         else if (inputFileType->CompareTo("video/*") == 0)
604                         {
605                                 __currentFileType = FILE_TYPE_VIDEO_TYPE;
606                         }
607                         else if (inputFileType->CompareTo("contacts") == 0)
608                         {
609                                 __currentFileType = FILE_TYPE_CONTACTS_TYPE;
610                         }
611                         else if(inputFileType->CompareTo("inode/directory") == 0)
612                         {
613                                 __currentFileType = FILE_TYPE_ALL;
614                                 __currentView = APPCONTROL_VIEW_EXPORT;
615                         }
616                         else
617                         {
618                                 __currentFileType = FILE_TYPE_ALL;
619                         }
620                 }
621                 else
622                 {
623                         __currentFileType = FILE_TYPE_ALL;
624                 }
625
626                 if (inputSelectionType != null)
627                 {
628                         if (inputSelectionType->CompareTo("single") == 0)
629                         {
630                                 __currentSelectionMode = SELECTION_MODE_SINGE;
631                         }
632                         else if (inputSelectionType->CompareTo("multiple") == 0)
633                         {
634                                 __currentSelectionMode = SELECTION_MODE_MULTIPLE;
635                         }
636                 }
637                 else
638                 {
639                         __currentSelectionMode = SELECTION_MODE_SINGE;
640                 }
641
642         }
643
644         if (__inputSource == APPCONTROL_STATE_SELECTED)
645         {
646                 SceneManager* pSceneManager = null;
647                 pSceneManager = SceneManager::GetInstance();
648
649                 if (pSceneManager != null && __currentView != APPCONTROL_VIEW_IMPORT)
650                 {
651                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM), null);
652                         //pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_MOST_SELECTION_FORM));
653                 }
654 #if 0
655                 else if (pSceneManager != null && __currentView == APPCONTROL_VIEW_IMPORT)
656                 {
657                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_MOST_SELECTION_FORM), null);
658                 }
659                 else if (pSceneManager != null && __currentView == APPCONTROL_VIEW_EXPORT)
660                 {
661                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_FOLDER_SELECTION_FORM), null);
662                 }
663 #endif
664         }
665
666 }
667 void
668 MyFilesApp::InitializeListeners(void)
669 {
670         __pCurrentListToUpdate = null;
671         __pNotificationListener = null;
672 }
673 void
674 MyFilesApp::OnSettingChanged(Tizen::Base::String& key)
675 {
676         AppLogDebug("SettingChanged:%S", key.GetPointer());
677         AppRegistry* pAppRegistry = null;
678         result r = E_SUCCESS;
679
680         String languageSettingKey = L"http://tizen.org/setting/locale.language";
681         String languageSelected;
682
683         String timeFormatKeyName(L"TimeFormat");
684         String timeFormatSettingSelected;
685         String timeFormatSettingKey = L"http://tizen.org/setting/locale.date_time.format";
686         TimeFormat timeFormatSelected = TIME_FORMAT_NONE;
687
688         if ( key.CompareTo(languageSettingKey) == 0 )
689         {
690                 SettingInfo::GetValue(languageSettingKey, languageSelected);
691
692                 if ( __currentDisplayLanguage.CompareTo(languageSelected) !=0)
693                 {
694                         Application::Terminate();
695                 }
696         }
697         else if (key.CompareTo(timeFormatSettingKey) == 0)
698         {
699                 SettingInfo::GetValue(timeFormatSettingKey, timeFormatSettingSelected);
700                 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
701
702                 if (timeFormatSettingSelected.CompareTo(IDB_DATETIME_24HR) == 0)
703                 {
704                         timeFormatSelected = TIME_FORMAT_24_HOUR;
705                 }
706                 else if (timeFormatSettingSelected.CompareTo(IDB_DATETIME_12HR) == 0)
707                 {
708                         timeFormatSelected = TIME_FORMAT_12_HOUR;
709                 }
710                 r = pAppRegistry->Set(timeFormatKeyName, timeFormatSelected);
711                 if (r == E_SUCCESS)
712                 {
713                         r = pAppRegistry->Save();
714                 }
715                 __pCurrentListToUpdate->OnSettingValueChanged();
716         }
717         AppLogDebug("SettingChanged--");
718 }
719 bool
720 MyFilesApp::IsAppControlMode(void)
721 {
722         return __bAppControlMode;
723 }
724
725 void
726 MyFilesApp::SetAudioNotificationListener(IAudioNotificationListener* listener)
727 {
728         __pAudioNotificationListener = listener;
729 }
730
731 void
732 MyFilesApp::SetCurrentScene(const Tizen::Ui::Scenes::SceneId&           currentScene, const Tizen::Ui::Scenes::SceneId&         previousScene)
733 {
734         __currentSceneId = currentScene;
735         __previousSceneId = previousScene;
736
737         if ( __pCurrentListToUpdate )
738                 __pCurrentListToUpdate->OnSceneIdChanged(__currentSceneId, __previousSceneId);
739 }
740
741 bool
742 MyFilesApp::IsAppInBackground(void)
743 {
744         return __bIsAppInBackground;
745 }
746
747 void
748 MyFilesApp::SetAppControlLaunched(bool  isAppControlLaunched)
749 {
750         AppLogDebug("Enter : %d", isAppControlLaunched);
751         __IsAppControlLaunched = isAppControlLaunched;
752 }
753
754 bool
755 MyFilesApp::IsAppControlLaunched(void)
756 {
757         AppLogDebug("Enter");
758         return __IsAppControlLaunched;
759 }