author | teknolog |
Sun, 28 Feb 2010 23:25:24 +0000 | |
changeset 29 | 08733234ccb1 |
parent 23 | cf4b850bbffb |
child 33 | 64ed1227e68d |
child 35 | 66c5303f3610 |
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 "PodcastQueueView.h" |
|
20 |
#include "PodcastAppUi.h" |
|
21 |
#include "ShowEngine.h" |
|
22 |
#include "SettingsEngine.h" |
|
23 |
#include "PodcastApp.h" |
|
24 |
#include "Constants.h" |
|
25 |
#include "imagehandler.h" |
|
26 |
#include "PodcastShowsView.h" |
|
27 |
||
28 |
#include <akntitle.h> |
|
29 |
#include <podcast.rsg> |
|
30 |
#include <podcast.mbg> |
|
31 |
#include <gulicon.h> |
|
32 |
#include <barsread.h> |
|
33 |
#include <aknnotedialog.h> |
|
34 |
#include <aknmessagequerydialog.h> |
|
35 |
#include "Podcast.hrh" |
|
36 |
||
37 |
#define KMaxMessageLength 200 |
|
38 |
||
39 |
#define KPodcastImageWidth 160 |
|
40 |
#define KPodcastImageHeight 120 |
|
41 |
#define KPodcastDialogOffset 2 |
|
42 |
||
43 |
#define KOneHundredPercent 100 |
|
44 |
||
45 |
const TInt KSizeBufLen = 64; |
|
46 |
const TInt KDefaultGran = 5; |
|
47 |
_LIT(KSizeDownloadingOf, "%.1f/%.1f MB"); |
|
48 |
_LIT(KShowsSizeFormatS60, "%.1f MB"); |
|
49 |
||
50 |
_LIT(KShowFormat, "%d\t%S\t%S %S\t"); |
|
51 |
_LIT(KShowErrorFormat, "%d\t%S\t%S\t"); |
|
52 |
_LIT(KShowQueueFormat, "%d\t%S\t%S%S\t"); |
|
53 |
||
54 |
||
55 |
// these must correspond with TShowsIconIndex |
|
56 |
||
57 |
const TUint KShowIconArrayIds[] = |
|
58 |
{ |
|
59 |
EMbmPodcastAudio, |
|
60 |
EMbmPodcastAudio_mask, |
|
61 |
EMbmPodcastAudio_new, |
|
62 |
EMbmPodcastAudio_new_mask, |
|
63 |
EMbmPodcastAudio_queued, |
|
64 |
EMbmPodcastAudio_queued_mask, |
|
65 |
EMbmPodcastAudio_downloading, |
|
66 |
EMbmPodcastAudio_downloading_mask, |
|
67 |
EMbmPodcastAudio_downloaded, |
|
68 |
EMbmPodcastAudio_downloaded_mask, |
|
69 |
EMbmPodcastAudio_downloaded_new, |
|
70 |
EMbmPodcastAudio_downloaded_new_mask, |
|
71 |
EMbmPodcastAudio_failed, |
|
72 |
EMbmPodcastAudio_failed_mask, |
|
73 |
EMbmPodcastAudio_suspended, |
|
74 |
EMbmPodcastAudio_suspended_mask, |
|
75 |
0, |
|
76 |
0 |
|
77 |
}; |
|
78 |
||
79 |
CPodcastQueueView* CPodcastQueueView::NewL(CPodcastModel& aPodcastModel) |
|
80 |
{ |
|
81 |
CPodcastQueueView* self = CPodcastQueueView::NewLC(aPodcastModel); |
|
82 |
CleanupStack::Pop(self); |
|
83 |
return self; |
|
84 |
} |
|
85 |
||
86 |
CPodcastQueueView* CPodcastQueueView::NewLC(CPodcastModel& aPodcastModel) |
|
87 |
{ |
|
88 |
CPodcastQueueView* self = new ( ELeave ) CPodcastQueueView(aPodcastModel); |
|
89 |
CleanupStack::PushL(self); |
|
90 |
self->ConstructL(); |
|
91 |
return self; |
|
92 |
} |
|
93 |
||
94 |
CPodcastQueueView::CPodcastQueueView(CPodcastModel& aPodcastModel) : |
|
95 |
iPodcastModel(aPodcastModel) |
|
96 |
{ |
|
97 |
} |
|
98 |
||
99 |
void CPodcastQueueView::ConstructL() |
|
100 |
{ |
|
101 |
BaseConstructL(R_PODCAST_QUEUEVIEW); |
|
102 |
CPodcastListView::ConstructL(); |
|
103 |
CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1); |
|
104 |
CleanupStack::PushL(icons); |
|
105 |
TInt pos = 0; |
|
106 |
while (KShowIconArrayIds[pos] > 0) |
|
107 |
{ |
|
108 |
// Load the bitmap for play icon |
|
109 |
CFbsBitmap* bitmap= NULL;//iEikonEnv->CreateBitmapL( _L("*"), KIconArrayIds[pos]); |
|
110 |
CFbsBitmap* mask= NULL;////iEikonEnv->CreateBitmapL( _L("*"), KIconArrayIds[pos+1] ); |
|
111 |
AknIconUtils::CreateIconL(bitmap, |
|
112 |
mask, |
|
113 |
iEikonEnv->EikAppUi()->Application()->BitmapStoreName(), |
|
114 |
KShowIconArrayIds[pos], |
|
115 |
KShowIconArrayIds[pos+1]); |
|
116 |
CleanupStack::PushL(bitmap); |
|
117 |
// Load the mask for play icon |
|
118 |
CleanupStack::PushL(mask); |
|
119 |
// Append the play icon to icon array |
|
120 |
icons->AppendL(CGulIcon::NewL(bitmap, mask) ); |
|
121 |
CleanupStack::Pop(2); // bitmap, mask |
|
122 |
pos+=2; |
|
123 |
} |
|
124 |
iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons); |
|
125 |
CleanupStack::Pop(icons); // icons |
|
126 |
iListContainer->Listbox()->SetListBoxObserver(this); |
|
127 |
||
128 |
iPodcastModel.FeedEngine().AddObserver(this); |
|
129 |
iPodcastModel.ShowEngine().AddObserver(this); |
|
130 |
||
131 |
iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0)); |
|
132 |
TResourceReader reader; |
|
133 |
iCoeEnv->CreateResourceReaderLC(reader,R_QUEUEVIEW_POPUP_MENU); |
|
134 |
iStylusPopupMenu->ConstructFromResourceL(reader); |
|
135 |
CleanupStack::PopAndDestroy(); |
|
136 |
SetEmptyTextL(R_PODCAST_EMPTY_QUEUE); |
|
137 |
} |
|
138 |
||
139 |
TKeyResponse CPodcastQueueView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
140 |
{ |
|
141 |
if (aType == EEventKey) |
|
142 |
{ |
|
143 |
CShowInfo *activeShow = NULL; |
|
144 |
||
145 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
146 |
if(index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
147 |
{ |
|
148 |
activeShow = iPodcastModel.ActiveShowList()[index]; |
|
149 |
} |
|
150 |
||
151 |
if (activeShow != NULL) { |
|
152 |
DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode); |
|
153 |
switch (aKeyEvent.iCode) { |
|
154 |
case 117: |
|
155 |
case '*': |
|
156 |
case EKeySpace: |
|
157 |
if (activeShow->PlayState() == EPlayed) { |
|
158 |
HandleCommandL(EPodcastMarkAsUnplayed); |
|
159 |
} else { |
|
160 |
HandleCommandL(EPodcastMarkAsPlayed); |
|
161 |
} |
|
162 |
break; |
|
163 |
case 106: |
|
164 |
case '#': |
|
165 |
if (activeShow->DownloadState() == ENotDownloaded) { |
|
166 |
HandleCommandL(EPodcastDownloadShow); |
|
167 |
} |
|
168 |
break; |
|
169 |
case EKeyBackspace: |
|
170 |
case EKeyDelete: |
|
171 |
HandleCommandL(EPodcastRemoveDownload); |
|
172 |
break; |
|
173 |
default: |
|
174 |
break; |
|
175 |
} |
|
176 |
UpdateToolbar(); |
|
177 |
} |
|
178 |
} |
|
179 |
return CPodcastListView::OfferKeyEventL(aKeyEvent, aType); |
|
180 |
} |
|
181 |
||
182 |
CPodcastQueueView::~CPodcastQueueView() |
|
183 |
{ |
|
184 |
iPodcastModel.ShowEngine().RemoveObserver(this); |
|
185 |
iPodcastModel.FeedEngine().RemoveObserver(this); |
|
186 |
||
187 |
if(iStylusPopupMenu) |
|
188 |
delete iStylusPopupMenu, iStylusPopupMenu = NULL; |
|
189 |
} |
|
190 |
||
191 |
||
192 |
TUid CPodcastQueueView::Id() const |
|
193 |
{ |
|
194 |
return KUidPodcastQueueViewID; |
|
195 |
} |
|
196 |
||
197 |
void CPodcastQueueView::DoActivateL(const TVwsViewId& aPrevViewId, |
|
198 |
TUid aCustomMessageId, const TDesC8& aCustomMessage) |
|
199 |
{ |
|
200 |
DP("CPodcastQueueView::DoActivateL BEGIN"); |
|
201 |
||
202 |
CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
203 |
iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID); |
|
204 |
||
205 |
UpdateFeedUpdateStateL(); |
|
206 |
UpdateToolbar(); |
|
207 |
DP("CPodcastQueueView::DoActivateL END"); |
|
208 |
} |
|
209 |
||
210 |
void CPodcastQueueView::DoDeactivate() |
|
211 |
{ |
|
212 |
CPodcastListView::DoDeactivate(); |
|
213 |
} |
|
214 |
||
215 |
// Engine callback when new shows are available |
|
216 |
void CPodcastQueueView::ShowListUpdatedL() |
|
217 |
{ |
|
218 |
UpdateListboxItemsL(); |
|
219 |
} |
|
220 |
||
221 |
void CPodcastQueueView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/) |
|
222 |
{ |
|
223 |
if (!iListContainer->IsVisible()) |
|
224 |
{ |
|
225 |
return; |
|
226 |
} |
|
227 |
||
228 |
CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading(); |
|
229 |
if (info) |
|
230 |
{ |
|
231 |
UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload); |
|
232 |
} |
|
233 |
} |
|
234 |
||
235 |
void CPodcastQueueView::ShowDownloadFinishedL(TUint /*aShowUid*/, TInt aError) |
|
236 |
{ |
|
237 |
iProgressAdded = EFalse; |
|
238 |
||
8 | 239 |
iPodcastModel.GetShowsDownloadingL(); |
2 | 240 |
UpdateListboxItemsL(); |
241 |
UpdateToolbar(); |
|
242 |
||
243 |
switch(aError) |
|
244 |
{ |
|
245 |
case KErrCouldNotConnect: |
|
246 |
{ |
|
247 |
TBuf<KMaxMessageLength> message; |
|
248 |
iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR); |
|
249 |
ShowErrorMessage(message); |
|
250 |
} |
|
251 |
break; |
|
252 |
default: // Do nothing |
|
253 |
break; |
|
254 |
} |
|
255 |
} |
|
256 |
||
257 |
||
258 |
void CPodcastQueueView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid) |
|
259 |
{ |
|
260 |
// TODO make use of the fact that we know that the feed download is |
|
261 |
// started instead of checking feed engine states in UpdateFeedUpdateStateL. |
|
262 |
if (iPodcastModel.ActiveFeedInfo() != NULL |
|
263 |
&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid) |
|
264 |
{ |
|
8 | 265 |
UpdateFeedUpdateStateL(); |
2 | 266 |
UpdateToolbar(); |
267 |
} |
|
268 |
} |
|
269 |
||
270 |
void CPodcastQueueView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/) |
|
271 |
{ |
|
272 |
DP("CPodcastQueueView::FeedDownloadFinishedL BEGIN"); |
|
273 |
// TODO make use of the fact that we know that the feed download is |
|
274 |
// finished instead of checking feed engine states in UpdateFeedUpdateStateL. |
|
275 |
if (iPodcastModel.ActiveFeedInfo() != NULL |
|
276 |
&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid) |
|
277 |
{ |
|
8 | 278 |
UpdateFeedUpdateStateL(); |
2 | 279 |
} |
280 |
DP("CPodcastQueueView::FeedDownloadFinishedL END"); |
|
281 |
} |
|
282 |
||
283 |
void CPodcastQueueView::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
284 |
TListBoxEvent aEventType) |
|
285 |
{ |
|
286 |
switch (aEventType) |
|
287 |
{ |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
14
diff
changeset
|
288 |
#ifndef SYMBIAN1_UI |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
14
diff
changeset
|
289 |
case EEventItemClicked: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
14
diff
changeset
|
290 |
#endif |
2 | 291 |
case EEventEnterKeyPressed: |
292 |
case EEventItemActioned: |
|
293 |
case EEventItemDoubleClicked: |
|
294 |
break; |
|
295 |
default: |
|
296 |
break; |
|
297 |
} |
|
298 |
UpdateToolbar(); |
|
299 |
} |
|
300 |
||
301 |
void CPodcastQueueView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex) |
|
302 |
{ |
|
303 |
TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended(); |
|
304 |
TUint showDownloadingUid = iPodcastModel.ShowEngine().ShowDownloading() ? iPodcastModel.ShowEngine().ShowDownloading()->Uid() : 0; |
|
305 |
||
306 |
if (showDownloadingUid == aShowInfo->Uid()) |
|
307 |
{ |
|
308 |
aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon; |
|
309 |
} |
|
310 |
else |
|
311 |
{ |
|
312 |
switch (aShowInfo->DownloadState()) |
|
313 |
{ |
|
314 |
case EQueued: |
|
315 |
aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon; |
|
316 |
break; |
|
317 |
case EDownloading: |
|
318 |
aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon; |
|
319 |
break; |
|
320 |
case EFailedDownload: |
|
321 |
aIconIndex = EFailedShowIcon; |
|
322 |
break; |
|
323 |
default: |
|
324 |
DP("Wrong download state for queue view!"); |
|
325 |
break; |
|
326 |
} |
|
327 |
} |
|
328 |
} |
|
329 |
||
330 |
void CPodcastQueueView::UpdateFeedUpdateStateL() |
|
331 |
{ |
|
332 |
TBool listboxDimmed = EFalse; |
|
333 |
||
334 |
if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() |
|
335 |
!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid()) |
|
336 |
{ |
|
337 |
listboxDimmed = ETrue; |
|
338 |
} |
|
339 |
||
340 |
if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed)) |
|
341 |
{ |
|
342 |
iListContainer->Listbox()->SetDimmed(listboxDimmed); |
|
343 |
} |
|
344 |
UpdateListboxItemsL(); |
|
345 |
UpdateToolbar(); |
|
346 |
} |
|
347 |
||
348 |
void CPodcastQueueView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded) |
|
349 |
{ |
|
350 |
TBuf<32> infoSize; |
|
351 |
TInt iconIndex = 0; |
|
352 |
TBuf<KMaxShortDateFormatSpec*2> showDate; |
|
353 |
GetShowIcons(&aShowInfo, iconIndex); |
|
354 |
||
355 |
if(aSizeDownloaded > 0) |
|
356 |
{ |
|
357 |
if (aShowInfo.ShowSize() > 0) |
|
358 |
{ |
|
359 |
infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb), |
|
360 |
((float)aShowInfo.ShowSize() / (float)KSizeMb)); |
|
361 |
} |
|
362 |
else |
|
363 |
{ |
|
364 |
infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb); |
|
365 |
} |
|
366 |
} |
|
367 |
else if (aShowInfo.ShowSize() > 0) |
|
368 |
{ |
|
369 |
infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb); |
|
370 |
} |
|
371 |
else { |
|
372 |
infoSize = KNullDesC(); |
|
373 |
} |
|
374 |
||
375 |
if (aShowInfo.PubDate().Int64() == 0) |
|
376 |
{ |
|
377 |
showDate = KNullDesC(); |
|
378 |
} |
|
379 |
else |
|
380 |
{ |
|
381 |
aShowInfo.PubDate().FormatL(showDate, KDateFormatShort()); |
|
382 |
} |
|
383 |
||
384 |
if(aShowInfo.LastError() != KErrNone) |
|
385 |
{ |
|
386 |
TBuf<KSizeBufLen> errorBuffer; |
|
387 |
iEikonEnv->GetErrorText(errorBuffer, aShowInfo.LastError()); |
|
388 |
iListboxFormatbuffer.Format(KShowErrorFormat(), iconIndex, &aShowInfo.Title(), &errorBuffer); |
|
389 |
} |
|
390 |
else |
|
391 |
{ |
|
392 |
if (infoSize.Length() > 0) { |
|
393 |
infoSize.Insert(0,_L(", ")); |
|
394 |
} |
|
395 |
||
396 |
iListboxFormatbuffer.Format(KShowQueueFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize); |
|
397 |
} |
|
398 |
} |
|
399 |
||
400 |
void CPodcastQueueView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded) |
|
401 |
{ |
|
402 |
FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded); |
|
403 |
iItemArray->Delete(aIndex); |
|
404 |
if(aIndex>= iItemArray->MdcaCount()) |
|
405 |
{ |
|
406 |
iItemArray->AppendL(iListboxFormatbuffer); |
|
407 |
} |
|
408 |
else |
|
409 |
{ |
|
410 |
iItemArray->InsertL(aIndex, iListboxFormatbuffer); |
|
411 |
} |
|
412 |
} |
|
413 |
||
414 |
void CPodcastQueueView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded) |
|
415 |
{ |
|
416 |
RShowInfoArray& array = iPodcastModel.ActiveShowList(); |
|
417 |
||
418 |
for (int i=0;i<array.Count();i++) { |
|
419 |
if (array[i]->Uid() == aUid) { |
|
420 |
UpdateShowItemDataL(array[i], i, aSizeDownloaded); |
|
421 |
if (iListContainer->Listbox()->TopItemIndex() <= i && |
|
422 |
iListContainer->Listbox()->BottomItemIndex() >= i) { |
|
423 |
iListContainer->Listbox()->DrawItem(i); |
|
424 |
} |
|
425 |
} |
|
426 |
} |
|
427 |
} |
|
428 |
||
429 |
void CPodcastQueueView::UpdateListboxItemsL() |
|
430 |
{ |
|
431 |
if (iListContainer->IsVisible()) |
|
432 |
{ |
|
433 |
TListItemProperties itemProps; |
|
434 |
TInt len = 0; |
|
435 |
||
8 | 436 |
iPodcastModel.GetShowsDownloadingL(); |
2 | 437 |
|
438 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
|
439 |
len = fItems.Count(); |
|
440 |
||
441 |
if (iListContainer->Listbox() != NULL) |
|
442 |
{ |
|
443 |
TBool allUidsMatch = EFalse; |
|
444 |
||
445 |
if (len == iListContainer->Listbox()->Model()->NumberOfItems()) |
|
446 |
{ |
|
447 |
allUidsMatch = ETrue; |
|
448 |
TUint itemId = 0; |
|
449 |
for (TInt loop = 0; loop< len; loop++) |
|
450 |
{ |
|
451 |
itemId = iItemIdArray[loop]; |
|
452 |
if (fItems[loop]->Uid() != itemId) |
|
453 |
{ |
|
454 |
allUidsMatch = EFalse; |
|
455 |
break; |
|
456 |
} |
|
457 |
} |
|
458 |
} |
|
459 |
||
460 |
if (allUidsMatch && len > 0) |
|
461 |
{ |
|
462 |
for (TInt loop = 0; loop< len; loop++) |
|
463 |
{ |
|
464 |
UpdateShowItemDataL(fItems[loop], loop); |
|
465 |
iListContainer->Listbox()->DrawItem(loop); |
|
466 |
} |
|
467 |
} |
|
468 |
else |
|
469 |
{ |
|
470 |
iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL(); |
|
471 |
iListContainer->Listbox()->Reset(); |
|
472 |
iItemIdArray.Reset(); |
|
473 |
iItemArray->Reset(); |
|
474 |
||
475 |
if (len > 0) |
|
476 |
{ |
|
477 |
for (TInt i=0; i<len; i++) |
|
478 |
{ |
|
479 |
CShowInfo *si = fItems[i]; |
|
480 |
FormatShowInfoListBoxItemL(*si); |
|
481 |
iItemIdArray.Append(si->Uid()); |
|
482 |
iItemArray->AppendL(iListboxFormatbuffer); |
|
483 |
} |
|
484 |
} |
|
485 |
else |
|
486 |
{ |
|
487 |
iItemArray->Reset(); |
|
488 |
iItemIdArray.Reset(); |
|
489 |
||
490 |
itemProps.SetDimmed(ETrue); |
|
491 |
itemProps.SetHiddenSelection(ETrue); |
|
492 |
} |
|
493 |
iListContainer->Listbox()->HandleItemAdditionL(); |
|
494 |
} |
|
495 |
} |
|
496 |
} |
|
497 |
} |
|
498 |
||
499 |
/** |
|
500 |
* Command handling function intended for overriding by sub classes. |
|
501 |
* Default implementation is empty. |
|
502 |
* @param aCommand ID of the command to respond to. |
|
503 |
*/ |
|
504 |
void CPodcastQueueView::HandleCommandL(TInt aCommand) |
|
505 |
{ |
|
506 |
switch (aCommand) |
|
507 |
{ |
|
508 |
case EPodcastRemoveAllDownloads: |
|
509 |
{ |
|
510 |
TBuf<KMaxMessageLength> msg; |
|
511 |
iEikonEnv->ReadResourceL(msg, R_CLEAR_QUERY); |
|
512 |
||
513 |
if(ShowQueryMessage(msg)) |
|
514 |
{ |
|
515 |
iPodcastModel.ShowEngine().RemoveAllDownloads(); |
|
516 |
UpdateListboxItemsL(); |
|
517 |
} |
|
518 |
} |
|
519 |
break; |
|
520 |
case EPodcastRemoveDownload: |
|
521 |
{ |
|
522 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
523 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
524 |
{ |
|
525 |
if (iPodcastModel.ShowEngine().RemoveDownloadL(iPodcastModel.ActiveShowList()[index]->Uid())) |
|
526 |
{ |
|
527 |
iItemArray->Delete(index); |
|
528 |
iItemIdArray.Remove(index); |
|
529 |
iListContainer->Listbox()->HandleItemRemovalL(); |
|
530 |
iListContainer->Listbox()->SetCurrentItemIndex(index - 1 > 0 ? index - 1 : 0); |
|
531 |
iListContainer->Listbox()->DrawNow(); |
|
532 |
||
533 |
delete iPodcastModel.ActiveShowList()[index]; |
|
534 |
iPodcastModel.ActiveShowList().Remove(index); |
|
535 |
} |
|
536 |
} |
|
537 |
} |
|
538 |
break; |
|
539 |
case EPodcastSuspendDownloads: |
|
540 |
{ |
|
541 |
iPodcastModel.ShowEngine().SuspendDownloads(); |
|
542 |
UpdateListboxItemsL(); |
|
543 |
} |
|
544 |
break; |
|
545 |
case EPodcastResumeDownloads: |
|
546 |
{ |
|
547 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
|
548 |
UpdateListboxItemsL(); |
|
549 |
} |
|
550 |
break; |
|
551 |
default: |
|
552 |
CPodcastListView::HandleCommandL(aCommand); |
|
553 |
break; |
|
554 |
} |
|
555 |
UpdateToolbar(); |
|
556 |
} |
|
557 |
||
558 |
void CPodcastQueueView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
559 |
{ |
|
560 |
if(aResourceId == R_PODCAST_SHOWSVIEW_MENU) |
|
561 |
{ |
|
562 |
aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, ETrue); |
|
563 |
} |
|
564 |
} |
|
565 |
||
13 | 566 |
void CPodcastQueueView::UpdateToolbar(TBool aVisible) |
2 | 567 |
{ |
568 |
CAknToolbar* toolbar = Toolbar(); |
|
569 |
||
13 | 570 |
if (toolbar) { |
571 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
|
572 |
TInt itemCnt = fItems.Count(); |
|
14
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
573 |
if (iListContainer->IsVisible()) { |
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
574 |
toolbar->SetToolbarVisibility(aVisible); |
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
575 |
} |
13 | 576 |
toolbar->HideItem(EPodcastRemoveAllDownloads, EFalse, ETrue); |
577 |
toolbar->SetItemDimmed(EPodcastRemoveAllDownloads, itemCnt == 0, ETrue); |
|
578 |
toolbar->HideItem(EPodcastSuspendDownloads,iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue); |
|
579 |
toolbar->HideItem(EPodcastResumeDownloads,!iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue); |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
14
diff
changeset
|
580 |
#ifdef SYMBIAN1_UI |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
14
diff
changeset
|
581 |
toolbar->HideItem(EPodcastRemoveDownload, EFalse, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
14
diff
changeset
|
582 |
toolbar->SetItemDimmed(EPodcastRemoveDownload, itemCnt == 0, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
14
diff
changeset
|
583 |
#endif |
13 | 584 |
} |
2 | 585 |
} |
586 |
||
587 |
void CPodcastQueueView::DownloadQueueUpdatedL(TInt /*aDownloadingShows*/, TInt /*aQueuedShows*/) |
|
588 |
{ |
|
589 |
} |
|
590 |
||
591 |
void CPodcastQueueView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
|
592 |
{ |
|
593 |
UpdateListboxItemsL(); |
|
594 |
UpdateToolbar(); |
|
595 |
} |