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