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