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