gssettingsuis/Gs/GSDisplayPlugin/Src/GSDisplayPluginAO.cpp
changeset 0 8c5d936e5675
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2007 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "GSDisplayPlugin.h"
       
    21 #include "GSDisplayPluginAO.h"
       
    22 #include "GsLogger.h"
       
    23 #include <psmsrvdomaincrkeys.h>
       
    24 
       
    25 // EXTERNAL DATA STRUCTURES
       
    26 
       
    27 // EXTERNAL FUNCTION PROTOTYPES
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // ----------------------------------------------------------------------------------
       
    32 // CGSDisplayPluginAO::CGSDisplayPluginAO
       
    33 // ----------------------------------------------------------------------------------
       
    34 CGSDisplayPluginAO::CGSDisplayPluginAO() : CActive( EPriorityStandard )
       
    35     {
       
    36     
       
    37     }
       
    38 
       
    39 
       
    40 // ----------------------------------------------------------------------------------
       
    41 // CGSDisplayPluginAO::~CGSDisplayPluginAO
       
    42 // ----------------------------------------------------------------------------------
       
    43 CGSDisplayPluginAO::~CGSDisplayPluginAO()
       
    44     {
       
    45     Cancel();
       
    46     delete iPsmRepository;
       
    47     }
       
    48 
       
    49 
       
    50 // ----------------------------------------------------------------------------------
       
    51 // CGSDisplayPluginAO::DoCancel
       
    52 // ----------------------------------------------------------------------------------
       
    53 void CGSDisplayPluginAO::DoCancel()
       
    54     {
       
    55     iPsmRepository->NotifyCancel( KPsmCurrentMode );
       
    56     }
       
    57 
       
    58 // ----------------------------------------------------------------------------------
       
    59 // CGSDisplayPluginAO::RunL
       
    60 // ----------------------------------------------------------------------------------
       
    61 void CGSDisplayPluginAO::RunL()
       
    62     {
       
    63     // Request complete, notify request again and get new value
       
    64     iPsmRepository->Get( KPsmCurrentMode, iPsmMode );
       
    65     iPsmRepository->NotifyRequest( KPsmCurrentMode, iStatus );
       
    66     SetActive();
       
    67     __GSLOGSTRING1( "[CGSDisplayPluginAO::RunL] iPsmMode:%d", iPsmMode );
       
    68 
       
    69     // Update display view when PSM mode has changed
       
    70     iDisplayView->UpdateViewL();
       
    71     }
       
    72 
       
    73 // ----------------------------------------------------------------------------------
       
    74 // CGSDisplayPluginAO::RunError
       
    75 // ----------------------------------------------------------------------------------
       
    76 TInt CGSDisplayPluginAO::RunError( TInt /*aError*/ )
       
    77     {
       
    78     return KErrNone;
       
    79     }
       
    80 
       
    81 
       
    82 // ----------------------------------------------------------------------------------
       
    83 // CGSDisplayPluginAO::NewL
       
    84 // ----------------------------------------------------------------------------------
       
    85 CGSDisplayPluginAO* CGSDisplayPluginAO::NewL()
       
    86     {
       
    87     CGSDisplayPluginAO* self = new( ELeave ) CGSDisplayPluginAO();
       
    88     CleanupStack::PushL( self );
       
    89     self->ConstructL();
       
    90     CleanupStack::Pop( self );
       
    91     return self;    
       
    92     }
       
    93 
       
    94 
       
    95 // ----------------------------------------------------------------------------------
       
    96 // CGSDisplayPluginAO::ConstructL
       
    97 // ----------------------------------------------------------------------------------
       
    98 void CGSDisplayPluginAO::ConstructL()
       
    99     {
       
   100     CActiveScheduler::Add ( this );
       
   101     iPsmRepository = CRepository::NewL( KCRUidPowerSaveMode );
       
   102     // Read from CenRep so iPsmMode gets correct init value
       
   103     iPsmRepository->Get( KPsmCurrentMode, iPsmMode );
       
   104     iPsmRepository->NotifyRequest( KPsmCurrentMode, iStatus );
       
   105     SetActive();
       
   106     }
       
   107 
       
   108 
       
   109 // ----------------------------------------------------------------------------------
       
   110 // CGSDisplayPluginAO::SetView
       
   111 // ----------------------------------------------------------------------------------
       
   112 void CGSDisplayPluginAO::SetView( CGSDisplayPlugin* aDisplayView )
       
   113     {
       
   114     iDisplayView = aDisplayView;
       
   115     }
       
   116 
       
   117 
       
   118 // ----------------------------------------------------------------------------------
       
   119 // CGSDisplayPluginAO::Mode
       
   120 // ----------------------------------------------------------------------------------
       
   121 TInt CGSDisplayPluginAO::Mode()
       
   122     {
       
   123     return iPsmMode;
       
   124     }
       
   125 
       
   126 
       
   127 // End of File
       
   128 
       
   129