author | Sebastian Brannstrom <sebastianb@symbian.org> |
Wed, 07 Jul 2010 14:19:21 +0100 | |
branch | symbian1 |
changeset 164 | 000f9fc147b2 |
parent 65 | bcd88ba95046 |
child 176 | 1c8b56cb6409 |
child 347 | b8d687bb7ca1 |
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 |
||
60 | 28 |
#include <akncommondialogsdynmem.h> |
2 | 29 |
#include <pathinfo.h> |
60 | 30 |
#include <aknquerydialog.h> |
2 | 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) { |
|
60 | 292 |
TFileName selectedFolder; |
293 |
selectedFolder.Copy(iShowDir); |
|
294 |
TFileName startFolder; |
|
295 |
startFolder.Zero(); |
|
296 |
TInt types = AknCommonDialogsDynMem::EMemoryTypePhone | AknCommonDialogsDynMem::EMemoryTypeMMC |AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| AknCommonDialogsDynMem::EMemoryTypeRemote; |
|
297 |
||
298 |
HBufC *title = iCoeEnv->AllocReadResourceLC(R_PODCAST_SELECT_FOLDER); |
|
299 |
if (AknCommonDialogsDynMem::RunFolderSelectDlgLD (types, selectedFolder, |
|
300 |
startFolder, NULL, NULL, *title)) |
|
2 | 301 |
{ |
60 | 302 |
_LIT(KPodcastsDir, "Podcasts"); |
303 |
TInt pos = selectedFolder.Find(KPodcastsDir); |
|
304 |
if (pos == KErrNotFound || pos != selectedFolder.Length()-9) |
|
305 |
{ |
|
306 |
// append "Podcasts" if the folder isn't already called this |
|
307 |
selectedFolder.Append(KPodcastsDir); |
|
308 |
} |
|
309 |
||
310 |
if (selectedFolder[selectedFolder.Length()-1] != '\\') |
|
311 |
{ |
|
312 |
selectedFolder.Append(_L("\\")); |
|
313 |
} |
|
314 |
||
315 |
iShowDir.Copy(selectedFolder); |
|
316 |
LoadSettingsL(); |
|
2 | 317 |
} |
60 | 318 |
CleanupStack::PopAndDestroy(title); |
2 | 319 |
} |
320 |
else { |
|
321 |
CAknSettingItemList::EditItemL(aIndex,aCalledFromMenu); |
|
322 |
} |
|
323 |
StoreSettingsL(); |
|
324 |
UpdateSettingVisibility(); |
|
325 |
DP("EditItemL END"); |
|
326 |
} |
|
327 |
||
328 |
/** |
|
329 |
* Framework method to create a setting item based upon the user id aSettingId. The |
|
330 |
* client code decides what type to contruct. new (ELeave) must then be used and the resulting |
|
331 |
* pointer returned. Ownership is thereafter base class's responsiblity. |
|
332 |
* |
|
333 |
* @param aSettingId ID to use to determine the type of the setting item |
|
334 |
* @return a constructed (not 2nd-stage constructed) setting item. |
|
335 |
*/ |
|
336 |
CAknSettingItem* CreateSettingItemL( TInt aSettingId ) |
|
337 |
{ |
|
338 |
DP1("CreateSettingItemL BEGIN, aSettingId=%d", aSettingId); |
|
339 |
||
340 |
CSettingsEngine &se = iPodcastModel.SettingsEngine(); |
|
341 |
iShowDir.Copy(se.BaseDir()); |
|
342 |
iAutoUpdate = se.UpdateAutomatically(); |
|
343 |
iIap = se.SpecificIAP(); |
|
344 |
||
345 |
if( iIap == 0) |
|
346 |
{ |
|
347 |
iConnection = EConnectionDefault; |
|
348 |
} |
|
349 |
else if ( iIap == -1) |
|
350 |
{ |
|
351 |
iConnection = EConnectionAlwaysAsk; |
|
352 |
} |
|
353 |
else if ( (iIap & KUseIAPFlag)) |
|
354 |
{ |
|
355 |
iConnection = EConnectionUseIap; |
|
356 |
iIap = iIap& KUseIAPMask; |
|
357 |
} |
|
358 |
else |
|
359 |
{ |
|
360 |
TInt snapIndex = 0; |
|
361 |
TInt cnt = iPodcastModel.SNAPIds().Count(); |
|
362 |
while(snapIndex < cnt && ((TInt)iPodcastModel.SNAPIds()[snapIndex].iIapId) != iIap) |
|
363 |
{ |
|
364 |
snapIndex++; |
|
365 |
} |
|
366 |
||
367 |
if(snapIndex != cnt) |
|
368 |
{ |
|
369 |
iConnection = EConnectionUseNetwork+snapIndex; |
|
370 |
} |
|
371 |
else |
|
372 |
{ |
|
373 |
iConnection = EConnectionAlwaysAsk; |
|
374 |
} |
|
375 |
} |
|
376 |
||
377 |
iAutoDownload = se.DownloadAutomatically(); |
|
378 |
||
379 |
switch(aSettingId) |
|
380 |
{ |
|
381 |
case EPodcastSettingShowDir: |
|
382 |
DP("EPodcastSettingShowDir"); |
|
383 |
return new (ELeave) CAknTextSettingItem(aSettingId, iShowDir); |
|
384 |
break; |
|
385 |
case EPodcastSettingAutoUpdate: |
|
386 |
DP("EPodcastSettingAutoUpdate"); |
|
387 |
iSettingAutoUpdate = new (ELeave) CAknEnumeratedTextPopupSettingItem(aSettingId, iAutoUpdate); |
|
388 |
return iSettingAutoUpdate; |
|
389 |
break; |
|
390 |
case EPodcastSettingConnection: |
|
391 |
DP("EPodcastSettingConnection"); |
|
392 |
return new (ELeave) CConnectionSetting (aSettingId, iConnection, iPodcastModel); |
|
393 |
break; |
|
394 |
case EPodcastSettingIAPList: |
|
395 |
DP("EPodcastSettingIAPList"); |
|
396 |
iSettingIAP = new (ELeave) CIapSetting (aSettingId, iIap, iPodcastModel); |
|
397 |
return iSettingIAP; |
|
398 |
break; |
|
399 |
case EPodcastSettingAutoDownload: |
|
400 |
DP("EPodcastSettingAutoDownload"); |
|
401 |
iSettingAutoDownload = new (ELeave) CAknBinaryPopupSettingItem (aSettingId, iAutoDownload); |
|
402 |
return iSettingAutoDownload; |
|
403 |
break; |
|
404 |
default: |
|
405 |
return CAknSettingItemList::CreateSettingItemL(aSettingId); |
|
406 |
break; |
|
407 |
} |
|
408 |
DP("CreateSettingItemL END"); |
|
409 |
return NULL; |
|
410 |
} |
|
411 |
||
412 |
TFileName iShowDir; |
|
413 |
||
414 |
TInt iAutoUpdate; |
|
415 |
CAknSettingItem *iSettingAutoUpdate; |
|
416 |
||
417 |
TInt iAutoDownload; |
|
418 |
CAknSettingItem *iSettingAutoDownload; |
|
419 |
||
420 |
TInt iConnection; |
|
421 |
||
422 |
TInt iIap; |
|
423 |
CIapSetting *iSettingIAP; |
|
424 |
||
425 |
||
426 |
CPodcastModel &iPodcastModel; |
|
427 |
}; |
|
428 |
||
429 |
||
430 |
CPodcastSettingsView* CPodcastSettingsView::NewL(CPodcastModel& aPodcastModel) |
|
431 |
{ |
|
432 |
CPodcastSettingsView* self = CPodcastSettingsView::NewLC(aPodcastModel); |
|
433 |
CleanupStack::Pop( self ); |
|
434 |
return self; |
|
435 |
} |
|
436 |
||
437 |
CPodcastSettingsView* CPodcastSettingsView::NewLC(CPodcastModel& aPodcastModel) |
|
438 |
{ |
|
439 |
CPodcastSettingsView* self = new ( ELeave ) CPodcastSettingsView(aPodcastModel); |
|
440 |
CleanupStack::PushL( self ); |
|
441 |
self->ConstructL(); |
|
442 |
return self; |
|
443 |
} |
|
444 |
||
445 |
CPodcastSettingsView::CPodcastSettingsView(CPodcastModel& aPodcastModel):iPodcastModel(aPodcastModel) |
|
446 |
{ |
|
447 |
} |
|
448 |
||
449 |
void CPodcastSettingsView::ConstructL() |
|
450 |
{ |
|
451 |
BaseConstructL(R_PODCAST_SETTINGSVIEW); |
|
452 |
} |
|
453 |
||
454 |
CPodcastSettingsView::~CPodcastSettingsView() |
|
455 |
{ |
|
456 |
DP("CPodcastSettingsView::~CPodcastSettingsView()"); |
|
457 |
delete iListbox; |
|
458 |
} |
|
459 |
||
460 |
TUid CPodcastSettingsView::Id() const |
|
461 |
{ |
|
462 |
return KUidPodcastSettingsViewID; |
|
463 |
} |
|
464 |
||
465 |
void CPodcastSettingsView::DoActivateL(const TVwsViewId& aPrevViewId, |
|
466 |
TUid /*aCustomMessageId*/, |
|
467 |
const TDesC8& /*aCustomMessage*/) |
|
468 |
{ |
|
469 |
DP("CPodcastSettingsView::DoActivateL BEGIN"); |
|
470 |
iPreviousView = aPrevViewId; |
|
471 |
||
472 |
if (iListbox) { |
|
473 |
delete iListbox; |
|
474 |
iListbox = NULL; |
|
475 |
} |
|
476 |
||
477 |
DP("Creating listbox"); |
|
478 |
iPodcastModel.UpdateSNAPListL(); |
|
479 |
iPodcastModel.UpdateIAPListL(); |
|
480 |
||
481 |
iListbox =new (ELeave) CPodcastSettingItemList(iPodcastModel); |
|
482 |
iListbox->SetMopParent( this ); |
|
483 |
iListbox->ConstructFromResourceL(R_PODCAST_SETTINGS); |
|
484 |
iListbox->SetRect(ClientRect()); |
|
485 |
iListbox->ActivateL(); |
|
486 |
||
487 |
DP("Creating navipane"); |
|
488 |
iNaviPane =( CAknNavigationControlContainer * ) StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); |
|
489 |
||
490 |
HBufC *titleBuffer = iEikonEnv->AllocReadResourceL(R_SETTINGS_TITLE); |
|
491 |
iNaviDecorator = iNaviPane->CreateNavigationLabelL(*titleBuffer); |
|
492 |
delete titleBuffer; |
|
493 |
||
494 |
DP("Updating listbox"); |
|
495 |
AppUi()->AddToStackL(*this, iListbox); |
|
496 |
iListbox->UpdateSettingVisibility(); |
|
497 |
iListbox->MakeVisible(ETrue); |
|
498 |
iListbox->DrawNow(); |
|
499 |
iListbox->SetFocus(ETrue); |
|
500 |
||
501 |
if(iNaviDecorator && iNaviPane) |
|
502 |
{ |
|
503 |
iNaviPane->PushL(*iNaviDecorator); |
|
504 |
} |
|
49
43e204e6ae2e
Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents:
2
diff
changeset
|
505 |
|
2 | 506 |
DP("CPodcastSettingsView::DoActivateL END"); |
507 |
} |
|
508 |
||
509 |
void CPodcastSettingsView::DoDeactivate() |
|
510 |
{ |
|
511 |
DP("CPodcastSettingsView::DoDeactivate BEGIN"); |
|
512 |
if (iListbox) { |
|
513 |
iListbox->MakeVisible(EFalse); |
|
514 |
||
515 |
AppUi()->RemoveFromViewStack( *this, iListbox ); |
|
516 |
||
517 |
} |
|
518 |
||
519 |
if(iNaviDecorator && iNaviPane) |
|
520 |
{ |
|
521 |
iNaviPane->Pop(iNaviDecorator); |
|
522 |
delete iNaviDecorator; |
|
523 |
iNaviDecorator = NULL; |
|
524 |
} |
|
525 |
DP("CPodcastSettingsView::DoDeactivate END"); |
|
526 |
} |
|
527 |
||
528 |
/** |
|
529 |
* Command handling function intended for overriding by sub classes. |
|
530 |
* Default implementation is empty. |
|
531 |
* @param aCommand ID of the command to respond to. |
|
532 |
*/ |
|
533 |
void CPodcastSettingsView::HandleCommandL(TInt aCommand) |
|
534 |
{ |
|
535 |
CAknView::HandleCommandL(aCommand); |
|
536 |
DP1("CPodcastListView::HandleCommandL=%d", aCommand); |
|
537 |
switch(aCommand) |
|
538 |
{ |
|
539 |
case EAknSoftkeyBack: |
|
540 |
{ |
|
541 |
iListbox->StoreSettings(); |
|
542 |
AppUi()->ActivateViewL(iPreviousView); |
|
543 |
} |
|
60 | 544 |
break; |
545 |
case EPodcastResetDb: |
|
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
65
diff
changeset
|
546 |
{ |
60 | 547 |
CAknQueryDialog* dlg= new(ELeave) CAknQueryDialog(); |
548 |
||
549 |
CleanupStack::PushL(dlg); |
|
550 |
HBufC *text = iCoeEnv->AllocReadResourceLC(R_RESET_DB_QUERY); |
|
551 |
dlg->SetPromptL(*text); |
|
552 |
CleanupStack::PopAndDestroy(text); |
|
553 |
CleanupStack::Pop(dlg); |
|
554 |
if(dlg->ExecuteLD(R_QUERYDLG)) |
|
555 |
{ |
|
556 |
iPodcastModel.DropDB(); |
|
557 |
AppUi()->Exit(); |
|
558 |
} |
|
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
65
diff
changeset
|
559 |
} |
60 | 560 |
break; |
2 | 561 |
default: |
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
65
diff
changeset
|
562 |
{ |
2 | 563 |
AppUi()->HandleCommandL(aCommand); |
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
65
diff
changeset
|
564 |
} |
2 | 565 |
break; |
566 |
} |
|
567 |
} |
|
568 |
||
569 |
void CPodcastSettingsView::HandleStatusPaneSizeChange() |
|
570 |
{ |
|
571 |
CAknView::HandleStatusPaneSizeChange(); |
|
572 |
||
573 |
DP2("CPodcastSettingsView::HandleStatusPaneSizeChange() width=%d, height=%d", ClientRect().Width(), ClientRect().Height()); |
|
574 |
if (iListbox) { |
|
575 |
iListbox->SetRect( ClientRect()); |
|
576 |
} |
|
577 |
} |