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