wvuing/wvuiave/AppSrc/CCASettingsView.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2006 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:  View class for settings view
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include	"chatngclient.hrh"
       
    20 #include	"CCASettingsView.h"
       
    21 #include	"CCAAppUi.h"
       
    22 #include	"CCAStatusPaneHandler.h"
       
    23 #include	"CAExternalInterface.h"
       
    24 #include	"CCASettingsViewContainer.h"
       
    25 #include	"CCAAppSettingsDialog.h"
       
    26 #include    "CAExternalInterface.h"
       
    27 #include	"ChatDefinitions.h"
       
    28 #include    "ChatDebugPrint.h"
       
    29 
       
    30 #include	<aknviewappui.h>
       
    31 #include	<chatNG.rsg>
       
    32 #include    <bldvariant.hrh>
       
    33 
       
    34 // The Settings have been moved to Cenrep (also retained in the Resource file),
       
    35 // so the enums for keys and central repository header is added here
       
    36 #include 	"VariantKeys.h"
       
    37 
       
    38 // ================= MEMBER FUNCTIONS =======================
       
    39 
       
    40 // Symbian OS default constructor can leave.
       
    41 void CCASettingsView::ConstructL( TInt aAvkonViewResourceId,
       
    42                                   TUid aViewId )
       
    43     {
       
    44     BaseConstructL( aAvkonViewResourceId, aViewId );
       
    45 
       
    46     }
       
    47 
       
    48 // Destructor
       
    49 CCASettingsView::~CCASettingsView()
       
    50     {
       
    51     if ( iContainer )
       
    52         {
       
    53         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    54         }
       
    55 
       
    56     delete iContainer;
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CCASettingsView::DoActivateL
       
    61 // (other items were commented in a header).
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 void CCASettingsView::DoActivateL( const TVwsViewId& aPrevViewId,
       
    65                                    TUid /*aCustomMessageId*/,
       
    66                                    const TDesC8& /*aCustomMessage*/ )
       
    67     {
       
    68     CHAT_DP_TXT( "CCASettingsView::DoActivateL" );
       
    69 
       
    70     // To prevent looping between this view and refresh view
       
    71     if ( aPrevViewId.iViewUid != KUidRefreshView )
       
    72         {
       
    73         iPrevViewId = aPrevViewId;
       
    74         }
       
    75 
       
    76 
       
    77 
       
    78     iContainer = new ( ELeave ) CCASettingsViewContainer(
       
    79         *( static_cast<MCAViewSwitcher*>( CAAppUi() ) ),
       
    80         *( CAAppUi()->GetProcessManager().GetSettingsInterface( ) ) //( CAModel().GetInternalSettingsInterface() )
       
    81     );
       
    82     iContainer->SetMopParent( this );
       
    83     iContainer->ConstructL( ClientRect() );
       
    84 
       
    85     AppUi()->AddToViewStackL( *this, iContainer );
       
    86     CAAppUi()->CAStatusPane()->ClearNaviPaneL();
       
    87 
       
    88     CAAppUi()->CAStatusPane()->SetTitleL( iEikonEnv, R_CHATCLIEN_SETTINGS_VIEW_TITLE );
       
    89 
       
    90     if ( aPrevViewId.iViewUid == KUidRefreshView )
       
    91         {
       
    92         iContainer->Listbox()->SetCurrentItemIndexAndDraw(
       
    93             CCASettingsViewContainer::EServiceSettings );
       
    94         }
       
    95 
       
    96 #ifdef RD_SERVICE_ENHANCEMENTS
       
    97     if ( iServSettingsDialogWasActive )
       
    98         {
       
    99         iContainer->LaunchServSettingsDialogL( ETrue );
       
   100         }
       
   101 #endif  // RD_SERVICE_ENHANCEMENTS
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // CCASettingsView::DoDeactivate
       
   106 // (other items were commented in a header).
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 void CCASettingsView::DoDeactivate()
       
   110     {
       
   111     CHAT_DP_TXT( "CCASettingsView::DoDeactivate" );
       
   112 
       
   113     if ( iContainer )
       
   114         {
       
   115 #ifdef RD_SERVICE_ENHANCEMENTS
       
   116         iServSettingsDialogWasActive = iContainer->IsServSettingsDialogActive();
       
   117 #endif  // RD_SERVICE_ENHANCEMENTS
       
   118 
       
   119         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   120         }
       
   121 
       
   122     delete iContainer;
       
   123     iContainer = NULL;
       
   124     }
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CCASettingsView::HandleCommandL
       
   128 // (other items were commented in a header).
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 void CCASettingsView::HandleCommandL( TInt aCommand )
       
   132     {
       
   133     switch ( aCommand )
       
   134         {
       
   135         case EAknSoftkeyBack: // Flow through
       
   136         case EChatClientCmdBack:
       
   137             {
       
   138             CAAppUi()->SwitchViewL( iPrevViewId.iViewUid );
       
   139             break;
       
   140             }
       
   141         case EAknSoftkeyOpen:   // Flowthrough, MSK command
       
   142         case EChatClientSettingsOpen:
       
   143             {
       
   144             TInt index( iContainer->Listbox()->CurrentItemIndex() );
       
   145 
       
   146             if ( index == CCASettingsViewContainer::EApplicationSettings )
       
   147                 {
       
   148                 iContainer->LaunchAppSettingsDialogL();
       
   149                 }
       
   150 
       
   151             if ( index == CCASettingsViewContainer::EServiceSettings )
       
   152                 {
       
   153                 iContainer->LaunchServSettingsDialogL();
       
   154                 }
       
   155             break;
       
   156             }
       
   157 
       
   158         case EChatClientCmdHelp:
       
   159             {
       
   160             LaunchHelpL();
       
   161             break;
       
   162             }
       
   163 
       
   164         default:
       
   165             {
       
   166             AppUi()->HandleCommandL( aCommand );
       
   167             break;
       
   168             }
       
   169         }
       
   170     }
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // CCASettingsView::DynInitMenuPaneL
       
   174 // (other items were commented in a header).
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 void CCASettingsView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   178     {
       
   179     CCAView::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   180     }
       
   181 
       
   182 //  End of File