commsconfig/cscsettingsui/src/cscsettingsuimodel.cpp
branchRCL_3
changeset 22 d38647835c2e
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2007-2010 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:  Implements CSCSettingsUiModel methods
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <eikenv.h>
       
    20 #include <cchclient.h>
       
    21 #include <cmmanagerext.h>
       
    22 #include <AknIconUtils.h>
       
    23 #include <mspnotifychangeobserver.h>
       
    24 
       
    25 #include "cscsettingsui.hrh"
       
    26 #include "cscengcchhandler.h"
       
    27 #include "cscsettingsuimodel.h"
       
    28 #include "cscsettingsuilogger.h"
       
    29 #include "cscengservicehandler.h"
       
    30 #include "cscengbrandinghandler.h"
       
    31 #include "cscsettingsuiconstants.h"
       
    32 #include "cscengdestinationshandler.h"
       
    33 #include "mcscsettingsuimodelobserver.h"
       
    34 #include "cscengservicepluginhandler.h"
       
    35 
       
    36 // ======== MEMBER FUNCTIONS ========
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 CCSCSettingsUiModel::CCSCSettingsUiModel( 
       
    42     MCSCSettingsUiModelObserver& aObserver,
       
    43     CEikonEnv& aEikEnv )
       
    44     : iObserver( aObserver ),
       
    45     iEikEnv( aEikEnv )
       
    46     {
       
    47     }
       
    48 
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 void CCSCSettingsUiModel::ConstructL()
       
    54     {
       
    55     CSCSETUIDEBUG( "CCSCSettingsUiModel::ConstructL - begin" );
       
    56 
       
    57     // Create handle to CSC's Service Provider Settings Handler.
       
    58     iSPSHandler = CCSCEngServiceHandler::NewL( this );
       
    59 
       
    60     // Create handle to CSC's Converged Connection Handler.
       
    61     iCCHHandler = CCSCEngCCHHandler::NewL( *this );
       
    62 
       
    63     // Create handle to CSC's Destinations Handler.
       
    64     iDestinationsHandler = CCSCEngDestinationsHandler::NewL();
       
    65 
       
    66     // Create handle to CSC's Branding Server Handler.
       
    67     iBSHandler = CCSCEngBrandingHandler::NewL();
       
    68 
       
    69     // Create CSC's Service Plugin Handler.
       
    70     iServicePluginHandler = CCSCEngServicePluginHandler::NewL( 
       
    71         iEikEnv, *this, *iSPSHandler );
       
    72 
       
    73     CSCSETUIDEBUG( "CCSCSettingsUiModel::ConstructL - end" );
       
    74     }
       
    75 
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 CCSCSettingsUiModel* CCSCSettingsUiModel::NewL( 
       
    81     MCSCSettingsUiModelObserver& aObserver,
       
    82     CEikonEnv& aEikEnv )
       
    83     {
       
    84     CCSCSettingsUiModel* self = 
       
    85         CCSCSettingsUiModel::NewLC( aObserver, aEikEnv );
       
    86     CleanupStack::Pop( self );
       
    87     return self;
       
    88     }
       
    89 
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 CCSCSettingsUiModel* CCSCSettingsUiModel::NewLC(
       
    95     MCSCSettingsUiModelObserver& aObserver,
       
    96     CEikonEnv& aEikEnv )
       
    97     {
       
    98     CCSCSettingsUiModel* self = 
       
    99         new ( ELeave ) CCSCSettingsUiModel( aObserver, aEikEnv );
       
   100     CleanupStack::PushL( self );
       
   101     self->ConstructL();
       
   102     return self;
       
   103     }
       
   104 
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 CCSCSettingsUiModel::~CCSCSettingsUiModel()
       
   110     {
       
   111     CSCSETUIDEBUG( "CCSCSettingsUiModel::~CCSCSettingsUiModel - begin" );
       
   112     
       
   113     delete iBSHandler;
       
   114     delete iSPSHandler;
       
   115     delete iCCHHandler;
       
   116     delete iDestinationsHandler;
       
   117     delete iServicePluginHandler;
       
   118     
       
   119     CSCSETUIDEBUG( "CCSCSettingsUiModel::~CCSCSettingsUiModel - end" );
       
   120     }
       
   121 
       
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 // CCSCSettingsUiModel::SettingsHandler
       
   125 // Returns reference to CSC's Service Provider Settings Handler.
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 CCSCEngServiceHandler& CCSCSettingsUiModel::SettingsHandler() const
       
   129     {
       
   130     return *iSPSHandler;
       
   131     }
       
   132 
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // CCSCSettingsUiModel::CCHHandler
       
   136 // Returns reference to CSC's Converged Connection Handler.
       
   137 // ---------------------------------------------------------------------------
       
   138 //
       
   139 CCSCEngCCHHandler& CCSCSettingsUiModel::CCHHandler() const
       
   140     {
       
   141     return *iCCHHandler;
       
   142     }
       
   143 
       
   144 
       
   145 // ---------------------------------------------------------------------------
       
   146 // CCSCSettingsUiModel::DestinationsHandler
       
   147 // Returns reference to CSC's Destinations Handler.
       
   148 // ---------------------------------------------------------------------------
       
   149 //
       
   150 CCSCEngDestinationsHandler& CCSCSettingsUiModel::DestinationsHandler() const
       
   151     {
       
   152     return *iDestinationsHandler;
       
   153     }
       
   154 
       
   155 // ---------------------------------------------------------------------------
       
   156 // CCSCSettingsUiModel::BSHandler
       
   157 // Returns reference to CSC's Branding Server Handler.
       
   158 // ---------------------------------------------------------------------------
       
   159 //
       
   160 CCSCEngBrandingHandler& CCSCSettingsUiModel::BSHandler() const
       
   161     {
       
   162     return *iBSHandler;
       
   163     }
       
   164 
       
   165 // ---------------------------------------------------------------------------
       
   166 // CCSCSettingsUiModel::ServicePluginHandler
       
   167 // Returns reference to CSC's Service Plugin Handler.
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 CCSCEngServicePluginHandler& CCSCSettingsUiModel::ServicePluginHandler() const
       
   171     {
       
   172     return *iServicePluginHandler;
       
   173     }
       
   174 
       
   175 // ---------------------------------------------------------------------------
       
   176 // CCSCSettingsUiModel::StoreInitializationDataL
       
   177 // Stores initialization information.
       
   178 // ---------------------------------------------------------------------------
       
   179 //
       
   180 void CCSCSettingsUiModel::StoreInitializationDataL(
       
   181     const TUid& aViewId,
       
   182     TUint aServiceId )
       
   183     {
       
   184     CSCSETUIDEBUG( "CCSCSettingsUiModel::StoreInitializationDataL - begin" );
       
   185 
       
   186     // View id for customer application return view id.
       
   187     iViewId = aViewId;
       
   188 
       
   189     // Check that service exists in service table.
       
   190     RArray<TUint> spEntryIds;
       
   191     CleanupClosePushL( spEntryIds );
       
   192     iSPSHandler->GetAllServiceIdsL( spEntryIds );
       
   193     User::LeaveIfError( spEntryIds.Find( aServiceId ) );
       
   194     CleanupStack::PopAndDestroy( &spEntryIds );
       
   195     iServiceId = aServiceId;
       
   196 
       
   197     CSCSETUIDEBUG( "CCSCSettingsUiModel::StoreInitializationDataL - end" );
       
   198     }
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // CCSCSettingsUiModel::UpdateSoftkeys
       
   202 // To notify when softkeys need to be changed.
       
   203 // ---------------------------------------------------------------------------
       
   204 //
       
   205 void CCSCSettingsUiModel::UpdateSoftkeys()
       
   206     {
       
   207     CSCSETUIDEBUG( "CCSCSettingsUiModel::UpdateSoftkeys - begin" );
       
   208    
       
   209     iObserver.UpdateSoftkeys();
       
   210     
       
   211     CSCSETUIDEBUG( "CCSCSettingsUiModel::UpdateSoftkeys - end" );
       
   212     }
       
   213 
       
   214 
       
   215 // ---------------------------------------------------------------------------
       
   216 // CCSCSettingsUiModel::ReturnViewId
       
   217 // Returns uid of the view where to be returned.
       
   218 // ---------------------------------------------------------------------------
       
   219 //
       
   220 TUid CCSCSettingsUiModel::ReturnViewId() const
       
   221     {
       
   222     return iViewId;
       
   223     }
       
   224 
       
   225 
       
   226 // ---------------------------------------------------------------------------
       
   227 // CCSCSettingsUiModel::CurrentSPEntryId
       
   228 // Returns currently selected service provider entry id.
       
   229 // ---------------------------------------------------------------------------
       
   230 //
       
   231 TUint CCSCSettingsUiModel::CurrentSPEntryId() const
       
   232     {
       
   233     return iServiceId;
       
   234     }
       
   235 
       
   236 // ---------------------------------------------------------------------------
       
   237 // From MCSCEngCCHObserver.
       
   238 // CCSCSettingsUiModel::ServiceStatusChanged
       
   239 // ---------------------------------------------------------------------------
       
   240 //
       
   241 void CCSCSettingsUiModel::ServiceStatusChanged(
       
   242     TUint /*aServiceId*/, 
       
   243     TCCHSubserviceType /*aType*/, 
       
   244     const TCchServiceStatus& /*aServiceStatus*/ )
       
   245     {
       
   246     // Not used.
       
   247     }
       
   248 
       
   249 
       
   250 // ---------------------------------------------------------------------------
       
   251 // From MCSCEngServiceObserver.
       
   252 // CCSCSettingsUiModel::NotifyServiceChange
       
   253 // ---------------------------------------------------------------------------
       
   254 //
       
   255 void CCSCSettingsUiModel::NotifyServiceChange()
       
   256     {
       
   257     // Not used.
       
   258     }
       
   259 
       
   260 // ---------------------------------------------------------------------------
       
   261 // From MCSCProvisioningObserver.
       
   262 // CCSCSettingsUiModel::NotifyServicePluginResponse
       
   263 // ---------------------------------------------------------------------------
       
   264 //
       
   265 void CCSCSettingsUiModel::NotifyServicePluginResponse( 
       
   266     const CCSCEngServicePluginHandler::TServicePluginResponse& /*aResponse*/,
       
   267     const TInt /*aIndex*/, const TUid& /*aPluginUid*/ )
       
   268     {
       
   269     }