meetingrequest/mrgui/src/cesmrtitlepanehandler.cpp
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 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:   MR title pane handler implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cesmrtitlepanehandler.h"
       
    19 
       
    20 #include <akntitle.h>
       
    21 #include <eikspane.h>
       
    22 #include <avkon.hrh> // EEikStatusPaneUidTitle
       
    23 
       
    24 // DEBUG
       
    25 #include "emailtrace.h"
       
    26 
       
    27 // ======== MEMBER FUNCTIONS ========
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // CESMRTitlePaneHandler::CESMRTitlePaneHandler
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 CESMRTitlePaneHandler::CESMRTitlePaneHandler( CEikonEnv& aEnv )
       
    34     : iEikEnv( aEnv )
       
    35     {
       
    36     FUNC_LOG;
       
    37     // Do nothing
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // CESMRTitlePaneHandler::ConstructL
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 void CESMRTitlePaneHandler::ConstructL()
       
    45     {
       
    46     FUNC_LOG;
       
    47     // Do nothing
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // CESMRTitlePaneHandler::NewL
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 CESMRTitlePaneHandler* CESMRTitlePaneHandler::NewL( CEikonEnv& aEnv )
       
    55     {
       
    56     FUNC_LOG;
       
    57     CESMRTitlePaneHandler* self = new (ELeave) CESMRTitlePaneHandler( aEnv );
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL();
       
    60     CleanupStack::Pop( self );
       
    61     return self;
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CESMRTitlePaneHandler::~CESMRTitlePaneHandler
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CESMRTitlePaneHandler::~CESMRTitlePaneHandler()
       
    69     {
       
    70     FUNC_LOG;
       
    71     delete iSaveTitlePaneText;
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CESMRTitlePaneHandler::SetNewTitle
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 void CESMRTitlePaneHandler::SetNewTitle( const TDesC* aNewTitle )
       
    79     {
       
    80     FUNC_LOG;
       
    81     TRAPD( error, SetTitlePaneTextL( aNewTitle ) );
       
    82 
       
    83     if ( error != KErrNone )
       
    84     	{
       
    85     	iEikEnv.HandleError( error );
       
    86     	}
       
    87     }
       
    88 
       
    89 // ---------------------------------------------------------------------------
       
    90 // CESMRTitlePaneHandler::Rollback
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 void CESMRTitlePaneHandler::Rollback()
       
    94     {
       
    95     FUNC_LOG;
       
    96     if ( iTitlePane && iSaveTitlePaneText )
       
    97         {
       
    98         // iTitlePane takes ownership of iSaveTitlePaneText
       
    99         iTitlePane->SetText( iSaveTitlePaneText );
       
   100         iSaveTitlePaneText = NULL;
       
   101         }
       
   102     }
       
   103 
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // CESMRTitlePaneHandler::SetTitlePaneTextL
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 void CESMRTitlePaneHandler::SetTitlePaneTextL( const TDesC* aNewTitle )
       
   110     {
       
   111     FUNC_LOG;
       
   112     // Reset saved state
       
   113     delete iSaveTitlePaneText;
       
   114     iSaveTitlePaneText = NULL;
       
   115 
       
   116     CEikStatusPane* statusPane = iEikEnv.AppUiFactory()->StatusPane();
       
   117 
       
   118     if ( statusPane )
       
   119         {
       
   120         if ( statusPane->PaneCapabilities(
       
   121                 TUid::Uid( EEikStatusPaneUidTitle ) ).IsPresent() )
       
   122             {
       
   123             iTitlePane = static_cast<CAknTitlePane*>(
       
   124                     statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   125 
       
   126             if ( iTitlePane->Text() )
       
   127                 {
       
   128                 iSaveTitlePaneText = iTitlePane->Text()->AllocL();
       
   129                 }
       
   130 
       
   131             if ( aNewTitle )
       
   132                 {
       
   133                 iTitlePane->SetTextL( *aNewTitle );
       
   134                 }
       
   135             else
       
   136                 {
       
   137                 iTitlePane->SetTextToDefaultL();
       
   138                 }
       
   139             }
       
   140         }
       
   141     }
       
   142 
       
   143 // End of file
       
   144