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