56
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-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: General theme view.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
|
|
22 |
// General - services
|
|
23 |
#include <StringLoader.h>
|
|
24 |
#include <AknGlobalNote.h>
|
|
25 |
#include <aknnotewrappers.h>
|
|
26 |
#include <akntitle.h>
|
|
27 |
#include <barsread.h>
|
|
28 |
#include <eikbtgpc.h>
|
|
29 |
#include <eikmenup.h>
|
|
30 |
|
|
31 |
// Feature manager.
|
|
32 |
#include <featmgr.h>
|
|
33 |
#include <features.hrh>
|
|
34 |
|
|
35 |
// Power save mode setting
|
|
36 |
#include <psmsettings.h>
|
|
37 |
|
|
38 |
// Resources
|
|
39 |
#include <psln.rsg>
|
|
40 |
#include <pslncommon.rsg>
|
|
41 |
#include <data_caging_path_literals.hrh>
|
|
42 |
|
|
43 |
// Psln specific.
|
|
44 |
#include "PslnGeneralThemeView.h"
|
|
45 |
#include "PslnConst.h"
|
|
46 |
#include "PslnUi.h"
|
|
47 |
#include "PslnModel.h"
|
|
48 |
#include "PslnFeatures.h"
|
|
49 |
#include "PslnDebug.h"
|
|
50 |
|
|
51 |
|
|
52 |
// Path to common personalization resources. This resource file is meant for
|
|
53 |
// shared resources between application and plugins.
|
|
54 |
_LIT( KPslnCommonResourceFileName, "z:pslncommon.rsc" );
|
|
55 |
|
|
56 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
57 |
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
// C++ constructor can NOT contain any code, that might leave.
|
|
60 |
// -----------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
CPslnGeneralThemeView::CPslnGeneralThemeView()
|
|
63 |
: iResourceLoaderCommon( *iCoeEnv )
|
|
64 |
{
|
|
65 |
}
|
|
66 |
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
// Symbian 2nd phase constructor can leave.
|
|
69 |
// -----------------------------------------------------------------------------
|
|
70 |
//
|
|
71 |
void CPslnGeneralThemeView::ConstructL()
|
|
72 |
{
|
|
73 |
BaseConstructL( R_PSLN_GENERAL_VIEW );
|
|
74 |
|
|
75 |
iNaviPaneContext = iPslnUi->PslnTabGroup();
|
|
76 |
|
|
77 |
// Find the common resource file:
|
|
78 |
TParse* parse = new (ELeave) TParse;
|
|
79 |
CleanupStack::PushL( parse );
|
|
80 |
parse->Set( KPslnCommonResourceFileName, &KDC_APP_RESOURCE_DIR, NULL );
|
|
81 |
TFileName* fileName = new (ELeave) TFileName( parse->FullName() );
|
|
82 |
CleanupStack::PushL( fileName );
|
|
83 |
|
|
84 |
// Open resource file:
|
|
85 |
iResourceLoaderCommon.OpenL( *fileName );
|
|
86 |
|
|
87 |
CleanupStack::PopAndDestroy( 2, parse ); // fileName, parse
|
|
88 |
|
|
89 |
// Normally download item is the first one.
|
|
90 |
iDownloadItemIndex = 0;
|
|
91 |
|
|
92 |
// If enchanted embedded links are not supported, then there shouldn't be
|
|
93 |
// 'Download' item at all.
|
|
94 |
if ( !PslnFeatures::IsEnhancedEmbeddedLinksSupported() )
|
|
95 |
{
|
|
96 |
iDownloadItemIndex = KErrNotFound;
|
|
97 |
}
|
|
98 |
}
|
|
99 |
|
|
100 |
// -----------------------------------------------------------------------------
|
|
101 |
// Two-phased constructor.
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
//
|
|
104 |
CPslnGeneralThemeView* CPslnGeneralThemeView::NewLC()
|
|
105 |
{
|
|
106 |
CPslnGeneralThemeView* self = new (ELeave) CPslnGeneralThemeView();
|
|
107 |
CleanupStack::PushL( self );
|
|
108 |
self->ConstructL();
|
|
109 |
return self;
|
|
110 |
}
|
|
111 |
|
|
112 |
// Destructor
|
|
113 |
CPslnGeneralThemeView::~CPslnGeneralThemeView()
|
|
114 |
{
|
|
115 |
iResourceLoaderCommon.Close();
|
|
116 |
}
|
|
117 |
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
// CPslnGeneralThemeView::Id
|
|
120 |
// -----------------------------------------------------------------------------
|
|
121 |
//
|
|
122 |
TUid CPslnGeneralThemeView::Id() const
|
|
123 |
{
|
|
124 |
return KPslnGeneralView;
|
|
125 |
}
|
|
126 |
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
// CPslnGeneralThemeView::HandleCommandL
|
|
129 |
// -----------------------------------------------------------------------------
|
|
130 |
//
|
|
131 |
void CPslnGeneralThemeView::HandleCommandL( TInt aCommand )
|
|
132 |
{
|
|
133 |
// First set active item and active skin.
|
|
134 |
if ( iContainer )
|
|
135 |
{
|
|
136 |
iCurrentItem = iContainer->CurrentItemIndex();
|
|
137 |
}
|
|
138 |
TInt activeSkinIndex = iCurrentItem;
|
|
139 |
if ( iDownloadItemIndex != KErrNotFound )
|
|
140 |
{
|
|
141 |
activeSkinIndex--;
|
|
142 |
}
|
|
143 |
switch ( aCommand )
|
|
144 |
{
|
|
145 |
case EPslnCmdTransitionEffectsActivate:
|
|
146 |
{
|
|
147 |
TInt PsmMode = 0;
|
|
148 |
CPsmSettings *PsmSettings = CPsmSettings::NewL();
|
|
149 |
PsmSettings->GetCurrentMode( PsmMode );
|
|
150 |
delete PsmSettings;
|
|
151 |
|
|
152 |
if ( PsmMode == EPsmsrvModePowerSave ) // PSM on, setting is protected
|
|
153 |
{
|
|
154 |
HBufC* buf = StringLoader::LoadLC( R_PSLN_QTN_PSM_INFONOTE );
|
|
155 |
CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue );
|
|
156 |
note->ExecuteLD( *buf );
|
|
157 |
CleanupStack::PopAndDestroy( buf );
|
|
158 |
return;
|
|
159 |
}
|
|
160 |
|
|
161 |
TInt error = iModel->SetTransitionEffectsL( EPslnEnableAllEffects );
|
|
162 |
|
|
163 |
if ( error == KErrNoMemory )
|
|
164 |
{
|
|
165 |
HBufC* errorBuf = StringLoader::LoadLC(
|
|
166 |
R_PSLN_NOT_ENOUGH_MEMORY );
|
|
167 |
// Display global note.
|
|
168 |
CAknGlobalNote* errorNote = CAknGlobalNote::NewLC();
|
|
169 |
errorNote->ShowNoteL( EAknGlobalErrorNote, *errorBuf );
|
|
170 |
CleanupStack::PopAndDestroy( 2, errorBuf ); // errorNote also
|
|
171 |
}
|
|
172 |
else
|
|
173 |
{
|
|
174 |
User::LeaveIfError( error );
|
|
175 |
}
|
|
176 |
}
|
|
177 |
break;
|
|
178 |
case EPslnCmdTransitionEffectsDeactivate:
|
|
179 |
iModel->SetTransitionEffectsL( EPslnDisableAllEffects );
|
|
180 |
break;
|
|
181 |
|
|
182 |
case EPslnCmdAnimBackgroundActivate:
|
|
183 |
{
|
|
184 |
TInt PsmMode = 0;
|
|
185 |
CPsmSettings *PsmSettings = CPsmSettings::NewL();
|
|
186 |
PsmSettings->GetCurrentMode( PsmMode );
|
|
187 |
delete PsmSettings;
|
|
188 |
|
|
189 |
if ( PsmMode == EPsmsrvModePowerSave ) // PSM on, setting is protected
|
|
190 |
{
|
|
191 |
HBufC* buf = StringLoader::LoadLC( R_PSLN_QTN_PSM_INFONOTE );
|
|
192 |
CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue );
|
|
193 |
note->ExecuteLD( *buf );
|
|
194 |
CleanupStack::PopAndDestroy( buf );
|
|
195 |
return;
|
|
196 |
}
|
|
197 |
|
|
198 |
TInt error = iModel->SetAnimBackground( EPslnEnableAllEffects );
|
|
199 |
if ( error == KErrNoMemory )
|
|
200 |
{
|
|
201 |
HBufC* errorBuf = StringLoader::LoadLC(
|
|
202 |
R_PSLN_NOT_ENOUGH_MEMORY );
|
|
203 |
|
|
204 |
CAknGlobalNote* errorNote = CAknGlobalNote::NewLC();
|
|
205 |
errorNote->ShowNoteL( EAknGlobalErrorNote, *errorBuf );
|
|
206 |
CleanupStack::PopAndDestroy( 2, errorBuf ); // errorNote also
|
|
207 |
}
|
|
208 |
}
|
|
209 |
break;
|
|
210 |
case EPslnCmdAnimBackgroundDeactivate:
|
|
211 |
iModel->SetAnimBackground( EPslnDisableAllEffects );
|
|
212 |
break;
|
|
213 |
case EPslnCmdEmptyCommand: // Fallthrough
|
|
214 |
case EPslnCmdAppActivate: // Fallthrough
|
|
215 |
{
|
|
216 |
if ( iContainer )
|
|
217 |
{
|
|
218 |
if ( iToBeActivatedSkinIndex != KErrNotFound )
|
|
219 |
{
|
|
220 |
activeSkinIndex = iToBeActivatedSkinIndex;
|
|
221 |
iToBeActivatedSkinIndex = -1;
|
|
222 |
}
|
|
223 |
// Do nothing if active theme is selected.
|
|
224 |
if ( iModel->IsActiveSkinSelected( activeSkinIndex ) )
|
|
225 |
{
|
|
226 |
break;
|
|
227 |
}
|
|
228 |
// Check is the theme corrupted.
|
|
229 |
if ( !iModel->IsValidForActivation( activeSkinIndex ) )
|
|
230 |
{
|
|
231 |
HBufC* errorBuf = StringLoader::LoadLC(
|
|
232 |
R_PSLN_QTN_SKINS_ERROR_CORRUPTED );
|
|
233 |
// Display global note.
|
|
234 |
CAknGlobalNote* errorNote = CAknGlobalNote::NewLC();
|
|
235 |
errorNote->ShowNoteL( EAknGlobalErrorNote, *errorBuf );
|
|
236 |
CleanupStack::PopAndDestroy( 2, errorBuf ); // errorNote also
|
|
237 |
return;
|
|
238 |
}
|
|
239 |
else
|
|
240 |
{
|
|
241 |
iModel->SetCurrentSelectedSkinIndex( activeSkinIndex );
|
|
242 |
}
|
|
243 |
}
|
|
244 |
}
|
|
245 |
case EPslnCmdAppDownload: // Fallthrough
|
|
246 |
default:
|
|
247 |
iPslnUi->HandleCommandL( aCommand );
|
|
248 |
break;
|
|
249 |
}
|
|
250 |
}
|
|
251 |
|
|
252 |
// ---------------------------------------------------------------------------
|
|
253 |
// CPslnGeneralThemeView::UpdateSkinListItemsL()
|
|
254 |
// ---------------------------------------------------------------------------
|
|
255 |
//
|
|
256 |
void CPslnGeneralThemeView::UpdateSkinListItemsL( TInt aCurrentIndex )
|
|
257 |
{
|
|
258 |
PSLN_TRACE_DEBUG("CPslnGeneralThemeView::UpdateSkinListItemsL");
|
|
259 |
if ( iContainer )
|
|
260 |
{
|
|
261 |
if ( aCurrentIndex == KErrNotFound )
|
|
262 |
{
|
|
263 |
aCurrentIndex = iContainer->CurrentItemIndex();
|
|
264 |
}
|
|
265 |
static_cast<CPslnGeneralThemeContainer*>(iContainer)->
|
|
266 |
UpdateSkinListItemsL( aCurrentIndex );
|
|
267 |
}
|
|
268 |
CheckMiddleSoftkeyLabelL();
|
|
269 |
}
|
|
270 |
|
|
271 |
// -----------------------------------------------------------------------------
|
|
272 |
// CPslnGeneralThemeView::DoActivateL
|
|
273 |
// -----------------------------------------------------------------------------
|
|
274 |
//
|
|
275 |
void CPslnGeneralThemeView::DoActivateL(
|
|
276 |
const TVwsViewId& aPrevViewId,
|
|
277 |
TUid aCustomMessageId,
|
|
278 |
const TDesC8& aCustomMessage )
|
|
279 |
{
|
|
280 |
PSLN_TRACE_DEBUG("CPslnGeneralThemeView::DoActivateL");
|
|
281 |
|
|
282 |
CPslnBaseView::DoActivateL(
|
|
283 |
aPrevViewId,
|
|
284 |
aCustomMessageId,
|
|
285 |
aCustomMessage );
|
|
286 |
|
|
287 |
// If view is directly activated (not through main view), update
|
|
288 |
// tab group (and main view's active folder). The static views
|
|
289 |
// have same UID as their tab index.
|
|
290 |
if ( aPrevViewId.iAppUid != KUidPsln )
|
|
291 |
{
|
|
292 |
iPslnUi->UpdateTabIndex(
|
|
293 |
KPslnGeneralView.iUid,
|
|
294 |
KPslnGeneralView.iUid );
|
|
295 |
}
|
|
296 |
|
|
297 |
// Update skin list.
|
|
298 |
// Set active index and update container.
|
|
299 |
TInt currentlySelected = iModel->ActiveSkinIndex();
|
|
300 |
iModel->SetCurrentSelectedSkinIndex( currentlySelected );
|
|
301 |
|
|
302 |
CheckMiddleSoftkeyLabelL();
|
|
303 |
|
|
304 |
iToBeActivatedSkinIndex = -1;
|
|
305 |
}
|
|
306 |
|
|
307 |
// -----------------------------------------------------------------------------
|
|
308 |
// CPslnGeneralThemeView::DoDeactivate
|
|
309 |
// -----------------------------------------------------------------------------
|
|
310 |
//
|
|
311 |
void CPslnGeneralThemeView::DoDeactivate()
|
|
312 |
{
|
|
313 |
PSLN_TRACE_DEBUG("CPslnGeneralThemeView::DoDeactivate");
|
|
314 |
RemoveCommandFromMSK();
|
|
315 |
CPslnBaseView::DoDeactivate();
|
|
316 |
}
|
|
317 |
|
|
318 |
// -----------------------------------------------------------------------------
|
|
319 |
// CPslnGeneralThemeView::DynInitMenuPaneL
|
|
320 |
//
|
|
321 |
// -----------------------------------------------------------------------------
|
|
322 |
//
|
|
323 |
void CPslnGeneralThemeView::DynInitMenuPaneL(
|
|
324 |
TInt aResourceId, CEikMenuPane* aMenuPane )
|
|
325 |
{
|
|
326 |
PSLN_TRACE_DEBUG("CPslnGeneralThemeView::DynInitMenuPaneL");
|
|
327 |
if( aResourceId == R_PSLN_GEN_VIEW_MENUPANE )
|
|
328 |
{
|
|
329 |
if ( iContainer )
|
|
330 |
{
|
|
331 |
if ( iContainer->iListBox->IsHighlightEnabled() )
|
|
332 |
{
|
|
333 |
iCurrentItem = iContainer->CurrentItemIndex();
|
|
334 |
}
|
|
335 |
else
|
|
336 |
{
|
|
337 |
iCurrentItem = iModel->ActiveSkinIndex();
|
|
338 |
if ( iDownloadItemIndex != KErrNotFound )
|
|
339 |
{
|
|
340 |
iCurrentItem++;
|
|
341 |
}
|
|
342 |
}
|
|
343 |
}
|
|
344 |
|
|
345 |
TBool downloadExists = ETrue;
|
|
346 |
// Download theme is not selected, or it is not supported.
|
|
347 |
if ( iDownloadItemIndex == KErrNotFound )
|
|
348 |
{
|
|
349 |
// Download item is not supported.
|
|
350 |
aMenuPane->SetItemDimmed( EPslnCmdAppDownload, ETrue );
|
|
351 |
downloadExists = EFalse;
|
|
352 |
}
|
|
353 |
else if ( iCurrentItem != iDownloadItemIndex )
|
|
354 |
{
|
|
355 |
// Download is supported, but is not selected.
|
|
356 |
aMenuPane->SetItemDimmed( EPslnCmdAppDownload, ETrue );
|
|
357 |
downloadExists = ETrue;
|
|
358 |
}
|
|
359 |
else
|
|
360 |
{
|
|
361 |
aMenuPane->SetItemDimmed( EPslnCmdAppActivate, ETrue );
|
|
362 |
}
|
|
363 |
|
|
364 |
// Update current item index in model.
|
|
365 |
// Possibly reduce by one, since UI might show Download item.
|
|
366 |
TInt skinIndex = iCurrentItem - (TInt) downloadExists;
|
|
367 |
iModel->SetCurrentSelectedSkinIndex( skinIndex );
|
|
368 |
|
|
369 |
if( iModel->IsActiveSkinSelected() ||
|
|
370 |
!iModel->IsValidForActivation( skinIndex ) )
|
|
371 |
{
|
|
372 |
aMenuPane->SetItemDimmed( EPslnCmdAppActivate, ETrue );
|
|
373 |
}
|
|
374 |
}
|
|
375 |
else if ( aResourceId == R_PSLN_TRANSITION_EFFECTS_MENU_PANE )
|
|
376 |
{
|
|
377 |
if ( ( iCurrentItem == iDownloadItemIndex &&
|
|
378 |
iDownloadItemIndex != KErrNotFound ) ||
|
|
379 |
!FeatureManager::FeatureSupported(KFeatureIdUiTransitionEffects) )
|
|
380 |
{
|
|
381 |
// Remove Transition Effects when Download is highlighted.
|
|
382 |
aMenuPane->SetItemDimmed( EPslnCmdTransitionEffectsSubMenuOpen, ETrue );
|
|
383 |
}
|
|
384 |
}
|
|
385 |
else if ( aResourceId == R_PSLN_TRANSITION_EFFECTS_CASCADE_MENU )
|
|
386 |
{
|
|
387 |
// Do nothing with cascade menu values, if Download is highlighted.
|
|
388 |
if ( iCurrentItem != iDownloadItemIndex ||
|
|
389 |
iDownloadItemIndex != KErrNotFound )
|
|
390 |
{
|
|
391 |
TInt transitionEffectsValue = iModel->GetTransitionEffectStateL();
|
|
392 |
// Effects are enabled if value is NOT KMaxTInt.
|
|
393 |
if( transitionEffectsValue != KMaxTInt )
|
|
394 |
{
|
|
395 |
aMenuPane->SetItemButtonState(
|
|
396 |
EPslnCmdTransitionEffectsActivate,
|
|
397 |
EEikMenuItemSymbolOn );
|
|
398 |
aMenuPane->SetItemButtonState(
|
|
399 |
EPslnCmdTransitionEffectsDeactivate,
|
|
400 |
EEikMenuItemSymbolIndeterminate );
|
|
401 |
}
|
|
402 |
else
|
|
403 |
{
|
|
404 |
aMenuPane->SetItemButtonState(
|
|
405 |
EPslnCmdTransitionEffectsActivate,
|
|
406 |
EEikMenuItemSymbolIndeterminate );
|
|
407 |
aMenuPane->SetItemButtonState(
|
|
408 |
EPslnCmdTransitionEffectsDeactivate,
|
|
409 |
EEikMenuItemSymbolOn );
|
|
410 |
}
|
|
411 |
}
|
|
412 |
}
|
|
413 |
else if ( aResourceId == R_PSLN_ANIM_BACKGROUND_MENU_PANE )
|
|
414 |
{
|
|
415 |
TBool downloadExists = ETrue;
|
|
416 |
if ( iDownloadItemIndex == KErrNotFound )
|
|
417 |
{
|
|
418 |
downloadExists = EFalse;
|
|
419 |
}
|
|
420 |
TInt skinIndex = iCurrentItem - (TInt) downloadExists;
|
|
421 |
|
|
422 |
if ( ( iCurrentItem == iDownloadItemIndex &&
|
|
423 |
iDownloadItemIndex != KErrNotFound )||
|
|
424 |
!iModel->IsActiveSkinSelected() ||
|
|
425 |
!PslnFeatures::IsSupported( KPslnSupportAnimBackground ) ||
|
|
426 |
!iModel->IsSupportAnimBg(skinIndex))
|
|
427 |
{
|
|
428 |
aMenuPane->SetItemDimmed( EPslnCmdAnimBackgroundSubMenuOpen, ETrue );
|
|
429 |
}
|
|
430 |
}
|
|
431 |
else if ( aResourceId == R_PSLN_ANIM_BACKGROUND_CASCADE_MENU )
|
|
432 |
{
|
|
433 |
// Do nothing with cascade menu values, if Download is highlighted.
|
|
434 |
if ( iCurrentItem != iDownloadItemIndex ||
|
|
435 |
iDownloadItemIndex != KErrNotFound )
|
|
436 |
{
|
|
437 |
TInt animEffectsValue = iModel->AnimBackgroundState();
|
|
438 |
// Animation background are enabled if value is NOT KMaxTInt.
|
|
439 |
if( animEffectsValue != KMaxTInt )
|
|
440 |
{
|
|
441 |
aMenuPane->SetItemButtonState(
|
|
442 |
EPslnCmdAnimBackgroundActivate,
|
|
443 |
EEikMenuItemSymbolOn );
|
|
444 |
aMenuPane->SetItemButtonState(
|
|
445 |
EPslnCmdAnimBackgroundDeactivate,
|
|
446 |
EEikMenuItemSymbolIndeterminate );
|
|
447 |
}
|
|
448 |
else
|
|
449 |
{
|
|
450 |
aMenuPane->SetItemButtonState(
|
|
451 |
EPslnCmdAnimBackgroundActivate,
|
|
452 |
EEikMenuItemSymbolIndeterminate );
|
|
453 |
aMenuPane->SetItemButtonState(
|
|
454 |
EPslnCmdAnimBackgroundDeactivate,
|
|
455 |
EEikMenuItemSymbolOn );
|
|
456 |
}
|
|
457 |
}
|
|
458 |
}
|
|
459 |
else
|
|
460 |
{
|
|
461 |
PSLN_TRACE_DEBUG("CPslnGeneralThemeView::DynInitMenuPaneL empty else");
|
|
462 |
}
|
|
463 |
CPslnBaseView::DynInitMenuPaneL( aResourceId, aMenuPane );
|
|
464 |
}
|
|
465 |
|
|
466 |
// -----------------------------------------------------------------------------
|
|
467 |
// Handle listbox selection.
|
|
468 |
//
|
|
469 |
// -----------------------------------------------------------------------------
|
|
470 |
//
|
|
471 |
void CPslnGeneralThemeView::HandleListBoxSelectionL()
|
|
472 |
{
|
|
473 |
PSLN_TRACE_DEBUG("CPslnGeneralThemeView::HandleListBoxSelectionL");
|
|
474 |
if ( iContainer )
|
|
475 |
{
|
|
476 |
iCurrentItem = iContainer->CurrentItemIndex();
|
|
477 |
}
|
|
478 |
|
|
479 |
if ( iCurrentItem == iDownloadItemIndex )
|
|
480 |
{
|
|
481 |
HandleCommandL( EPslnCmdAppDownload );
|
|
482 |
}
|
|
483 |
else
|
|
484 |
{
|
|
485 |
HandleCommandL( EPslnCmdAppActivate );
|
|
486 |
}
|
|
487 |
}
|
|
488 |
|
|
489 |
// -----------------------------------------------------------------------------
|
|
490 |
// Create container.
|
|
491 |
//
|
|
492 |
// -----------------------------------------------------------------------------
|
|
493 |
//
|
|
494 |
void CPslnGeneralThemeView::NewContainerL()
|
|
495 |
{
|
|
496 |
iContainer = new(ELeave) CPslnGeneralThemeContainer();
|
|
497 |
iContainer->SetMiddleSoftkeyObserver( this );
|
|
498 |
}
|
|
499 |
|
|
500 |
// -----------------------------------------------------------------------------
|
|
501 |
// Sets view specific title pane text.
|
|
502 |
//
|
|
503 |
// -----------------------------------------------------------------------------
|
|
504 |
//
|
|
505 |
void CPslnGeneralThemeView::SetTitlePaneL( TInt& aResourceId )
|
|
506 |
{
|
|
507 |
aResourceId = R_PSLN_TITLE_PANE_GENERAL;
|
|
508 |
}
|
|
509 |
|
|
510 |
// -----------------------------------------------------------------------------
|
|
511 |
// Checks is there a need to update the middle softkey label.
|
|
512 |
// This method should do nothing but MSK issues, since it is still called
|
|
513 |
// if the framework does not support MSK.
|
|
514 |
// -----------------------------------------------------------------------------
|
|
515 |
//
|
|
516 |
void CPslnGeneralThemeView::CheckMiddleSoftkeyLabelL()
|
|
517 |
{
|
|
518 |
PSLN_TRACE_DEBUG("CPslnGeneralThemeView::CheckMiddleSoftkeyLabelL");
|
|
519 |
TInt currentItem = KErrNotFound;
|
|
520 |
if ( iContainer )
|
|
521 |
{
|
|
522 |
currentItem = iContainer->CurrentItemIndex();
|
|
523 |
}
|
|
524 |
|
|
525 |
TInt activeSkinIndex = 0;
|
|
526 |
if ( iModel )
|
|
527 |
{
|
|
528 |
activeSkinIndex = iModel->ActiveSkinIndex();
|
|
529 |
}
|
|
530 |
if ( iDownloadItemIndex != KErrNotFound )
|
|
531 |
{
|
|
532 |
// If download item is present, increment current index,
|
|
533 |
// so that skin index maps directly to listbox indexes.
|
|
534 |
activeSkinIndex++;
|
|
535 |
}
|
|
536 |
|
|
537 |
// First remove any prevous commands.
|
|
538 |
RemoveCommandFromMSK();
|
|
539 |
if ( currentItem == iDownloadItemIndex && currentItem != KErrNotFound )
|
|
540 |
{
|
|
541 |
// Set middle softkey as Download.
|
|
542 |
CPslnBaseView::SetMiddleSoftKeyLabelL(
|
|
543 |
R_PSLN_MSK_SELECT,
|
|
544 |
EPslnCmdAppDownload );
|
|
545 |
}
|
|
546 |
else if ( currentItem != activeSkinIndex )
|
|
547 |
{
|
|
548 |
// Set middle softkey as Apply.
|
|
549 |
CPslnBaseView::SetMiddleSoftKeyLabelL(
|
|
550 |
R_PSLN_MSK_ACTIVATE,
|
|
551 |
EPslnCmdAppActivate );
|
|
552 |
}
|
|
553 |
else
|
|
554 |
{
|
|
555 |
// Set middle softkey as dummy.
|
|
556 |
CPslnBaseView::SetMiddleSoftKeyLabelL(
|
|
557 |
R_PSLN_MSK_DUMMY,
|
|
558 |
EPslnCmdEmptyCommand );
|
|
559 |
}
|
|
560 |
}
|
|
561 |
|
|
562 |
// -----------------------------------------------------------------------------
|
|
563 |
// Requests container to update skin data for D column.
|
|
564 |
// -----------------------------------------------------------------------------
|
|
565 |
//
|
|
566 |
void CPslnGeneralThemeView::UpdateSkinListItemsDColumnOnlyL()
|
|
567 |
{
|
|
568 |
PSLN_TRACE_DEBUG("CPslnGeneralThemeView::UpdateSkinListItemsL");
|
|
569 |
if ( iContainer )
|
|
570 |
{
|
|
571 |
static_cast<CPslnGeneralThemeContainer*>(iContainer)->
|
|
572 |
UpdateSkinListItemsDColumnOnlyL();
|
|
573 |
}
|
|
574 |
CheckMiddleSoftkeyLabelL();
|
|
575 |
}
|
|
576 |
|
|
577 |
// -----------------------------------------------------------------------------
|
|
578 |
// Remove MSK command mappings.
|
|
579 |
// This method should do nothing but MSK issues.
|
|
580 |
// -----------------------------------------------------------------------------
|
|
581 |
//
|
|
582 |
void CPslnGeneralThemeView::RemoveCommandFromMSK()
|
|
583 |
{
|
|
584 |
PSLN_TRACE_DEBUG("CPslnGeneralThemeView::RemoveCommandFromMSK");
|
|
585 |
CEikButtonGroupContainer* cbaGroup = Cba();
|
|
586 |
// Check if model exists => indicates that UI is not exiting.
|
|
587 |
if ( cbaGroup && iPslnUi->Model() )
|
|
588 |
{
|
|
589 |
cbaGroup->RemoveCommandFromStack( KPslnMSKControlID, EPslnCmdAppDownload );
|
|
590 |
cbaGroup->RemoveCommandFromStack( KPslnMSKControlID, EPslnCmdAppActivate );
|
|
591 |
}
|
|
592 |
}
|
|
593 |
|
|
594 |
// -----------------------------------------------------------------------------
|
|
595 |
// Hightligt Default skin
|
|
596 |
// -----------------------------------------------------------------------------
|
|
597 |
//
|
|
598 |
void CPslnGeneralThemeView::HightlightDefaultSkin()
|
|
599 |
{
|
|
600 |
if ( iContainer )
|
|
601 |
{
|
|
602 |
CPslnGeneralThemeContainer* container = static_cast<CPslnGeneralThemeContainer*>(iContainer);
|
|
603 |
TInt modifier = container->IsEmbeddedLinkVisible( );
|
|
604 |
container->SetCurrentItemIndex( modifier );
|
|
605 |
}
|
|
606 |
}
|
|
607 |
// End of File
|