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