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