messagingappbase/mcesettings/src/MceSettingsTitlePaneHandlerDialog.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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 *     Message centre's settings title pane handler
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include <StringLoader.h>   // StringLoader
       
    24 #include <akntitle.h>       // CAknTitlePane
       
    25 #include <aknViewAppUi.h>
       
    26 #include "MceSettingsTitlePaneHandlerDialog.h"
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 
       
    30 // ----------------------------------------------------
       
    31 // CMceSettingsTitlePaneHandlerDialog::Constructor
       
    32 // ----------------------------------------------------
       
    33 CMceSettingsTitlePaneHandlerDialog::CMceSettingsTitlePaneHandlerDialog()
       
    34 : CAknDialog()
       
    35     {
       
    36     }
       
    37 
       
    38 // ----------------------------------------------------
       
    39 // CMceSettingsTitlePaneHandlerDialog::Destructor
       
    40 // ----------------------------------------------------
       
    41 CMceSettingsTitlePaneHandlerDialog::~CMceSettingsTitlePaneHandlerDialog()
       
    42     {
       
    43     delete iOldTitleText;
       
    44     iOldTitleText = NULL;
       
    45     }
       
    46 
       
    47 // ----------------------------------------------------
       
    48 // CMceSettingsTitlePaneHandlerDialog::StoreTitleTextAndSetNewL
       
    49 // ----------------------------------------------------
       
    50 void CMceSettingsTitlePaneHandlerDialog::StoreTitleTextAndSetNewL( TInt aResourceId )
       
    51     {
       
    52     HBufC* text = StringLoader::LoadLC( aResourceId, iEikonEnv );
       
    53     CEikStatusPane* sp = ( (CAknAppUi*)iEikonEnv->EikAppUi() )
       
    54         ->StatusPane();
       
    55     // Fetch pointer to the default title pane control
       
    56     CAknTitlePane* title=(CAknTitlePane *)sp->ControlL(
       
    57         TUid::Uid( EEikStatusPaneUidTitle ) );
       
    58 
       
    59     delete iOldTitleText;
       
    60     iOldTitleText = NULL;
       
    61     if ( title )
       
    62         {
       
    63         iOldTitleText = ( *title->Text() ).Alloc();
       
    64         title->SetTextL( *text );
       
    65         }
       
    66     CleanupStack::PopAndDestroy( text ); // text
       
    67     }
       
    68 
       
    69 // ----------------------------------------------------
       
    70 // CMceSettingsTitlePaneHandlerDialog::StoreTitleTextAndSetNewL
       
    71 // ----------------------------------------------------
       
    72 void CMceSettingsTitlePaneHandlerDialog::StoreTitleTextAndSetNewL( const TDesC& aTitleText )
       
    73     {
       
    74     CEikStatusPane* sp = ((CAknAppUi*)iEikonEnv->EikAppUi())
       
    75         ->StatusPane();
       
    76     // Fetch pointer to the default title pane control
       
    77     CAknTitlePane* title=(CAknTitlePane *)sp->ControlL(
       
    78         TUid::Uid( EEikStatusPaneUidTitle ) );
       
    79 
       
    80     delete iOldTitleText;
       
    81     iOldTitleText = NULL;
       
    82     if ( title )
       
    83         {
       
    84         iOldTitleText = ( *title->Text() ).Alloc();
       
    85         title->SetTextL( aTitleText );
       
    86         }
       
    87     }
       
    88 
       
    89 // ----------------------------------------------------
       
    90 // CMceSettingsTitlePaneHandlerDialog::RestoreTitleTextL
       
    91 // ----------------------------------------------------
       
    92 void CMceSettingsTitlePaneHandlerDialog::RestoreTitleTextL()
       
    93     {
       
    94     if ( iOldTitleText )
       
    95         {
       
    96         CEikStatusPane* sp = ( (CAknAppUi*)iEikonEnv->EikAppUi() )
       
    97             ->StatusPane();
       
    98         // Fetch pointer to the default title pane control
       
    99         CAknTitlePane* title=(CAknTitlePane *)sp->ControlL(
       
   100             TUid::Uid( EEikStatusPaneUidTitle ) );
       
   101 
       
   102         title->SetTextL( iOldTitleText->Des() );
       
   103         }
       
   104 	}
       
   105