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