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 |
|
314
|
40 |
_LIT(KShowFormat, "%d\t%S\t%S%S");
|
316
|
41 |
_LIT(KShowFormatLandscape, "%d\t%S");
|
2
|
42 |
|
|
43 |
// these must correspond with TShowsIconIndex
|
|
44 |
|
|
45 |
const TUint KShowIconArrayIds[] =
|
|
46 |
{
|
368
|
47 |
// EShowIcon = 0,
|
|
48 |
EMbmPodcastAudio,
|
|
49 |
EMbmPodcastAudio_mask,
|
|
50 |
// EShowIconNew,
|
|
51 |
EMbmPodcastAudio_new,
|
|
52 |
EMbmPodcastAudio_new_mask,
|
|
53 |
// EQuedShowIcon,
|
|
54 |
EMbmPodcastAudio_dl_queued,
|
|
55 |
EMbmPodcastAudio_dl_queued_mask,
|
|
56 |
// EQuedShowIconNew,
|
|
57 |
EMbmPodcastAudio_dl_queued_new,
|
|
58 |
EMbmPodcastAudio_dl_queued_new_mask,
|
|
59 |
// EDownloadingShowIcon,
|
|
60 |
EMbmPodcastAudio_dl_active,
|
|
61 |
EMbmPodcastAudio_dl_active_mask,
|
|
62 |
// EDownloadingShowIconNew,
|
|
63 |
EMbmPodcastAudio_dl_active_new,
|
|
64 |
EMbmPodcastAudio_dl_active_new_mask,
|
|
65 |
// EDownloadedShowIcon,
|
|
66 |
EMbmPodcastAudio_dl,
|
|
67 |
EMbmPodcastAudio_dl_mask,
|
|
68 |
// EDownloadedShowIconNew,
|
|
69 |
EMbmPodcastAudio_dl_new,
|
|
70 |
EMbmPodcastAudio_dl_new_mask,
|
|
71 |
// EFailedShowIcon,
|
|
72 |
EMbmPodcastAudio_dl_failed,
|
|
73 |
EMbmPodcastAudio_dl_failed_mask,
|
|
74 |
// EFailedShowIconNew,
|
|
75 |
EMbmPodcastAudio_dl_failed_new,
|
|
76 |
EMbmPodcastAudio_dl_failed_new_mask,
|
|
77 |
// ESuspendedShowIcon,
|
|
78 |
EMbmPodcastAudio_dl_suspended,
|
|
79 |
EMbmPodcastAudio_dl_suspended_mask,
|
|
80 |
// ESuspendedShowIconNew
|
|
81 |
EMbmPodcastAudio_dl_suspended_new,
|
|
82 |
EMbmPodcastAudio_dl_suspended_new_mask,
|
|
83 |
// EShowIcon = 0,
|
|
84 |
EMbmPodcastVideo,
|
|
85 |
EMbmPodcastVideo_mask,
|
|
86 |
// EShowIconNew,
|
|
87 |
EMbmPodcastVideo_new,
|
|
88 |
EMbmPodcastVideo_new_mask,
|
|
89 |
// EQuedShowIcon,
|
|
90 |
EMbmPodcastVideo_dl_queued,
|
|
91 |
EMbmPodcastVideo_dl_queued_mask,
|
|
92 |
// EQuedShowIconNew,
|
|
93 |
EMbmPodcastVideo_dl_queued_new,
|
|
94 |
EMbmPodcastVideo_dl_queued_new_mask,
|
|
95 |
// EDownloadingShowIcon,
|
|
96 |
EMbmPodcastVideo_dl_active,
|
|
97 |
EMbmPodcastVideo_dl_active_mask,
|
|
98 |
// EDownloadingShowIconNew,
|
|
99 |
EMbmPodcastVideo_dl_active_new,
|
|
100 |
EMbmPodcastVideo_dl_active_new_mask,
|
|
101 |
// EDownloadedShowIcon,
|
|
102 |
EMbmPodcastVideo_dl,
|
|
103 |
EMbmPodcastVideo_dl_mask,
|
|
104 |
// EDownloadedShowIconNew,
|
|
105 |
EMbmPodcastVideo_dl_new,
|
|
106 |
EMbmPodcastVideo_dl_new_mask,
|
|
107 |
// EFailedShowIcon,
|
|
108 |
EMbmPodcastVideo_dl_failed,
|
|
109 |
EMbmPodcastVideo_dl_failed_mask,
|
|
110 |
// EFailedShowIconNew,
|
|
111 |
EMbmPodcastVideo_dl_failed_new,
|
|
112 |
EMbmPodcastVideo_dl_failed_new_mask,
|
|
113 |
// ESuspendedShowIcon,
|
|
114 |
EMbmPodcastVideo_dl_suspended,
|
|
115 |
EMbmPodcastVideo_dl_suspended_mask,
|
|
116 |
// ESuspendedShowIconNew
|
|
117 |
EMbmPodcastVideo_dl_suspended_new,
|
|
118 |
EMbmPodcastVideo_dl_suspended_new_mask,
|
|
119 |
EMbmPodcastFeed,
|
|
120 |
EMbmPodcastFeed_mask,
|
|
121 |
0,
|
|
122 |
0
|
2
|
123 |
};
|
|
124 |
|
368
|
125 |
const TInt KVideoIconOffset = 12;
|
120
|
126 |
|
2
|
127 |
CPodcastShowsView* CPodcastShowsView::NewL(CPodcastModel& aPodcastModel)
|
|
128 |
{
|
|
129 |
CPodcastShowsView* self = CPodcastShowsView::NewLC(aPodcastModel);
|
|
130 |
CleanupStack::Pop(self);
|
|
131 |
return self;
|
|
132 |
}
|
|
133 |
|
|
134 |
CPodcastShowsView* CPodcastShowsView::NewLC(CPodcastModel& aPodcastModel)
|
|
135 |
{
|
|
136 |
CPodcastShowsView* self = new ( ELeave ) CPodcastShowsView(aPodcastModel);
|
|
137 |
CleanupStack::PushL(self);
|
|
138 |
self->ConstructL();
|
|
139 |
return self;
|
|
140 |
}
|
|
141 |
|
|
142 |
CPodcastShowsView::CPodcastShowsView(CPodcastModel& aPodcastModel) :
|
|
143 |
iPodcastModel(aPodcastModel)
|
|
144 |
{
|
|
145 |
}
|
|
146 |
|
|
147 |
void CPodcastShowsView::ConstructL()
|
|
148 |
{
|
|
149 |
BaseConstructL(R_PODCAST_SHOWSVIEW);
|
|
150 |
CPodcastListView::ConstructL();
|
|
151 |
|
|
152 |
CreateIconsL();
|
318
|
153 |
|
2
|
154 |
iPodcastModel.FeedEngine().AddObserver(this);
|
|
155 |
iPodcastModel.ShowEngine().AddObserver(this);
|
|
156 |
}
|
|
157 |
|
|
158 |
void CPodcastShowsView::CreateIconsL()
|
|
159 |
{
|
|
160 |
CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
|
|
161 |
CleanupStack::PushL(icons);
|
|
162 |
TInt pos = 0;
|
|
163 |
while (KShowIconArrayIds[pos] > 0)
|
|
164 |
{
|
120
|
165 |
// Load the icon
|
|
166 |
CFbsBitmap* bitmap= NULL;
|
|
167 |
CFbsBitmap* mask= NULL;
|
2
|
168 |
AknIconUtils::CreateIconL(bitmap,
|
|
169 |
mask,
|
|
170 |
iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
|
|
171 |
KShowIconArrayIds[pos],
|
|
172 |
KShowIconArrayIds[pos+1]);
|
|
173 |
CleanupStack::PushL(bitmap);
|
|
174 |
CleanupStack::PushL(mask);
|
|
175 |
|
120
|
176 |
// Append the icon to icon array
|
2
|
177 |
icons->AppendL(CGulIcon::NewL(bitmap, mask) );
|
|
178 |
CleanupStack::Pop(2); // bitmap, mask
|
|
179 |
pos+=2;
|
|
180 |
}
|
|
181 |
|
313
|
182 |
//iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
|
|
183 |
iListContainer->SetListboxIcons(icons);
|
2
|
184 |
CleanupStack::Pop(icons); // icons
|
|
185 |
}
|
|
186 |
|
|
187 |
TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
|
|
188 |
{
|
|
189 |
if (aType == EEventKey)
|
|
190 |
{
|
|
191 |
CShowInfo *activeShow = NULL;
|
|
192 |
|
|
193 |
TInt index = iListContainer->Listbox()->CurrentItemIndex();
|
|
194 |
if(index >= 0 && index < iPodcastModel.ActiveShowList().Count())
|
|
195 |
{
|
|
196 |
activeShow = iPodcastModel.ActiveShowList()[index];
|
|
197 |
}
|
|
198 |
|
|
199 |
if (activeShow != NULL) {
|
|
200 |
DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode);
|
|
201 |
switch (aKeyEvent.iCode) {
|
|
202 |
case 117:
|
|
203 |
case '*':
|
|
204 |
case EKeySpace:
|
|
205 |
if (activeShow->PlayState() == EPlayed) {
|
|
206 |
HandleCommandL(EPodcastMarkAsUnplayed);
|
|
207 |
} else {
|
|
208 |
HandleCommandL(EPodcastMarkAsPlayed);
|
|
209 |
}
|
|
210 |
break;
|
|
211 |
case 106:
|
|
212 |
case '#':
|
|
213 |
if (activeShow->DownloadState() == ENotDownloaded) {
|
|
214 |
HandleCommandL(EPodcastDownloadShow);
|
|
215 |
}
|
|
216 |
break;
|
|
217 |
case EKeyBackspace:
|
|
218 |
case EKeyDelete:
|
|
219 |
HandleCommandL(EPodcastDeleteShow);
|
|
220 |
break;
|
|
221 |
default:
|
|
222 |
break;
|
|
223 |
}
|
|
224 |
UpdateToolbar();
|
|
225 |
}
|
|
226 |
}
|
|
227 |
return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
|
|
228 |
}
|
|
229 |
|
|
230 |
CPodcastShowsView::~CPodcastShowsView()
|
|
231 |
{
|
368
|
232 |
DP("CPodcastShowsView::~CPodcastShowsView BEGIN");
|
2
|
233 |
iPodcastModel.ShowEngine().RemoveObserver(this);
|
|
234 |
iPodcastModel.FeedEngine().RemoveObserver(this);
|
368
|
235 |
DP("CPodcastShowsView::~CPodcastShowsView END");
|
2
|
236 |
}
|
|
237 |
|
|
238 |
|
|
239 |
TUid CPodcastShowsView::Id() const
|
|
240 |
{
|
|
241 |
return KUidPodcastShowsViewID;
|
|
242 |
}
|
|
243 |
|
|
244 |
void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId,
|
|
245 |
TUid aCustomMessageId, const TDesC8& aCustomMessage)
|
|
246 |
{
|
|
247 |
DP("CPodcastShowsView::DoActivateL BEGIN");
|
49
|
248 |
CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
|
|
249 |
|
|
250 |
iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
|
2
|
251 |
|
367
|
252 |
iShowNewShows = (aCustomMessageId.iUid == 1);
|
|
253 |
|
|
254 |
if (iShowNewShows)
|
|
255 |
{
|
|
256 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
257 |
cba->SetCommandSetL(R_PODCAST_CBA);
|
|
258 |
cba->DrawDeferred();
|
|
259 |
}
|
|
260 |
else
|
|
261 |
{
|
|
262 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
263 |
cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);
|
|
264 |
cba->DrawDeferred();
|
|
265 |
}
|
|
266 |
|
2
|
267 |
UpdateViewTitleL();
|
|
268 |
UpdateFeedUpdateStateL();
|
|
269 |
UpdateToolbar();
|
|
270 |
DP("CPodcastShowsView::DoActivateL END");
|
|
271 |
}
|
|
272 |
|
|
273 |
void CPodcastShowsView::DoDeactivate()
|
|
274 |
{
|
|
275 |
CPodcastListView::DoDeactivate();
|
|
276 |
}
|
|
277 |
|
|
278 |
// Engine callback when new shows are available
|
|
279 |
void CPodcastShowsView::ShowListUpdatedL()
|
|
280 |
{
|
|
281 |
UpdateListboxItemsL();
|
|
282 |
}
|
|
283 |
|
|
284 |
void CPodcastShowsView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/)
|
|
285 |
{
|
|
286 |
if (!iListContainer->IsVisible())
|
|
287 |
{
|
|
288 |
return;
|
|
289 |
}
|
|
290 |
|
|
291 |
CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading();
|
|
292 |
if (info)
|
|
293 |
{
|
|
294 |
UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
|
|
295 |
}
|
|
296 |
}
|
|
297 |
|
34
|
298 |
void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError)
|
2
|
299 |
{
|
|
300 |
iProgressAdded = EFalse;
|
34
|
301 |
CShowInfo *info = NULL;
|
|
302 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
|
|
303 |
|
|
304 |
for (TInt i=0;i<fItems.Count();i++)
|
|
305 |
{
|
|
306 |
if (fItems[i]->Uid() == aShowUid)
|
|
307 |
{
|
|
308 |
info = fItems[i];
|
|
309 |
}
|
|
310 |
}
|
|
311 |
|
|
312 |
if (info == NULL) {
|
|
313 |
return;
|
|
314 |
}
|
2
|
315 |
|
|
316 |
switch(aError)
|
|
317 |
{
|
|
318 |
case KErrCouldNotConnect:
|
|
319 |
{
|
|
320 |
TBuf<KMaxMessageLength> message;
|
|
321 |
iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
|
35
|
322 |
ShowErrorMessageL(message);
|
2
|
323 |
}
|
|
324 |
break;
|
6
|
325 |
default:
|
2
|
326 |
break;
|
|
327 |
}
|
6
|
328 |
UpdateListboxItemsL();
|
2
|
329 |
}
|
|
330 |
|
|
331 |
|
|
332 |
void CPodcastShowsView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
|
|
333 |
{
|
|
334 |
// TODO make use of the fact that we know that the feed download is
|
|
335 |
// started instead of checking feed engine states in UpdateFeedUpdateStateL.
|
|
336 |
if (iPodcastModel.ActiveFeedInfo() != NULL
|
|
337 |
&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
|
|
338 |
{
|
8
|
339 |
UpdateFeedUpdateStateL();
|
2
|
340 |
UpdateToolbar();
|
|
341 |
}
|
|
342 |
}
|
|
343 |
|
|
344 |
void CPodcastShowsView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/)
|
|
345 |
{
|
|
346 |
DP("CPodcastShowsView::FeedDownloadFinishedL BEGIN");
|
165
d886725e4499
Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
347 |
if (iListContainer->IsVisible() &&
|
d886725e4499
Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
348 |
iPodcastModel.ActiveFeedInfo() != NULL &&
|
d886725e4499
Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
349 |
iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
|
2
|
350 |
{
|
8
|
351 |
UpdateFeedUpdateStateL();
|
|
352 |
UpdateViewTitleL();
|
2
|
353 |
}
|
|
354 |
DP("CPodcastShowsView::FeedDownloadFinishedL END");
|
|
355 |
}
|
|
356 |
|
|
357 |
void CPodcastShowsView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
|
|
358 |
TListBoxEvent aEventType)
|
|
359 |
{
|
|
360 |
switch (aEventType)
|
|
361 |
{
|
137
eefed4bda2e2
Minor fixes to comply with single tap technical solution description. By this I consider bug 2056 closed.
teknolog
diff
changeset
|
362 |
case EEventItemSingleClicked:
|
2
|
363 |
case EEventEnterKeyPressed:
|
|
364 |
case EEventItemActioned:
|
|
365 |
case EEventItemDoubleClicked:
|
|
366 |
{
|
|
367 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
|
|
368 |
TInt index = iListContainer->Listbox()->CurrentItemIndex();
|
|
369 |
if (index>=0 && index< fItems.Count())
|
|
370 |
{
|
|
371 |
DP2("Handle event for podcast %S, downloadState is %d", &(fItems[index]->Title()), fItems[index]->DownloadState());
|
|
372 |
CShowInfo *showInfo = fItems[index];
|
|
373 |
|
|
374 |
switch (showInfo->DownloadState()) {
|
|
375 |
case ENotDownloaded:
|
38
|
376 |
case EFailedDownload:
|
2
|
377 |
HandleCommandL(EPodcastDownloadShow);
|
|
378 |
break;
|
38
|
379 |
case EDownloading:
|
2
|
380 |
case EQueued:
|
|
381 |
AppUi()->ActivateLocalViewL(KUidPodcastQueueViewID, TUid::Uid(0), KNullDesC8());
|
|
382 |
((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue);
|
|
383 |
break;
|
|
384 |
case EDownloaded:
|
134
46baf9a7cadd
Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
diff
changeset
|
385 |
{
|
46baf9a7cadd
Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
diff
changeset
|
386 |
TRAPD(err, iPodcastModel.PlayPausePodcastL(showInfo, ETrue));
|
46baf9a7cadd
Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
diff
changeset
|
387 |
if (err != KErrNone)
|
46baf9a7cadd
Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
diff
changeset
|
388 |
{
|
46baf9a7cadd
Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
diff
changeset
|
389 |
HBufC *error = iEikonEnv->AllocReadResourceLC(R_ERROR_PLAYBACK_FAILED);
|
46baf9a7cadd
Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
diff
changeset
|
390 |
ShowErrorMessageL(*error);
|
46baf9a7cadd
Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
diff
changeset
|
391 |
CleanupStack::PopAndDestroy(error);
|
46baf9a7cadd
Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
diff
changeset
|
392 |
}
|
133
|
393 |
UpdateListboxItemsL();
|
134
46baf9a7cadd
Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
diff
changeset
|
394 |
}
|
2
|
395 |
break;
|
|
396 |
default:
|
|
397 |
break;
|
|
398 |
}
|
|
399 |
}
|
|
400 |
}
|
|
401 |
break;
|
|
402 |
default:
|
|
403 |
break;
|
|
404 |
}
|
|
405 |
UpdateToolbar();
|
|
406 |
}
|
|
407 |
|
|
408 |
void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
|
|
409 |
{
|
|
410 |
TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
|
368
|
411 |
TBool isNew = aShowInfo->PlayState() == ENeverPlayed;
|
34
|
412 |
switch (aShowInfo->DownloadState())
|
2
|
413 |
{
|
34
|
414 |
case EDownloaded:
|
368
|
415 |
aIconIndex = isNew ? EDownloadedShowIconNew : EDownloadedShowIcon;
|
34
|
416 |
break;
|
|
417 |
case ENotDownloaded:
|
368
|
418 |
aIconIndex = isNew ? EShowIconNew : EShowIcon;
|
34
|
419 |
break;
|
|
420 |
case EQueued:
|
368
|
421 |
aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) :
|
|
422 |
(isNew ? EQuedShowIconNew : EQuedShowIcon);
|
34
|
423 |
break;
|
|
424 |
case EDownloading:
|
368
|
425 |
aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) :
|
|
426 |
(isNew ? EDownloadingShowIconNew : EDownloadingShowIcon);
|
34
|
427 |
break;
|
|
428 |
case EFailedDownload:
|
368
|
429 |
aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) :
|
|
430 |
(isNew ? EFailedShowIconNew : EFailedShowIconNew);
|
34
|
431 |
break;
|
2
|
432 |
}
|
120
|
433 |
|
|
434 |
if (aShowInfo->ShowType() == EVideoPodcast)
|
|
435 |
{
|
|
436 |
aIconIndex += KVideoIconOffset;
|
|
437 |
}
|
368
|
438 |
|
|
439 |
//DP3("dlStop=%d, isNew=%d, aIconIndex=%d", dlStop, isNew, aIconIndex);
|
2
|
440 |
}
|
|
441 |
|
|
442 |
|
|
443 |
void CPodcastShowsView::UpdateFeedUpdateStateL()
|
|
444 |
{
|
|
445 |
TBool listboxDimmed = EFalse;
|
|
446 |
|
|
447 |
if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo()
|
|
448 |
!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid())
|
|
449 |
{
|
|
450 |
listboxDimmed = ETrue;
|
|
451 |
}
|
|
452 |
|
|
453 |
if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed))
|
|
454 |
{
|
|
455 |
iListContainer->Listbox()->SetDimmed(listboxDimmed);
|
|
456 |
}
|
|
457 |
UpdateListboxItemsL();
|
|
458 |
UpdateToolbar();
|
|
459 |
}
|
|
460 |
|
|
461 |
void CPodcastShowsView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded)
|
|
462 |
{
|
|
463 |
TBuf<32> infoSize;
|
|
464 |
TInt iconIndex = 0;
|
|
465 |
TBuf<KMaxShortDateFormatSpec*2> showDate;
|
|
466 |
GetShowIcons(&aShowInfo, iconIndex);
|
|
467 |
|
|
468 |
if(aSizeDownloaded > 0)
|
|
469 |
{
|
|
470 |
if (aShowInfo.ShowSize() > 0)
|
|
471 |
{
|
368
|
472 |
TUint showSize = aShowInfo.ShowSize() >= (TUint) aSizeDownloaded ? aShowInfo.ShowSize() : (TUint) aSizeDownloaded;
|
2
|
473 |
infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb),
|
368
|
474 |
((float) showSize / (float)KSizeMb));
|
2
|
475 |
}
|
|
476 |
else
|
|
477 |
{
|
|
478 |
infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb);
|
|
479 |
}
|
|
480 |
}
|
|
481 |
else if (aShowInfo.ShowSize() > 0)
|
|
482 |
{
|
|
483 |
infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb);
|
|
484 |
}
|
|
485 |
else {
|
|
486 |
infoSize = KNullDesC();
|
|
487 |
}
|
|
488 |
|
|
489 |
if (aShowInfo.PubDate().Int64() == 0)
|
|
490 |
{
|
|
491 |
showDate = KNullDesC();
|
|
492 |
}
|
|
493 |
else
|
|
494 |
{
|
|
495 |
aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
|
|
496 |
}
|
|
497 |
|
|
498 |
if(aShowInfo.LastError() != KErrNone)
|
|
499 |
{
|
6
|
500 |
GetShowErrorText(infoSize, aShowInfo.LastError());
|
112
|
501 |
showDate.Zero();
|
2
|
502 |
}
|
6
|
503 |
|
112
|
504 |
if (infoSize.Length() > 0 && showDate.Length() > 0)
|
2
|
505 |
{
|
6
|
506 |
infoSize.Insert(0,_L(", "));
|
2
|
507 |
}
|
|
508 |
|
6
|
509 |
iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
|
317
|
510 |
iListboxFormatbufferShort.Format(KShowFormatLandscape(), iconIndex, &aShowInfo.Title());
|
2
|
511 |
}
|
|
512 |
|
|
513 |
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
|
|
514 |
{
|
117
|
515 |
TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
|
2
|
516 |
}
|
|
517 |
|
|
518 |
void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
|
|
519 |
{
|
|
520 |
FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
|
|
521 |
iItemArray->Delete(aIndex);
|
316
|
522 |
iItemArrayShort->Delete(aIndex);
|
|
523 |
|
2
|
524 |
if(aIndex>= iItemArray->MdcaCount())
|
|
525 |
{
|
|
526 |
iItemArray->AppendL(iListboxFormatbuffer);
|
316
|
527 |
iItemArrayShort->AppendL(iListboxFormatbufferShort);
|
2
|
528 |
}
|
|
529 |
else
|
|
530 |
{
|
|
531 |
iItemArray->InsertL(aIndex, iListboxFormatbuffer);
|
316
|
532 |
iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
|
2
|
533 |
}
|
|
534 |
}
|
|
535 |
|
|
536 |
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
|
|
537 |
{
|
|
538 |
RShowInfoArray& array = iPodcastModel.ActiveShowList();
|
|
539 |
|
|
540 |
for (int i=0;i<array.Count();i++) {
|
|
541 |
if (array[i]->Uid() == aUid) {
|
|
542 |
UpdateShowItemDataL(array[i], i, aSizeDownloaded);
|
|
543 |
if (iListContainer->Listbox()->TopItemIndex() <= i &&
|
|
544 |
iListContainer->Listbox()->BottomItemIndex() >= i) {
|
|
545 |
iListContainer->Listbox()->DrawItem(i);
|
|
546 |
}
|
|
547 |
}
|
|
548 |
}
|
|
549 |
}
|
|
550 |
|
|
551 |
void CPodcastShowsView::UpdateListboxItemsL()
|
|
552 |
{
|
367
|
553 |
DP("CPodcastShowsView::UpdateListboxItemsL BEGIN");
|
2
|
554 |
if (iListContainer->IsVisible())
|
|
555 |
{
|
|
556 |
TListItemProperties itemProps;
|
|
557 |
TInt len = 0;
|
|
558 |
|
367
|
559 |
if (iShowNewShows)
|
|
560 |
{
|
|
561 |
iPodcastModel.GetNewShowsL();
|
|
562 |
}
|
|
563 |
else
|
|
564 |
{
|
|
565 |
iPodcastModel.GetShowsByFeedL(iPodcastModel.ActiveFeedInfo()->Uid());
|
|
566 |
}
|
|
567 |
|
2
|
568 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
|
|
569 |
len = fItems.Count();
|
|
570 |
|
|
571 |
if (iListContainer->Listbox() != NULL)
|
|
572 |
{
|
|
573 |
TBool allUidsMatch = EFalse;
|
|
574 |
|
|
575 |
if (len == iListContainer->Listbox()->Model()->NumberOfItems())
|
|
576 |
{
|
|
577 |
allUidsMatch = ETrue;
|
|
578 |
TUint itemId = 0;
|
|
579 |
for (TInt loop = 0; loop< len; loop++)
|
|
580 |
{
|
|
581 |
itemId = iItemIdArray[loop];
|
|
582 |
if (fItems[loop]->Uid() != itemId)
|
|
583 |
{
|
|
584 |
allUidsMatch = EFalse;
|
|
585 |
break;
|
|
586 |
}
|
|
587 |
}
|
|
588 |
}
|
|
589 |
|
|
590 |
if (allUidsMatch && len > 0)
|
|
591 |
{
|
|
592 |
for (TInt loop = 0; loop< len; loop++)
|
34
|
593 |
{
|
6
|
594 |
UpdateShowItemDataL(fItems[loop], loop);
|
2
|
595 |
}
|
31
|
596 |
iListContainer->Listbox()->DrawNow();
|
2
|
597 |
}
|
|
598 |
else
|
|
599 |
{
|
317
|
600 |
//iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
|
2
|
601 |
iListContainer->Listbox()->Reset();
|
|
602 |
iItemIdArray.Reset();
|
|
603 |
iItemArray->Reset();
|
316
|
604 |
iItemArrayShort->Reset();
|
|
605 |
|
2
|
606 |
if (len > 0)
|
|
607 |
{
|
|
608 |
for (TInt i=0; i<len; i++)
|
|
609 |
{
|
|
610 |
CShowInfo *si = fItems[i];
|
|
611 |
FormatShowInfoListBoxItemL(*si);
|
|
612 |
iItemIdArray.Append(si->Uid());
|
|
613 |
iItemArray->AppendL(iListboxFormatbuffer);
|
316
|
614 |
iItemArrayShort->AppendL(iListboxFormatbufferShort);
|
|
615 |
|
2
|
616 |
}
|
|
617 |
}
|
|
618 |
else
|
|
619 |
{
|
|
620 |
iItemArray->Reset();
|
316
|
621 |
iItemArrayShort->Reset();
|
2
|
622 |
iItemIdArray.Reset();
|
|
623 |
|
|
624 |
itemProps.SetDimmed(ETrue);
|
|
625 |
itemProps.SetHiddenSelection(ETrue);
|
|
626 |
}
|
|
627 |
iListContainer->Listbox()->HandleItemAdditionL();
|
|
628 |
}
|
|
629 |
}
|
|
630 |
}
|
367
|
631 |
DP("CPodcastShowsView::UpdateListboxItemsL END");
|
2
|
632 |
}
|
|
633 |
|
|
634 |
/**
|
|
635 |
* Command handling function intended for overriding by sub classes.
|
|
636 |
* Default implementation is empty.
|
|
637 |
* @param aCommand ID of the command to respond to.
|
|
638 |
*/
|
|
639 |
void CPodcastShowsView::HandleCommandL(TInt aCommand)
|
|
640 |
{
|
|
641 |
switch (aCommand)
|
|
642 |
{
|
|
643 |
case EPodcastMarkAsPlayed:
|
35
|
644 |
HandleSetShowPlayedL(ETrue);
|
2
|
645 |
break;
|
|
646 |
case EPodcastMarkAsUnplayed:
|
35
|
647 |
HandleSetShowPlayedL(EFalse);
|
2
|
648 |
break;
|
|
649 |
case EPodcastMarkAllPlayed:
|
367
|
650 |
{
|
|
651 |
if (iShowNewShows) {
|
|
652 |
TBuf<KMaxMessageLength> msg;
|
|
653 |
iEikonEnv->ReadResourceL(msg, R_MARK_ALL_OLD_QUERY);
|
|
654 |
if (!ShowQueryMessageL(msg))
|
|
655 |
{
|
|
656 |
break;
|
|
657 |
}
|
|
658 |
}
|
35
|
659 |
iPodcastModel.MarkSelectionPlayedL();
|
2
|
660 |
UpdateListboxItemsL();
|
367
|
661 |
}
|
2
|
662 |
break;
|
|
663 |
case EPodcastDeleteShow:
|
35
|
664 |
HandleDeleteShowL();
|
2
|
665 |
break;
|
367
|
666 |
case EPodcastDownloadAll:
|
|
667 |
HandleDownloadAllL();
|
|
668 |
break;
|
2
|
669 |
case EPodcastDownloadShow:
|
|
670 |
{
|
|
671 |
TInt index = iListContainer->Listbox()->CurrentItemIndex();
|
33
|
672 |
|
2
|
673 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
|
|
674 |
{
|
|
675 |
iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
|
|
676 |
UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1);
|
|
677 |
}
|
|
678 |
}
|
|
679 |
break;
|
|
680 |
case EPodcastUpdateFeed:
|
|
681 |
{
|
|
682 |
|
|
683 |
if (iPodcastModel.ActiveFeedInfo()->Url().Length()>0)
|
|
684 |
{
|
|
685 |
TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid()));
|
|
686 |
|
|
687 |
if (error != KErrNone)
|
|
688 |
{
|
5
|
689 |
HBufC* str =
|
2
|
690 |
iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR);
|
|
691 |
User::InfoPrint(*str);
|
|
692 |
CleanupStack::PopAndDestroy(str);
|
|
693 |
}
|
|
694 |
}
|
|
695 |
}
|
|
696 |
break;
|
367
|
697 |
case EPodcastUpdateAllFeeds:
|
|
698 |
{
|
|
699 |
iPodcastModel.FeedEngine().UpdateAllFeedsL();
|
|
700 |
UpdateToolbar();
|
|
701 |
}break;
|
2
|
702 |
case EPodcastCancelUpdateAllFeeds:
|
|
703 |
iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
|
|
704 |
break;
|
|
705 |
case EPodcastShowInfo:
|
|
706 |
{
|
|
707 |
DisplayShowInfoDialogL();
|
|
708 |
}break;
|
|
709 |
default:
|
|
710 |
CPodcastListView::HandleCommandL(aCommand);
|
|
711 |
break;
|
|
712 |
}
|
28
|
713 |
|
2
|
714 |
UpdateToolbar();
|
|
715 |
}
|
|
716 |
|
|
717 |
void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
|
|
718 |
{
|
|
719 |
if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
|
|
720 |
{
|
243
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
721 |
TInt index = iListContainer->Listbox()->CurrentItemIndex();
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
722 |
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
723 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
724 |
{
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
725 |
CShowInfo* info = iPodcastModel.ActiveShowList()[index];
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
726 |
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
727 |
TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded;
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
728 |
TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded;
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
729 |
TBool hideMarkOld = info->PlayState() == EPlayed;
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
730 |
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
731 |
aMenuPane->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld);
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
732 |
aMenuPane->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld);
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
733 |
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
734 |
aMenuPane->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd);
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
735 |
aMenuPane->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd);
|
44d205147a83
Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
diff
changeset
|
736 |
}
|
2
|
737 |
}
|
|
738 |
}
|
|
739 |
|
|
740 |
void CPodcastShowsView::DisplayShowInfoDialogL()
|
|
741 |
{
|
|
742 |
TInt index = iListContainer->Listbox()->CurrentItemIndex();
|
|
743 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
|
|
744 |
{
|
|
745 |
CShowInfo* info = iPodcastModel.ActiveShowList()[index];
|
24
|
746 |
|
|
747 |
HBufC *title = info->Title().AllocL();
|
|
748 |
HBufC *description = info->Description().AllocL();
|
2
|
749 |
|
24
|
750 |
CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title );
|
2
|
751 |
|
|
752 |
note->PrepareLC( R_SHOW_INFO_NOTE ); // Adds to CleanupStack
|
24
|
753 |
note->RunLD();
|
2
|
754 |
}
|
|
755 |
}
|
|
756 |
|
368
|
757 |
void CPodcastShowsView::HandleDownloadAllL()
|
|
758 |
{
|
|
759 |
|
|
760 |
TBuf<KMaxMessageLength> msg;
|
|
761 |
iEikonEnv->ReadResourceL(msg, R_DOWNLOAD_ALL_QUERY);
|
|
762 |
if (!ShowQueryMessageL(msg))
|
|
763 |
{
|
|
764 |
return;
|
|
765 |
}
|
|
766 |
|
|
767 |
for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++)
|
|
768 |
{
|
|
769 |
CShowInfo* info = iPodcastModel.ActiveShowList()[i];
|
|
770 |
|
|
771 |
if (info->DownloadState() == ENotDownloaded)
|
|
772 |
{
|
|
773 |
TRAP_IGNORE(iPodcastModel.ShowEngine().AddDownloadL(*info));
|
|
774 |
}
|
|
775 |
}
|
|
776 |
}
|
|
777 |
|
13
|
778 |
void CPodcastShowsView::UpdateToolbar(TBool aVisible)
|
2
|
779 |
{
|
|
780 |
CAknToolbar* toolbar = Toolbar();
|
13
|
781 |
|
23
|
782 |
if (toolbar) {
|
|
783 |
if (iListContainer->IsVisible()) {
|
|
784 |
toolbar->SetToolbarVisibility(aVisible);
|
|
785 |
}
|
2
|
786 |
|
155
|
787 |
TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() &&
|
23
|
788 |
iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
|
368
|
789 |
|
367
|
790 |
if (iShowNewShows)
|
|
791 |
{
|
|
792 |
updatingState = iPodcastModel.FeedEngine().ClientState();
|
|
793 |
toolbar->HideItem(EPodcastUpdateFeed, ETrue, ETrue );
|
|
794 |
toolbar->HideItem(EPodcastUpdateAllFeeds, updatingState, ETrue );
|
|
795 |
}
|
|
796 |
else
|
|
797 |
{
|
|
798 |
toolbar->HideItem(EPodcastUpdateFeed, updatingState, ETrue );
|
|
799 |
toolbar->HideItem(EPodcastUpdateAllFeeds, ETrue, ETrue );
|
|
800 |
}
|
|
801 |
|
23
|
802 |
toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !updatingState, ETrue );
|
367
|
803 |
|
383
|
804 |
|
|
805 |
toolbar->HideItem(EPodcastEmpty, EFalse, ETrue );
|
|
806 |
toolbar->SetItemDimmed(EPodcastEmpty, ETrue, ETrue);
|
|
807 |
|
367
|
808 |
toolbar->HideItem(EPodcastDownloadAll, !iShowNewShows, ETrue);
|
290
|
809 |
|
|
810 |
TBool showMarkAllPlayed = EFalse;
|
367
|
811 |
TBool showDownloadAll = EFalse;
|
290
|
812 |
for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++)
|
|
813 |
{
|
|
814 |
CShowInfo* info = iPodcastModel.ActiveShowList()[i];
|
|
815 |
if (info->PlayState() == ENeverPlayed)
|
|
816 |
{
|
|
817 |
showMarkAllPlayed = ETrue;
|
367
|
818 |
}
|
|
819 |
if (info->DownloadState() == ENotDownloaded)
|
|
820 |
{
|
|
821 |
showDownloadAll = ETrue;
|
290
|
822 |
}
|
|
823 |
}
|
367
|
824 |
|
290
|
825 |
toolbar->SetItemDimmed(EPodcastMarkAllPlayed, !showMarkAllPlayed, ETrue);
|
367
|
826 |
toolbar->SetItemDimmed(EPodcastDownloadAll, !showDownloadAll, ETrue);
|
2
|
827 |
}
|
|
828 |
}
|
|
829 |
|
35
|
830 |
void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed)
|
2
|
831 |
{
|
|
832 |
|
|
833 |
TInt index = iListContainer->Listbox()->CurrentItemIndex();
|
|
834 |
|
|
835 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
|
|
836 |
{
|
|
837 |
CShowInfo *info = iPodcastModel.ActiveShowList()[index];
|
|
838 |
info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed);
|
368
|
839 |
if (aPlayed)
|
|
840 |
{
|
|
841 |
// PostPlayHandling calls UpdateShow, which is slow, so we don't need to do it again
|
|
842 |
iPodcastModel.ShowEngine().PostPlayHandling(info);
|
|
843 |
}
|
|
844 |
else
|
|
845 |
{
|
|
846 |
iPodcastModel.ShowEngine().UpdateShowL(*info);
|
|
847 |
}
|
|
848 |
|
|
849 |
if (iShowNewShows)
|
|
850 |
{
|
|
851 |
UpdateListboxItemsL();
|
|
852 |
|
|
853 |
if (index > 0)
|
|
854 |
{
|
|
855 |
iListContainer->Listbox()->SetCurrentItemIndex(index - 1);
|
|
856 |
}
|
|
857 |
}
|
|
858 |
else
|
|
859 |
{
|
|
860 |
UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
|
|
861 |
iListContainer->Listbox()->DrawItem(index);
|
|
862 |
}
|
2
|
863 |
}
|
|
864 |
}
|
|
865 |
|
35
|
866 |
void CPodcastShowsView::HandleDeleteShowL()
|
2
|
867 |
{
|
|
868 |
TInt index = iListContainer->Listbox()->CurrentItemIndex();
|
|
869 |
|
|
870 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
|
|
871 |
{
|
|
872 |
CShowInfo *info = iPodcastModel.ActiveShowList()[index];
|
|
873 |
TBuf<KMaxMessageLength> msg;
|
|
874 |
TBuf<KMaxMessageLength> templ;
|
|
875 |
iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT);
|
|
876 |
msg.Format(templ, &(info->Title()));
|
35
|
877 |
if (ShowQueryMessageL(msg))
|
2
|
878 |
{
|
|
879 |
iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid());
|
|
880 |
|
|
881 |
// and mark as played, and not downloaded
|
|
882 |
|
|
883 |
info->SetDownloadState(ENotDownloaded);
|
|
884 |
info->SetPlayState(EPlayed);
|
35
|
885 |
iPodcastModel.ShowEngine().UpdateShowL(*info);
|
376
|
886 |
|
|
887 |
if (iShowNewShows)
|
|
888 |
{
|
|
889 |
UpdateListboxItemsL();
|
|
890 |
|
|
891 |
if (index > 0)
|
|
892 |
{
|
|
893 |
iListContainer->Listbox()->SetCurrentItemIndex(index - 1);
|
|
894 |
}
|
|
895 |
}
|
|
896 |
else
|
|
897 |
{
|
|
898 |
UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
|
|
899 |
iListContainer->Listbox()->DrawItem(index);
|
|
900 |
}
|
2
|
901 |
}
|
|
902 |
}
|
|
903 |
}
|
|
904 |
|
16
|
905 |
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
|
2
|
906 |
{
|
35
|
907 |
((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows);
|
34
|
908 |
UpdateListboxItemsL();
|
2
|
909 |
}
|
|
910 |
|
|
911 |
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
|
|
912 |
{
|
|
913 |
UpdateListboxItemsL();
|
|
914 |
UpdateToolbar();
|
|
915 |
}
|
|
916 |
|
|
917 |
void CPodcastShowsView::UpdateViewTitleL()
|
|
918 |
{
|
|
919 |
DP("CPodcastShowsView::UpdateViewTitleL BEGIN");
|
|
920 |
CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
|
|
921 |
( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
|
|
922 |
|
367
|
923 |
TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() &&
|
2
|
924 |
iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
|
|
925 |
|
|
926 |
if (updatingState) {
|
|
927 |
SetEmptyTextL(R_PODCAST_EMPTY_LIST_UPDATING);
|
|
928 |
} else {
|
|
929 |
SetEmptyTextL(R_PODCAST_EMPTY_LIST);
|
|
930 |
}
|
|
931 |
|
367
|
932 |
if(iShowNewShows)
|
|
933 |
{
|
|
934 |
HBufC *title = iEikonEnv->AllocReadResourceLC(R_NEW_SHOWS);
|
|
935 |
titlePane->SetTextL(*title);
|
|
936 |
CleanupStack::PopAndDestroy(title);
|
|
937 |
}
|
|
938 |
else if(iPodcastModel.ActiveFeedInfo())
|
2
|
939 |
{
|
|
940 |
if (iPodcastModel.ActiveFeedInfo()->Title() != KNullDesC)
|
|
941 |
{
|
|
942 |
titlePane->SetTextL( iPodcastModel.ActiveFeedInfo()->Title(), ETrue );
|
|
943 |
}
|
|
944 |
}
|
|
945 |
else
|
|
946 |
{
|
|
947 |
titlePane->SetTextToDefaultL();
|
|
948 |
}
|
|
949 |
|
|
950 |
DP("CPodcastShowsView::UpdateViewTitleL END");
|
|
951 |
}
|