NSE_41049
[apps/osp/Gallery.git] / src / GlSettingMainForm.cpp
index 58cbad0..efe7551 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
 //
@@ -20,6 +20,7 @@
  */
 
 #include "GlDropDownCustomItem.h"
+#include "GlFileListPresentationModel.h"
 #include "GlGalleryApp.h"
 #include "GlRadioCustomItem.h"
 #include "GlResourceManager.h"
@@ -142,7 +143,14 @@ SettingMainForm::OnFormBackRequested(Form& source)
                else
                {
                        SceneManager* pSceneManager = SceneManager::GetInstance();
-                       pSceneManager->GoBackward(BackwardSceneTransition());
+                       if (__contentUpdated)
+                       {
+                               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
+                       }
+                       else
+                       {
+                               pSceneManager->GoBackward(BackwardSceneTransition());
+                       }
                }
        }
 
@@ -150,10 +158,19 @@ SettingMainForm::OnFormBackRequested(Form& source)
 }
 
 void
+SettingMainForm::OnContentUpdated(void)
+{
+       AppLogDebug("ENTER");
+       __contentUpdated = true;
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}
+
+void
 SettingMainForm::OnSceneActivatedN(const SceneId& previousSceneId,
                const SceneId& currentSceneId, IList* pArgs)
 {
        AppLogDebug("ENTER");
+       FileListPresentationModel::GetInstance()->AddContentEventListener(this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -162,6 +179,7 @@ SettingMainForm::OnSceneDeactivated(const SceneId& currentSceneId,
                const SceneId& nextSceneId)
 {
        AppLogDebug("ENTER");
+       FileListPresentationModel::GetInstance()->RemoveContentEventListener(this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -413,6 +431,7 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
        int effectiveIndex = 0;
        const Color ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND;
        const Color ITEM_RADIO_ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_RADIO_BACKGROUND;
+       const Color ITEM_BACKGROUND_COLOR_HIGHLIGHTED = CUSTOM_BACKGROUND_COLOR_LISTVIEW_PRESSED_HIGHLIGHTED;
 
        effectiveIndex = effectiveIndex + itemIndex;
        AppLogDebug("SettingMainForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d effectiveIndex %d", groupIndex, itemIndex, itemWidth, effectiveIndex);
@@ -429,7 +448,7 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                }
 
                pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_BACKGROUND_COLOR);
-               pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR);
+               pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
 
                if (__pList != null)
                {
@@ -452,7 +471,7 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                }
 
                pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_BACKGROUND_COLOR);
-               pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR);
+               pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
 
                pItem->SetMainText(settingInfo[effectiveIndex].titleText);
                pItem->SetSubText(settingInfo[effectiveIndex].subText);
@@ -498,7 +517,7 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                }
 
                pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_RADIO_ITEM_BACKGROUND_COLOR);
-               pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_RADIO_ITEM_BACKGROUND_COLOR);
+               pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
 
                pItem->SetText(settingInfo[effectiveIndex].titleText);
                AppLogDebug("effectiveIndex %d SettingInfo[effectiveIndex].isSelected %d", effectiveIndex, settingInfo[effectiveIndex].isSelected);