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