20
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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:
|
|
15 |
* Implementation of CCbsUiSettingsViewContainer.
|
|
16 |
*
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <bldvariant.hrh> // For feature flags
|
|
23 |
#include <featmgr.h> // FeatureManager
|
|
24 |
#include <aknnotewrappers.h> // CAknErrorNote
|
|
25 |
#include <e32def.h>
|
|
26 |
#include <aknlists.h>
|
|
27 |
#include <akncheckboxsettingpage.h>
|
|
28 |
#include <cbsuiApp.rsg>
|
|
29 |
#include <barsread.h>
|
|
30 |
#include <centralrepository.h> // CRepository
|
|
31 |
#include <CoreApplicationUIsSDKCRKeys.h> // KCRUidCoreApplicationUIs, TCoreAppUIsNetworkConnectionAllowed
|
|
32 |
#include "CbsUiId.h"
|
|
33 |
#include <csxhelp/mce.hlp.hrh>
|
|
34 |
#include <AknDef.h> // KEikDynamicLayoutVariantSwitch
|
|
35 |
#include "MCbs.h"
|
|
36 |
#include "ccbsuisettingsviewcontainer.h"
|
|
37 |
#include "CCbsUiSettingsView.h"
|
|
38 |
#include "CbsUiConstants.h"
|
|
39 |
#include "CCbsUiLanguageSettingPage.h"
|
|
40 |
#include "CbsUiPanic.h"
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
// CONSTANTS
|
|
45 |
|
|
46 |
// exact number of items in selection list
|
|
47 |
const TInt KNumberOfItemsInSelectionPage = 3;
|
|
48 |
|
|
49 |
// There should be only one item in the list box before, which
|
|
50 |
// is reception.
|
|
51 |
const TInt KPreciseNumberOfItemsBeforeLanguage = 1;
|
|
52 |
const TInt KNumberOfOnOfItems = 2;
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
// MODULE DATA STRUCTURES
|
|
58 |
enum TCbsUiSettingValues { EReception, ELanguage, ETopicDetection };
|
|
59 |
|
|
60 |
// to select right item in setting_items_with_two_available_values
|
|
61 |
enum TCbsUiSettingOnOff
|
|
62 |
{
|
|
63 |
ESettingOn = 0,
|
|
64 |
ESettingOff
|
|
65 |
};
|
|
66 |
|
|
67 |
// ================= MEMBER FUNCTIONS =======================
|
|
68 |
|
|
69 |
// C++ default constructor can NOT contain any code, that
|
|
70 |
// might leave.
|
|
71 |
//
|
|
72 |
CCbsUiSettingsViewContainer::CCbsUiSettingsViewContainer(
|
|
73 |
CCbsUiSettingsView& aView,
|
|
74 |
MCbs& aServer )
|
|
75 |
: iView( aView ), iServer( aServer )
|
|
76 |
{
|
|
77 |
}
|
|
78 |
|
|
79 |
// Symbian OS default constructor can leave.
|
|
80 |
void CCbsUiSettingsViewContainer::ConstructL( const TRect& aRect )
|
|
81 |
{
|
|
82 |
CreateWindowL();
|
|
83 |
SetMopParent(&iView);
|
|
84 |
CreateListBoxL();
|
|
85 |
SetRect( aRect );
|
|
86 |
|
|
87 |
// Prepare FeatureManager, read values to members and uninitialize FeatureManager
|
|
88 |
FeatureManager::InitializeLibL();
|
|
89 |
iOfflineFeatureSupported = FeatureManager::FeatureSupported( KFeatureIdOfflineMode );
|
|
90 |
}
|
|
91 |
|
|
92 |
// Two-phased constructor.
|
|
93 |
CCbsUiSettingsViewContainer* CCbsUiSettingsViewContainer::NewL(
|
|
94 |
CCbsUiSettingsView& aView,
|
|
95 |
const TRect& aRect,
|
|
96 |
MCbs& aServer )
|
|
97 |
{
|
|
98 |
CCbsUiSettingsViewContainer* self =
|
|
99 |
new (ELeave) CCbsUiSettingsViewContainer(aView, aServer);
|
|
100 |
|
|
101 |
CleanupStack::PushL(self);
|
|
102 |
self->ConstructL(aRect);
|
|
103 |
CleanupStack::Pop();
|
|
104 |
|
|
105 |
return self;
|
|
106 |
}
|
|
107 |
|
|
108 |
// Destructor
|
|
109 |
CCbsUiSettingsViewContainer::~CCbsUiSettingsViewContainer()
|
|
110 |
{
|
|
111 |
delete iListBox;
|
|
112 |
FeatureManager::UnInitializeLib();
|
|
113 |
}
|
|
114 |
|
|
115 |
// ---------------------------------------------------------
|
|
116 |
// CCbsUiSettingsViewContainer::CountComponentControls
|
|
117 |
//
|
|
118 |
//
|
|
119 |
// ---------------------------------------------------------
|
|
120 |
//
|
|
121 |
TInt CCbsUiSettingsViewContainer::CountComponentControls() const
|
|
122 |
{
|
|
123 |
return 1;
|
|
124 |
}
|
|
125 |
|
|
126 |
// ---------------------------------------------------------
|
|
127 |
// CCbsUiSettingsViewContainer::ComponentControl
|
|
128 |
//
|
|
129 |
//
|
|
130 |
// ---------------------------------------------------------
|
|
131 |
//
|
|
132 |
CCoeControl* CCbsUiSettingsViewContainer::ComponentControl( TInt aIndex ) const
|
|
133 |
{
|
|
134 |
CCoeControl* control = NULL;
|
|
135 |
|
|
136 |
switch ( aIndex )
|
|
137 |
{
|
|
138 |
case 0:
|
|
139 |
control = iListBox;
|
|
140 |
break;
|
|
141 |
default:
|
|
142 |
break;
|
|
143 |
}
|
|
144 |
|
|
145 |
return control;
|
|
146 |
}
|
|
147 |
|
|
148 |
// ---------------------------------------------------------
|
|
149 |
// CCbsUiSettingsViewContainer::OfferKeyEventL
|
|
150 |
//
|
|
151 |
//
|
|
152 |
// ---------------------------------------------------------
|
|
153 |
//
|
|
154 |
TKeyResponse CCbsUiSettingsViewContainer::OfferKeyEventL(
|
|
155 |
const TKeyEvent& aKeyEvent,
|
|
156 |
TEventCode aType )
|
|
157 |
{
|
|
158 |
return iListBox->OfferKeyEventL( aKeyEvent, aType );
|
|
159 |
}
|
|
160 |
|
|
161 |
// ---------------------------------------------------------
|
|
162 |
// CCbsUiSettingsViewContainer::SizeChanged
|
|
163 |
//
|
|
164 |
//
|
|
165 |
// ---------------------------------------------------------
|
|
166 |
//
|
|
167 |
void CCbsUiSettingsViewContainer::SizeChanged()
|
|
168 |
{
|
|
169 |
iListBox->SetRect( Rect() );
|
|
170 |
}
|
|
171 |
|
|
172 |
|
|
173 |
// ---------------------------------------------------------
|
|
174 |
// CCbsUiSettingsViewContainer::FocusChanged
|
|
175 |
// ---------------------------------------------------------
|
|
176 |
//
|
|
177 |
void CCbsUiSettingsViewContainer::FocusChanged( TDrawNow aDrawNow )
|
|
178 |
{
|
|
179 |
CCoeControl::FocusChanged( aDrawNow );
|
|
180 |
if( iListBox )
|
|
181 |
{
|
|
182 |
iListBox->SetFocus( IsFocused(), aDrawNow );
|
|
183 |
}
|
|
184 |
}
|
|
185 |
|
|
186 |
|
|
187 |
// ---------------------------------------------------------
|
|
188 |
// CCbsUiSettingsViewContainer::CreateListBoxL
|
|
189 |
//
|
|
190 |
//
|
|
191 |
// ---------------------------------------------------------
|
|
192 |
//
|
|
193 |
void CCbsUiSettingsViewContainer::CreateListBoxL()
|
|
194 |
{
|
|
195 |
iListBox = new (ELeave) CAknSettingStyleListBox;
|
|
196 |
iListBox->SetContainerWindowL( *this );
|
|
197 |
iListBox->ConstructL( this, EAknListBoxSelectionListWithShortcuts );
|
|
198 |
iListBox->SetListBoxObserver( this );
|
|
199 |
iListBox->CreateScrollBarFrameL( ETrue );
|
|
200 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
|
|
201 |
CEikScrollBarFrame::EAuto );
|
|
202 |
GetSettingsL();
|
|
203 |
}
|
|
204 |
|
|
205 |
|
|
206 |
// ---------------------------------------------------------
|
|
207 |
// CCbsUiSettingsViewContainer::GetSettingsL
|
|
208 |
//
|
|
209 |
//
|
|
210 |
// ---------------------------------------------------------
|
|
211 |
//
|
|
212 |
void CCbsUiSettingsViewContainer::GetSettingsL()
|
|
213 |
{
|
|
214 |
__ASSERT_DEBUG( iListBox, CbsUiPanic(EListBoxNullError) );
|
|
215 |
|
|
216 |
MDesCArray* itemList =
|
|
217 |
STATIC_CAST(CEikFormattedCellListBox*,
|
|
218 |
iListBox)->Model()->ItemTextArray();
|
|
219 |
|
|
220 |
CDesCArray* itemArray = STATIC_CAST(CDesCArray*, itemList);
|
|
221 |
|
|
222 |
itemArray->Reset();
|
|
223 |
|
|
224 |
TBool status;
|
|
225 |
iServer.GetReceptionStatus(status);
|
|
226 |
|
|
227 |
TInt resourceId(R_TEXT_RECEPTION_ON);
|
|
228 |
|
|
229 |
if ( !status )
|
|
230 |
{
|
|
231 |
resourceId = R_TEXT_RECEPTION_OFF;
|
|
232 |
}
|
|
233 |
|
|
234 |
HBufC* reception = iCoeEnv->AllocReadResourceLC(resourceId);
|
|
235 |
itemArray->AppendL(*reception);
|
|
236 |
CleanupStack::PopAndDestroy(); // reception
|
|
237 |
|
|
238 |
// This must be here, don't move; otherwise order
|
|
239 |
// is different in the list box.
|
|
240 |
SetLanguageSelectionL(*itemArray);
|
|
241 |
|
|
242 |
iServer.GetTopicDetectionStatus(status);
|
|
243 |
resourceId = R_TEXT_DETECTION_ON;
|
|
244 |
|
|
245 |
if ( !status )
|
|
246 |
{
|
|
247 |
resourceId = R_TEXT_DETECTION_OFF;
|
|
248 |
}
|
|
249 |
|
|
250 |
HBufC* detection = iCoeEnv->AllocReadResourceLC(resourceId);
|
|
251 |
|
|
252 |
itemArray->AppendL(*detection);
|
|
253 |
CleanupStack::PopAndDestroy(); // detection
|
|
254 |
|
|
255 |
iListBox->HandleItemAdditionL();
|
|
256 |
|
|
257 |
}
|
|
258 |
|
|
259 |
|
|
260 |
// ---------------------------------------------------------
|
|
261 |
// CCbsUiSettingsViewContainer::PrepareLanguageSettingPageL
|
|
262 |
//
|
|
263 |
//
|
|
264 |
// ---------------------------------------------------------
|
|
265 |
//
|
|
266 |
void CCbsUiSettingsViewContainer::PrepareLanguageSettingPageL()
|
|
267 |
{
|
|
268 |
|
|
269 |
CDesCArrayFlat* items =
|
|
270 |
new (ELeave) CDesCArrayFlat(KNumberOfItemsInSelectionPage);
|
|
271 |
CleanupStack::PushL(items);
|
|
272 |
|
|
273 |
AddItemsToListL(
|
|
274 |
R_CBS_LANGUAGE_SETTING_PAGE_ARRAY, *items);
|
|
275 |
|
|
276 |
TInt selected( GetSelected() );
|
|
277 |
|
|
278 |
LaunchLanguageSettingPageL(*items, selected);
|
|
279 |
|
|
280 |
CleanupStack::PopAndDestroy(); // items
|
|
281 |
|
|
282 |
}
|
|
283 |
|
|
284 |
// ---------------------------------------------------------
|
|
285 |
// CCbsUiSettingsViewContainer::GetSelected
|
|
286 |
//
|
|
287 |
//
|
|
288 |
// ---------------------------------------------------------
|
|
289 |
//
|
|
290 |
TCbsUiLanguageSelectionIndex CCbsUiSettingsViewContainer::GetSelected()
|
|
291 |
{
|
|
292 |
TCbsDbLanguages dbLanguages;
|
|
293 |
iServer.GetLanguages(dbLanguages);
|
|
294 |
|
|
295 |
TCbsUiLanguageSelectionIndex result(ECbsUiSelected);
|
|
296 |
|
|
297 |
if ( dbLanguages.iLanguages[ECbsAll] )
|
|
298 |
{
|
|
299 |
result = ECbsUiAll;
|
|
300 |
}
|
|
301 |
else if ( dbLanguages.iLanguages[ECbsOther] )
|
|
302 |
{
|
|
303 |
result = ECbsUiOther;
|
|
304 |
}
|
|
305 |
else
|
|
306 |
{
|
|
307 |
result = ECbsUiSelected;
|
|
308 |
}
|
|
309 |
|
|
310 |
return result;
|
|
311 |
}
|
|
312 |
|
|
313 |
// ---------------------------------------------------------
|
|
314 |
// CCbsUiSettingsViewContainer::LaunchLanguageSettingPageL
|
|
315 |
//
|
|
316 |
//
|
|
317 |
// ---------------------------------------------------------
|
|
318 |
//
|
|
319 |
void CCbsUiSettingsViewContainer::LaunchLanguageSettingPageL(
|
|
320 |
CDesCArrayFlat& aItems, TInt& aCurrentSelectionIndex )
|
|
321 |
{
|
|
322 |
__ASSERT_DEBUG(
|
|
323 |
aCurrentSelectionIndex >= ECbsUiAll &&
|
|
324 |
aCurrentSelectionIndex <= ECbsUiOther,
|
|
325 |
CbsUiPanic(EErrIndexOutOfBounds) );
|
|
326 |
__ASSERT_DEBUG( aItems.Count() == 3, CbsUiPanic(EErrInvalidValue) );
|
|
327 |
|
|
328 |
CCbsUiLanguageSettingPage* languagePage =
|
|
329 |
new (ELeave) CCbsUiLanguageSettingPage(
|
|
330 |
R_LANGUAGE_SETTING_PAGE, aCurrentSelectionIndex,
|
|
331 |
&aItems, iServer);
|
|
332 |
|
|
333 |
languagePage->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
|
|
334 |
}
|
|
335 |
|
|
336 |
// ---------------------------------------------------------
|
|
337 |
// CCbsUiSettingsViewContainer::AddItemsToListL
|
|
338 |
//
|
|
339 |
//
|
|
340 |
// ---------------------------------------------------------
|
|
341 |
//
|
|
342 |
void CCbsUiSettingsViewContainer::AddItemsToListL(
|
|
343 |
TInt aResourceId,
|
|
344 |
CDesCArrayFlat& aItemList ) const
|
|
345 |
{
|
|
346 |
__ASSERT_DEBUG(aResourceId >= 0, CbsUiPanic(EErrInvalidValue) );
|
|
347 |
__ASSERT_DEBUG( aItemList.MdcaCount() == 0, CbsUiPanic(EErrInvalidValue) );
|
|
348 |
|
|
349 |
TResourceReader reader;
|
|
350 |
iCoeEnv->CreateResourceReaderLC(reader, aResourceId);
|
|
351 |
TInt count( reader.ReadInt16() );
|
|
352 |
|
|
353 |
for ( TInt i(0); i < count; i++ )
|
|
354 |
{
|
|
355 |
HBufC* selectableItem = reader.ReadHBufCL();
|
|
356 |
|
|
357 |
CleanupStack::PushL(selectableItem);
|
|
358 |
aItemList.AppendL(*selectableItem);
|
|
359 |
CleanupStack::PopAndDestroy(); // selectableItem
|
|
360 |
}
|
|
361 |
|
|
362 |
CleanupStack::PopAndDestroy(); // reader
|
|
363 |
}
|
|
364 |
|
|
365 |
|
|
366 |
// ---------------------------------------------------------
|
|
367 |
// CCbsUiSettingsViewContainer::HandleListViewActionL
|
|
368 |
//
|
|
369 |
//
|
|
370 |
// ---------------------------------------------------------
|
|
371 |
//
|
|
372 |
TKeyResponse CCbsUiSettingsViewContainer::HandleListViewActionL(
|
|
373 |
const CEikListBox* aListBox, TBool aLaunchedFromOptionMenu )
|
|
374 |
{
|
|
375 |
__ASSERT_DEBUG( aListBox, CbsUiPanic(EErrNullPointer) );
|
|
376 |
|
|
377 |
switch ( aListBox->CurrentItemIndex() )
|
|
378 |
{
|
|
379 |
case EReception:
|
|
380 |
{
|
|
381 |
if ( IsPhoneOfflineL() )
|
|
382 |
{
|
|
383 |
// If is in offline mode, don't set reception on or off(Only error note)
|
|
384 |
HBufC* text = iCoeEnv->AllocReadResourceLC( R_QTN_OFFLINE_NOT_POSSIBLE );
|
|
385 |
CAknErrorNote* note = new (ELeave) CAknErrorNote( ETrue );
|
|
386 |
note->ExecuteLD( *text );
|
|
387 |
CleanupStack::PopAndDestroy( ); //text
|
|
388 |
}
|
|
389 |
else
|
|
390 |
{
|
|
391 |
TBool reception;
|
|
392 |
TBool update(ETrue); // if value need to be updated
|
|
393 |
iServer.GetReceptionStatus(reception);
|
|
394 |
if ( aLaunchedFromOptionMenu )
|
|
395 |
{
|
|
396 |
LaunchDialogOnOffL(reception, update, R_TEXT_RECEPTION);
|
|
397 |
}
|
|
398 |
if ( update )
|
|
399 |
{
|
|
400 |
if ( !reception )
|
|
401 |
{
|
|
402 |
// Reception is off. -> Set reception On
|
|
403 |
User::LeaveIfError( iServer.SetReceptionStatus( ETrue ) );
|
|
404 |
}
|
|
405 |
else
|
|
406 |
{
|
|
407 |
// Reception is On. -> Set reception Off
|
|
408 |
User::LeaveIfError( iServer.SetReceptionStatus( EFalse ) );
|
|
409 |
}
|
|
410 |
}
|
|
411 |
}
|
|
412 |
break;
|
|
413 |
}
|
|
414 |
case ELanguage:
|
|
415 |
{
|
|
416 |
PrepareLanguageSettingPageL();
|
|
417 |
break;
|
|
418 |
}
|
|
419 |
case ETopicDetection:
|
|
420 |
{
|
|
421 |
TBool detection;
|
|
422 |
TBool update(ETrue);
|
|
423 |
|
|
424 |
iServer.GetTopicDetectionStatus(detection);
|
|
425 |
|
|
426 |
if ( aLaunchedFromOptionMenu )
|
|
427 |
{
|
|
428 |
LaunchTopicDetectionDialogOnOffL(detection, update, R_TEXT_TOPIC_DETECTION);
|
|
429 |
}
|
|
430 |
|
|
431 |
if ( update )
|
|
432 |
{
|
|
433 |
User::LeaveIfError( iServer.SetTopicDetectionStatus(!detection) );
|
|
434 |
}
|
|
435 |
break;
|
|
436 |
}
|
|
437 |
default:
|
|
438 |
break;
|
|
439 |
}
|
|
440 |
|
|
441 |
GetSettingsL();
|
|
442 |
|
|
443 |
return EKeyWasConsumed;
|
|
444 |
}
|
|
445 |
|
|
446 |
// ---------------------------------------------------------
|
|
447 |
// CCbsUiSettingsViewContainer::LaunchDialogOnOffL
|
|
448 |
//
|
|
449 |
//
|
|
450 |
// ---------------------------------------------------------
|
|
451 |
//
|
|
452 |
void CCbsUiSettingsViewContainer::LaunchDialogOnOffL(
|
|
453 |
const TBool& aValue, TBool& aUpdate, TInt aResourceId ) const
|
|
454 |
{
|
|
455 |
TInt selected( aValue ? ESettingOn : ESettingOff );
|
|
456 |
|
|
457 |
CDesCArrayFlat* items =
|
|
458 |
new (ELeave) CDesCArrayFlat(KNumberOfOnOfItems);
|
|
459 |
CleanupStack::PushL(items);
|
|
460 |
|
|
461 |
AddItemsToListL(R_CBS_ON_OFF_ARRAY, *items);
|
|
462 |
|
|
463 |
HBufC* settingText = iCoeEnv->AllocReadResourceL(aResourceId);
|
|
464 |
CleanupStack::PushL(settingText);
|
|
465 |
|
|
466 |
CAknRadioButtonSettingPage* dlg =
|
|
467 |
new (ELeave) CAknRadioButtonSettingPage(
|
|
468 |
R_ON_OFF_SETTING_PAGE, selected, items);
|
|
469 |
|
|
470 |
CleanupStack::PushL(dlg);
|
|
471 |
dlg->SetSettingTextL(*settingText);
|
|
472 |
CleanupStack::Pop(); // dlg
|
|
473 |
|
|
474 |
dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
|
|
475 |
|
|
476 |
CleanupStack::PopAndDestroy(); // settingText
|
|
477 |
|
|
478 |
TBool valueNotChanged(
|
|
479 |
selected == (aValue ? ESettingOn : ESettingOff) );
|
|
480 |
if ( valueNotChanged )
|
|
481 |
{
|
|
482 |
aUpdate = EFalse;
|
|
483 |
}
|
|
484 |
|
|
485 |
CleanupStack::PopAndDestroy(); // items
|
|
486 |
}
|
|
487 |
|
|
488 |
|
|
489 |
// ---------------------------------------------------------
|
|
490 |
// CCbsUiSettingsViewContainer::LaunchTopicDetectionDialogOnOffL
|
|
491 |
//
|
|
492 |
//
|
|
493 |
// ---------------------------------------------------------
|
|
494 |
//
|
|
495 |
void CCbsUiSettingsViewContainer::LaunchTopicDetectionDialogOnOffL(
|
|
496 |
const TBool& aValue, TBool& aUpdate, TInt aResourceId ) const
|
|
497 |
{
|
|
498 |
TInt selected( aValue ? ESettingOn : ESettingOff );
|
|
499 |
|
|
500 |
CDesCArrayFlat* items =
|
|
501 |
new (ELeave) CDesCArrayFlat(KNumberOfOnOfItems);
|
|
502 |
CleanupStack::PushL(items);
|
|
503 |
|
|
504 |
AddItemsToListL(R_CBS_TOPIC_DETECTION_ON_OFF_ARRAY, *items);
|
|
505 |
|
|
506 |
HBufC* settingText = iCoeEnv->AllocReadResourceL(aResourceId);
|
|
507 |
CleanupStack::PushL(settingText);
|
|
508 |
|
|
509 |
CAknRadioButtonSettingPage* dlg =
|
|
510 |
new (ELeave) CAknRadioButtonSettingPage(
|
|
511 |
R_ON_OFF_SETTING_PAGE, selected, items);
|
|
512 |
|
|
513 |
CleanupStack::PushL(dlg);
|
|
514 |
dlg->SetSettingTextL(*settingText);
|
|
515 |
CleanupStack::Pop(); // dlg
|
|
516 |
|
|
517 |
dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
|
|
518 |
|
|
519 |
CleanupStack::PopAndDestroy(); // settingText
|
|
520 |
|
|
521 |
TBool valueNotChanged(
|
|
522 |
selected == (aValue ? ESettingOn : ESettingOff) );
|
|
523 |
if ( valueNotChanged )
|
|
524 |
{
|
|
525 |
aUpdate = EFalse;
|
|
526 |
}
|
|
527 |
|
|
528 |
CleanupStack::PopAndDestroy(); // items
|
|
529 |
}
|
|
530 |
|
|
531 |
// ---------------------------------------------------------
|
|
532 |
// CCbsUiSettingsViewContainer::HandleListViewActiontL
|
|
533 |
//
|
|
534 |
//
|
|
535 |
// ---------------------------------------------------------
|
|
536 |
//
|
|
537 |
TKeyResponse CCbsUiSettingsViewContainer::HandleListViewActionL(
|
|
538 |
TBool aLaunchedFromOptionMenu )
|
|
539 |
{
|
|
540 |
if ( iListBox )
|
|
541 |
{
|
|
542 |
return HandleListViewActionL(iListBox, aLaunchedFromOptionMenu);
|
|
543 |
}
|
|
544 |
return EKeyWasNotConsumed;
|
|
545 |
}
|
|
546 |
|
|
547 |
// ---------------------------------------------------------
|
|
548 |
// CCbsUiSettingsViewContainer::UpdateSettingsL
|
|
549 |
//
|
|
550 |
//
|
|
551 |
// ---------------------------------------------------------
|
|
552 |
//
|
|
553 |
void CCbsUiSettingsViewContainer::UpdateSettingsL()
|
|
554 |
{
|
|
555 |
GetSettingsL();
|
|
556 |
}
|
|
557 |
|
|
558 |
// ---------------------------------------------------------
|
|
559 |
// CCbsUiSettingsViewContainer::SetFocusToFirstItem
|
|
560 |
//
|
|
561 |
//
|
|
562 |
// ---------------------------------------------------------
|
|
563 |
//
|
|
564 |
void CCbsUiSettingsViewContainer::SetFocusToFirstItem() const
|
|
565 |
{
|
|
566 |
__ASSERT_DEBUG( iListBox, CbsUiPanic(EErrNullPointer) );
|
|
567 |
iListBox->SetCurrentItemIndexAndDraw(0);
|
|
568 |
}
|
|
569 |
|
|
570 |
// ---------------------------------------------------------
|
|
571 |
// CCbsUiSettingsViewContainer::HandleListBoxEventL
|
|
572 |
//
|
|
573 |
//
|
|
574 |
// ---------------------------------------------------------
|
|
575 |
//
|
|
576 |
void CCbsUiSettingsViewContainer::HandleListBoxEventL(
|
|
577 |
CEikListBox* aListBox,
|
|
578 |
TListBoxEvent aEventType )
|
|
579 |
{
|
|
580 |
if ( EEventEnterKeyPressed == aEventType
|
|
581 |
|| EEventItemSingleClicked == aEventType )
|
|
582 |
{
|
|
583 |
HandleListViewActionL(aListBox, EFalse);
|
|
584 |
}
|
|
585 |
}
|
|
586 |
|
|
587 |
|
|
588 |
// ---------------------------------------------------------
|
|
589 |
// CCbsUiSettingsViewContainer::SetLanguageSelectionL
|
|
590 |
//
|
|
591 |
//
|
|
592 |
// ---------------------------------------------------------
|
|
593 |
//
|
|
594 |
void CCbsUiSettingsViewContainer::SetLanguageSelectionL(
|
|
595 |
CDesCArray& aItemArray )
|
|
596 |
{
|
|
597 |
TInt count( aItemArray.MdcaCount() );
|
|
598 |
|
|
599 |
__ASSERT_ALWAYS( count == KPreciseNumberOfItemsBeforeLanguage,
|
|
600 |
CbsUiPanic(EErrIndexOutOfBounds) );
|
|
601 |
|
|
602 |
if ( count == KPreciseNumberOfItemsBeforeLanguage )
|
|
603 |
{
|
|
604 |
TInt textId(R_TEXT_LANGUAGE_ALL);
|
|
605 |
|
|
606 |
switch ( GetSelected() )
|
|
607 |
{
|
|
608 |
case ECbsUiAll:
|
|
609 |
// do nothing
|
|
610 |
break;
|
|
611 |
case ECbsUiSelected:
|
|
612 |
textId = R_TEXT_LANGUAGE_SELECTED;
|
|
613 |
break;
|
|
614 |
case ECbsUiOther:
|
|
615 |
textId = R_TEXT_LANGUAGE_OTHER;
|
|
616 |
break;
|
|
617 |
default:
|
|
618 |
break;
|
|
619 |
}
|
|
620 |
|
|
621 |
HBufC* language = iCoeEnv->AllocReadResourceLC(textId);
|
|
622 |
aItemArray.AppendL(*language);
|
|
623 |
|
|
624 |
CleanupStack::PopAndDestroy(); // language
|
|
625 |
}
|
|
626 |
}
|
|
627 |
|
|
628 |
|
|
629 |
// ---------------------------------------------------------
|
|
630 |
// CCbsUiSettingsViewContainer::GetHelpContext
|
|
631 |
//
|
|
632 |
// Gets the control's help context.
|
|
633 |
// ---------------------------------------------------------
|
|
634 |
//
|
|
635 |
void CCbsUiSettingsViewContainer::GetHelpContext(
|
|
636 |
TCoeHelpContext& aContext ) const
|
|
637 |
{
|
|
638 |
aContext.iMajor = TUid::Uid(0x100058C5); // Messaging MCE UID
|
|
639 |
aContext.iContext = KMCE_HLP_SETTINGS_CB;
|
|
640 |
}
|
|
641 |
|
|
642 |
|
|
643 |
// ----------------------------------------------------
|
|
644 |
// CCbsUiSettingsViewContainer::HandleResourceChange
|
|
645 |
//
|
|
646 |
// ----------------------------------------------------
|
|
647 |
void CCbsUiSettingsViewContainer::HandleResourceChange( TInt aType )
|
|
648 |
{
|
|
649 |
CCoeControl::HandleResourceChange( aType );
|
|
650 |
|
|
651 |
if( aType == KEikDynamicLayoutVariantSwitch )
|
|
652 |
{
|
|
653 |
iView.HandleRectChangeInContainer();
|
|
654 |
}
|
|
655 |
}
|
|
656 |
|
|
657 |
|
|
658 |
// ---------------------------------------------------------
|
|
659 |
// CCbsUiSettingsViewContainer::IsPhoneOfflineL
|
|
660 |
//
|
|
661 |
// Checks if phone is in offline mode or not.
|
|
662 |
// Return ETrue if phone is in offline mode.
|
|
663 |
// Return EFalse if phone is not in offline mode.
|
|
664 |
// ---------------------------------------------------------
|
|
665 |
//
|
|
666 |
TBool CCbsUiSettingsViewContainer::IsPhoneOfflineL() const
|
|
667 |
{
|
|
668 |
if ( iOfflineFeatureSupported )
|
|
669 |
{
|
|
670 |
CRepository* repository = CRepository::NewLC( KCRUidCoreApplicationUIs );
|
|
671 |
TInt connAllowed = 1;
|
|
672 |
repository->Get( KCoreAppUIsNetworkConnectionAllowed, connAllowed );
|
|
673 |
CleanupStack::PopAndDestroy(); // repository
|
|
674 |
if ( !connAllowed )
|
|
675 |
{
|
|
676 |
return ETrue;
|
|
677 |
}
|
|
678 |
}
|
|
679 |
return EFalse;
|
|
680 |
}
|
|
681 |
|
|
682 |
|
|
683 |
// End of File
|