photosgallery/viewframework/uiutilities/src/glxsetappstate.cpp
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Update PCFW with current application state
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  * @internal reviewed 03/07/2007 by David Holland
       
    23  */
       
    24 
       
    25 #include "glxsetappstate.h"
       
    26 
       
    27 #include <glxlog.h>
       
    28 
       
    29 ///@todo use 'real' header when available in SDK
       
    30 #include <glxpsstatesourceappstatedomainpskeys.h>
       
    31 #include <e32property.h>
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // SetState
       
    35 // -----------------------------------------------------------------------------
       
    36 //	
       
    37 EXPORT_C void GlxSetAppState::SetState(TGlxAppState aAppState)
       
    38     {
       
    39     GLX_LOG_INFO1("GlxSetAppState::SetState state (%d)", aAppState);
       
    40     
       
    41     KPCFWAppStatePSGalleryState appState;
       
    42     
       
    43     TBool validAppState = ETrue;
       
    44     
       
    45     switch(aAppState)
       
    46         {
       
    47         case EGlxInCarouselView:
       
    48             {
       
    49             appState = GalleryInCarouselView;      
       
    50             }
       
    51             break;
       
    52         case EGlxInFullScreenView:
       
    53             {
       
    54             appState = GalleryInFullScreenView;  
       
    55             }
       
    56             break;
       
    57         case EGlxInZoomedView:
       
    58             {
       
    59             appState = GalleryInZoomedView;  
       
    60             }
       
    61             break;
       
    62         case EGlxInVideoPlaybackView:
       
    63             {
       
    64             appState = GalleryInVideoPlaybackView;  
       
    65             }
       
    66             break;
       
    67         case EGlxInSlideshowView:
       
    68             {
       
    69             appState = GalleryInSlideshowView;  
       
    70             }
       
    71             break;
       
    72         case EGlxInListView:
       
    73             {
       
    74             appState = GalleryInListView;  
       
    75             }
       
    76             break;		
       
    77         case EGlxInTagBrowserView:
       
    78             {
       
    79             appState = GalleryInTagBrowserView;  
       
    80             }
       
    81             break;
       
    82         case EGlxInMapBrowserView:
       
    83             {
       
    84             appState = GalleryInMapBrowserView;  
       
    85             }
       
    86             break;
       
    87         case EGlxInTextEntry:
       
    88             {
       
    89             appState = GalleryInTextEntry;
       
    90             }
       
    91             break;
       
    92         default:
       
    93             {
       
    94             validAppState = EFalse; 
       
    95             }
       
    96             break;    
       
    97         }
       
    98          
       
    99     if(validAppState)
       
   100         {
       
   101         // ignore any error
       
   102         RProperty::Set(KPCFWAppStatePSUid, KPCFWAppStatePSGallery, appState);
       
   103         }
       
   104     }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // AppState
       
   108 // -----------------------------------------------------------------------------
       
   109 //    
       
   110 EXPORT_C TGlxAppState GlxSetAppState::AppState()
       
   111     {
       
   112     TGlxAppState appState = EGlxAppStateUndefined;
       
   113     TInt pcfwState;
       
   114 
       
   115     TInt err = 
       
   116         RProperty::Get(KPCFWAppStatePSUid, KPCFWAppStatePSGallery, pcfwState);
       
   117     
       
   118     if(err == KErrNone)
       
   119         {
       
   120          switch(pcfwState)
       
   121             {
       
   122             case GalleryInCarouselView:
       
   123                 {
       
   124                 appState = EGlxInCarouselView;      
       
   125                 }
       
   126                 break;
       
   127             case GalleryInFullScreenView:
       
   128                 {
       
   129                 appState =  EGlxInFullScreenView;  
       
   130                 }
       
   131                 break;
       
   132             case GalleryInZoomedView:
       
   133                 {
       
   134                 appState = EGlxInZoomedView;  
       
   135                 }
       
   136                 break;
       
   137             case GalleryInVideoPlaybackView:
       
   138                 {
       
   139                 appState = EGlxInVideoPlaybackView;  
       
   140                 }
       
   141                 break;
       
   142             case GalleryInSlideshowView:
       
   143                 {
       
   144                 appState = EGlxInSlideshowView;  
       
   145                 }
       
   146                 break;
       
   147             case GalleryInListView:
       
   148                 {
       
   149                 appState = EGlxInListView;  
       
   150                 }
       
   151                 break;		
       
   152             case GalleryInTagBrowserView:
       
   153                 {
       
   154                 appState = EGlxInTagBrowserView;  
       
   155                 }
       
   156                 break;
       
   157             case GalleryInMapBrowserView:
       
   158                 {
       
   159                 appState = EGlxInMapBrowserView;  
       
   160                 }
       
   161                 break;
       
   162             case GalleryInTextEntry:
       
   163                 {
       
   164                 appState = EGlxInTextEntry;
       
   165                 }
       
   166                 break;
       
   167             default:
       
   168 
       
   169                 break;    
       
   170             }
       
   171         }
       
   172     GLX_LOG_INFO1("GlxSetAppState::AppState state is (%d)", appState);
       
   173     return appState;
       
   174     }