|
1 /* |
|
2 * Copyright (c) 2007-2008 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 CSCSettingsUiImpl methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <eikclb.h> |
|
20 #include <aknview.h> |
|
21 #include <bautils.h> |
|
22 #include <aknnavi.h> |
|
23 #include <pathinfo.h> |
|
24 #include <akntitle.h> |
|
25 #include <cchclient.h> |
|
26 #include <akncontext.h> |
|
27 #include <aknViewAppUi.h> |
|
28 #include <xSPViewServices.h> |
|
29 #include <data_caging_path_literals.hrh> |
|
30 |
|
31 #include "cscsettingsui.hrh" |
|
32 #include "cscsettingsuiimpl.h" |
|
33 #include "cscsettingsuimodel.h" |
|
34 #include "cscsettingsuilogger.h" |
|
35 #include "cscsettingsuimainview.h" |
|
36 #include "cscsettingsuiconstants.h" |
|
37 |
|
38 |
|
39 #define AppUi() (static_cast<CAknViewAppUi*>(iAvkonAppUi) ) |
|
40 |
|
41 // ======== MEMBER FUNCTIONS ======== |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 CCSCSettingsUiImpl::CCSCSettingsUiImpl( CEikonEnv& aEikEnv ) |
|
47 : iEikEnv( aEikEnv ) |
|
48 { |
|
49 } |
|
50 |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CCSCSettingsUiImpl::ConstructL() |
|
56 { |
|
57 CSCSETUIDEBUG( "CCSCSettingsUiImpl::ConstructL - begin" ); |
|
58 |
|
59 iModel = CCSCSettingsUiModel::NewL( *this, iEikEnv ); |
|
60 |
|
61 // Load resource file to the memory. |
|
62 TFileName resourceFile = TParsePtrC( PathInfo::RomRootPath() ).Drive(); |
|
63 resourceFile.Append( KDC_RESOURCE_FILES_DIR ); |
|
64 resourceFile.Append( KCSCSettingsUiResourceFile ); |
|
65 BaflUtils::NearestLanguageFile( iEikEnv.FsSession(), resourceFile ); |
|
66 iResourceOffset = iEikEnv.AddResourceFileL( resourceFile ); |
|
67 |
|
68 CSCSETUIDEBUG( "CCSCSettingsUiImpl::ConstructL - end" ); |
|
69 } |
|
70 |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 CCSCSettingsUiImpl* CCSCSettingsUiImpl::NewL( CEikonEnv& aEikEnv ) |
|
76 { |
|
77 CCSCSettingsUiImpl* self = new (ELeave) CCSCSettingsUiImpl( aEikEnv ); |
|
78 CleanupStack::PushL( self ); |
|
79 self->ConstructL(); |
|
80 CleanupStack::Pop( self ); |
|
81 return self; |
|
82 } |
|
83 |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CCSCSettingsUiImpl::~CCSCSettingsUiImpl() |
|
89 { |
|
90 CSCSETUIDEBUG( "CCSCSettingsUi::~CCSCSettingsUiImpl - begin" ); |
|
91 |
|
92 delete iModel; |
|
93 |
|
94 // Remove resource file from the memory. |
|
95 if ( iResourceOffset ) |
|
96 { |
|
97 iEikEnv.DeleteResourceFile( iResourceOffset ); |
|
98 } |
|
99 |
|
100 CSCSETUIDEBUG( "CCSCSettingsUi::~CCSCSettingsUiImpl - end" ); |
|
101 } |
|
102 |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CCSCSettingsUiImpl::InitializeL |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 void CCSCSettingsUiImpl::InitializeL( |
|
109 const TUid& aReturnViewId, |
|
110 TUint aServiceId, |
|
111 const MCoeView* aDefaultAppView ) |
|
112 { |
|
113 CSCSETUIDEBUG4( |
|
114 "CCSCSettingsUiImpl::InitializeL, VIEW ID=%d, SERVICE ID=%d, ISDEFAULTVIEW=%d", |
|
115 aReturnViewId.iUid, aServiceId, NULL == aDefaultAppView ); |
|
116 |
|
117 if ( NULL == iMainView ) |
|
118 { |
|
119 iMainView = CCSCSettingsUiMainView::NewL( *iModel ); |
|
120 AppUi()->AddViewL( iMainView ); // ownership is transferred |
|
121 } |
|
122 |
|
123 // Set initialization information data. The function leaves if given |
|
124 // service does not exist. |
|
125 iModel->StoreInitializationDataL( aReturnViewId, aServiceId ); |
|
126 |
|
127 ( NULL == aDefaultAppView ) |
|
128 ? AppUi()->SetDefaultViewL( *iMainView ) |
|
129 : AppUi()->SetDefaultViewL( *aDefaultAppView ); |
|
130 } |
|
131 |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CCSCSettingsUiImpl::LaunchSettingsUiL |
|
135 // Launches Converged Service Configurator Settings UI. |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 void CCSCSettingsUiImpl::LaunchSettingsUiL() |
|
139 { |
|
140 CSCSETUIDEBUG( "CCSCSettingsUiImpl::LaunchSettingsUiL - begin" ); |
|
141 __ASSERT_ALWAYS( NULL != iMainView, User::Leave( KErrNotReady ) ); |
|
142 |
|
143 // Activate main view with given service properties. |
|
144 AppUi()->ActivateLocalViewL( KCSCSettingsUiMainViewId ); |
|
145 |
|
146 CSCSETUIDEBUG( "CCSCSettingsUiImpl::LaunchSettingsUiL - end" ); |
|
147 } |
|
148 |
|
149 |
|
150 // --------------------------------------------------------------------------- |
|
151 // From MCSCSettingsUiModelObserver. |
|
152 // CCSCSettingsUiImpl::UpdateSoftkeys |
|
153 // --------------------------------------------------------------------------- |
|
154 // |
|
155 void CCSCSettingsUiImpl::UpdateSoftkeys() const |
|
156 { |
|
157 // Pass notification to main view. |
|
158 CCSCSettingsUiMainView* mainView = |
|
159 static_cast<CCSCSettingsUiMainView*> |
|
160 ( AppUi()->View( KCSCSettingsUiMainViewId ) ); |
|
161 |
|
162 TVwsViewId activeViewId; |
|
163 AppUi()->GetActiveViewId( activeViewId ); |
|
164 |
|
165 if ( mainView && |
|
166 KCSCSettingsUiMainViewId == activeViewId.iViewUid ) |
|
167 { |
|
168 TRAP_IGNORE( mainView->UpdateSoftkeysL() ); |
|
169 } |
|
170 } |
|
171 |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // CCSCSettingsUiImpl::ReferenceCounter |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 TInt& CCSCSettingsUiImpl::ReferenceCounter() |
|
178 { |
|
179 CSCSETUIDEBUG( "CCSCSettingsUiImpl::ReferenceCounter - IN"); |
|
180 return iReferenceCounter; |
|
181 } |