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