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