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