Fixed prevent issue
[apps/osp/Gallery.git] / src / GlGalleryApp.cpp
index 74784b0..8428b1c 100644 (file)
@@ -1,7 +1,7 @@
 //
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
@@ -21,6 +21,7 @@
 
 #include <FUi.h>
 #include "GlAlbumListPresentationModel.h"
+#include "GlContentUpdateEventListener.h"\r
 #include "GlFileListPresentationModel.h"
 #include "GlGalleryApp.h"
 #include "GlMainFrame.h"
@@ -37,13 +38,11 @@ using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 using namespace Tizen::Ui::Scenes;
 
-static const wchar_t* PARAM_LANGUAGE = L"http://tizen.org/setting/locale.language";
-static const wchar_t* PARAM_LOCALE = L"http://tizen.org/setting/locale.country";
-
 GalleryApp::GalleryApp(void)
        : __requestId(0)
        , __pArguments(null)
        , __appControlResult(APP_CTRL_RESULT_SUCCEEDED)
+       , __frameActivated(false)
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -96,7 +95,17 @@ GalleryApp::SendAppControlResult(const AppCtrlResult appControlResult, const IMa
 {
        AppLogDebug("ENTER");
        AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
-       pAppManager->SendAppControlResult(__requestId, appControlResult, pExtraData);
+       result r = pAppManager->SendAppControlResult(__requestId, appControlResult, pExtraData);
+       if (r == E_MAX_EXCEEDED)
+       {
+               MessageBox messageBox;
+               messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
+                               MSGBOX_STYLE_NONE, 3000);
+               int modalResult;
+               messageBox.ShowAndWait(modalResult);
+       }
+
+       AppLogDebug("appControlResult is %d", appControlResult);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -127,7 +136,12 @@ GalleryApp::OnAppInitialized(void)
 bool
 GalleryApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
 {
-       AppLogDebug("ENTER");
+       AppLogDebug("ENTER");\r
+       ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance();\r
+       if (pContentListener)\r
+       {\r
+               pContentListener->RemoveContentListener();\r
+       }\r
        AlbumListPresentationModel* pAlbumListPresentationModel = AlbumListPresentationModel::GetInstance();
        if (pAlbumListPresentationModel != null)
        {
@@ -165,6 +179,11 @@ GalleryApp::OnForeground(void)
                pMainFrame->Invalidate(true);
        }
 
+       ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance();
+       if (pContentListener->GetChangeNotificationStatus() == true)
+       {
+               pContentListener->ResumeOperation();
+       }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -206,8 +225,8 @@ GalleryApp::OnAppControlRequestReceived(RequestId reqId, const String& operation
 void
 GalleryApp::OnSettingChanged(String& key)
 {
-       AppLogDebug("ENTER");
-       if (key.CompareTo(PARAM_LANGUAGE) == 0 || key.CompareTo(PARAM_LOCALE) == 0)
+       AppLogDebug("ENTER key(%ls)", key.GetPointer());
+       if (key.CompareTo(SETTING_KEY_LANGUAGE) == 0 || key.CompareTo(SETTING_KEY_FONT_SIZE) == 0)
        {
                UiApp::GetInstance()->Terminate();
        }
@@ -223,3 +242,16 @@ GalleryApp::SetFrameEnabled(const bool enabled)
                pMainFrame->SetEnabled(enabled);
        }
 }
+
+void
+GalleryApp::SetFrameActivated(bool frameActivated)
+{
+       __frameActivated = frameActivated;
+}
+
+bool
+GalleryApp::GetFrameActivated(void) const
+{
+       return __frameActivated;
+}
+