NSE_42316
authorrashmi udaya <rashmi.uday@samsung.com>
Tue, 25 Jun 2013 09:40:42 +0000 (15:10 +0530)
committerrashmi udaya <rashmi.uday@samsung.com>
Tue, 25 Jun 2013 09:40:42 +0000 (15:10 +0530)
Change-Id: I99b3101489b27cf7b74bb7d8b669bdd3f39ffc6b

inc/GlContentUpdateEventListener.h
src/GlContentUpdateEventListener.cpp
src/GlGalleryApp.cpp

index b1306a9..91f768d 100644 (file)
@@ -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_ */
index ed6761c..f95a798 100644 (file)
@@ -19,6 +19,8 @@
  * @brief              This is the implementation file for ContentUpdateEventListener class.
  */
 
+#include <FApp.h>
+#include <FUi.h>
 #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 );\r
+       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;
+       }\r
 
        AppLogDebug("EXIT");
 }
index 93b84d4..27764b0 100644 (file)
@@ -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()));
 }