author | teknolog |
Sun, 28 Feb 2010 23:00:55 +0000 | |
changeset 28 | 7aa3544d8be3 |
parent 24 | ca50ea154990 |
child 31 | 8a5ead064c4f |
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 "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 |
||
248 |
void CPodcastShowsView::ShowDownloadFinishedL(TUint /*aShowUid*/, TInt aError) |
|
249 |
{ |
|
250 |
iProgressAdded = EFalse; |
|
251 |
||
252 |
switch(aError) |
|
253 |
{ |
|
254 |
case KErrCouldNotConnect: |
|
255 |
{ |
|
256 |
TBuf<KMaxMessageLength> message; |
|
257 |
iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR); |
|
258 |
ShowErrorMessage(message); |
|
259 |
} |
|
260 |
break; |
|
6 | 261 |
default: |
2 | 262 |
break; |
263 |
} |
|
6 | 264 |
UpdateListboxItemsL(); |
2 | 265 |
} |
266 |
||
267 |
||
268 |
void CPodcastShowsView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid) |
|
269 |
{ |
|
270 |
// TODO make use of the fact that we know that the feed download is |
|
271 |
// started instead of checking feed engine states in UpdateFeedUpdateStateL. |
|
272 |
if (iPodcastModel.ActiveFeedInfo() != NULL |
|
273 |
&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid) |
|
274 |
{ |
|
8 | 275 |
UpdateFeedUpdateStateL(); |
2 | 276 |
UpdateToolbar(); |
277 |
} |
|
278 |
} |
|
279 |
||
280 |
void CPodcastShowsView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/) |
|
281 |
{ |
|
282 |
DP("CPodcastShowsView::FeedDownloadFinishedL BEGIN"); |
|
283 |
// TODO make use of the fact that we know that the feed download is |
|
284 |
// finished instead of checking feed engine states in UpdateFeedUpdateStateL. |
|
285 |
if (iPodcastModel.ActiveFeedInfo() != NULL |
|
286 |
&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid) |
|
287 |
{ |
|
8 | 288 |
UpdateFeedUpdateStateL(); |
289 |
UpdateViewTitleL(); |
|
2 | 290 |
} |
291 |
DP("CPodcastShowsView::FeedDownloadFinishedL END"); |
|
292 |
} |
|
293 |
||
294 |
void CPodcastShowsView::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
295 |
TListBoxEvent aEventType) |
|
296 |
{ |
|
297 |
switch (aEventType) |
|
298 |
{ |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
299 |
#ifndef SYMBIAN1_UI |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
300 |
case EEventItemClicked: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
301 |
#endif |
2 | 302 |
case EEventEnterKeyPressed: |
303 |
case EEventItemActioned: |
|
304 |
case EEventItemDoubleClicked: |
|
305 |
{ |
|
306 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
|
307 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
308 |
if (index>=0 && index< fItems.Count()) |
|
309 |
{ |
|
310 |
DP2("Handle event for podcast %S, downloadState is %d", &(fItems[index]->Title()), fItems[index]->DownloadState()); |
|
311 |
CShowInfo *showInfo = fItems[index]; |
|
312 |
||
313 |
switch (showInfo->DownloadState()) { |
|
314 |
case ENotDownloaded: |
|
315 |
HandleCommandL(EPodcastDownloadShow); |
|
316 |
break; |
|
317 |
case EQueued: |
|
318 |
AppUi()->ActivateLocalViewL(KUidPodcastQueueViewID, TUid::Uid(0), KNullDesC8()); |
|
319 |
((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue); |
|
320 |
break; |
|
321 |
case EDownloaded: |
|
322 |
#pragma message("LAPER Replace activate playview with activate playback in mpx") |
|
323 |
break; |
|
324 |
default: |
|
325 |
break; |
|
326 |
} |
|
327 |
} |
|
328 |
} |
|
329 |
break; |
|
330 |
default: |
|
331 |
break; |
|
332 |
} |
|
333 |
UpdateToolbar(); |
|
334 |
} |
|
335 |
||
336 |
void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex) |
|
337 |
{ |
|
338 |
TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended(); |
|
339 |
TUint showDownloadingUid = iPodcastModel.ShowEngine().ShowDownloading() ? iPodcastModel.ShowEngine().ShowDownloading()->Uid() : 0; |
|
340 |
||
341 |
if (showDownloadingUid == aShowInfo->Uid()) |
|
342 |
{ |
|
343 |
aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon; |
|
344 |
} |
|
345 |
else |
|
346 |
{ |
|
347 |
switch (aShowInfo->DownloadState()) |
|
348 |
{ |
|
349 |
case EDownloaded: |
|
350 |
if (aShowInfo->PlayState() == ENeverPlayed) { |
|
351 |
aIconIndex = EDownloadedNewShowIcon; |
|
352 |
} else { |
|
353 |
aIconIndex = EDownloadedShowIcon; |
|
354 |
} |
|
355 |
break; |
|
356 |
case ENotDownloaded: |
|
357 |
if (aShowInfo->PlayState() == ENeverPlayed) { |
|
358 |
aIconIndex = ENewShowIcon; |
|
359 |
} else { |
|
360 |
aIconIndex = EShowIcon; |
|
361 |
} |
|
362 |
break; |
|
363 |
case EQueued: |
|
364 |
aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon; |
|
365 |
break; |
|
366 |
case EDownloading: |
|
367 |
aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon; |
|
368 |
break; |
|
369 |
case EFailedDownload: |
|
370 |
aIconIndex = EFailedShowIcon; |
|
371 |
break; |
|
372 |
} |
|
373 |
} |
|
374 |
} |
|
375 |
||
376 |
||
377 |
void CPodcastShowsView::UpdateFeedUpdateStateL() |
|
378 |
{ |
|
379 |
TBool listboxDimmed = EFalse; |
|
380 |
||
381 |
if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() |
|
382 |
!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid()) |
|
383 |
{ |
|
384 |
listboxDimmed = ETrue; |
|
385 |
} |
|
386 |
||
387 |
if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed)) |
|
388 |
{ |
|
389 |
iListContainer->Listbox()->SetDimmed(listboxDimmed); |
|
390 |
} |
|
391 |
UpdateListboxItemsL(); |
|
392 |
UpdateToolbar(); |
|
393 |
} |
|
394 |
||
395 |
void CPodcastShowsView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded) |
|
396 |
{ |
|
397 |
TBuf<32> infoSize; |
|
398 |
TInt iconIndex = 0; |
|
399 |
TBuf<KMaxShortDateFormatSpec*2> showDate; |
|
400 |
GetShowIcons(&aShowInfo, iconIndex); |
|
401 |
||
402 |
if(aSizeDownloaded > 0) |
|
403 |
{ |
|
404 |
if (aShowInfo.ShowSize() > 0) |
|
405 |
{ |
|
406 |
infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb), |
|
407 |
((float)aShowInfo.ShowSize() / (float)KSizeMb)); |
|
408 |
} |
|
409 |
else |
|
410 |
{ |
|
411 |
infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb); |
|
412 |
} |
|
413 |
} |
|
414 |
else if (aShowInfo.ShowSize() > 0) |
|
415 |
{ |
|
416 |
infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb); |
|
417 |
} |
|
418 |
else { |
|
419 |
infoSize = KNullDesC(); |
|
420 |
} |
|
421 |
||
422 |
if (aShowInfo.PubDate().Int64() == 0) |
|
423 |
{ |
|
424 |
showDate = KNullDesC(); |
|
425 |
} |
|
426 |
else |
|
427 |
{ |
|
428 |
aShowInfo.PubDate().FormatL(showDate, KDateFormatShort()); |
|
429 |
} |
|
430 |
||
431 |
if(aShowInfo.LastError() != KErrNone) |
|
432 |
{ |
|
6 | 433 |
GetShowErrorText(infoSize, aShowInfo.LastError()); |
2 | 434 |
} |
6 | 435 |
|
436 |
if (infoSize.Length() > 0) |
|
2 | 437 |
{ |
6 | 438 |
infoSize.Insert(0,_L(", ")); |
2 | 439 |
} |
440 |
||
6 | 441 |
iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize); |
2 | 442 |
} |
443 |
||
444 |
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode) |
|
445 |
{ |
|
446 |
iEikonEnv->GetErrorText(aErrorMessage, aErrorCode); |
|
447 |
} |
|
448 |
||
449 |
void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded) |
|
450 |
{ |
|
451 |
FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded); |
|
452 |
iItemArray->Delete(aIndex); |
|
453 |
if(aIndex>= iItemArray->MdcaCount()) |
|
454 |
{ |
|
455 |
iItemArray->AppendL(iListboxFormatbuffer); |
|
456 |
} |
|
457 |
else |
|
458 |
{ |
|
459 |
iItemArray->InsertL(aIndex, iListboxFormatbuffer); |
|
460 |
} |
|
461 |
} |
|
462 |
||
463 |
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded) |
|
464 |
{ |
|
465 |
RShowInfoArray& array = iPodcastModel.ActiveShowList(); |
|
466 |
||
467 |
for (int i=0;i<array.Count();i++) { |
|
468 |
if (array[i]->Uid() == aUid) { |
|
469 |
UpdateShowItemDataL(array[i], i, aSizeDownloaded); |
|
470 |
if (iListContainer->Listbox()->TopItemIndex() <= i && |
|
471 |
iListContainer->Listbox()->BottomItemIndex() >= i) { |
|
472 |
iListContainer->Listbox()->DrawItem(i); |
|
473 |
} |
|
474 |
} |
|
475 |
} |
|
476 |
} |
|
477 |
||
478 |
void CPodcastShowsView::UpdateListboxItemsL() |
|
479 |
{ |
|
480 |
if (iListContainer->IsVisible()) |
|
481 |
{ |
|
482 |
TListItemProperties itemProps; |
|
483 |
TInt len = 0; |
|
484 |
||
8 | 485 |
iPodcastModel.GetShowsByFeedL(iPodcastModel.ActiveFeedInfo()->Uid()); |
2 | 486 |
|
487 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
|
488 |
len = fItems.Count(); |
|
489 |
||
490 |
if (iListContainer->Listbox() != NULL) |
|
491 |
{ |
|
492 |
TBool allUidsMatch = EFalse; |
|
493 |
||
494 |
if (len == iListContainer->Listbox()->Model()->NumberOfItems()) |
|
495 |
{ |
|
496 |
allUidsMatch = ETrue; |
|
497 |
TUint itemId = 0; |
|
498 |
for (TInt loop = 0; loop< len; loop++) |
|
499 |
{ |
|
500 |
itemId = iItemIdArray[loop]; |
|
501 |
if (fItems[loop]->Uid() != itemId) |
|
502 |
{ |
|
503 |
allUidsMatch = EFalse; |
|
504 |
break; |
|
505 |
} |
|
506 |
} |
|
507 |
} |
|
508 |
||
509 |
if (allUidsMatch && len > 0) |
|
510 |
{ |
|
511 |
for (TInt loop = 0; loop< len; loop++) |
|
512 |
{ |
|
6 | 513 |
UpdateShowItemDataL(fItems[loop], loop); |
10 | 514 |
//iListContainer->Listbox()->DrawItem(loop); |
2 | 515 |
} |
516 |
} |
|
517 |
else |
|
518 |
{ |
|
519 |
iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL(); |
|
520 |
iListContainer->Listbox()->Reset(); |
|
521 |
iItemIdArray.Reset(); |
|
522 |
iItemArray->Reset(); |
|
523 |
||
524 |
if (len > 0) |
|
525 |
{ |
|
526 |
for (TInt i=0; i<len; i++) |
|
527 |
{ |
|
528 |
CShowInfo *si = fItems[i]; |
|
529 |
FormatShowInfoListBoxItemL(*si); |
|
530 |
iItemIdArray.Append(si->Uid()); |
|
531 |
iItemArray->AppendL(iListboxFormatbuffer); |
|
532 |
} |
|
533 |
} |
|
534 |
else |
|
535 |
{ |
|
536 |
iItemArray->Reset(); |
|
537 |
iItemIdArray.Reset(); |
|
538 |
||
539 |
itemProps.SetDimmed(ETrue); |
|
540 |
itemProps.SetHiddenSelection(ETrue); |
|
541 |
} |
|
542 |
iListContainer->Listbox()->HandleItemAdditionL(); |
|
543 |
} |
|
544 |
} |
|
545 |
} |
|
546 |
} |
|
547 |
||
548 |
/** |
|
549 |
* Command handling function intended for overriding by sub classes. |
|
550 |
* Default implementation is empty. |
|
551 |
* @param aCommand ID of the command to respond to. |
|
552 |
*/ |
|
553 |
void CPodcastShowsView::HandleCommandL(TInt aCommand) |
|
554 |
{ |
|
555 |
switch (aCommand) |
|
556 |
{ |
|
557 |
case EPodcastMarkAsPlayed: |
|
5 | 558 |
HandleSetShowPlayed(ETrue); |
2 | 559 |
break; |
560 |
case EPodcastMarkAsUnplayed: |
|
5 | 561 |
HandleSetShowPlayed(EFalse); |
2 | 562 |
break; |
563 |
case EPodcastMarkAllPlayed: |
|
564 |
iPodcastModel.MarkSelectionPlayed(); |
|
565 |
UpdateListboxItemsL(); |
|
566 |
break; |
|
567 |
case EPodcastDeleteShow: |
|
5 | 568 |
HandleDeleteShow(); |
2 | 569 |
break; |
570 |
case EPodcastDownloadShow: |
|
571 |
{ |
|
572 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
573 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
574 |
{ |
|
575 |
iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]); |
|
576 |
UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1); |
|
577 |
} |
|
578 |
} |
|
579 |
break; |
|
580 |
case EPodcastUpdateFeed: |
|
581 |
{ |
|
582 |
||
583 |
if (iPodcastModel.ActiveFeedInfo()->Url().Length()>0) |
|
584 |
{ |
|
585 |
TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid())); |
|
586 |
||
587 |
if (error != KErrNone) |
|
588 |
{ |
|
5 | 589 |
HBufC* str = |
2 | 590 |
iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR); |
591 |
User::InfoPrint(*str); |
|
592 |
CleanupStack::PopAndDestroy(str); |
|
593 |
} |
|
594 |
} |
|
595 |
} |
|
596 |
break; |
|
597 |
case EPodcastCancelUpdateAllFeeds: |
|
598 |
iPodcastModel.FeedEngine().CancelUpdateAllFeeds(); |
|
599 |
break; |
|
600 |
case EPodcastShowInfo: |
|
601 |
{ |
|
602 |
DisplayShowInfoDialogL(); |
|
603 |
}break; |
|
604 |
default: |
|
605 |
CPodcastListView::HandleCommandL(aCommand); |
|
606 |
break; |
|
607 |
} |
|
28 | 608 |
iListContainer->SetLongTapDetected(EFalse); |
609 |
||
2 | 610 |
UpdateToolbar(); |
611 |
} |
|
612 |
||
613 |
void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
614 |
{ |
|
615 |
if(aResourceId == R_PODCAST_SHOWSVIEW_MENU) |
|
616 |
{ |
|
617 |
TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
|
618 |
aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState); |
|
619 |
} |
|
620 |
} |
|
621 |
||
622 |
void CPodcastShowsView::ImageOperationCompleteL(TInt aError) |
|
623 |
{ |
|
624 |
iLastImageHandlerError = aError; |
|
625 |
if(iSetTitlebarImage) |
|
626 |
{ |
|
627 |
iSetTitlebarImage = EFalse; |
|
628 |
if(aError == KErrNone) |
|
629 |
{ |
|
630 |
CAknTitlePane* titlePane = static_cast<CAknTitlePane*> |
|
631 |
( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
632 |
titlePane->SetSmallPicture(iPodcastModel.ImageHandler().ScaledBitmap(), NULL, ETrue); |
|
633 |
} |
|
634 |
else |
|
635 |
{ |
|
636 |
iPodcastModel.ImageHandler().ScaledBitmap(); |
|
637 |
} |
|
638 |
||
639 |
} |
|
640 |
else |
|
641 |
{ |
|
642 |
CActiveScheduler::Stop(); |
|
643 |
} |
|
644 |
} |
|
645 |
||
646 |
void CPodcastShowsView::DisplayShowInfoDialogL() |
|
647 |
{ |
|
648 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
649 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
650 |
{ |
|
651 |
CShowInfo* info = iPodcastModel.ActiveShowList()[index]; |
|
24
ca50ea154990
Moved search result title to navipane. Fixed but 1832
teknolog
parents:
23
diff
changeset
|
652 |
|
ca50ea154990
Moved search result title to navipane. Fixed but 1832
teknolog
parents:
23
diff
changeset
|
653 |
HBufC *title = info->Title().AllocL(); |
ca50ea154990
Moved search result title to navipane. Fixed but 1832
teknolog
parents:
23
diff
changeset
|
654 |
HBufC *description = info->Description().AllocL(); |
2 | 655 |
|
24
ca50ea154990
Moved search result title to navipane. Fixed but 1832
teknolog
parents:
23
diff
changeset
|
656 |
CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title ); |
2 | 657 |
|
658 |
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
|
659 |
note->RunLD(); |
2 | 660 |
} |
661 |
} |
|
662 |
||
13 | 663 |
void CPodcastShowsView::UpdateToolbar(TBool aVisible) |
2 | 664 |
{ |
665 |
CAknToolbar* toolbar = Toolbar(); |
|
13 | 666 |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
667 |
if (toolbar) { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
668 |
if (iListContainer->IsVisible()) { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
669 |
toolbar->SetToolbarVisibility(aVisible); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
670 |
} |
2 | 671 |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
672 |
TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
673 |
iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
14
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
674 |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
675 |
toolbar->HideItem(EPodcastUpdateFeed, updatingState, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
676 |
toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !updatingState, ETrue ); |
2 | 677 |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
678 |
#ifdef SYMBIAN1_UI |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
679 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
680 |
TInt itemCnt = fItems.Count(); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
681 |
|
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
682 |
TBool hideDownloadShowCmd = EFalse; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
683 |
TBool dimDownloadShowCmd = EFalse; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
684 |
TBool hideSetPlayed = EFalse; |
2 | 685 |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
686 |
if(iListContainer->Listbox() != NULL) |
2 | 687 |
{ |
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
688 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
689 |
|
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
690 |
if(index>= 0 && index < itemCnt) |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
691 |
{ |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
692 |
switch(fItems[index]->DownloadState()) |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
693 |
{ |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
694 |
case ENotDownloaded: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
695 |
case EFailedDownload: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
696 |
hideDownloadShowCmd = EFalse; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
697 |
dimDownloadShowCmd = EFalse; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
698 |
break; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
699 |
case EQueued: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
700 |
case EDownloading: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
701 |
hideDownloadShowCmd = EFalse; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
702 |
dimDownloadShowCmd = ETrue; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
703 |
break; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
704 |
case EDownloaded: |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
705 |
hideDownloadShowCmd = ETrue; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
706 |
break; |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
707 |
} |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
708 |
|
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
709 |
if(fItems[index]->PlayState() == EPlayed) { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
710 |
hideSetPlayed = ETrue; |
2 | 711 |
} |
712 |
} |
|
713 |
} |
|
23
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 |
if (hideDownloadShowCmd) { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
716 |
toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
717 |
toolbar->HideItem(EPodcastDeleteShow, EFalse, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
718 |
toolbar->SetItemDimmed(EPodcastDeleteShow, updatingState, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
719 |
} else { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
720 |
toolbar->HideItem(EPodcastDownloadShow, EFalse, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
721 |
toolbar->HideItem(EPodcastDeleteShow, ETrue, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
722 |
toolbar->SetItemDimmed(EPodcastDownloadShow, updatingState || dimDownloadShowCmd, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
723 |
} |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
724 |
|
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
725 |
if (hideSetPlayed) { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
726 |
toolbar->HideItem(EPodcastMarkAsPlayed, ETrue, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
727 |
toolbar->HideItem(EPodcastMarkAsUnplayed, EFalse, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
728 |
toolbar->SetItemDimmed(EPodcastMarkAsUnplayed, updatingState, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
729 |
} else { |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
730 |
toolbar->HideItem(EPodcastMarkAsPlayed, EFalse, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
731 |
toolbar->HideItem(EPodcastMarkAsUnplayed, ETrue, ETrue ); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
732 |
toolbar->SetItemDimmed(EPodcastMarkAsPlayed, updatingState, ETrue); |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
733 |
} |
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
16
diff
changeset
|
734 |
#endif |
2 | 735 |
} |
736 |
} |
|
737 |
||
738 |
void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
|
739 |
{ |
|
740 |
DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
|
28 | 741 |
|
742 |
iListContainer->SetLongTapDetected(ETrue); |
|
743 |
||
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
|
744 |
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
|
745 |
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
|
746 |
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
|
747 |
|
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
|
748 |
if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight) |
2 | 749 |
{ |
750 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
751 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
752 |
{ |
|
753 |
CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
|
754 |
TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded; |
|
755 |
TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded; |
|
756 |
TBool hideMarkOld = info->PlayState() == EPlayed; |
|
757 |
||
758 |
iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld); |
|
759 |
iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld); |
|
760 |
||
761 |
iStylusPopupMenu->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd); |
|
762 |
iStylusPopupMenu->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd); |
|
763 |
} |
|
764 |
||
765 |
iStylusPopupMenu->ShowMenu(); |
|
766 |
iStylusPopupMenu->SetPosition(aPenEventLocation); |
|
767 |
} |
|
768 |
DP("CPodcastShowsView::HandleLongTapEventL END"); |
|
769 |
} |
|
770 |
||
5 | 771 |
void CPodcastShowsView::HandleSetShowPlayed(TBool aPlayed) |
2 | 772 |
{ |
773 |
||
774 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
775 |
||
776 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
777 |
{ |
|
778 |
CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
|
779 |
info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
|
780 |
iPodcastModel.ShowEngine().UpdateShow(*info); |
|
781 |
UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
|
782 |
iListContainer->Listbox()->DrawItem(index); |
|
783 |
} |
|
784 |
} |
|
785 |
||
5 | 786 |
void CPodcastShowsView::HandleDeleteShow() |
2 | 787 |
{ |
788 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
789 |
||
790 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
791 |
{ |
|
792 |
CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
|
793 |
TBuf<KMaxMessageLength> msg; |
|
794 |
TBuf<KMaxMessageLength> templ; |
|
795 |
iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT); |
|
796 |
msg.Format(templ, &(info->Title())); |
|
797 |
if (ShowQueryMessage(msg)) |
|
798 |
{ |
|
799 |
iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid()); |
|
800 |
||
801 |
// and mark as played, and not downloaded |
|
802 |
||
803 |
info->SetDownloadState(ENotDownloaded); |
|
804 |
info->SetPlayState(EPlayed); |
|
805 |
iPodcastModel.ShowEngine().UpdateShow(*info); |
|
806 |
||
807 |
UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
|
808 |
iListContainer->Listbox()->DrawItem(index); |
|
809 |
} |
|
810 |
} |
|
811 |
} |
|
812 |
||
16 | 813 |
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
2 | 814 |
{ |
16 | 815 |
((CPodcastAppUi*)AppUi())->UpdateQueueTab(aDownloadingShows+aQueuedShows); |
2 | 816 |
} |
817 |
||
818 |
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
|
819 |
{ |
|
820 |
UpdateListboxItemsL(); |
|
821 |
UpdateToolbar(); |
|
822 |
} |
|
823 |
||
824 |
void CPodcastShowsView::UpdateViewTitleL() |
|
825 |
{ |
|
826 |
DP("CPodcastShowsView::UpdateViewTitleL BEGIN"); |
|
827 |
CAknTitlePane* titlePane = static_cast<CAknTitlePane*> |
|
828 |
( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
829 |
||
830 |
TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && |
|
831 |
iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
|
832 |
||
833 |
if (updatingState) { |
|
834 |
SetEmptyTextL(R_PODCAST_EMPTY_LIST_UPDATING); |
|
835 |
} else { |
|
836 |
SetEmptyTextL(R_PODCAST_EMPTY_LIST); |
|
837 |
} |
|
838 |
||
839 |
if(iPodcastModel.ActiveFeedInfo()) |
|
840 |
{ |
|
841 |
if (iPodcastModel.ActiveFeedInfo()->Title() != KNullDesC) |
|
842 |
{ |
|
843 |
titlePane->SetTextL( iPodcastModel.ActiveFeedInfo()->Title(), ETrue ); |
|
844 |
} |
|
845 |
} |
|
846 |
else |
|
847 |
{ |
|
848 |
titlePane->SetPicture(NULL, NULL); |
|
849 |
titlePane->SetTextToDefaultL(); |
|
850 |
} |
|
851 |
||
852 |
DP("CPodcastShowsView::UpdateViewTitleL END"); |
|
853 |
} |