65
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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 the License "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:
|
|
15 |
* View of the information about the active settings
|
|
16 |
*
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
|
|
23 |
#include <AKNLISTS.H>
|
|
24 |
#include <CALSLBS.H>
|
|
25 |
#include <AKNVIEWAPPUI.H>
|
|
26 |
#include <BrowserNG.rsg>
|
|
27 |
#include <EikMenuP.H>
|
|
28 |
|
|
29 |
#include "BrowserAppUi.h"
|
|
30 |
#include "BrowserPreferences.h"
|
|
31 |
#include "BrowserDialogs.h"
|
|
32 |
#include "SettingsView.h"
|
|
33 |
#include "SettingsContainer.h"
|
|
34 |
#include "CommonConstants.h"
|
|
35 |
|
|
36 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
37 |
#include <eikapp.h>
|
|
38 |
#else
|
|
39 |
#include <eikapp.h>
|
|
40 |
#include <vwsdefpartner.h> // KNullViewId
|
|
41 |
#endif
|
|
42 |
|
|
43 |
// CONSTS
|
|
44 |
|
|
45 |
// ========================= MEMBER FUNCTIONS ================================
|
|
46 |
|
|
47 |
// ---------------------------------------------------------
|
|
48 |
// CBrowserSettingsView::ConstructL
|
|
49 |
// ---------------------------------------------------------
|
|
50 |
//
|
|
51 |
void CBrowserSettingsView::ConstructL()
|
|
52 |
{
|
|
53 |
BaseConstructL( R_BROWSER_SETTINGS_SETTINGS_VIEW );
|
|
54 |
}
|
|
55 |
|
|
56 |
// ---------------------------------------------------------
|
|
57 |
// CBrowserSettingsView::NewLC
|
|
58 |
// ---------------------------------------------------------
|
|
59 |
//
|
|
60 |
CBrowserSettingsView* CBrowserSettingsView::NewLC( MApiProvider& aApiProvider )
|
|
61 |
{
|
|
62 |
CBrowserSettingsView* result;
|
|
63 |
result = new( ELeave ) CBrowserSettingsView( aApiProvider );
|
|
64 |
CleanupStack::PushL( result );
|
|
65 |
result->ConstructL();
|
|
66 |
return result;
|
|
67 |
}
|
|
68 |
|
|
69 |
// ---------------------------------------------------------
|
|
70 |
// CBrowserSettingsView::NewL
|
|
71 |
// ---------------------------------------------------------
|
|
72 |
//
|
|
73 |
CBrowserSettingsView* CBrowserSettingsView::NewL( MApiProvider& aApiProvider )
|
|
74 |
{
|
|
75 |
CBrowserSettingsView* result;
|
|
76 |
result = CBrowserSettingsView::NewLC( aApiProvider );
|
|
77 |
CleanupStack::Pop();
|
|
78 |
return result;
|
|
79 |
}
|
|
80 |
|
|
81 |
// ---------------------------------------------------------
|
|
82 |
// CBrowserSettingsView::CBrowserSettingsView
|
|
83 |
// ---------------------------------------------------------
|
|
84 |
//
|
|
85 |
CBrowserSettingsView::CBrowserSettingsView( MApiProvider& aApiProvider )
|
|
86 |
: CBrowserViewBase( aApiProvider )
|
|
87 |
{
|
|
88 |
}
|
|
89 |
|
|
90 |
// ---------------------------------------------------------
|
|
91 |
// CBrowserSettingsView::~CBrowserSettingsView
|
|
92 |
// ---------------------------------------------------------
|
|
93 |
//
|
|
94 |
CBrowserSettingsView::~CBrowserSettingsView()
|
|
95 |
{
|
|
96 |
delete iContainer;
|
|
97 |
}
|
|
98 |
|
|
99 |
// ---------------------------------------------------------------------------
|
|
100 |
// CBrowserSettingsView::CommandSetResourceIdL
|
|
101 |
// ---------------------------------------------------------------------------
|
|
102 |
TInt CBrowserSettingsView::CommandSetResourceIdL()
|
|
103 |
{
|
|
104 |
// It is never called, but this function have to be implemented
|
|
105 |
return KWmlEmptyResourceId;
|
|
106 |
}
|
|
107 |
|
|
108 |
// ---------------------------------------------------------
|
|
109 |
// CBrowserSettingsView::HandleCommsModelChangeL
|
|
110 |
// ---------------------------------------------------------
|
|
111 |
//
|
|
112 |
void CBrowserSettingsView::HandleCommsModelChangeL()
|
|
113 |
{
|
|
114 |
MPreferences& preferences = ApiProvider().Preferences();
|
|
115 |
TUint defaultAp = preferences.DefaultAccessPoint();
|
|
116 |
|
|
117 |
// re-check default access point in case it was deleted.
|
|
118 |
preferences.SetDefaultAccessPointL(defaultAp);
|
|
119 |
|
|
120 |
if ( iContainer )
|
|
121 |
{
|
|
122 |
iContainer->DisplayCorrectSettingCategoryListL();
|
|
123 |
}
|
|
124 |
}
|
|
125 |
|
|
126 |
// ---------------------------------------------------------
|
|
127 |
// CBrowserSettingsView::HandleCommandL
|
|
128 |
// ---------------------------------------------------------
|
|
129 |
//
|
|
130 |
void CBrowserSettingsView::HandleCommandL( TInt aCommandId )
|
|
131 |
{
|
|
132 |
switch ( aCommandId )
|
|
133 |
{
|
|
134 |
case EWmlCmdSettingsOpen:
|
|
135 |
{
|
|
136 |
UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE);
|
|
137 |
iContainer->DisplayCorrectSettingCategoryListL();
|
|
138 |
break;
|
|
139 |
}
|
|
140 |
case EWmlCmdSettingsChange:
|
|
141 |
{
|
|
142 |
UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE);
|
|
143 |
iContainer->ChangeItemL( ETrue );
|
|
144 |
break;
|
|
145 |
}
|
|
146 |
case EAknSoftkeyBack:
|
|
147 |
{
|
|
148 |
if ( iContainer->SettingsError() )
|
|
149 |
{
|
|
150 |
TBrowserDialogs::ErrorNoteL( R_BROWSER_SETTING_TOOLBAR_SAVE_DIALOG );
|
|
151 |
break;
|
|
152 |
}
|
|
153 |
|
|
154 |
UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_OPEN);
|
|
155 |
|
|
156 |
// Close the settings
|
|
157 |
if ( iContainer->CloseSettingsListL() )
|
|
158 |
{
|
|
159 |
if ( iLastViewId != KNullViewId )
|
|
160 |
{
|
|
161 |
ActivateViewL( iLastViewId );
|
|
162 |
}
|
|
163 |
}
|
|
164 |
break;
|
|
165 |
}
|
|
166 |
case EWmlNoCmd:
|
|
167 |
{
|
|
168 |
// Fake MSK command for settings -- update cba to label MSK as Change
|
|
169 |
UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE);
|
|
170 |
break;
|
|
171 |
}
|
|
172 |
|
|
173 |
case EWmlCmdUserExit:
|
|
174 |
{
|
|
175 |
if ( iContainer->SettingsError() )
|
|
176 |
{
|
|
177 |
TBrowserDialogs::ErrorNoteL( R_BROWSER_SETTING_TOOLBAR_SAVE_DIALOG );
|
|
178 |
break;
|
|
179 |
}
|
|
180 |
|
|
181 |
// Save the settings
|
|
182 |
iContainer->SaveChangesL();
|
|
183 |
}
|
|
184 |
// intentional fall through to default case below.
|
|
185 |
|
|
186 |
default:
|
|
187 |
{
|
|
188 |
AppUi()->HandleCommandL( aCommandId );
|
|
189 |
break;
|
|
190 |
}
|
|
191 |
}
|
|
192 |
}
|
|
193 |
|
|
194 |
// ---------------------------------------------------------
|
|
195 |
// CBrowserSettingsView::Id
|
|
196 |
// ---------------------------------------------------------
|
|
197 |
//
|
|
198 |
TUid CBrowserSettingsView::Id() const
|
|
199 |
{
|
|
200 |
return KUidBrowserSettingsViewId;
|
|
201 |
}
|
|
202 |
|
|
203 |
// ---------------------------------------------------------
|
|
204 |
// CBrowserSettingsView::DoActivateL
|
|
205 |
// ---------------------------------------------------------
|
|
206 |
//
|
|
207 |
void CBrowserSettingsView::DoActivateL( const TVwsViewId& aPrevViewId,
|
|
208 |
TUid aCustomMessageId,
|
|
209 |
const TDesC8& /*aCustomMessage*/ )
|
|
210 |
{
|
|
211 |
StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL );
|
|
212 |
StatusPane()->MakeVisible( ETrue );
|
|
213 |
|
|
214 |
if (aPrevViewId.iAppUid == AppUi()->Application()->AppDllUid())
|
|
215 |
{ // store this only if our own...
|
|
216 |
iLastViewId = aPrevViewId;
|
|
217 |
}
|
|
218 |
else
|
|
219 |
{
|
|
220 |
iLastViewId = TVwsViewId(AppUi()->Application()->AppDllUid(), ApiProvider().LastActiveViewId());
|
|
221 |
}
|
|
222 |
|
|
223 |
ApiProvider().SetLastActiveViewId( Id() );
|
|
224 |
|
|
225 |
// restoring container
|
|
226 |
iContainer = CSettingsContainer::NewL
|
|
227 |
( ClientRect(), ApiProvider(), *this );
|
|
228 |
|
|
229 |
|
|
230 |
AppUi()->AddToViewStackL( *this, iContainer );
|
|
231 |
ApiProvider().CommsModel().AddObserverL( *this );
|
|
232 |
|
|
233 |
if (iContainer && ( aCustomMessageId == KUidSettingsGotoToolbarGroup ) )
|
|
234 |
{
|
|
235 |
iContainer->DisplayToolbarSettingsL();
|
|
236 |
UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE);
|
|
237 |
}
|
|
238 |
else if (iContainer && ( aCustomMessageId == KUidSettingsGotoShortcutsGroup ) )
|
|
239 |
{
|
|
240 |
iContainer->DisplayShortcutsSettingsL();
|
|
241 |
UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE);
|
|
242 |
}
|
|
243 |
else if (iContainer)
|
|
244 |
{
|
|
245 |
UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_OPEN);
|
|
246 |
}
|
|
247 |
}
|
|
248 |
|
|
249 |
// ---------------------------------------------------------
|
|
250 |
// CBrowserSettingsView::DoDeactivate
|
|
251 |
// ---------------------------------------------------------
|
|
252 |
//
|
|
253 |
void CBrowserSettingsView::DoDeactivate()
|
|
254 |
{
|
|
255 |
if ( !ApiProvider().ExitInProgress() )
|
|
256 |
{
|
|
257 |
ApiProvider().CommsModel().RemoveObserver( *this );
|
|
258 |
}
|
|
259 |
// removing container
|
|
260 |
AppUi()->RemoveFromViewStack( *this, iContainer );
|
|
261 |
delete iContainer;
|
|
262 |
iContainer = NULL;
|
|
263 |
}
|
|
264 |
|
|
265 |
// ---------------------------------------------------------
|
|
266 |
// CBrowserSettingsView::HandleClientRectChange
|
|
267 |
// ---------------------------------------------------------
|
|
268 |
//
|
|
269 |
void CBrowserSettingsView::HandleClientRectChange()
|
|
270 |
{
|
|
271 |
if( iContainer )
|
|
272 |
{
|
|
273 |
iContainer->SetRect( ClientRect() );
|
|
274 |
}
|
|
275 |
}
|
|
276 |
|
|
277 |
// ---------------------------------------------------------
|
|
278 |
// CBrowserSettingsView::HandleForegroundEventL
|
|
279 |
// ---------------------------------------------------------
|
|
280 |
//
|
|
281 |
void CBrowserSettingsView::HandleForegroundEventL (TBool aForeground)
|
|
282 |
{
|
|
283 |
if(aForeground)
|
|
284 |
{
|
|
285 |
iContainer->HandleGainingForegroundL();
|
|
286 |
}
|
|
287 |
}
|
|
288 |
|
|
289 |
// ---------------------------------------------------------------------------
|
|
290 |
// CBrowserSettingsView::DynInitMenuPaneL
|
|
291 |
// ---------------------------------------------------------------------------
|
|
292 |
void CBrowserSettingsView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
|
|
293 |
{
|
|
294 |
#ifndef BRDO_SINGLE_CLICK_ENABLED_FF
|
|
295 |
if ( aResourceId == R_BROWSER_SETTINGS_SETTINGS_MENU )
|
|
296 |
{
|
|
297 |
// Show the appropriate menu items, depending on whether
|
|
298 |
// we are in the main setting list, or sub category e.g. Page
|
|
299 |
if ( iContainer->IsSettingModifiable() )
|
|
300 |
{
|
|
301 |
aMenuPane->SetItemDimmed( EWmlCmdSettingsOpen, ETrue );
|
|
302 |
}
|
|
303 |
else
|
|
304 |
{
|
|
305 |
aMenuPane->SetItemDimmed( EWmlCmdSettingsChange, ETrue );
|
|
306 |
}
|
|
307 |
|
|
308 |
}
|
|
309 |
#endif
|
|
310 |
}
|
|
311 |
|
|
312 |
// ---------------------------------------------------------------------------
|
|
313 |
// CBrowserSettingsView::UpdateCba()
|
|
314 |
// ---------------------------------------------------------------------------
|
|
315 |
void CBrowserSettingsView::UpdateCbaL(TInt aCommandSet)
|
|
316 |
{
|
|
317 |
if (Cba())
|
|
318 |
{
|
|
319 |
Cba()->SetCommandSetL(aCommandSet);
|
|
320 |
Cba()->DrawDeferred();
|
|
321 |
}
|
|
322 |
}
|
|
323 |
// End of File
|