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