author | teknolog |
Sat, 27 Feb 2010 14:40:44 +0000 | |
changeset 18 | cda6e6257514 |
parent 17 | 4bcc91e70483 |
child 19 | 9219912415dc |
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 "PodcastFeedView.h" |
|
20 |
#include "PodcastAppUi.h" |
|
21 |
#include "ShowEngine.h" |
|
22 |
#include "SettingsEngine.h" |
|
23 |
#include "PodcastApp.h" |
|
24 |
#include "PodcastUtils.h" |
|
25 |
#include "PodcastFeedViewUpdater.h" |
|
26 |
#include "Podcast.hrh" |
|
27 |
#include <caknfileselectiondialog.h> |
|
28 |
#include <podcast.rsg> |
|
29 |
#include <podcast.mbg> |
|
30 |
#include <gulicon.h> |
|
31 |
#include <aknquerydialog.h> |
|
32 |
#include <caknmemoryselectiondialog.h> |
|
33 |
#include <caknfilenamepromptdialog.h> |
|
34 |
#include <BAUTILS.H> |
|
35 |
#include <pathinfo.h> |
|
36 |
||
37 |
const TInt KMaxFeedNameLength = 100; |
|
38 |
const TInt KMaxUnplayedFeedsLength =64; |
|
39 |
const TInt KADayInHours = 24; |
|
40 |
const TInt KDefaultGran = 5; |
|
41 |
const TInt KNumberOfFilesMaxLength = 4; |
|
42 |
#define KMaxMessageLength 200 |
|
43 |
#define KMaxTitleLength 100 |
|
44 |
const TInt KMimeBufLength = 100; |
|
45 |
||
46 |
_LIT(KFeedFormat, "%d\t%S\t%S%S"); |
|
47 |
enum |
|
48 |
{ |
|
49 |
EFeedIcon |
|
50 |
}; |
|
51 |
||
52 |
CPodcastFeedView* CPodcastFeedView::NewL(CPodcastModel& aPodcastModel) |
|
53 |
{ |
|
54 |
CPodcastFeedView* self = CPodcastFeedView::NewLC(aPodcastModel); |
|
55 |
CleanupStack::Pop( self ); |
|
56 |
return self; |
|
57 |
} |
|
58 |
||
59 |
CPodcastFeedView* CPodcastFeedView::NewLC(CPodcastModel& aPodcastModel) |
|
60 |
{ |
|
61 |
CPodcastFeedView* self = new ( ELeave ) CPodcastFeedView(aPodcastModel); |
|
62 |
CleanupStack::PushL( self ); |
|
63 |
self->ConstructL(); |
|
64 |
return self; |
|
65 |
} |
|
66 |
||
67 |
CPodcastFeedView::CPodcastFeedView(CPodcastModel& aPodcastModel):iPodcastModel(aPodcastModel) |
|
68 |
{ |
|
69 |
iFirstActivateAfterLaunch = ETrue; |
|
70 |
} |
|
71 |
#define KAsterisk iEikonEnv->EikAppUi()->Application()->BitmapStoreName() |
|
72 |
void CPodcastFeedView::ConstructL() |
|
73 |
{ |
|
74 |
DP("CPodcastFeedView::ConstructL BEGIN"); |
|
75 |
//_LIT(KAsterisk, "*"); |
|
76 |
BaseConstructL(R_PODCAST_FEEDVIEW); |
|
77 |
iNeverUpdated = iEikonEnv->AllocReadResourceL(R_PODCAST_FEEDS_NEVER_UPDATED); |
|
78 |
iFeedsFormat = iEikonEnv->AllocReadResourceL(R_PODCAST_FEEDS_STATUS_FORMAT); |
|
79 |
CPodcastListView::ConstructL(); |
|
80 |
iPodcastModel.FeedEngine().AddObserver(this); |
|
81 |
CArrayPtr< CGulIcon >* icons = new(ELeave) CArrayPtrFlat< CGulIcon >(1); |
|
82 |
CleanupStack::PushL( icons ); |
|
83 |
||
84 |
CFbsBitmap* bitmap = NULL; |
|
85 |
CFbsBitmap* mask = NULL; |
|
86 |
// Load the bitmap for empty icon |
|
87 |
TFileName fname = KAsterisk; |
|
88 |
TParsePtr parser(fname); |
|
89 |
||
90 |
SetEmptyTextL(R_PODCAST_NO_FEEDS); |
|
91 |
||
92 |
// Load svg.-image and mask with a single call |
|
93 |
AknIconUtils::CreateIconL(bitmap, |
|
94 |
mask, |
|
95 |
iEikonEnv->EikAppUi()->Application()->BitmapStoreName(), |
|
96 |
EMbmPodcastFeed, |
|
97 |
EMbmPodcastFeed_mask); |
|
98 |
||
99 |
/*bitmap = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40); |
|
100 |
* */ |
|
101 |
CleanupStack::PushL( bitmap ); |
|
102 |
// Load the mask for feed icon |
|
103 |
//mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m ); |
|
104 |
CleanupStack::PushL( mask ); |
|
105 |
// Append the feed icon to icon array |
|
106 |
icons->AppendL( CGulIcon::NewL( bitmap, mask ) ); |
|
107 |
CleanupStack::Pop(2); // bitmap, mask |
|
108 |
||
109 |
iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons ); |
|
110 |
CleanupStack::Pop(icons); // icons |
|
111 |
||
112 |
iListContainer->Listbox()->SetListBoxObserver(this); |
|
113 |
||
114 |
iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0)); |
|
115 |
TResourceReader reader; |
|
116 |
iCoeEnv->CreateResourceReaderLC(reader,R_FEEDVIEW_POPUP_MENU); |
|
117 |
iStylusPopupMenu->ConstructFromResourceL(reader); |
|
118 |
CleanupStack::PopAndDestroy(); |
|
119 |
||
120 |
iUpdater = CPodcastFeedViewUpdater::NewL(*this); |
|
121 |
DP("CPodcastFeedView::ConstructL END"); |
|
18 | 122 |
|
123 |
TBuf<1024> test; |
|
124 |
test.Copy(_L("Yeah, we’re doing an episode. "hej" © fl ong Should you get used to it? Ummm… maybe not. But let’s enjoy the ride while it lasts! Today we just yammer on about whatever, mostly just about what we’ve been up to. Until next time!")); |
|
125 |
||
126 |
PodcastUtils::CleanHtmlL(test); |
|
2 | 127 |
} |
128 |
||
129 |
CPodcastFeedView::~CPodcastFeedView() |
|
130 |
{ |
|
131 |
iPodcastModel.FeedEngine().RemoveObserver(this); |
|
132 |
delete iFeedsFormat; |
|
133 |
delete iNeverUpdated; |
|
134 |
delete iStylusPopupMenu; |
|
135 |
delete iUpdater; |
|
136 |
} |
|
137 |
||
138 |
void CPodcastFeedView::UpdateItemL(TInt aIndex) |
|
139 |
{ |
|
140 |
_LIT(KPanicCategory, "CPodcastFeedView::UpdateItemL"); |
|
141 |
__ASSERT_DEBUG(iListContainer->IsVisible(), User::Panic(KPanicCategory, 0)); |
|
142 |
__ASSERT_ALWAYS(iItemIdArray.Count() > aIndex, User::Panic(KPanicCategory, 1)); |
|
143 |
||
144 |
const RFeedInfoArray& sortedItems = iPodcastModel.FeedEngine().GetSortedFeeds(); |
|
145 |
__ASSERT_ALWAYS(sortedItems.Count() > aIndex, User::Panic(KPanicCategory, 2)); |
|
146 |
||
147 |
// Update UID of for the feed at aIndex |
|
148 |
iItemIdArray[aIndex] = sortedItems[aIndex]->Uid(); |
|
149 |
||
150 |
// Prepare data to update the listbox item with |
|
151 |
FormatFeedInfoListBoxItemL(*sortedItems[aIndex], EFalse); |
|
152 |
||
153 |
// If nothing has changed, we are done here |
|
154 |
if (iListboxFormatbuffer == iItemArray->MdcaPoint(aIndex)) |
|
155 |
{ |
|
156 |
return; |
|
157 |
} |
|
158 |
||
159 |
// Something has changed, update the listbox item |
|
160 |
TListItemProperties itemProps; |
|
161 |
itemProps.SetDimmed(EFalse); |
|
162 |
iItemArray->Delete(aIndex); |
|
163 |
iItemArray->InsertL(aIndex, iListboxFormatbuffer); |
|
164 |
iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps); |
|
165 |
// If item is visible, redraw it |
|
166 |
if (iListContainer->Listbox()->TopItemIndex() <= aIndex |
|
167 |
&& iListContainer->Listbox()->BottomItemIndex() >= aIndex) |
|
168 |
{ |
|
169 |
iListContainer->Listbox()->DrawItem(aIndex); |
|
170 |
} |
|
171 |
} |
|
172 |
||
173 |
TUid CPodcastFeedView::Id() const |
|
174 |
{ |
|
175 |
return KUidPodcastFeedViewID; |
|
176 |
} |
|
177 |
||
178 |
void CPodcastFeedView::DoActivateL(const TVwsViewId& aPrevViewId, |
|
179 |
TUid aCustomMessageId, |
|
180 |
const TDesC8& aCustomMessage) |
|
181 |
{ |
|
182 |
UpdateToolbar(); |
|
183 |
||
184 |
CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
11 | 185 |
|
2 | 186 |
if (iFirstActivateAfterLaunch) |
187 |
{ |
|
188 |
iFirstActivateAfterLaunch = EFalse; |
|
189 |
} |
|
190 |
} |
|
191 |
||
192 |
void CPodcastFeedView::DoDeactivate() |
|
193 |
{ |
|
194 |
iUpdater->StopUpdate(); |
|
195 |
CPodcastListView::DoDeactivate(); |
|
196 |
} |
|
197 |
||
198 |
||
199 |
void CPodcastFeedView::HandleListBoxEventL(CEikListBox* /* aListBox */, TListBoxEvent aEventType) |
|
200 |
{ |
|
201 |
DP("CPodcastFeedView::HandleListBoxEventL BEGIN"); |
|
202 |
||
203 |
switch(aEventType) |
|
204 |
{ |
|
17
4bcc91e70483
Configuration changes to default podcasts. Changed Download to Get in toolbar
teknolog
parents:
14
diff
changeset
|
205 |
case EEventEnterKeyPressed: |
2 | 206 |
case EEventItemDoubleClicked: |
17
4bcc91e70483
Configuration changes to default podcasts. Changed Download to Get in toolbar
teknolog
parents:
14
diff
changeset
|
207 |
case EEventItemActioned: |
2 | 208 |
{ |
209 |
const RFeedInfoArray* sortedItems = NULL; |
|
210 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
211 |
sortedItems = &iPodcastModel.FeedEngine().GetSortedFeeds(); |
|
212 |
||
213 |
if(index >= 0 && index < sortedItems->Count()) |
|
214 |
{ |
|
215 |
iPodcastModel.ActiveShowList().Reset(); |
|
216 |
iPodcastModel.SetActiveFeedInfo((*sortedItems)[index]); |
|
217 |
||
218 |
AppUi()->ActivateLocalViewL(KUidPodcastShowsViewID, TUid::Uid(0), KNullDesC8()); |
|
219 |
} |
|
220 |
} |
|
221 |
break; |
|
222 |
default: |
|
223 |
break; |
|
224 |
} |
|
225 |
DP("CPodcastFeedView::HandleListBoxEventL END"); |
|
226 |
} |
|
227 |
||
228 |
void CPodcastFeedView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
|
229 |
{ |
|
230 |
iUpdatingAllRunning = EFalse; |
|
231 |
UpdateToolbar(); |
|
232 |
} |
|
233 |
||
234 |
void CPodcastFeedView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid) |
|
235 |
{ |
|
236 |
// Update status text |
|
237 |
UpdateFeedInfoStatusL(aFeedUid, ETrue); |
|
238 |
||
239 |
UpdateToolbar(); |
|
240 |
} |
|
241 |
||
242 |
void CPodcastFeedView::FeedDownloadFinishedL(TFeedState aState,TUint aFeedUid, TInt aError) |
|
243 |
{ |
|
244 |
switch(aError) |
|
245 |
{ |
|
246 |
case KErrCouldNotConnect: |
|
247 |
{ |
|
248 |
if(aState == MFeedEngineObserver::EFeedManualUpdate) |
|
249 |
{ |
|
250 |
TBuf<KMaxMessageLength> message; |
|
251 |
iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR); |
|
252 |
ShowErrorMessage(message); |
|
253 |
} |
|
254 |
} |
|
255 |
break; |
|
256 |
default: // Do nothing |
|
257 |
break; |
|
258 |
} |
|
259 |
UpdateFeedInfoStatusL(aFeedUid, EFalse); |
|
260 |
} |
|
261 |
||
262 |
void CPodcastFeedView::UpdateFeedInfoStatusL(TUint aFeedUid, TBool aIsUpdating) |
|
263 |
{ |
|
264 |
const RFeedInfoArray& feeds = iPodcastModel.FeedEngine().GetSortedFeeds(); |
|
265 |
||
266 |
// Find the index for the feed i both the feed-array and the listbox |
|
267 |
TInt feedsIdx = KErrNotFound; |
|
268 |
TInt listboxIdx = KErrNotFound; |
|
269 |
for (TInt i = 0; i < feeds.Count(); i++) |
|
270 |
{ |
|
271 |
if (feeds[i]->Uid() == aFeedUid) |
|
272 |
{ |
|
273 |
feedsIdx = i; |
|
274 |
break; |
|
275 |
} |
|
276 |
} |
|
277 |
for (TInt j = 0; j < iItemIdArray.Count(); j++) |
|
278 |
{ |
|
279 |
if (iItemIdArray[j] == aFeedUid) |
|
280 |
{ |
|
281 |
listboxIdx = j; |
|
282 |
break; |
|
283 |
} |
|
284 |
} |
|
285 |
||
286 |
if (feedsIdx != KErrNotFound && listboxIdx != KErrNotFound) |
|
287 |
{ |
|
288 |
// TODO In the long run we want to move the sorting resposibility from |
|
289 |
// CFeedEngine to CPodcastFeedView. |
|
290 |
// Hackish fix to make sure the listbox is sorted. |
|
291 |
if (listboxIdx != feedsIdx) |
|
292 |
{ |
|
293 |
iItemIdArray.Remove(listboxIdx); |
|
294 |
iItemIdArray.InsertL(aFeedUid, feedsIdx); |
|
295 |
iItemArray->Delete(listboxIdx); |
|
296 |
iItemArray->InsertL(feedsIdx, KNullDesC); |
|
297 |
iListContainer->Listbox()->HandleItemAdditionL(); |
|
298 |
} |
|
299 |
// Update the listbox info |
|
300 |
UpdateFeedInfoDataL(feeds[feedsIdx], feedsIdx, aIsUpdating); |
|
301 |
//TODO sort the listbox after update |
|
302 |
} |
|
303 |
// Update all visible listbox items that are affected by sorting and update. |
|
304 |
TInt minIdx = Max(Min(feedsIdx, listboxIdx), iListContainer->Listbox()->TopItemIndex()); |
|
305 |
TInt maxIdx = Min(Max(feedsIdx, listboxIdx), iListContainer->Listbox()->BottomItemIndex()); |
|
306 |
for (TInt k = minIdx; k <= maxIdx; k++) |
|
307 |
{ |
|
308 |
iListContainer->Listbox()->DrawItem(k); |
|
309 |
} |
|
310 |
} |
|
311 |
||
312 |
void CPodcastFeedView::FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating) |
|
313 |
{ |
|
314 |
TBuf<KMaxShortDateFormatSpec*2> updatedDate; |
|
315 |
TBuf<KMaxUnplayedFeedsLength> unplayedShows; |
|
316 |
TUint unplayedCount = 0; |
|
317 |
TUint showCount = 0; |
|
318 |
TInt iconIndex = EFeedIcon; |
|
319 |
||
320 |
if(aIsUpdating) |
|
321 |
{ |
|
322 |
iEikonEnv->ReadResourceL(updatedDate, R_PODCAST_FEEDS_IS_UPDATING); |
|
323 |
unplayedShows = KNullDesC(); |
|
324 |
} |
|
325 |
else |
|
326 |
{ |
|
327 |
iPodcastModel.FeedEngine().GetStatsByFeed(aFeedInfo.Uid(), showCount, unplayedCount); |
|
328 |
||
329 |
if (unplayedCount) { |
|
330 |
unplayedShows.Format(*iFeedsFormat, unplayedCount); |
|
331 |
} else { |
|
332 |
unplayedShows.Zero(); |
|
333 |
} |
|
334 |
||
335 |
if (aFeedInfo.LastUpdated().Int64() == 0) |
|
336 |
{ |
|
337 |
updatedDate.Copy(*iNeverUpdated); |
|
338 |
unplayedShows.Zero(); |
|
339 |
} |
|
340 |
else |
|
341 |
{ |
|
342 |
TTime now; |
|
343 |
TTimeIntervalHours interval; |
|
344 |
now.HomeTime(); |
|
345 |
now.HoursFrom(aFeedInfo.LastUpdated(), interval); |
|
346 |
if (interval.Int() < KADayInHours) |
|
347 |
{ |
|
348 |
aFeedInfo.LastUpdated().FormatL(updatedDate, KTimeFormat()); |
|
349 |
} |
|
350 |
else |
|
351 |
{ |
|
352 |
aFeedInfo.LastUpdated().FormatL(updatedDate, KDateFormatShort()); |
|
353 |
} |
|
354 |
} |
|
355 |
} |
|
356 |
CArrayPtr<CGulIcon>* icons = iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->IconArray(); |
|
357 |
||
358 |
if (aFeedInfo.FeedIconIndex() != -1) { |
|
359 |
iconIndex = aFeedInfo.FeedIconIndex(); |
|
360 |
} else { |
|
361 |
if(aFeedInfo.FeedIcon() != NULL && |
|
362 |
aFeedInfo.FeedIcon()->SizeInPixels().iHeight > 0 && |
|
363 |
aFeedInfo.FeedIcon()->SizeInPixels().iWidth > 0) |
|
364 |
{ |
|
365 |
// Hopefully temporary haxx to prevent double delete. I would prefer if |
|
366 |
// this could be solved with a little better design. |
|
367 |
CFbsBitmap* bmpCopy = new (ELeave) CFbsBitmap; |
|
368 |
CleanupStack::PushL(bmpCopy); |
|
369 |
bmpCopy->Duplicate(aFeedInfo.FeedIcon()->Handle()); |
|
370 |
icons->AppendL( CGulIcon::NewL(bmpCopy, NULL)); |
|
371 |
CleanupStack::Pop(bmpCopy); |
|
372 |
iconIndex = icons->Count()-1; |
|
373 |
aFeedInfo.SetFeedIconIndex(iconIndex); |
|
374 |
} |
|
375 |
else { |
|
376 |
if(BaflUtils::FileExists(iPodcastModel.FsSession(), aFeedInfo.ImageFileName())) |
|
377 |
{ |
|
378 |
// If this fails, no reason to worry |
|
379 |
TRAP_IGNORE(iPodcastModel.ImageHandler().LoadFileAndScaleL(aFeedInfo.FeedIcon(), aFeedInfo.ImageFileName(), TSize(64,56), *this)); |
|
380 |
} |
|
381 |
} |
|
382 |
} |
|
383 |
||
5 | 384 |
if(aFeedInfo.LastError() != KErrNone) |
385 |
{ |
|
386 |
GetFeedErrorText(unplayedShows, aFeedInfo.LastError()); |
|
387 |
} |
|
388 |
||
2 | 389 |
if (unplayedShows.Length() > 0) { |
390 |
unplayedShows.Insert(0,_L(", ")); |
|
391 |
} |
|
392 |
||
393 |
iListboxFormatbuffer.Format(KFeedFormat(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows); |
|
394 |
} |
|
395 |
||
396 |
void CPodcastFeedView::ImageOperationCompleteL(TInt aError) |
|
397 |
{ |
|
398 |
if (aError == KErrNone) { |
|
399 |
UpdateListboxItemsL(); |
|
400 |
} |
|
401 |
} |
|
402 |
||
403 |
void CPodcastFeedView::UpdateFeedInfoDataL(CFeedInfo* aFeedInfo, TInt aIndex, TBool aIsUpdating ) |
|
404 |
{ |
|
405 |
TListItemProperties itemProps; |
|
406 |
itemProps.SetDimmed(aIsUpdating); |
|
407 |
FormatFeedInfoListBoxItemL(*aFeedInfo, aIsUpdating); |
|
408 |
||
409 |
TPtrC compareTo((*iItemArray)[aIndex]); |
|
410 |
||
411 |
if (iListboxFormatbuffer.Compare(compareTo) != 0) { |
|
412 |
iItemArray->Delete(aIndex); |
|
413 |
if(aIndex>= iItemArray->MdcaCount()) |
|
414 |
{ |
|
415 |
iItemArray->AppendL(iListboxFormatbuffer); |
|
416 |
} |
|
417 |
else |
|
418 |
{ |
|
419 |
iItemArray->InsertL(aIndex, iListboxFormatbuffer); |
|
420 |
} |
|
421 |
} |
|
422 |
iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps); |
|
423 |
} |
|
424 |
||
425 |
||
426 |
void CPodcastFeedView::UpdateListboxItemsL() |
|
427 |
{ |
|
428 |
// No reason to do any work if it isn't going to show.. |
|
429 |
if(!iListContainer->IsVisible()) |
|
430 |
{ |
|
431 |
return; |
|
432 |
} |
|
433 |
||
434 |
TInt nbrItems = iPodcastModel.FeedEngine().GetSortedFeeds().Count(); |
|
435 |
if (nbrItems > 0) |
|
436 |
{ |
|
437 |
// Ensure that there are as many elements in iItemIdArray as in FeedEngine |
|
438 |
while (iItemIdArray.Count() < nbrItems) |
|
439 |
{ |
|
440 |
iItemIdArray.AppendL(0); |
|
441 |
} |
|
442 |
while (iItemIdArray.Count() > nbrItems) |
|
443 |
{ |
|
444 |
iItemIdArray.Remove(iItemIdArray.Count() - 1); |
|
445 |
} |
|
446 |
||
447 |
// Ensure that there are as many elements in iItemArray as in FeedEngine |
|
448 |
while (iItemArray->Count() < nbrItems) |
|
449 |
{ |
|
450 |
iItemArray->AppendL(KNullDesC); |
|
451 |
TListItemProperties itemProps; |
|
452 |
iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(iItemArray->Count() - 1, itemProps); |
|
453 |
} |
|
454 |
while (iItemArray->Count() > nbrItems) |
|
455 |
{ |
|
456 |
iItemArray->Delete(iItemArray->Count() - 1); |
|
457 |
} |
|
458 |
iUpdater->StartUpdate(nbrItems); |
|
459 |
} |
|
460 |
else |
|
461 |
{ |
|
462 |
// No feeds at all in the list , add dummy list item |
|
463 |
TBuf<KMaxFeedNameLength> itemName; |
|
464 |
iEikonEnv->ReadResourceL(itemName, R_PODCAST_FEEDS_NO_FEEDS); |
|
465 |
iItemArray->Reset(); |
|
466 |
iItemIdArray.Reset(); |
|
467 |
||
468 |
TListItemProperties itemProps; |
|
469 |
itemProps.SetDimmed(ETrue); |
|
470 |
itemProps.SetHiddenSelection(ETrue); |
|
471 |
iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps); |
|
472 |
} |
|
473 |
iListContainer->Listbox()->HandleItemAdditionL(); |
|
474 |
} |
|
475 |
||
476 |
/** |
|
477 |
* Command handling function intended for overriding by sub classes. |
|
478 |
* Default implementation is empty. |
|
479 |
* @param aCommand ID of the command to respond to. |
|
480 |
*/ |
|
481 |
void CPodcastFeedView::HandleCommandL(TInt aCommand) |
|
482 |
{ |
|
483 |
//CloseToolbarExtension(); |
|
484 |
switch(aCommand) |
|
485 |
{ |
|
486 |
case EPodcastHide: |
|
487 |
AppUi()->HandleCommandL(EEikCmdExit); |
|
488 |
break; |
|
489 |
case EPodcastAddFeed: |
|
490 |
HandleAddFeedL(); |
|
491 |
break; |
|
492 |
case EPodcastImportFeeds: |
|
493 |
HandleImportFeedsL(); |
|
494 |
break; |
|
495 |
case EPodcastExportFeeds: |
|
496 |
HandleExportFeedsL(); |
|
497 |
break; |
|
498 |
case EPodcastEditFeed: |
|
499 |
HandleEditFeedL(); |
|
500 |
break; |
|
501 |
case EPodcastDeleteFeedHardware: |
|
502 |
case EPodcastDeleteFeed: |
|
503 |
HandleRemoveFeedL(); |
|
504 |
break; |
|
505 |
case EPodcastUpdateAllFeeds: |
|
506 |
{ |
|
507 |
iUpdatingAllRunning = ETrue; |
|
508 |
iPodcastModel.FeedEngine().UpdateAllFeedsL(); |
|
509 |
UpdateToolbar(); |
|
510 |
}break; |
|
511 |
case EPodcastUpdateFeed: |
|
512 |
{ |
|
513 |
HandleUpdateFeedL(); |
|
514 |
}break; |
|
515 |
case EPodcastCancelUpdateAllFeeds: |
|
516 |
{ |
|
517 |
if(iUpdatingAllRunning) |
|
518 |
{ |
|
519 |
iUpdatingAllRunning = EFalse; |
|
520 |
iPodcastModel.FeedEngine().CancelUpdateAllFeeds(); |
|
521 |
} |
|
522 |
}break; |
|
523 |
case EAknSoftkeyExit: |
|
524 |
{ |
|
525 |
RShowInfoArray dlQueue; |
|
526 |
iPodcastModel.ShowEngine().GetShowsDownloadingL(dlQueue); |
|
527 |
TUint queueCount = dlQueue.Count(); |
|
528 |
dlQueue.ResetAndDestroy(); |
|
529 |
dlQueue.Close(); |
|
530 |
||
531 |
if (queueCount > 0 && !iPodcastModel.SettingsEngine().DownloadSuspended()) |
|
532 |
{ |
|
533 |
TBuf<KMaxMessageLength> message; |
|
534 |
iEikonEnv->ReadResourceL(message, R_EXIT_SHOWS_DOWNLOADING); |
|
535 |
if(ShowQueryMessage(message)) |
|
536 |
{ |
|
537 |
// pass it on to AppUi, which will exit for us |
|
538 |
CPodcastListView::HandleCommandL(aCommand); |
|
539 |
} |
|
540 |
} |
|
541 |
else |
|
542 |
{ |
|
543 |
// nothing in queue, or downloading suspended |
|
544 |
CPodcastListView::HandleCommandL(aCommand); |
|
545 |
} |
|
546 |
} |
|
547 |
break; |
|
548 |
default: |
|
549 |
CPodcastListView::HandleCommandL(aCommand); |
|
550 |
break; |
|
551 |
} |
|
552 |
UpdateToolbar(); |
|
553 |
} |
|
554 |
||
13 | 555 |
void CPodcastFeedView::UpdateToolbar(TBool aVisible) |
2 | 556 |
{ |
557 |
CAknToolbar* toolbar = Toolbar(); |
|
558 |
||
559 |
if (toolbar) |
|
560 |
{ |
|
14
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
561 |
if (iListContainer->IsVisible()) { |
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
562 |
toolbar->SetToolbarVisibility(aVisible); |
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
563 |
} |
2 | 564 |
toolbar->HideItem(EPodcastUpdateAllFeeds, iUpdatingAllRunning, ETrue); |
565 |
toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !iUpdatingAllRunning, ETrue ); |
|
566 |
toolbar->SetItemDimmed(EPodcastAddFeed, iUpdatingAllRunning, ETrue ); |
|
567 |
toolbar->SetItemDimmed(EPodcastSettings, iUpdatingAllRunning, ETrue ); |
|
568 |
} |
|
569 |
} |
|
570 |
||
571 |
void CPodcastFeedView::HandleAddFeedL() |
|
572 |
{ |
|
573 |
TBuf<KFeedUrlLength> url; |
|
574 |
url.Copy(_L("http://")); |
|
575 |
CAknTextQueryDialog * dlg =CAknTextQueryDialog::NewL(url); |
|
576 |
dlg->PrepareLC(R_PODCAST_ADD_FEED_DLG); |
|
577 |
HBufC* prompt = iEikonEnv->AllocReadResourceLC(R_PODCAST_ADDFEED_PROMPT); |
|
578 |
dlg->SetPromptL(*prompt); |
|
579 |
CleanupStack::PopAndDestroy(prompt); |
|
580 |
||
581 |
if(dlg->RunLD()) |
|
582 |
{ |
|
583 |
||
584 |
// if no :// we do a search |
|
585 |
if (url.Find(_L("://")) == KErrNotFound) |
|
586 |
{ |
|
587 |
HBufC *waitText = iEikonEnv->AllocReadResourceLC(R_SEARCHING); |
|
588 |
ShowWaitDialogL(*waitText); |
|
589 |
CleanupStack::PopAndDestroy(waitText); |
|
590 |
||
591 |
iOpmlState = EOpmlSearching; |
|
592 |
iPodcastModel.FeedEngine().SearchForFeedL(url); |
|
593 |
} |
|
594 |
else |
|
595 |
{ |
|
596 |
PodcastUtils::FixProtocolsL(url); |
|
597 |
||
598 |
CFeedInfo* newFeedInfo = CFeedInfo::NewL(); |
|
599 |
CleanupStack::PushL(newFeedInfo); |
|
600 |
newFeedInfo->SetUrlL(url); |
|
601 |
newFeedInfo->SetTitleL(newFeedInfo->Url()); |
|
602 |
||
603 |
TBool added = iPodcastModel.FeedEngine().AddFeedL(*newFeedInfo); |
|
604 |
||
605 |
if (added) |
|
606 |
{ |
|
607 |
UpdateListboxItemsL(); |
|
608 |
||
609 |
// ask if users wants to update it now |
|
610 |
TBuf<KMaxMessageLength> message; |
|
611 |
iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS); |
|
612 |
if(ShowQueryMessage(message)) |
|
613 |
{ |
|
614 |
CFeedInfo *info = iPodcastModel.FeedEngine().GetFeedInfoByUid(newFeedInfo->Uid()); |
|
615 |
||
616 |
iPodcastModel.ActiveShowList().Reset(); |
|
617 |
iPodcastModel.SetActiveFeedInfo(info); |
|
618 |
AppUi()->ActivateLocalViewL(KUidPodcastShowsViewID, TUid::Uid(0), KNullDesC8()); |
|
619 |
iPodcastModel.FeedEngine().UpdateFeedL(newFeedInfo->Uid()); |
|
620 |
} |
|
621 |
} |
|
622 |
else |
|
623 |
{ |
|
624 |
TBuf<KMaxMessageLength> message; |
|
625 |
iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS); |
|
626 |
ShowErrorMessage(message); |
|
627 |
} |
|
628 |
||
629 |
CleanupStack::PopAndDestroy(newFeedInfo); |
|
630 |
} |
|
631 |
} |
|
632 |
} |
|
633 |
||
634 |
void CPodcastFeedView::HandleEditFeedL() |
|
635 |
{ |
|
636 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
637 |
||
638 |
if(index < iItemArray->MdcaCount() && index >= 0) |
|
639 |
{ |
|
640 |
CFeedInfo *info = iPodcastModel.FeedEngine().GetSortedFeeds()[index]; |
|
641 |
||
642 |
TBuf<KFeedTitleLength> title; |
|
643 |
title.Copy(info->Title()); |
|
644 |
TBuf<KFeedUrlLength> url; |
|
645 |
url.Copy(info->Url()); |
|
646 |
CAknMultiLineDataQueryDialog *dlg = CAknMultiLineDataQueryDialog ::NewL(title, url); |
|
647 |
||
648 |
if (dlg->ExecuteLD(R_PODCAST_EDIT_FEED_DLG)) |
|
649 |
{ |
|
650 |
||
651 |
if(info->Url().Compare(url) != 0) |
|
652 |
{ |
|
653 |
TBuf<KMaxMessageLength> dlgMessage; |
|
654 |
iEikonEnv->ReadResourceL(dlgMessage, R_ADD_FEED_REPLACE); |
|
655 |
||
656 |
// Ask the user if it is OK to remove all shows |
|
657 |
if ( ShowQueryMessage(dlgMessage)) |
|
658 |
{ |
|
659 |
PodcastUtils::FixProtocolsL(url); |
|
660 |
||
661 |
//----- HACK ---- // |
|
662 |
CFeedInfo* temp = CFeedInfo::NewLC(); |
|
663 |
temp->SetUrlL(url); |
|
664 |
TBool added = iPodcastModel.FeedEngine().AddFeedL(*temp); |
|
665 |
if (added) { |
|
666 |
// The Feed URL did not exist |
|
667 |
// Remove the temp entry so that the correct entry could be changed |
|
668 |
iPodcastModel.FeedEngine().RemoveFeedL(temp->Uid()); |
|
669 |
||
12 | 670 |
// we remove the existing feed |
671 |
iPodcastModel.FeedEngine().RemoveFeedL(info->Uid()); |
|
672 |
||
673 |
CFeedInfo* newFeed = CFeedInfo::NewLC(); |
|
674 |
newFeed->SetUrlL(url); |
|
675 |
newFeed->SetTitleL(title); |
|
676 |
||
677 |
iPodcastModel.FeedEngine().AddFeedL(*newFeed); |
|
678 |
CleanupStack::PopAndDestroy(newFeed); |
|
2 | 679 |
UpdateListboxItemsL(); |
680 |
} else { |
|
681 |
// the feed existed. Object deleted in AddFeed. |
|
682 |
TBuf<KMaxMessageLength> dlgMessage; |
|
683 |
iEikonEnv->ReadResourceL(dlgMessage, R_ADD_FEED_EXISTS); |
|
684 |
ShowErrorMessage(dlgMessage); |
|
685 |
} |
|
686 |
CleanupStack::PopAndDestroy(temp); |
|
687 |
} |
|
688 |
} else { // no url change, maybe title? |
|
689 |
// Update the title |
|
690 |
if (info->Title().Compare(title) != 0) |
|
691 |
{ |
|
692 |
info->SetTitleL(title); |
|
693 |
info->SetCustomTitle(); |
|
694 |
iPodcastModel.FeedEngine().UpdateFeed(info); |
|
695 |
UpdateListboxItemsL(); |
|
696 |
} |
|
697 |
} |
|
698 |
} |
|
699 |
} |
|
700 |
} |
|
701 |
||
702 |
void CPodcastFeedView::HandleRemoveFeedL() |
|
703 |
{ |
|
704 |
if(iListContainer->Listbox() != NULL) |
|
705 |
{ |
|
706 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
707 |
||
708 |
if(index < iItemArray->MdcaCount() && index >= 0) |
|
709 |
{ |
|
710 |
CFeedInfo *info = iPodcastModel.FeedEngine().GetFeedInfoByUid(iItemIdArray[index]); |
|
711 |
TBuf<KMaxMessageLength> templ; |
|
712 |
TBuf<KMaxMessageLength> message; |
|
713 |
iEikonEnv->ReadResourceL(templ, R_PODCAST_REMOVE_FEED_PROMPT); |
|
714 |
message.Format(templ, &info->Title()); |
|
715 |
if(ShowQueryMessage(message)) |
|
716 |
{ |
|
717 |
iPodcastModel.FeedEngine().RemoveFeedL(iItemIdArray[index]); |
|
718 |
iItemArray->Delete(index); |
|
719 |
iItemIdArray.Remove(index); |
|
720 |
iListContainer->Listbox()->HandleItemRemovalL(); |
|
721 |
iListContainer->Listbox()->DrawNow(); |
|
722 |
} |
|
723 |
} |
|
724 |
UpdateListboxItemsL(); |
|
725 |
} |
|
726 |
} |
|
727 |
||
728 |
void CPodcastFeedView::HandleUpdateFeedL() |
|
729 |
{ |
|
730 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
731 |
||
732 |
if(index < iItemArray->MdcaCount() && index >= 0) |
|
733 |
{ |
|
734 |
CFeedInfo *info = iPodcastModel.FeedEngine().GetSortedFeeds()[index]; |
|
735 |
iPodcastModel.FeedEngine().UpdateFeedL(info->Uid()); |
|
736 |
} |
|
737 |
} |
|
738 |
||
739 |
void CPodcastFeedView::HandleImportFeedsL() |
|
740 |
{ |
|
741 |
CAknMemorySelectionDialog* memDlg = |
|
742 |
CAknMemorySelectionDialog::NewL(ECFDDialogTypeNormal, ETrue); |
|
743 |
CleanupStack::PushL(memDlg); |
|
744 |
CAknMemorySelectionDialog::TMemory memory = |
|
745 |
CAknMemorySelectionDialog::EPhoneMemory; |
|
746 |
||
747 |
if (memDlg->ExecuteL(memory)) |
|
748 |
{ |
|
749 |
TFileName importName; |
|
750 |
||
751 |
if (memory==CAknMemorySelectionDialog::EMemoryCard) |
|
752 |
{ |
|
753 |
importName = PathInfo:: MemoryCardRootPath(); |
|
754 |
} |
|
755 |
else |
|
756 |
{ |
|
757 |
importName = PathInfo:: PhoneMemoryRootPath(); |
|
758 |
} |
|
759 |
||
760 |
CAknFileSelectionDialog* dlg = CAknFileSelectionDialog::NewL(ECFDDialogTypeNormal, R_PODCAST_IMPORT_PODCAST); |
|
761 |
CleanupStack::PushL(dlg); |
|
762 |
||
763 |
dlg->SetDefaultFolderL(importName); |
|
764 |
||
765 |
if(dlg->ExecuteL(importName)) |
|
766 |
{ |
|
767 |
if(importName.Length()>0) |
|
768 |
{ |
|
769 |
HBufC *waitText = iEikonEnv->AllocReadResourceLC(R_IMPORTING); |
|
770 |
iOpmlState = EOpmlImporting; |
|
771 |
ShowWaitDialogL(*waitText); |
|
772 |
CleanupStack::PopAndDestroy(waitText); |
|
773 |
||
774 |
TRAPD(err, iPodcastModel.FeedEngine().ImportFeedsL(importName)); |
|
775 |
||
776 |
if (err != KErrNone) { |
|
777 |
TBuf<KMaxMessageLength> message; |
|
778 |
iEikonEnv->ReadResourceL(message, R_IMPORT_FEED_FAILURE); |
|
779 |
ShowErrorMessage(message); |
|
780 |
} |
|
781 |
} |
|
782 |
||
783 |
} |
|
784 |
CleanupStack::PopAndDestroy(dlg); |
|
785 |
} |
|
786 |
CleanupStack::PopAndDestroy(memDlg); |
|
787 |
} |
|
788 |
||
789 |
void CPodcastFeedView::HandleExportFeedsL() |
|
790 |
{ |
|
791 |
CAknMemorySelectionDialog* memDlg = |
|
792 |
CAknMemorySelectionDialog::NewL(ECFDDialogTypeSave, ETrue); |
|
793 |
CleanupStack::PushL(memDlg); |
|
794 |
CAknMemorySelectionDialog::TMemory memory = |
|
795 |
CAknMemorySelectionDialog::EPhoneMemory; |
|
796 |
||
797 |
if (memDlg->ExecuteL(memory)) |
|
798 |
{ |
|
799 |
TFileName pathName; |
|
800 |
||
801 |
if (memory==CAknMemorySelectionDialog::EMemoryCard) |
|
802 |
{ |
|
803 |
pathName = PathInfo::MemoryCardRootPath(); |
|
804 |
} |
|
805 |
else |
|
806 |
{ |
|
807 |
pathName = PathInfo::PhoneMemoryRootPath(); |
|
808 |
} |
|
809 |
||
810 |
CAknFileSelectionDialog* dlg = CAknFileSelectionDialog::NewL(ECFDDialogTypeSave, R_PODCAST_EXPORT_FEEDS); |
|
811 |
CleanupStack::PushL(dlg); |
|
812 |
||
813 |
if(dlg->ExecuteL(pathName)) |
|
814 |
{ |
|
815 |
CAknFileNamePromptDialog *fileDlg = CAknFileNamePromptDialog::NewL(R_PODCAST_FILENAME_PROMPT_DIALOG); |
|
816 |
CleanupStack::PushL(fileDlg); |
|
817 |
fileDlg->SetPathL(pathName); |
|
818 |
TFileName fileName; |
|
819 |
if (fileDlg->ExecuteL(fileName) && fileName.Length() > 0) |
|
820 |
{ |
|
821 |
pathName.Append(fileName); |
|
822 |
TFileName temp; |
|
823 |
TRAPD(err, iPodcastModel.FeedEngine().ExportFeedsL(temp)); |
|
824 |
BaflUtils::CopyFile(iEikonEnv->FsSession(), temp, pathName); |
|
825 |
BaflUtils::DeleteFile(iEikonEnv->FsSession(),temp); |
|
826 |
if (err == KErrNone) |
|
827 |
{ |
|
828 |
UpdateListboxItemsL(); |
|
829 |
TInt numFeeds = iPodcastModel.FeedEngine().GetSortedFeeds().Count(); |
|
830 |
||
831 |
TBuf<KMaxMessageLength> message; |
|
832 |
TBuf<KMaxMessageLength> templ; |
|
833 |
iEikonEnv->ReadResourceL(templ, R_EXPORT_FEED_SUCCESS); |
|
834 |
message.Format(templ, numFeeds); |
|
835 |
ShowOkMessage(message); |
|
836 |
} |
|
837 |
else |
|
838 |
{ |
|
839 |
TBuf<KMaxMessageLength> message; |
|
840 |
iEikonEnv->ReadResourceL(message, R_EXPORT_FEED_FAILURE); |
|
841 |
ShowErrorMessage(message); |
|
842 |
} |
|
843 |
} |
|
844 |
CleanupStack::PopAndDestroy(fileDlg); |
|
845 |
} |
|
846 |
CleanupStack::PopAndDestroy(dlg); |
|
847 |
} |
|
848 |
CleanupStack::PopAndDestroy(memDlg); |
|
849 |
} |
|
850 |
||
851 |
void CPodcastFeedView::CheckResumeDownload() |
|
852 |
{ |
|
853 |
// if there are shows queued for downloading, ask if we should resume now |
|
854 |
RShowInfoArray showsDownloading; |
|
855 |
iPodcastModel.ShowEngine().GetShowsDownloadingL(showsDownloading); |
|
856 |
||
857 |
if (showsDownloading.Count() > 0) |
|
858 |
{ |
|
859 |
TBuf<KMaxMessageLength> msg; |
|
860 |
iEikonEnv->ReadResourceL(msg, R_PODCAST_ENABLE_DOWNLOADS_PROMPT); |
|
861 |
||
862 |
if (ShowQueryMessage(msg)) |
|
863 |
{ |
|
864 |
// need to suspend downloads before ResumeDownloadL will work :) |
|
865 |
iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue); |
|
866 |
// resume downloading if user says yes |
|
867 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
|
868 |
} |
|
869 |
else |
|
870 |
{ |
|
871 |
// we disable downloading if user says no |
|
872 |
iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue); |
|
873 |
} |
|
874 |
} |
|
875 |
||
876 |
// if no shows in queue, we keep whichever state suspend is in |
|
877 |
showsDownloading.ResetAndDestroy(); |
|
878 |
} |
|
879 |
||
7 | 880 |
void CPodcastFeedView::OpmlParsingComplete(TInt aError, TUint aNumFeedsImported) |
2 | 881 |
{ |
882 |
DP("CPodcastFeedView::OpmlParsingComplete BEGIN"); |
|
883 |
||
7 | 884 |
switch (aError) |
2 | 885 |
{ |
7 | 886 |
case KErrCouldNotConnect: |
2 | 887 |
{ |
888 |
TBuf<KMaxMessageLength> message; |
|
7 | 889 |
iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR); |
890 |
ShowErrorMessage(message); |
|
2 | 891 |
} |
892 |
break; |
|
7 | 893 |
case KErrNone: |
894 |
default: // we don't do more error handling here, just show 0 imported feeds |
|
895 |
switch (iOpmlState) |
|
896 |
{ |
|
897 |
case EOpmlIdle: |
|
898 |
break; |
|
899 |
case EOpmlImporting: |
|
2 | 900 |
{ |
7 | 901 |
UpdateListboxItemsL(); |
902 |
delete iWaitDialog; |
|
903 |
iOpmlState = EOpmlIdle; |
|
904 |
||
2 | 905 |
TBuf<KMaxMessageLength> message; |
7 | 906 |
TBuf<KMaxMessageLength> templ; |
907 |
iEikonEnv->ReadResourceL(templ, R_IMPORT_FEED_SUCCESS); |
|
908 |
message.Format(templ, aNumFeedsImported); |
|
909 |
||
910 |
if(ShowQueryMessage(message)) |
|
911 |
{ |
|
912 |
HandleCommandL(EPodcastUpdateAllFeeds); |
|
913 |
} |
|
2 | 914 |
} |
7 | 915 |
break; |
916 |
case EOpmlSearching: |
|
917 |
delete iWaitDialog; |
|
918 |
if (iPodcastModel.FeedEngine().GetSearchResults().Count() == 0) |
|
919 |
{ |
|
920 |
TBuf<KMaxMessageLength> message; |
|
921 |
iEikonEnv->ReadResourceL(message, R_SEARCH_NORESULTS); |
|
922 |
ShowErrorMessage(message); |
|
923 |
} |
|
924 |
else |
|
925 |
{ |
|
11 | 926 |
((CPodcastAppUi*)AppUi())->SetTabsVisibleL(EFalse); |
7 | 927 |
AppUi()->ActivateLocalViewL(KUidPodcastSearchViewID, TUid::Uid(0), KNullDesC8()); |
928 |
} |
|
929 |
iOpmlState = EOpmlIdle; |
|
930 |
break; |
|
931 |
default: |
|
932 |
break; |
|
933 |
} |
|
2 | 934 |
} |
935 |
||
936 |
DP("CPodcastFeedView::OpmlParsingComplete END"); |
|
937 |
} |
|
938 |
||
939 |
void CPodcastFeedView::DialogDismissedL(TInt /*aButtonId*/) |
|
940 |
{ |
|
941 |
iPodcastModel.FeedEngine().CancelUpdateAllFeeds(); |
|
942 |
} |
|
5 | 943 |
|
944 |
void CPodcastFeedView::GetFeedErrorText(TDes &aErrorMessage, TInt aErrorCode) |
|
945 |
{ |
|
946 |
iEikonEnv->GetErrorText(aErrorMessage, aErrorCode); |
|
947 |
} |
|
8 | 948 |
|
949 |
void CPodcastFeedView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
|
950 |
{ |
|
951 |
DP("CPodcastListView::HandleLongTapEventL BEGIN"); |
|
952 |
||
953 |
if (iUpdatingAllRunning) { |
|
954 |
return; // we don't allow feed manipulation while update is running |
|
955 |
} |
|
956 |
||
957 |
const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
|
958 |
TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
|
959 |
iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
|
960 |
||
961 |
if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight) |
|
962 |
{ |
|
963 |
iStylusPopupMenu->ShowMenu(); |
|
964 |
iStylusPopupMenu->SetPosition(aPenEventLocation); |
|
965 |
} |
|
966 |
DP("CPodcastListView::HandleLongTapEventL END"); |
|
967 |
} |