author | teknolog |
Fri, 12 Mar 2010 00:20:10 +0000 | |
changeset 49 | 43e204e6ae2e |
parent 2 | 29cda98b007e |
child 65 | bcd88ba95046 |
child 105 | 236022094302 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB |
|
3 |
* |
|
4 |
* All rights reserved. |
|
5 |
* This component and the accompanying materials are made available |
|
6 |
* under the terms of the License "Eclipse Public License v1.0" |
|
7 |
* which accompanies this distribution, and is available |
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 |
* |
|
10 |
* Initial Contributors: |
|
11 |
* EmbedDev AB - initial contribution. |
|
12 |
* |
|
13 |
* Contributors: |
|
14 |
* |
|
15 |
* Description: |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
#include "PodcastSettingsView.h" |
|
20 |
#include "PodcastAppUi.h" |
|
21 |
#include "Podcast.hrh" |
|
22 |
#include <aknlists.h> |
|
23 |
#include <aknsettingitemlist.h> |
|
24 |
#include <aknnavide.h> |
|
25 |
#include <podcast.rsg> |
|
26 |
#include "SettingsEngine.h" |
|
27 |
||
28 |
#include <caknfileselectiondialog.h> |
|
29 |
#include <caknmemoryselectiondialog.h> |
|
30 |
#include <pathinfo.h> |
|
31 |
||
32 |
||
33 |
class CIapSetting: public CAknEnumeratedTextPopupSettingItem |
|
34 |
{ |
|
35 |
public: |
|
36 |
CIapSetting(TInt aResourceId, TInt& aValue, CPodcastModel &aPodcastModel) : |
|
37 |
CAknEnumeratedTextPopupSettingItem(aResourceId, aValue), iPodcastModel(aPodcastModel), iIap(aValue) |
|
38 |
{ |
|
39 |
} |
|
40 |
||
41 |
~CIapSetting() |
|
42 |
{ |
|
43 |
} |
|
44 |
||
45 |
void RefreshConnectionListL() |
|
46 |
{ |
|
47 |
CArrayPtr< CAknEnumeratedText > * enumeratedArr = EnumeratedTextArray(); |
|
48 |
CArrayPtr< HBufC > * poppedUpTextArray = PoppedUpTextArray(); |
|
49 |
enumeratedArr->ResetAndDestroy(); |
|
50 |
poppedUpTextArray->ResetAndDestroy(); |
|
51 |
||
52 |
CDesCArrayFlat *iapArray = iPodcastModel.IAPNames(); |
|
53 |
||
54 |
TBool valueExists = EFalse; |
|
55 |
DP2("InternalValue=%d, ExternalValue=%d", InternalValue(), ExternalValue()); |
|
56 |
for (int i=0;i<iapArray->Count();i++) { |
|
57 |
HBufC *buf = (*iapArray)[i].AllocL(); |
|
58 |
poppedUpTextArray->AppendL(buf); |
|
59 |
||
60 |
TInt iapId = iPodcastModel.IAPIds()[i].iIapId; |
|
61 |
DP2("IAP name='%S', id=%d", buf, iapId); |
|
62 |
||
63 |
if (iapId == ExternalValue()) { |
|
64 |
valueExists = ETrue; |
|
65 |
} |
|
66 |
// both arrays destroy themselves, so we need two copies to prevent USER 44 |
|
67 |
HBufC *buf2 = (*iapArray)[i].AllocL(); |
|
68 |
||
69 |
CAknEnumeratedText *enumerated = new CAknEnumeratedText(iapId, buf2); |
|
70 |
enumeratedArr->AppendL(enumerated); |
|
71 |
} |
|
72 |
||
73 |
DP1("valueExists=%d", valueExists); |
|
74 |
if (!valueExists && iPodcastModel.IAPIds().Count() > 0 ) { |
|
75 |
DP1("Setting iIap=%d", iPodcastModel.IAPIds()[0].iIapId); |
|
76 |
iIap = iPodcastModel.IAPIds()[0].iIapId; |
|
77 |
LoadL(); |
|
78 |
DP2("InternalValue=%d, ExternalValue=%d", InternalValue(), ExternalValue()); |
|
79 |
} |
|
80 |
||
81 |
TRAPD(err, HandleTextArrayUpdateL()); |
|
82 |
||
83 |
if (err != KErrNone) { |
|
84 |
DP1("Leave in HandleTextArrayUpdateL, err=%d", err); |
|
85 |
} |
|
86 |
} |
|
87 |
||
88 |
void CompleteConstructionL() |
|
89 |
{ |
|
90 |
DP("CIapSetting::CompleteConstructionL BEGIN"); |
|
91 |
CAknEnumeratedTextPopupSettingItem::CompleteConstructionL(); |
|
92 |
RefreshConnectionListL(); |
|
93 |
DP("CIapSetting::CompleteConstructionL END"); |
|
94 |
} |
|
95 |
||
96 |
void EditItemL(TBool aCalledFromMenu) |
|
97 |
{ |
|
98 |
DP("CIapSetting::EditItemL BEGIN"); |
|
99 |
LoadL(); |
|
100 |
CAknEnumeratedTextPopupSettingItem::EditItemL(aCalledFromMenu); |
|
101 |
StoreL(); |
|
102 |
DP2("InternalValue=%d, ExternalValue=%d", InternalValue(), ExternalValue()); |
|
103 |
DP("CIapSetting::EditItemL END"); |
|
104 |
} |
|
105 |
||
106 |
void HandleSettingPageEventL(CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType) |
|
107 |
{ |
|
108 |
DP("CIapSetting::HandleSettingPageEventL BEGIN"); |
|
109 |
CAknSettingItem::HandleSettingPageEventL(aSettingPage, aEventType); |
|
110 |
/*if (aEventType == EEventSettingOked) |
|
111 |
{ |
|
112 |
DP2("InternalValue=%d, ExternalValue=%d", InternalValue(), ExternalValue()); |
|
113 |
StoreL(); |
|
114 |
}*/ |
|
115 |
DP("CIapSetting::HandleSettingPageEventL END"); |
|
116 |
} |
|
117 |
||
118 |
protected: |
|
119 |
CPodcastModel& iPodcastModel; |
|
120 |
TInt& iIap; |
|
121 |
}; |
|
122 |
||
123 |
||
124 |
class CConnectionSetting: public CAknEnumeratedTextPopupSettingItem |
|
125 |
{ |
|
126 |
public: |
|
127 |
CConnectionSetting(TInt aResourceId, TInt& aValue, CPodcastModel &aPodcastModel) : |
|
128 |
CAknEnumeratedTextPopupSettingItem(aResourceId, aValue), iPodcastModel(aPodcastModel) |
|
129 |
{ |
|
130 |
} |
|
131 |
||
132 |
~CConnectionSetting() |
|
133 |
{ |
|
134 |
} |
|
135 |
||
136 |
void RefreshConnectionListL() |
|
137 |
{ |
|
138 |
CArrayPtr< CAknEnumeratedText > * enumeratedArr = EnumeratedTextArray(); |
|
139 |
CArrayPtr< HBufC > * poppedUpTextArray = PoppedUpTextArray(); |
|
140 |
||
141 |
CDesCArrayFlat *snapArray = iPodcastModel.SNAPNames(); |
|
142 |
||
143 |
TBool valueExists = EFalse; |
|
144 |
DP2("InternalValue=%d, ExternalValue=%d", InternalValue(), ExternalValue()); |
|
145 |
for (int i=0;i<snapArray->Count();i++) { |
|
146 |
HBufC *buf = (*snapArray)[i].AllocL(); |
|
147 |
poppedUpTextArray->InsertL(EConnectionUseNetwork+i,buf); |
|
148 |
||
149 |
TInt snapId = iPodcastModel.SNAPIds()[i].iIapId; |
|
150 |
DP2("SNAP name='%S', id=%d", buf, snapId); |
|
151 |
||
152 |
if (snapId == ExternalValue()) { |
|
153 |
valueExists = ETrue; |
|
154 |
} |
|
155 |
// both arrays destroy themselves, so we need two copies to prevent USER 44 |
|
156 |
HBufC *buf2 = (*snapArray)[i].AllocL(); |
|
157 |
||
158 |
CAknEnumeratedText *enumerated = new CAknEnumeratedText(EConnectionUseNetwork+i, buf2); |
|
159 |
enumeratedArr->InsertL(EConnectionUseNetwork+i, enumerated); |
|
160 |
} |
|
161 |
||
162 |
DP1("valueExists=%d", valueExists); |
|
163 |
if (!valueExists && iPodcastModel.SNAPIds().Count() > 0 ) { |
|
164 |
DP1("Setting i=%d", iPodcastModel.SNAPIds()[0].iIapId); |
|
165 |
LoadL(); |
|
166 |
DP2("InternalValue=%d, ExternalValue=%d", InternalValue(), ExternalValue()); |
|
167 |
} |
|
168 |
||
169 |
TRAPD(err, HandleTextArrayUpdateL()); |
|
170 |
||
171 |
if (err != KErrNone) { |
|
172 |
DP1("Leave in HandleTextArrayUpdateL, err=%d", err); |
|
173 |
} |
|
174 |
} |
|
175 |
||
176 |
void CompleteConstructionL() |
|
177 |
{ |
|
178 |
DP("CIapSetting::CompleteConstructionL BEGIN"); |
|
179 |
CAknEnumeratedTextPopupSettingItem::CompleteConstructionL(); |
|
180 |
RefreshConnectionListL(); |
|
181 |
DP("CIapSetting::CompleteConstructionL END"); |
|
182 |
} |
|
183 |
||
184 |
void EditItemL(TBool aCalledFromMenu) |
|
185 |
{ |
|
186 |
DP("CIapSetting::EditItemL BEGIN"); |
|
187 |
LoadL(); |
|
188 |
CAknEnumeratedTextPopupSettingItem::EditItemL(aCalledFromMenu); |
|
189 |
StoreL(); |
|
190 |
DP2("InternalValue=%d, ExternalValue=%d", InternalValue(), ExternalValue()); |
|
191 |
DP("CIapSetting::EditItemL END"); |
|
192 |
} |
|
193 |
||
194 |
void HandleSettingPageEventL(CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType) |
|
195 |
{ |
|
196 |
DP("CIapSetting::HandleSettingPageEventL BEGIN"); |
|
197 |
CAknSettingItem::HandleSettingPageEventL(aSettingPage, aEventType); |
|
198 |
/*if (aEventType == EEventSettingOked) |
|
199 |
{ |
|
200 |
DP2("InternalValue=%d, ExternalValue=%d", InternalValue(), ExternalValue()); |
|
201 |
StoreL(); |
|
202 |
}*/ |
|
203 |
DP("CIapSetting::HandleSettingPageEventL END"); |
|
204 |
} |
|
205 |
||
206 |
protected: |
|
207 |
CPodcastModel& iPodcastModel; |
|
208 |
}; |
|
209 |
||
210 |
class CPodcastSettingItemList:public CAknSettingItemList |
|
211 |
{ |
|
212 |
public: |
|
213 |
CPodcastSettingItemList(CPodcastModel& aPodcastModel) : iPodcastModel(aPodcastModel) |
|
214 |
{ |
|
215 |
} |
|
216 |
||
217 |
~CPodcastSettingItemList() |
|
218 |
{ |
|
219 |
DP("CPodcastSettingItemList~"); |
|
220 |
} |
|
221 |
||
222 |
void StoreSettings() { |
|
223 |
DP("StoreSettings BEGIN"); |
|
224 |
StoreSettingsL(); |
|
225 |
CSettingsEngine &se = iPodcastModel.SettingsEngine(); |
|
226 |
se.SetBaseDir(iShowDir); |
|
227 |
DP1("Base Dir: %S", &iShowDir); |
|
228 |
se.SetUpdateAutomatically((TAutoUpdateSetting)iAutoUpdate); |
|
229 |
DP1("Update automatically: %d", iAutoUpdate); |
|
230 |
switch(iConnection) |
|
231 |
{ |
|
232 |
case EConnectionDefault: |
|
233 |
{ |
|
234 |
DP("Specific IAP: 0 Ask user"); |
|
235 |
se.SetSpecificIAP(0); |
|
236 |
}break; |
|
237 |
case EConnectionAlwaysAsk: |
|
238 |
{ |
|
239 |
DP("Specific IAP: -1 Ask user"); |
|
240 |
se.SetSpecificIAP(-1); |
|
241 |
}break; |
|
242 |
||
243 |
case EConnectionUseIap: |
|
244 |
{ |
|
245 |
DP1("Specific NETWORK: %d", iIap); |
|
246 |
se.SetSpecificIAP((iIap|KUseIAPFlag)); |
|
247 |
}break; |
|
248 |
default: |
|
249 |
case EConnectionUseNetwork: |
|
250 |
{ |
|
251 |
DP1("Specific IAP: %d", iIap); |
|
252 |
TInt snapIndex = iConnection-EConnectionUseNetwork; |
|
253 |
se.SetSpecificIAP(iPodcastModel.SNAPIds()[snapIndex].iIapId); |
|
254 |
}break; |
|
255 |
} |
|
256 |
||
257 |
DP1("Download automatically: %d", iAutoDownload); |
|
258 |
se.SetDownloadAutomatically(iAutoDownload); |
|
259 |
se.SaveSettingsL(); |
|
260 |
DP("StoreSettings END"); |
|
261 |
} |
|
262 |
||
263 |
void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType) |
|
264 |
{ |
|
265 |
DP1("CPodcastSettingItemList::HandleListBoxEventL event %d", aEventType) |
|
266 |
CAknSettingItemList::HandleListBoxEventL(aListBox, aEventType); |
|
267 |
} |
|
268 |
||
269 |
void UpdateSettingVisibility() |
|
270 |
{ |
|
271 |
DP("UpdateSettingVisibility BEGIN"); |
|
272 |
LoadSettingsL(); |
|
273 |
TBool dimAutoUpdate = iConnection == EConnectionAlwaysAsk; |
|
274 |
TBool dimIAP = iConnection < EConnectionUseIap; |
|
275 |
||
276 |
iSettingAutoUpdate->SetHidden(dimAutoUpdate); |
|
277 |
iSettingIAP->SetHidden(dimIAP); |
|
278 |
if(!dimIAP) |
|
279 |
{ |
|
280 |
iSettingIAP->RefreshConnectionListL(); |
|
281 |
} |
|
282 |
ListBox()->ScrollToMakeItemVisible(0); |
|
283 |
||
284 |
TRAP_IGNORE(HandleChangeInItemArrayOrVisibilityL()); |
|
285 |
DP("UpdateSettingVisibility END"); |
|
286 |
} |
|
287 |
||
288 |
void EditItemL (TInt aIndex, TBool aCalledFromMenu) |
|
289 |
{ |
|
290 |
DP("EditItemL BEGIN"); |
|
291 |
if (aIndex == 0) { |
|
292 |
CAknMemorySelectionDialog* memDlg = |
|
293 |
CAknMemorySelectionDialog::NewL(ECFDDialogTypeNormal, ETrue); |
|
294 |
CleanupStack::PushL(memDlg); |
|
295 |
CAknMemorySelectionDialog::TMemory memory = |
|
296 |
CAknMemorySelectionDialog::EPhoneMemory; |
|
297 |
||
298 |
if (memDlg->ExecuteL(memory)) |
|
299 |
{ |
|
300 |
TFileName importName; |
|
301 |
||
302 |
if (memory==CAknMemorySelectionDialog::EMemoryCard) |
|
303 |
{ |
|
304 |
importName = PathInfo:: MemoryCardRootPath(); |
|
305 |
} |
|
306 |
else |
|
307 |
{ |
|
308 |
importName = PathInfo:: PhoneMemoryRootPath(); |
|
309 |
} |
|
310 |
||
311 |
CAknFileSelectionDialog* dlg = CAknFileSelectionDialog::NewL(ECFDDialogTypeSave, R_PODCAST_SHOWDIR_SELECTOR); |
|
312 |
HBufC* select = iEikonEnv->AllocReadResourceLC(R_PODCAST_SOFTKEY_SELECT); |
|
313 |
dlg->SetLeftSoftkeyFileL(*select); |
|
314 |
CleanupStack::PopAndDestroy(select); |
|
315 |
CleanupStack::PushL(dlg); |
|
316 |
||
317 |
dlg->SetDefaultFolderL(importName); |
|
318 |
||
319 |
if(dlg->ExecuteL(importName)) |
|
320 |
{ |
|
321 |
importName.Append(_L("Podcasts")); |
|
322 |
iShowDir.Copy(importName); |
|
323 |
LoadSettingsL(); |
|
324 |
} |
|
325 |
CleanupStack::PopAndDestroy(dlg); |
|
326 |
} |
|
327 |
CleanupStack::PopAndDestroy(memDlg); |
|
328 |
} |
|
329 |
else { |
|
330 |
CAknSettingItemList::EditItemL(aIndex,aCalledFromMenu); |
|
331 |
} |
|
332 |
StoreSettingsL(); |
|
333 |
UpdateSettingVisibility(); |
|
334 |
DP("EditItemL END"); |
|
335 |
} |
|
336 |
||
337 |
/** |
|
338 |
* Framework method to create a setting item based upon the user id aSettingId. The |
|
339 |
* client code decides what type to contruct. new (ELeave) must then be used and the resulting |
|
340 |
* pointer returned. Ownership is thereafter base class's responsiblity. |
|
341 |
* |
|
342 |
* @param aSettingId ID to use to determine the type of the setting item |
|
343 |
* @return a constructed (not 2nd-stage constructed) setting item. |
|
344 |
*/ |
|
345 |
CAknSettingItem* CreateSettingItemL( TInt aSettingId ) |
|
346 |
{ |
|
347 |
DP1("CreateSettingItemL BEGIN, aSettingId=%d", aSettingId); |
|
348 |
||
349 |
CSettingsEngine &se = iPodcastModel.SettingsEngine(); |
|
350 |
iShowDir.Copy(se.BaseDir()); |
|
351 |
iAutoUpdate = se.UpdateAutomatically(); |
|
352 |
iIap = se.SpecificIAP(); |
|
353 |
||
354 |
if( iIap == 0) |
|
355 |
{ |
|
356 |
iConnection = EConnectionDefault; |
|
357 |
} |
|
358 |
else if ( iIap == -1) |
|
359 |
{ |
|
360 |
iConnection = EConnectionAlwaysAsk; |
|
361 |
} |
|
362 |
else if ( (iIap & KUseIAPFlag)) |
|
363 |
{ |
|
364 |
iConnection = EConnectionUseIap; |
|
365 |
iIap = iIap& KUseIAPMask; |
|
366 |
} |
|
367 |
else |
|
368 |
{ |
|
369 |
TInt snapIndex = 0; |
|
370 |
TInt cnt = iPodcastModel.SNAPIds().Count(); |
|
371 |
while(snapIndex < cnt && ((TInt)iPodcastModel.SNAPIds()[snapIndex].iIapId) != iIap) |
|
372 |
{ |
|
373 |
snapIndex++; |
|
374 |
} |
|
375 |
||
376 |
if(snapIndex != cnt) |
|
377 |
{ |
|
378 |
iConnection = EConnectionUseNetwork+snapIndex; |
|
379 |
} |
|
380 |
else |
|
381 |
{ |
|
382 |
iConnection = EConnectionAlwaysAsk; |
|
383 |
} |
|
384 |
} |
|
385 |
||
386 |
iAutoDownload = se.DownloadAutomatically(); |
|
387 |
||
388 |
switch(aSettingId) |
|
389 |
{ |
|
390 |
case EPodcastSettingShowDir: |
|
391 |
DP("EPodcastSettingShowDir"); |
|
392 |
return new (ELeave) CAknTextSettingItem(aSettingId, iShowDir); |
|
393 |
break; |
|
394 |
case EPodcastSettingAutoUpdate: |
|
395 |
DP("EPodcastSettingAutoUpdate"); |
|
396 |
iSettingAutoUpdate = new (ELeave) CAknEnumeratedTextPopupSettingItem(aSettingId, iAutoUpdate); |
|
397 |
return iSettingAutoUpdate; |
|
398 |
break; |
|
399 |
case EPodcastSettingConnection: |
|
400 |
DP("EPodcastSettingConnection"); |
|
401 |
return new (ELeave) CConnectionSetting (aSettingId, iConnection, iPodcastModel); |
|
402 |
break; |
|
403 |
case EPodcastSettingIAPList: |
|
404 |
DP("EPodcastSettingIAPList"); |
|
405 |
iSettingIAP = new (ELeave) CIapSetting (aSettingId, iIap, iPodcastModel); |
|
406 |
return iSettingIAP; |
|
407 |
break; |
|
408 |
case EPodcastSettingAutoDownload: |
|
409 |
DP("EPodcastSettingAutoDownload"); |
|
410 |
iSettingAutoDownload = new (ELeave) CAknBinaryPopupSettingItem (aSettingId, iAutoDownload); |
|
411 |
return iSettingAutoDownload; |
|
412 |
break; |
|
413 |
default: |
|
414 |
return CAknSettingItemList::CreateSettingItemL(aSettingId); |
|
415 |
break; |
|
416 |
} |
|
417 |
DP("CreateSettingItemL END"); |
|
418 |
return NULL; |
|
419 |
} |
|
420 |
||
421 |
TFileName iShowDir; |
|
422 |
||
423 |
TInt iAutoUpdate; |
|
424 |
CAknSettingItem *iSettingAutoUpdate; |
|
425 |
||
426 |
TInt iAutoDownload; |
|
427 |
CAknSettingItem *iSettingAutoDownload; |
|
428 |
||
429 |
TInt iConnection; |
|
430 |
||
431 |
TInt iIap; |
|
432 |
CIapSetting *iSettingIAP; |
|
433 |
||
434 |
||
435 |
CPodcastModel &iPodcastModel; |
|
436 |
}; |
|
437 |
||
438 |
||
439 |
CPodcastSettingsView* CPodcastSettingsView::NewL(CPodcastModel& aPodcastModel) |
|
440 |
{ |
|
441 |
CPodcastSettingsView* self = CPodcastSettingsView::NewLC(aPodcastModel); |
|
442 |
CleanupStack::Pop( self ); |
|
443 |
return self; |
|
444 |
} |
|
445 |
||
446 |
CPodcastSettingsView* CPodcastSettingsView::NewLC(CPodcastModel& aPodcastModel) |
|
447 |
{ |
|
448 |
CPodcastSettingsView* self = new ( ELeave ) CPodcastSettingsView(aPodcastModel); |
|
449 |
CleanupStack::PushL( self ); |
|
450 |
self->ConstructL(); |
|
451 |
return self; |
|
452 |
} |
|
453 |
||
454 |
CPodcastSettingsView::CPodcastSettingsView(CPodcastModel& aPodcastModel):iPodcastModel(aPodcastModel) |
|
455 |
{ |
|
456 |
} |
|
457 |
||
458 |
void CPodcastSettingsView::ConstructL() |
|
459 |
{ |
|
460 |
BaseConstructL(R_PODCAST_SETTINGSVIEW); |
|
461 |
} |
|
462 |
||
463 |
CPodcastSettingsView::~CPodcastSettingsView() |
|
464 |
{ |
|
465 |
DP("CPodcastSettingsView::~CPodcastSettingsView()"); |
|
466 |
delete iListbox; |
|
467 |
} |
|
468 |
||
469 |
TUid CPodcastSettingsView::Id() const |
|
470 |
{ |
|
471 |
return KUidPodcastSettingsViewID; |
|
472 |
} |
|
473 |
||
474 |
void CPodcastSettingsView::DoActivateL(const TVwsViewId& aPrevViewId, |
|
475 |
TUid /*aCustomMessageId*/, |
|
476 |
const TDesC8& /*aCustomMessage*/) |
|
477 |
{ |
|
478 |
DP("CPodcastSettingsView::DoActivateL BEGIN"); |
|
479 |
iPreviousView = aPrevViewId; |
|
480 |
||
481 |
if (iListbox) { |
|
482 |
delete iListbox; |
|
483 |
iListbox = NULL; |
|
484 |
} |
|
485 |
||
486 |
DP("Creating listbox"); |
|
487 |
iPodcastModel.UpdateSNAPListL(); |
|
488 |
iPodcastModel.UpdateIAPListL(); |
|
489 |
||
490 |
iListbox =new (ELeave) CPodcastSettingItemList(iPodcastModel); |
|
491 |
iListbox->SetMopParent( this ); |
|
492 |
iListbox->ConstructFromResourceL(R_PODCAST_SETTINGS); |
|
493 |
iListbox->SetRect(ClientRect()); |
|
494 |
iListbox->ActivateL(); |
|
495 |
||
496 |
DP("Creating navipane"); |
|
497 |
iNaviPane =( CAknNavigationControlContainer * ) StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); |
|
498 |
||
499 |
HBufC *titleBuffer = iEikonEnv->AllocReadResourceL(R_SETTINGS_TITLE); |
|
500 |
iNaviDecorator = iNaviPane->CreateNavigationLabelL(*titleBuffer); |
|
501 |
delete titleBuffer; |
|
502 |
||
503 |
DP("Updating listbox"); |
|
504 |
AppUi()->AddToStackL(*this, iListbox); |
|
505 |
iListbox->UpdateSettingVisibility(); |
|
506 |
iListbox->MakeVisible(ETrue); |
|
507 |
iListbox->DrawNow(); |
|
508 |
iListbox->SetFocus(ETrue); |
|
509 |
||
510 |
if(iNaviDecorator && iNaviPane) |
|
511 |
{ |
|
512 |
iNaviPane->PushL(*iNaviDecorator); |
|
513 |
} |
|
49
43e204e6ae2e
Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents:
2
diff
changeset
|
514 |
|
2 | 515 |
DP("CPodcastSettingsView::DoActivateL END"); |
516 |
} |
|
517 |
||
518 |
void CPodcastSettingsView::DoDeactivate() |
|
519 |
{ |
|
520 |
DP("CPodcastSettingsView::DoDeactivate BEGIN"); |
|
521 |
if (iListbox) { |
|
522 |
iListbox->MakeVisible(EFalse); |
|
523 |
||
524 |
AppUi()->RemoveFromViewStack( *this, iListbox ); |
|
525 |
||
526 |
} |
|
527 |
||
528 |
if(iNaviDecorator && iNaviPane) |
|
529 |
{ |
|
530 |
iNaviPane->Pop(iNaviDecorator); |
|
531 |
delete iNaviDecorator; |
|
532 |
iNaviDecorator = NULL; |
|
533 |
} |
|
534 |
DP("CPodcastSettingsView::DoDeactivate END"); |
|
535 |
} |
|
536 |
||
537 |
/** |
|
538 |
* Command handling function intended for overriding by sub classes. |
|
539 |
* Default implementation is empty. |
|
540 |
* @param aCommand ID of the command to respond to. |
|
541 |
*/ |
|
542 |
void CPodcastSettingsView::HandleCommandL(TInt aCommand) |
|
543 |
{ |
|
544 |
CAknView::HandleCommandL(aCommand); |
|
545 |
DP1("CPodcastListView::HandleCommandL=%d", aCommand); |
|
546 |
switch(aCommand) |
|
547 |
{ |
|
548 |
case EAknSoftkeyBack: |
|
549 |
{ |
|
550 |
iListbox->StoreSettings(); |
|
551 |
AppUi()->ActivateViewL(iPreviousView); |
|
552 |
} |
|
553 |
break; |
|
554 |
default: |
|
555 |
AppUi()->HandleCommandL(aCommand); |
|
556 |
break; |
|
557 |
} |
|
558 |
} |
|
559 |
||
560 |
void CPodcastSettingsView::HandleStatusPaneSizeChange() |
|
561 |
{ |
|
562 |
CAknView::HandleStatusPaneSizeChange(); |
|
563 |
||
564 |
DP2("CPodcastSettingsView::HandleStatusPaneSizeChange() width=%d, height=%d", ClientRect().Width(), ClientRect().Height()); |
|
565 |
if (iListbox) { |
|
566 |
iListbox->SetRect( ClientRect()); |
|
567 |
} |
|
568 |
} |