From 949db1586658f3189cea174d5b44f7690ce094d0 Mon Sep 17 00:00:00 2001 From: rashmi udaya Date: Tue, 25 Jun 2013 15:10:42 +0530 Subject: [PATCH] NSE_42316 Change-Id: I99b3101489b27cf7b74bb7d8b669bdd3f39ffc6b --- inc/GlContentUpdateEventListener.h | 3 +++ src/GlContentUpdateEventListener.cpp | 48 +++++++++++++++++++++++++++++++----- src/GlGalleryApp.cpp | 5 ++++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/inc/GlContentUpdateEventListener.h b/inc/GlContentUpdateEventListener.h index b1306a9..91f768d 100644 --- a/inc/GlContentUpdateEventListener.h +++ b/inc/GlContentUpdateEventListener.h @@ -32,6 +32,8 @@ public: static ContentUpdateEventListener* GetInstance(void); void AddContentListener(void); void RemoveContentListener(void); + bool GetChangeNotificationStatus(); + void ResumeOperation(); private: ContentUpdateEventListener(void); @@ -49,6 +51,7 @@ private: private: static ContentUpdateEventListener* __pContentUpdateEventListener; Tizen::Content::ContentManager* __pContentManager; + bool __changeNotificationReceived; }; #endif /* _GL_CONTENT_UPDATE_EVENT_LISTENER_H_ */ diff --git a/src/GlContentUpdateEventListener.cpp b/src/GlContentUpdateEventListener.cpp index ed6761c..f95a798 100644 --- a/src/GlContentUpdateEventListener.cpp +++ b/src/GlContentUpdateEventListener.cpp @@ -19,6 +19,8 @@ * @brief This is the implementation file for ContentUpdateEventListener class. */ +#include +#include #include "GlContentUpdateEventListener.h" #include "GlFileListPresentationModel.h" #include "GlAlbumListPresentationModel.h" @@ -109,6 +111,24 @@ ContentUpdateEventListener::DestroyInstance(void) AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } +bool +ContentUpdateEventListener::GetChangeNotificationStatus() +{ + AppLogDebug("ENTER"); + AppLogDebug("EXIT"); + return __changeNotificationReceived; +} + +void +ContentUpdateEventListener::ResumeOperation() +{ + AppLogDebug("ENTER"); + AlbumListPresentationModel::GetInstance()->OnContentDeleted(); + FileListPresentationModel::GetInstance()->OnContentDeleted(); + __changeNotificationReceived = false; + AppLogDebug("EXIT"); +} + void ContentUpdateEventListener::OnContentFileCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r) { @@ -143,10 +163,18 @@ ContentUpdateEventListener::OnContentFileDeleted(Tizen::Content::ContentId conte if ( contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO) { - AlbumListPresentationModel::GetInstance()->OnContentDeleted(); - FileListPresentationModel::GetInstance()->OnContentDeleted(); - } + Tizen::App::UiApp* appPtr = Tizen::App::UiApp::GetInstance(); + if (appPtr->GetAppUiState() == Tizen::App::APP_UI_STATE_FOREGROUND) + { + AlbumListPresentationModel::GetInstance()->OnContentDeleted(); + FileListPresentationModel::GetInstance()->OnContentDeleted(); + } + else + { + __changeNotificationReceived = true; + } + } AppLogDebug("EXIT"); } @@ -155,9 +183,17 @@ ContentUpdateEventListener::OnContentDirectoryScanCompleted(const Tizen::Base::S { AppLogDebug("ENTER"); - AlbumListPresentationModel::GetInstance()->OnContentDeleted(); - FileListPresentationModel::GetInstance()->OnContentDeleted(); - AlbumListPresentationModel::GetInstance()->OnContentScanCompleted( directoryPath ); + Tizen::App::UiApp* appPtr = Tizen::App::UiApp::GetInstance(); + if (appPtr->GetAppUiState() == Tizen::App::APP_UI_STATE_FOREGROUND) + { + AlbumListPresentationModel::GetInstance()->OnContentDeleted(); + FileListPresentationModel::GetInstance()->OnContentDeleted(); + AlbumListPresentationModel::GetInstance()->OnContentScanCompleted( directoryPath ); + } + else + { + __changeNotificationReceived = true; + } AppLogDebug("EXIT"); } diff --git a/src/GlGalleryApp.cpp b/src/GlGalleryApp.cpp index 93b84d4..27764b0 100644 --- a/src/GlGalleryApp.cpp +++ b/src/GlGalleryApp.cpp @@ -181,6 +181,11 @@ GalleryApp::OnForeground(void) pMainFrame->Invalidate(true); } + ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance(); + if (pContentListener->GetChangeNotificationStatus() == true) + { + pContentListener->ResumeOperation(); + } AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } -- 2.7.4