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