28
|
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 |
else
|
|
123 |
{
|
|
124 |
// Already initialised. Reset view since we're probably switching
|
|
125 |
// between different service settings.
|
|
126 |
iMainView->ResetViewL();
|
|
127 |
}
|
|
128 |
|
|
129 |
// Set initialization information data. The function leaves if given
|
|
130 |
// service does not exist.
|
|
131 |
iModel->StoreInitializationDataL( aReturnViewId, aServiceId );
|
|
132 |
|
|
133 |
( NULL == aDefaultAppView )
|
|
134 |
? AppUi()->SetDefaultViewL( *iMainView )
|
|
135 |
: AppUi()->SetDefaultViewL( *aDefaultAppView );
|
|
136 |
}
|
|
137 |
|
|
138 |
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
// CCSCSettingsUiImpl::LaunchSettingsUiL
|
|
141 |
// Launches Converged Service Configurator Settings UI.
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
//
|
|
144 |
void CCSCSettingsUiImpl::LaunchSettingsUiL()
|
|
145 |
{
|
|
146 |
CSCSETUIDEBUG( "CCSCSettingsUiImpl::LaunchSettingsUiL - begin" );
|
|
147 |
__ASSERT_ALWAYS( NULL != iMainView, User::Leave( KErrNotReady ) );
|
|
148 |
|
|
149 |
// Activate main view with given service properties.
|
|
150 |
AppUi()->ActivateLocalViewL( KCSCSettingsUiMainViewId );
|
|
151 |
|
|
152 |
CSCSETUIDEBUG( "CCSCSettingsUiImpl::LaunchSettingsUiL - end" );
|
|
153 |
}
|
|
154 |
|
|
155 |
|
|
156 |
// ---------------------------------------------------------------------------
|
|
157 |
// From MCSCSettingsUiModelObserver.
|
|
158 |
// CCSCSettingsUiImpl::UpdateSoftkeys
|
|
159 |
// ---------------------------------------------------------------------------
|
|
160 |
//
|
|
161 |
void CCSCSettingsUiImpl::UpdateSoftkeys() const
|
|
162 |
{
|
|
163 |
// Pass notification to main view.
|
|
164 |
CCSCSettingsUiMainView* mainView =
|
|
165 |
static_cast<CCSCSettingsUiMainView*>
|
|
166 |
( AppUi()->View( KCSCSettingsUiMainViewId ) );
|
|
167 |
|
|
168 |
TVwsViewId activeViewId;
|
|
169 |
AppUi()->GetActiveViewId( activeViewId );
|
|
170 |
|
|
171 |
if ( mainView &&
|
|
172 |
KCSCSettingsUiMainViewId == activeViewId.iViewUid )
|
|
173 |
{
|
|
174 |
TRAP_IGNORE( mainView->UpdateSoftkeysL() );
|
|
175 |
}
|
|
176 |
}
|
|
177 |
|
|
178 |
|
|
179 |
// ---------------------------------------------------------------------------
|
|
180 |
// CCSCSettingsUiImpl::ReferenceCounter
|
|
181 |
// ---------------------------------------------------------------------------
|
|
182 |
//
|
|
183 |
TInt& CCSCSettingsUiImpl::ReferenceCounter()
|
|
184 |
{
|
|
185 |
CSCSETUIDEBUG( "CCSCSettingsUiImpl::ReferenceCounter - IN");
|
|
186 |
return iReferenceCounter;
|
|
187 |
}
|