wvuing/IMPSServiceSettingsUI/Src/CWVSettingsUIDialogTitlePaneHandler.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2003 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:  Handles title pane changes for service settings UI
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <E32std.H>
       
    21 #include <akntitle.h>
       
    22 #include <aknlists.h>
       
    23 #include <aknnavi.h>
       
    24 #include "CWVSettingsUIDialogTitlePaneHandler.h"
       
    25 
       
    26 // ================= MEMBER FUNCTIONS =======================
       
    27 // C++ default constructor can NOT contain any code, that
       
    28 // might leave.
       
    29 //
       
    30 CWVSettingsUIDialogTitlePaneHandler::CWVSettingsUIDialogTitlePaneHandler()
       
    31     {
       
    32     }
       
    33 
       
    34 
       
    35 // Destructor
       
    36 CWVSettingsUIDialogTitlePaneHandler::~CWVSettingsUIDialogTitlePaneHandler()
       
    37     {
       
    38     delete iOldTitleText;
       
    39     }
       
    40 
       
    41 // ---------------------------------------------------------
       
    42 // CWVSettingsUIDialogTitlePaneHandler::SetTitlePaneTextL
       
    43 // Set title pane text from given text
       
    44 // (other items were commented in a header).
       
    45 // ---------------------------------------------------------
       
    46 //
       
    47 void CWVSettingsUIDialogTitlePaneHandler::SetTitlePaneTextL( const TDesC& aTitleText ) const
       
    48     {
       
    49     CAknTitlePane* title = GetTitlePaneInstanceL();
       
    50     title->SetTextL( aTitleText );
       
    51     }
       
    52 
       
    53 
       
    54 void CWVSettingsUIDialogTitlePaneHandler::SetTitlePaneDefaultTextL() const
       
    55     {
       
    56     CAknTitlePane* title = GetTitlePaneInstanceL();
       
    57     title->SetTextL( KNullDesC );
       
    58     }
       
    59 // ---------------------------------------------------------
       
    60 // CWVSettingsUIDialogTitlePaneHandler::GetTitlePaneInstanceL
       
    61 // Gets titlepane instance from CEikonEnv
       
    62 // (other items were commented in a header).
       
    63 // ---------------------------------------------------------
       
    64 //
       
    65 CAknTitlePane* CWVSettingsUIDialogTitlePaneHandler::GetTitlePaneInstanceL() const
       
    66     {
       
    67     CAknTitlePane* title = static_cast< CAknTitlePane* >
       
    68                            ( CEikonEnv::Static()->AppUiFactory()->StatusPane()->ControlL(
       
    69                                  TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
    70     if ( !title )
       
    71         {
       
    72         User::Leave( KErrNotSupported );
       
    73         }
       
    74     return title;
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // CWVSettingsUIDialogTitlePaneHandler::StoreTitlePaneTextL
       
    79 // Stores current titlepanetext, so it can be later restored.
       
    80 // (other items were commented in a header).
       
    81 // ---------------------------------------------------------
       
    82 //
       
    83 void CWVSettingsUIDialogTitlePaneHandler::StoreTitlePaneTextL()
       
    84     {
       
    85     CAknTitlePane* title = GetTitlePaneInstanceL();
       
    86 
       
    87     HBufC* tmp = title->Text()->AllocL();
       
    88     delete iOldTitleText;
       
    89     iOldTitleText = tmp;
       
    90 
       
    91     // Clear the navi pane
       
    92     // Get pointer to status-pane
       
    93     CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()->
       
    94                                  StatusPane();
       
    95     // Get pointer to navi-pane
       
    96     CAknNavigationControlContainer* naviPane = static_cast<CAknNavigationControlContainer*>(
       
    97                                                    statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
    98     naviPane->PushDefaultL( ETrue );
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------
       
   102 // CWVSettingsUIDialogTitlePaneHandler::RestoreTitlePaneText
       
   103 // Restores titlepanetext to previously stored one.
       
   104 // (other items were commented in a header).
       
   105 // ---------------------------------------------------------
       
   106 //
       
   107 void CWVSettingsUIDialogTitlePaneHandler::RestoreTitlePaneText() const
       
   108     {
       
   109     // we can (and have to) ignore this error
       
   110     // no real harm done even if this fails
       
   111     TInt ignore;
       
   112     TRAP( ignore, DoRestoreTitlePaneTextL() );
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------
       
   116 // CWVSettingsUIDialogTitlePaneHandler::DoRestoreTitlePaneTextL() const
       
   117 // Does the actual restoring.
       
   118 // (other items were commented in a header).
       
   119 // ---------------------------------------------------------
       
   120 //
       
   121 void CWVSettingsUIDialogTitlePaneHandler::DoRestoreTitlePaneTextL() const
       
   122     {
       
   123     CAknTitlePane* title = GetTitlePaneInstanceL();
       
   124 
       
   125     if ( iOldTitleText )
       
   126         {
       
   127         title->SetTextL( *iOldTitleText );
       
   128         }
       
   129     else
       
   130         {
       
   131         title->SetTextToDefaultL();
       
   132         }
       
   133 
       
   134     // restore the navi pane
       
   135     // Get pointer to status-pane
       
   136     CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()->
       
   137                                  StatusPane();
       
   138     // Get pointer to navi-pane
       
   139     CAknNavigationControlContainer* naviPane = static_cast<CAknNavigationControlContainer*>(
       
   140                                                    statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
   141     naviPane->Pop();
       
   142     }
       
   143 //  End of File
       
   144 
       
   145