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