From 3d986a143a501689231d7f9c67958cc27c888793 Mon Sep 17 00:00:00 2001 From: chitta ranjan Date: Fri, 12 Apr 2013 17:54:23 +0900 Subject: [PATCH] Fixed issue 33526 Change-Id: Id44ee44bc9ee0097e09507787ae48b60ff86f578 Signed-off-by: chitta ranjan --- inc/GlFileListEditorForm.h | 6 ++++++ inc/GlFileListPresentationModel.h | 5 +++++ src/GlFileListEditorForm.cpp | 29 +++++++++++++++++++++++++++-- src/GlFileListPresentationModel.cpp | 20 ++++++++++++++++++++ src/GlFormFactory.cpp | 1 + 5 files changed, 59 insertions(+), 2 deletions(-) diff --git a/inc/GlFileListEditorForm.h b/inc/GlFileListEditorForm.h index 7574bd9..b781f7a 100644 --- a/inc/GlFileListEditorForm.h +++ b/inc/GlFileListEditorForm.h @@ -39,6 +39,7 @@ class FileListEditorForm , public ISlideSettingListener , public Tizen::Ui::IActionEventListener , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Scenes::ISceneEventListener { public: FileListEditorForm(void); @@ -65,6 +66,11 @@ public: virtual void OnSlideSettingPopUpItemSelected(int index); + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId); + private: result InitializeFooter(void); Tizen::Base::String GetDirecotyNameFromFullPath(const Tizen::Base::String& fullPath) const; diff --git a/inc/GlFileListPresentationModel.h b/inc/GlFileListPresentationModel.h index 540155b..2efbe33 100644 --- a/inc/GlFileListPresentationModel.h +++ b/inc/GlFileListPresentationModel.h @@ -23,6 +23,8 @@ #define _GL_FILE_LIST_PRESENTATION_MODEL_H_ #include +#include + #include "GlAlbumEventListener.h" #include "GlFormContentUpdateEventListener.h" #include "GlCommonUtil.h" @@ -39,6 +41,7 @@ class FileListPresentationModel : public IContentFileUpdateManager , public IThumbnailEventListener , public Tizen::Base::Object + , public Tizen::System::IDeviceEventListener { public: static FileListPresentationModel* GetInstance(void); @@ -54,6 +57,8 @@ public: static void AddPresentationModelListener(const IAlbumEventListener* listener); static void RemovePresentationModelListener(const IAlbumEventListener& listener); + virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state); + static void AddContentEventListener(const IFormContentUpdateEventListener* listener); static void RemoveContentEventListener(const IFormContentUpdateEventListener* listener); diff --git a/src/GlFileListEditorForm.cpp b/src/GlFileListEditorForm.cpp index f371ea7..1108fc9 100644 --- a/src/GlFileListEditorForm.cpp +++ b/src/GlFileListEditorForm.cpp @@ -878,11 +878,19 @@ FileListEditorForm::OnContentUpdated() { AppLogDebug("ENTER"); - if (_overlayMsg == false) + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK + && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST)); + + } + else if (_overlayMsg == false) { - SceneManager* pSceneManager = SceneManager::GetInstance(); pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST)); } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } @@ -1192,3 +1200,20 @@ FileListEditorForm::OnSlideSettingPopUpItemSelected(int index) pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN)); } } + +void +FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + AppLogDebug("ENTER"); + __pPresentationModel->RemoveContentEventListener(this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + +void +FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("ENTER"); + __pPresentationModel->AddContentEventListener(this); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} + diff --git a/src/GlFileListPresentationModel.cpp b/src/GlFileListPresentationModel.cpp index 8529041..2307b69 100644 --- a/src/GlFileListPresentationModel.cpp +++ b/src/GlFileListPresentationModel.cpp @@ -122,6 +122,8 @@ FileListPresentationModel::Construct(void) __pThumbnailEvent = new (std::nothrow) ThumbnailEvent(); __pThumbnailEvent->AddListener(*pThumbnailEventListener, true); + DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + ContentUpdateEventListener::GetInstance(); __pContentManager = new (std::nothrow) ContentManager(); __pContentManager->Construct(); @@ -1608,3 +1610,21 @@ FileListPresentationModel::RotateImage(int index, RotateMode rotateMode) ContentManager::ScanFile(filePath); return r; } + +void +FileListPresentationModel::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state) +{ + AppLogDebug("ENTER"); + if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED) + { + IFormContentUpdateEventListener* pInterface = null; + IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN(); + while (pEventEnum->MoveNext() == E_SUCCESS) + { + pInterface = static_cast(pEventEnum->GetCurrent()); + pInterface->OnContentUpdated(); + } + delete pEventEnum; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); +} diff --git a/src/GlFormFactory.cpp b/src/GlFormFactory.cpp index ed59d46..0063618 100644 --- a/src/GlFormFactory.cpp +++ b/src/GlFormFactory.cpp @@ -84,6 +84,7 @@ FormFactory::CreateFormN(const String& formId, const SceneId& sceneId) { FileListEditorForm* pForm = new (std::nothrow) FileListEditorForm(); pForm->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pForm); pNewForm = pForm; } else if (formId == IDC_FORM_SETTING_MAIN) -- 2.7.4