author | teknolog |
Thu, 04 Mar 2010 22:06:39 +0000 | |
changeset 34 | a6046405f1aa |
parent 33 | 64ed1227e68d |
child 36 | e010fc411ddc |
child 38 | c11e52c5acd2 |
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 "PodcastShowsView.h" |
|
20 |
#include "PodcastAppUi.h" |
|
21 |
#include "ShowEngine.h" |
|
22 |
#include "SettingsEngine.h" |
|
23 |
#include "PodcastApp.h" |
|
24 |
#include "imagehandler.h" |
|
25 |
#include "constants.h" |
|
26 |
||
27 |
#include <akntitle.h> |
|
28 |
#include <podcast.rsg> |
|
29 |
#include <podcast.mbg> |
|
30 |
#include <gulicon.h> |
|
31 |
#include <barsread.h> |
|
32 |
#include <aknnotedialog.h> |
|
33 |
#include <aknmessagequerydialog.h> |
|
34 |
||
35 |
#define KMaxMessageLength 200 |
|
36 |
||
37 |
#define KPodcastImageWidth 160 |
|
38 |
#define KPodcastImageHeight 120 |
|
39 |
#define KPodcastDialogOffset 2 |
|
40 |
||
41 |
#define KOneHundredPercent 100 |
|
42 |
||
43 |
const TInt KSizeBufLen = 64; |
|
44 |
const TInt KDefaultGran = 5; |
|
45 |
_LIT(KSizeDownloadingOf, "%.1f/%.1f MB"); |
|
46 |
_LIT(KShowsSizeFormatS60, "%.1f MB"); |
|
47 |
||
5 | 48 |
_LIT(KShowFormat, "%d\t%S\t%S%S\t"); |
2 | 49 |
_LIT(KShowErrorFormat, "%d\t%S\t%S\t"); |
50 |
_LIT(KShowQueueFormat, "%d\t%S\t%S%S\t"); |
|
51 |
||
52 |
// these must correspond with TShowsIconIndex |
|
53 |
||
54 |
const TUint KShowIconArrayIds[] = |
|
55 |
{ |
|
56 |
EMbmPodcastAudio, |
|
57 |
EMbmPodcastAudio_mask, |
|
58 |
EMbmPodcastAudio_new, |
|
59 |
EMbmPodcastAudio_new_mask, |
|
60 |
EMbmPodcastAudio_queued, |
|
61 |
EMbmPodcastAudio_queued_mask, |
|
62 |
EMbmPodcastAudio_downloading, |
|
63 |
EMbmPodcastAudio_downloading_mask, |
|
64 |
EMbmPodcastAudio_downloaded, |
|
65 |
EMbmPodcastAudio_downloaded_mask, |
|
66 |
EMbmPodcastAudio_downloaded_new, |
|
67 |
EMbmPodcastAudio_downloaded_new_mask, |
|
68 |
EMbmPodcastAudio_failed, |
|
69 |
EMbmPodcastAudio_failed_mask, |
|
70 |
EMbmPodcastAudio_suspended, |
|
71 |
EMbmPodcastAudio_suspended_mask, |
|
72 |
0, |
|
73 |
0 |
|
74 |
}; |
|
75 |
||
76 |
CPodcastShowsView* CPodcastShowsView::NewL(CPodcastModel& aPodcastModel) |
|
77 |
{ |
|
78 |
CPodcastShowsView* self = CPodcastShowsView::NewLC(aPodcastModel); |
|
79 |
CleanupStack::Pop(self); |
|
80 |
return self; |
|
81 |
} |
|
82 |
||
83 |
CPodcastShowsView* CPodcastShowsView::NewLC(CPodcastModel& aPodcastModel) |
|
84 |
{ |
|
85 |
CPodcastShowsView* self = new ( ELeave ) CPodcastShowsView(aPodcastModel); |
|
86 |
CleanupStack::PushL(self); |
|
87 |
self->ConstructL(); |
|
88 |
return self; |
|
89 |
} |
|
90 |
||
91 |
CPodcastShowsView::CPodcastShowsView(CPodcastModel& aPodcastModel) : |
|
92 |
iPodcastModel(aPodcastModel) |
|
93 |
{ |
|
94 |
} |
|
95 |
||
96 |
void CPodcastShowsView::ConstructL() |
|
97 |
{ |
|
98 |
BaseConstructL(R_PODCAST_SHOWSVIEW); |
|
99 |
CPodcastListView::ConstructL(); |
|
100 |
||
101 |
CreateIconsL(); |
|
102 |
||
103 |
iListContainer->Listbox()->SetListBoxObserver(this); |
|
104 |
||
105 |
iPodcastModel.FeedEngine().AddObserver(this); |
|
106 |
iPodcastModel.ShowEngine().AddObserver(this); |
|
107 |
||
108 |
iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0)); |
|
109 |
TResourceReader reader; |
|
110 |
iCoeEnv->CreateResourceReaderLC(reader,R_SHOWVIEW_POPUP_MENU); |
|
111 |
iStylusPopupMenu->ConstructFromResourceL(reader); |
|
112 |
||
113 |
CleanupStack::PopAndDestroy(); |
|
114 |
} |
|
115 |
||
116 |
void CPodcastShowsView::CreateIconsL() |
|
117 |
{ |
|
118 |
CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1); |
|
119 |
CleanupStack::PushL(icons); |
|
120 |
TInt pos = 0; |
|
121 |
while (KShowIconArrayIds[pos] > 0) |
|
122 |
{ |
|
123 |
// Load the bitmap for play icon |
|
124 |
CFbsBitmap* bitmap= NULL;//iEikonEnv->CreateBitmapL( _L("*"), KIconArrayIds[pos]); |
|
125 |
CFbsBitmap* mask= NULL;////iEikonEnv->CreateBitmapL( _L("*"), KIconArrayIds[pos+1] ); |
|
126 |
AknIconUtils::CreateIconL(bitmap, |
|
127 |
mask, |
|
128 |
iEikonEnv->EikAppUi()->Application()->BitmapStoreName(), |
|
129 |
KShowIconArrayIds[pos], |
|
130 |
KShowIconArrayIds[pos+1]); |
|
131 |
CleanupStack::PushL(bitmap); |
|
132 |
CleanupStack::PushL(mask); |
|
133 |
||
134 |
// Append the play icon to icon array |
|
135 |
icons->AppendL(CGulIcon::NewL(bitmap, mask) ); |
|
136 |
CleanupStack::Pop(2); // bitmap, mask |
|
137 |
pos+=2; |
|
138 |
} |
|
139 |
||
140 |
iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons); |
|
141 |
CleanupStack::Pop(icons); // icons |
|
142 |
} |
|
143 |
||
144 |
TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
145 |
{ |
|
146 |
if (aType == EEventKey) |
|
147 |
{ |
|
148 |
CShowInfo *activeShow = NULL; |
|
149 |
||
150 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
151 |
if(index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
152 |
{ |
|
153 |
activeShow = iPodcastModel.ActiveShowList()[index]; |
|
154 |
} |
|
155 |
||
156 |
if (activeShow != NULL) { |
|
157 |
DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode); |
|
158 |
switch (aKeyEvent.iCode) { |
|
159 |
case 117: |
|
160 |
case '*': |
|
161 |
case EKeySpace: |
|
162 |
if (activeShow->PlayState() == EPlayed) { |
|
163 |
HandleCommandL(EPodcastMarkAsUnplayed); |
|
164 |
} else { |
|
165 |
HandleCommandL(EPodcastMarkAsPlayed); |
|
166 |
} |
|
167 |
break; |
|
168 |
case 106: |
|
169 |
case '#': |
|
170 |
if (activeShow->DownloadState() == ENotDownloaded) { |
|
171 |
HandleCommandL(EPodcastDownloadShow); |
|
172 |
} |
|
173 |
break; |
|
174 |
case EKeyBackspace: |
|
175 |
case EKeyDelete: |
|
176 |
HandleCommandL(EPodcastDeleteShow); |
|
177 |
break; |
|
178 |
default: |
|
179 |
break; |
|
180 |
} |
|
181 |
UpdateToolbar(); |
|
182 |
} |
|
183 |
} |
|
184 |
return CPodcastListView::OfferKeyEventL(aKeyEvent, aType); |
|
185 |
} |
|
186 |
||
187 |
CPodcastShowsView::~CPodcastShowsView() |
|
188 |
{ |
|
189 |
iPodcastModel.ShowEngine().RemoveObserver(this); |
|
190 |
iPodcastModel.FeedEngine().RemoveObserver(this); |
|
191 |
||
192 |
if(iStylusPopupMenu) |
|
193 |
delete iStylusPopupMenu, iStylusPopupMenu = NULL; |
|
194 |
} |
|
195 |
||
196 |
||
197 |
TUid CPodcastShowsView::Id() const |
|
198 |
{ |
|
199 |
return KUidPodcastShowsViewID; |
|
200 |
} |
|
201 |
||
202 |
void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId, |
|
203 |
TUid aCustomMessageId, const TDesC8& aCustomMessage) |
|
204 |
{ |
|
205 |
DP("CPodcastShowsView::DoActivateL BEGIN"); |
|
206 |
||
207 |
UpdateViewTitleL(); |
|
208 |
||
209 |
CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
210 |
iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID); |
|
211 |
||
212 |
UpdateFeedUpdateStateL(); |
|
213 |
UpdateToolbar(); |
|
214 |
DP("CPodcastShowsView::DoActivateL END"); |
|
215 |
} |
|
216 |
||
217 |
void CPodcastShowsView::DoDeactivate() |
|
218 |
{ |
|
219 |
CAknTitlePane* titlePane = static_cast<CAknTitlePane*> |
|
220 |
( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
221 |
||
222 |
// titlePane->SetSmallPicture(NULL, NULL, ETrue); |
|
223 |
titlePane->SetPicture(NULL, NULL); |
|
224 |
titlePane->SetTextToDefaultL(); |
|
225 |
CPodcastListView::DoDeactivate(); |
|
226 |
} |
|
227 |
||
228 |
// Engine callback when new shows are available |
|
229 |
void CPodcastShowsView::ShowListUpdatedL() |
|
230 |
{ |
|
231 |
UpdateListboxItemsL(); |
|
232 |
} |
|
233 |
||
234 |
void CPodcastShowsView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/) |
|
235 |
{ |
|
236 |
if (!iListContainer->IsVisible()) |
|
237 |
{ |
|
238 |
return; |
|
239 |
} |
|
240 |
||
241 |
CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading(); |
|
242 |
if (info) |
|
243 |
{ |
|
244 |
UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload); |
|
245 |
} |
|
246 |
} |
|
247 |
||
34 | 248 |
void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError) |
2 | 249 |
{ |
250 |
iProgressAdded = EFalse; |
|
34 | 251 |
CShowInfo *info = NULL; |
252 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
|
253 |
||
254 |
for (TInt i=0;i<fItems.Count();i++) |
|
255 |
{ |
|
256 |
if (fItems[i]->Uid() == aShowUid) |
|
257 |
{ |
|
258 |
info = fItems[i]; |
|
259 |
} |
|
260 |
} |
|
261 |
||
262 |
if (info == NULL) { |
|
263 |
return; |
|
264 |
} |
|
2 | 265 |
|
266 |
switch(aError) |
|
267 |
{ |
|
268 |
case KErrCouldNotConnect: |
|
269 |
{ |
|
270 |
TBuf<KMaxMessageLength> message; |
|
271 |
iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR); |
|
272 |
ShowErrorMessage(message); |
|
273 |
} |
|
274 |
break; |
|
6 | 275 |
default: |
2 | 276 |
break; |
277 |
} |
|
6 | 278 |
UpdateListboxItemsL(); |
2 | 279 |
} |
280 |
||
281 |
||
282 |
void CPodcastShowsView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid) |
|
283 |
{ |
|
284 |
// TODO make use of the fact that we know that the feed download is |
|
285 |
// started instead of checking feed engine states in UpdateFeedUpdateStateL. |
|
286 |
if (iPodcastModel.ActiveFeedInfo() != NULL |
|
287 |
&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid) |
|
288 |
{ |
|
8 | 289 |
UpdateFeedUpdateStateL(); |
2 | 290 |
UpdateToolbar(); |
291 |
} |
|
292 |
} |
|
293 |
||
294 |
void CPodcastShowsView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/) |
|
295 |
{ |
|
296 |
DP("CPodcastShowsView::FeedDownloadFinishedL BEGIN"); |
|
297 |
// TODO make use of the fact that we know that the feed download is |
|
298 |
// finished instead of checking feed engine states in UpdateFeedUpdateStateL. |
|
299 |
if (iPodcastModel.ActiveFeedInfo() != NULL |
|
300 |
&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid) |
|
301 |
{ |
|
8 | 302 |
UpdateFeedUpdateStateL(); |
303 |
UpdateViewTitleL(); |
|
2 | 304 |
} |
305 |
DP("CPodcastShowsView::FeedDownloadFinishedL END"); |
|
306 |
} |
|
307 |
||
308 |
void CPodcastShowsView::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
309 |
TListBoxEvent aEventType) |
|
310 |
{ |
|
311 |
switch (aEventType) |
|
312 |
{ |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
313 |
#ifndef SYMBIAN1_UI |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
314 |
case EEventItemClicked: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
315 |
#endif |
2 | 316 |
case EEventEnterKeyPressed: |
317 |
case EEventItemActioned: |
|
318 |
case EEventItemDoubleClicked: |
|
319 |
{ |
|
320 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
|
321 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
322 |
if (index>=0 && index< fItems.Count()) |
|
323 |
{ |
|
324 |
DP2("Handle event for podcast %S, downloadState is %d", &(fItems[index]->Title()), fItems[index]->DownloadState()); |
|
325 |
CShowInfo *showInfo = fItems[index]; |
|
326 |
||
327 |
switch (showInfo->DownloadState()) { |
|
328 |
case ENotDownloaded: |
|
329 |
HandleCommandL(EPodcastDownloadShow); |
|
330 |
break; |
|
331 |
case EQueued: |
|
332 |
AppUi()->ActivateLocalViewL(KUidPodcastQueueViewID, TUid::Uid(0), KNullDesC8()); |
|
333 |
((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue); |
|
334 |
break; |
|
335 |
case EDownloaded: |
|
336 |
#pragma message("LAPER Replace activate playview with activate playback in mpx") |
|
337 |
break; |
|
338 |
default: |
|
339 |
break; |
|
340 |
} |
|
341 |
} |
|
342 |
} |
|
343 |
break; |
|
344 |
default: |
|
345 |
break; |
|
346 |
} |
|
347 |
UpdateToolbar(); |
|
348 |
} |
|
349 |
||
350 |
void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex) |
|
351 |
{ |
|
352 |
TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended(); |
|
34 | 353 |
|
354 |
switch (aShowInfo->DownloadState()) |
|
2 | 355 |
{ |
34 | 356 |
case EDownloaded: |
357 |
if (aShowInfo->PlayState() == ENeverPlayed) { |
|
358 |
aIconIndex = EDownloadedNewShowIcon; |
|
359 |
} else { |
|
360 |
aIconIndex = EDownloadedShowIcon; |
|
2 | 361 |
} |
34 | 362 |
break; |
363 |
case ENotDownloaded: |
|
364 |
if (aShowInfo->PlayState() == ENeverPlayed) { |
|
365 |
aIconIndex = ENewShowIcon; |
|
366 |
} else { |
|
367 |
aIconIndex = EShowIcon; |
|
368 |
} |
|
369 |
break; |
|
370 |
case EQueued: |
|
371 |
aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon; |
|
372 |
break; |
|
373 |
case EDownloading: |
|
374 |
aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon; |
|
375 |
break; |
|
376 |
case EFailedDownload: |
|
377 |
aIconIndex = EFailedShowIcon; |
|
378 |
break; |
|
2 | 379 |
} |
380 |
} |
|
381 |
||
382 |
||
383 |
void CPodcastShowsView::UpdateFeedUpdateStateL() |
|
384 |
{ |
|
385 |
TBool listboxDimmed = EFalse; |
|
386 |
||
387 |
if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() |
|
388 |
!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid()) |
|
389 |
{ |
|
390 |
listboxDimmed = ETrue; |
|
391 |
} |
|
392 |
||
393 |
if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed)) |
|
394 |
{ |
|
395 |
iListContainer->Listbox()->SetDimmed(listboxDimmed); |
|
396 |
} |
|
397 |
UpdateListboxItemsL(); |
|
398 |
UpdateToolbar(); |
|
399 |
} |
|
400 |
||
401 |
void CPodcastShowsView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded) |
|
402 |
{ |
|
403 |
TBuf<32> infoSize; |
|
404 |
TInt iconIndex = 0; |
|
405 |
TBuf<KMaxShortDateFormatSpec*2> showDate; |
|
406 |
GetShowIcons(&aShowInfo, iconIndex); |
|
407 |
||
408 |
if(aSizeDownloaded > 0) |
|
409 |
{ |
|
410 |
if (aShowInfo.ShowSize() > 0) |
|
411 |
{ |
|
412 |
infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb), |
|
413 |
((float)aShowInfo.ShowSize() / (float)KSizeMb)); |
|
414 |
} |
|
415 |
else |
|
416 |
{ |
|
417 |
infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb); |
|
418 |
} |
|
419 |
} |
|
420 |
else if (aShowInfo.ShowSize() > 0) |
|
421 |
{ |
|
422 |
infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb); |
|
423 |
} |
|
424 |
else { |
|
425 |
infoSize = KNullDesC(); |
|
426 |
} |
|
427 |
||
428 |
if (aShowInfo.PubDate().Int64() == 0) |
|
429 |
{ |
|
430 |
showDate = KNullDesC(); |
|
431 |
} |
|
432 |
else |
|
433 |
{ |
|
434 |
aShowInfo.PubDate().FormatL(showDate, KDateFormatShort()); |
|
435 |
} |
|
436 |
||
437 |
if(aShowInfo.LastError() != KErrNone) |
|
438 |
{ |
|
6 | 439 |
GetShowErrorText(infoSize, aShowInfo.LastError()); |
2 | 440 |
} |
6 | 441 |
|
442 |
if (infoSize.Length() > 0) |
|
2 | 443 |
{ |
6 | 444 |
infoSize.Insert(0,_L(", ")); |
2 | 445 |
} |
446 |
||
6 | 447 |
iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize); |
2 | 448 |
} |
449 |
||
450 |
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode) |
|
451 |
{ |
|
452 |
iEikonEnv->GetErrorText(aErrorMessage, aErrorCode); |
|
453 |
} |
|
454 |
||
455 |
void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded) |
|
456 |
{ |
|
457 |
FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded); |
|
458 |
iItemArray->Delete(aIndex); |
|
459 |
if(aIndex>= iItemArray->MdcaCount()) |
|
460 |
{ |
|
461 |
iItemArray->AppendL(iListboxFormatbuffer); |
|
462 |
} |
|
463 |
else |
|
464 |
{ |
|
465 |
iItemArray->InsertL(aIndex, iListboxFormatbuffer); |
|
466 |
} |
|
467 |
} |
|
468 |
||
469 |
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded) |
|
470 |
{ |
|
471 |
RShowInfoArray& array = iPodcastModel.ActiveShowList(); |
|
472 |
||
473 |
for (int i=0;i<array.Count();i++) { |
|
474 |
if (array[i]->Uid() == aUid) { |
|
475 |
UpdateShowItemDataL(array[i], i, aSizeDownloaded); |
|
476 |
if (iListContainer->Listbox()->TopItemIndex() <= i && |
|
477 |
iListContainer->Listbox()->BottomItemIndex() >= i) { |
|
478 |
iListContainer->Listbox()->DrawItem(i); |
|
479 |
} |
|
480 |
} |
|
481 |
} |
|
482 |
} |
|
483 |
||
484 |
void CPodcastShowsView::UpdateListboxItemsL() |
|
485 |
{ |
|
486 |
if (iListContainer->IsVisible()) |
|
487 |
{ |
|
488 |
TListItemProperties itemProps; |
|
489 |
TInt len = 0; |
|
490 |
||
8 | 491 |
iPodcastModel.GetShowsByFeedL(iPodcastModel.ActiveFeedInfo()->Uid()); |
2 | 492 |
|
493 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
|
494 |
len = fItems.Count(); |
|
495 |
||
496 |
if (iListContainer->Listbox() != NULL) |
|
497 |
{ |
|
498 |
TBool allUidsMatch = EFalse; |
|
499 |
||
500 |
if (len == iListContainer->Listbox()->Model()->NumberOfItems()) |
|
501 |
{ |
|
502 |
allUidsMatch = ETrue; |
|
503 |
TUint itemId = 0; |
|
504 |
for (TInt loop = 0; loop< len; loop++) |
|
505 |
{ |
|
506 |
itemId = iItemIdArray[loop]; |
|
507 |
if (fItems[loop]->Uid() != itemId) |
|
508 |
{ |
|
509 |
allUidsMatch = EFalse; |
|
510 |
break; |
|
511 |
} |
|
512 |
} |
|
513 |
} |
|
514 |
||
515 |
if (allUidsMatch && len > 0) |
|
516 |
{ |
|
517 |
for (TInt loop = 0; loop< len; loop++) |
|
34 | 518 |
{ |
6 | 519 |
UpdateShowItemDataL(fItems[loop], loop); |
2 | 520 |
} |
31
8a5ead064c4f
Shows view now updates correctl after Mark all played
teknolog
parents:
28
diff
changeset
|
521 |
iListContainer->Listbox()->DrawNow(); |
2 | 522 |
} |
523 |
else |
|
524 |
{ |
|
525 |
iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL(); |
|
526 |
iListContainer->Listbox()->Reset(); |
|
527 |
iItemIdArray.Reset(); |
|
528 |
iItemArray->Reset(); |
|
529 |
||
530 |
if (len > 0) |
|
531 |
{ |
|
532 |
for (TInt i=0; i<len; i++) |
|
533 |
{ |
|
534 |
CShowInfo *si = fItems[i]; |
|
535 |
FormatShowInfoListBoxItemL(*si); |
|
536 |
iItemIdArray.Append(si->Uid()); |
|
537 |
iItemArray->AppendL(iListboxFormatbuffer); |
|
538 |
} |
|
539 |
} |
|
540 |
else |
|
541 |
{ |
|
542 |
iItemArray->Reset(); |
|
543 |
iItemIdArray.Reset(); |
|
544 |
||
545 |
itemProps.SetDimmed(ETrue); |
|
546 |
itemProps.SetHiddenSelection(ETrue); |
|
547 |
} |
|
548 |
iListContainer->Listbox()->HandleItemAdditionL(); |
|
549 |
} |
|
550 |
} |
|
551 |
} |
|
552 |
} |
|
553 |
||
554 |
/** |
|
555 |
* Command handling function intended for overriding by sub classes. |
|
556 |
* Default implementation is empty. |
|
557 |
* @param aCommand ID of the command to respond to. |
|
558 |
*/ |
|
559 |
void CPodcastShowsView::HandleCommandL(TInt aCommand) |
|
560 |
{ |
|
561 |
switch (aCommand) |
|
562 |
{ |
|
563 |
case EPodcastMarkAsPlayed: |
|
5 | 564 |
HandleSetShowPlayed(ETrue); |
2 | 565 |
break; |
566 |
case EPodcastMarkAsUnplayed: |
|
5 | 567 |
HandleSetShowPlayed(EFalse); |
2 | 568 |
break; |
569 |
case EPodcastMarkAllPlayed: |
|
570 |
iPodcastModel.MarkSelectionPlayed(); |
|
571 |
UpdateListboxItemsL(); |
|
572 |
break; |
|
573 |
case EPodcastDeleteShow: |
|
5 | 574 |
HandleDeleteShow(); |
2 | 575 |
break; |
576 |
case EPodcastDownloadShow: |
|
577 |
{ |
|
578 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
33
64ed1227e68d
Fix for problem when new download can not be started after one is completed
teknolog
parents:
32
diff
changeset
|
579 |
|
2 | 580 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
581 |
{ |
|
582 |
iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]); |
|
583 |
UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1); |
|
584 |
} |
|
585 |
} |
|
586 |
break; |
|
587 |
case EPodcastUpdateFeed: |
|
588 |
{ |
|
589 |
||
590 |
if (iPodcastModel.ActiveFeedInfo()->Url().Length()>0) |
|
591 |
{ |
|
592 |
TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid())); |
|
593 |
||
594 |
if (error != KErrNone) |
|
595 |
{ |
|
5 | 596 |
HBufC* str = |
2 | 597 |
iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR); |
598 |
User::InfoPrint(*str); |
|
599 |
CleanupStack::PopAndDestroy(str); |
|
600 |
} |
|
601 |
} |
|
602 |
} |
|
603 |
break; |
|
604 |
case EPodcastCancelUpdateAllFeeds: |
|
605 |
iPodcastModel.FeedEngine().CancelUpdateAllFeeds(); |
|
606 |
break; |
|
607 |
case EPodcastShowInfo: |
|
608 |
{ |
|
609 |
DisplayShowInfoDialogL(); |
|
610 |
}break; |
|
611 |
default: |
|
612 |
CPodcastListView::HandleCommandL(aCommand); |
|
613 |
break; |
|
614 |
} |
|
28 | 615 |
iListContainer->SetLongTapDetected(EFalse); |
616 |
||
2 | 617 |
UpdateToolbar(); |
618 |
} |
|
619 |
||
620 |
void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
621 |
{ |
|
622 |
if(aResourceId == R_PODCAST_SHOWSVIEW_MENU) |
|
623 |
{ |
|
624 |
TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
|
625 |
aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState); |
|
626 |
} |
|
627 |
} |
|
628 |
||
32
26a3f2dfba08
Fix for bug where we always load the feed icon a large number of times
teknolog
parents:
31
diff
changeset
|
629 |
void CPodcastShowsView::ImageOperationCompleteL(TInt aError, TUint /*aHandle*/) |
2 | 630 |
{ |
631 |
iLastImageHandlerError = aError; |
|
632 |
if(iSetTitlebarImage) |
|
633 |
{ |
|
634 |
iSetTitlebarImage = EFalse; |
|
635 |
if(aError == KErrNone) |
|
636 |
{ |
|
637 |
CAknTitlePane* titlePane = static_cast<CAknTitlePane*> |
|
638 |
( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
639 |
titlePane->SetSmallPicture(iPodcastModel.ImageHandler().ScaledBitmap(), NULL, ETrue); |
|
640 |
} |
|
641 |
else |
|
642 |
{ |
|
643 |
iPodcastModel.ImageHandler().ScaledBitmap(); |
|
644 |
} |
|
645 |
||
646 |
} |
|
647 |
else |
|
648 |
{ |
|
649 |
CActiveScheduler::Stop(); |
|
650 |
} |
|
651 |
} |
|
652 |
||
653 |
void CPodcastShowsView::DisplayShowInfoDialogL() |
|
654 |
{ |
|
655 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
656 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
657 |
{ |
|
658 |
CShowInfo* info = iPodcastModel.ActiveShowList()[index]; |
|
24
ca50ea154990
Moved search result title to navipane. Fixed but 1832
teknolog
parents:
23
diff
changeset
|
659 |
|
ca50ea154990
Moved search result title to navipane. Fixed but 1832
teknolog
parents:
23
diff
changeset
|
660 |
HBufC *title = info->Title().AllocL(); |
ca50ea154990
Moved search result title to navipane. Fixed but 1832
teknolog
parents:
23
diff
changeset
|
661 |
HBufC *description = info->Description().AllocL(); |
2 | 662 |
|
24
ca50ea154990
Moved search result title to navipane. Fixed but 1832
teknolog
parents:
23
diff
changeset
|
663 |
CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title ); |
2 | 664 |
|
665 |
note->PrepareLC( R_SHOW_INFO_NOTE ); // Adds to CleanupStack |
|
24
ca50ea154990
Moved search result title to navipane. Fixed but 1832
teknolog
parents:
23
diff
changeset
|
666 |
note->RunLD(); |
2 | 667 |
} |
668 |
} |
|
669 |
||
13 | 670 |
void CPodcastShowsView::UpdateToolbar(TBool aVisible) |
2 | 671 |
{ |
672 |
CAknToolbar* toolbar = Toolbar(); |
|
13 | 673 |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
674 |
if (toolbar) { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
675 |
if (iListContainer->IsVisible()) { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
676 |
toolbar->SetToolbarVisibility(aVisible); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
677 |
} |
2 | 678 |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
679 |
TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
680 |
iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
14
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
681 |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
682 |
toolbar->HideItem(EPodcastUpdateFeed, updatingState, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
683 |
toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !updatingState, ETrue ); |
2 | 684 |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
685 |
#ifdef SYMBIAN1_UI |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
686 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
687 |
TInt itemCnt = fItems.Count(); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
688 |
|
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
689 |
TBool hideDownloadShowCmd = EFalse; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
690 |
TBool dimDownloadShowCmd = EFalse; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
691 |
TBool hideSetPlayed = EFalse; |
2 | 692 |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
693 |
if(iListContainer->Listbox() != NULL) |
2 | 694 |
{ |
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
695 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
696 |
|
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
697 |
if(index>= 0 && index < itemCnt) |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
698 |
{ |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
699 |
switch(fItems[index]->DownloadState()) |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
700 |
{ |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
701 |
case ENotDownloaded: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
702 |
case EFailedDownload: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
703 |
hideDownloadShowCmd = EFalse; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
704 |
dimDownloadShowCmd = EFalse; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
705 |
break; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
706 |
case EQueued: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
707 |
case EDownloading: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
708 |
hideDownloadShowCmd = EFalse; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
709 |
dimDownloadShowCmd = ETrue; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
710 |
break; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
711 |
case EDownloaded: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
712 |
hideDownloadShowCmd = ETrue; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
713 |
break; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
714 |
} |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
715 |
|
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
716 |
if(fItems[index]->PlayState() == EPlayed) { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
717 |
hideSetPlayed = ETrue; |
2 | 718 |
} |
719 |
} |
|
720 |
} |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
721 |
|
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
722 |
if (hideDownloadShowCmd) { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
723 |
toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
724 |
toolbar->HideItem(EPodcastDeleteShow, EFalse, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
725 |
toolbar->SetItemDimmed(EPodcastDeleteShow, updatingState, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
726 |
} else { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
727 |
toolbar->HideItem(EPodcastDownloadShow, EFalse, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
728 |
toolbar->HideItem(EPodcastDeleteShow, ETrue, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
729 |
toolbar->SetItemDimmed(EPodcastDownloadShow, updatingState || dimDownloadShowCmd, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
730 |
} |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
731 |
|
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
732 |
if (hideSetPlayed) { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
733 |
toolbar->HideItem(EPodcastMarkAsPlayed, ETrue, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
734 |
toolbar->HideItem(EPodcastMarkAsUnplayed, EFalse, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
735 |
toolbar->SetItemDimmed(EPodcastMarkAsUnplayed, updatingState, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
736 |
} else { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
737 |
toolbar->HideItem(EPodcastMarkAsPlayed, EFalse, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
738 |
toolbar->HideItem(EPodcastMarkAsUnplayed, ETrue, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
739 |
toolbar->SetItemDimmed(EPodcastMarkAsPlayed, updatingState, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
740 |
} |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
741 |
#endif |
2 | 742 |
} |
743 |
} |
|
744 |
||
745 |
void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
|
746 |
{ |
|
747 |
DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
|
28 | 748 |
|
749 |
iListContainer->SetLongTapDetected(ETrue); |
|
750 |
||
4
be243543a361
Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents:
3
diff
changeset
|
751 |
const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
be243543a361
Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents:
3
diff
changeset
|
752 |
TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
be243543a361
Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents:
3
diff
changeset
|
753 |
iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
be243543a361
Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents:
3
diff
changeset
|
754 |
|
be243543a361
Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents:
3
diff
changeset
|
755 |
if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight) |
2 | 756 |
{ |
757 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
758 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
759 |
{ |
|
760 |
CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
|
761 |
TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded; |
|
762 |
TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded; |
|
763 |
TBool hideMarkOld = info->PlayState() == EPlayed; |
|
764 |
||
765 |
iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld); |
|
766 |
iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld); |
|
767 |
||
768 |
iStylusPopupMenu->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd); |
|
769 |
iStylusPopupMenu->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd); |
|
770 |
} |
|
771 |
||
772 |
iStylusPopupMenu->ShowMenu(); |
|
773 |
iStylusPopupMenu->SetPosition(aPenEventLocation); |
|
774 |
} |
|
775 |
DP("CPodcastShowsView::HandleLongTapEventL END"); |
|
776 |
} |
|
777 |
||
5 | 778 |
void CPodcastShowsView::HandleSetShowPlayed(TBool aPlayed) |
2 | 779 |
{ |
780 |
||
781 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
782 |
||
783 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
784 |
{ |
|
785 |
CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
|
786 |
info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
|
787 |
iPodcastModel.ShowEngine().UpdateShow(*info); |
|
788 |
UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
|
789 |
iListContainer->Listbox()->DrawItem(index); |
|
790 |
} |
|
791 |
} |
|
792 |
||
5 | 793 |
void CPodcastShowsView::HandleDeleteShow() |
2 | 794 |
{ |
795 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
796 |
||
797 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
798 |
{ |
|
799 |
CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
|
800 |
TBuf<KMaxMessageLength> msg; |
|
801 |
TBuf<KMaxMessageLength> templ; |
|
802 |
iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT); |
|
803 |
msg.Format(templ, &(info->Title())); |
|
804 |
if (ShowQueryMessage(msg)) |
|
805 |
{ |
|
806 |
iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid()); |
|
807 |
||
808 |
// and mark as played, and not downloaded |
|
809 |
||
810 |
info->SetDownloadState(ENotDownloaded); |
|
811 |
info->SetPlayState(EPlayed); |
|
812 |
iPodcastModel.ShowEngine().UpdateShow(*info); |
|
813 |
||
814 |
UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
|
815 |
iListContainer->Listbox()->DrawItem(index); |
|
816 |
} |
|
817 |
} |
|
818 |
} |
|
819 |
||
16 | 820 |
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
2 | 821 |
{ |
16 | 822 |
((CPodcastAppUi*)AppUi())->UpdateQueueTab(aDownloadingShows+aQueuedShows); |
34 | 823 |
UpdateListboxItemsL(); |
2 | 824 |
} |
825 |
||
826 |
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
|
827 |
{ |
|
828 |
UpdateListboxItemsL(); |
|
829 |
UpdateToolbar(); |
|
830 |
} |
|
831 |
||
832 |
void CPodcastShowsView::UpdateViewTitleL() |
|
833 |
{ |
|
834 |
DP("CPodcastShowsView::UpdateViewTitleL BEGIN"); |
|
835 |
CAknTitlePane* titlePane = static_cast<CAknTitlePane*> |
|
836 |
( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
837 |
||
838 |
TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && |
|
839 |
iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
|
840 |
||
841 |
if (updatingState) { |
|
842 |
SetEmptyTextL(R_PODCAST_EMPTY_LIST_UPDATING); |
|
843 |
} else { |
|
844 |
SetEmptyTextL(R_PODCAST_EMPTY_LIST); |
|
845 |
} |
|
846 |
||
847 |
if(iPodcastModel.ActiveFeedInfo()) |
|
848 |
{ |
|
849 |
if (iPodcastModel.ActiveFeedInfo()->Title() != KNullDesC) |
|
850 |
{ |
|
851 |
titlePane->SetTextL( iPodcastModel.ActiveFeedInfo()->Title(), ETrue ); |
|
852 |
} |
|
853 |
} |
|
854 |
else |
|
855 |
{ |
|
856 |
titlePane->SetPicture(NULL, NULL); |
|
857 |
titlePane->SetTextToDefaultL(); |
|
858 |
} |
|
859 |
||
860 |
DP("CPodcastShowsView::UpdateViewTitleL END"); |
|
861 |
} |