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